From: Bobby Eshleman <bobbyeshleman@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "Donald Hunter" <donald.hunter@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Vivek Kasireddy" <vivek.kasireddy@intel.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Shuah Khan" <shuah@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
linaro-mm-sig@lists.linaro.org, linux-kselftest@vger.kernel.org,
sdf@fomichev.me, razor@blackwall.org, daniel@iogearbox.net,
almasrymina@google.com, matttbe@kernel.org, skhawaja@google.com,
dw@davidwei.uk, "Joe Damato" <joe@dama.to>,
"Bobby Eshleman" <bobbyeshleman@meta.com>
Subject: Re: [PATCH net-next v5 1/3] net: devmem: allow rx-buf-size > PAGE_SIZE per dmabuf binding
Date: Fri, 24 Jul 2026 09:39:54 -0700 [thread overview]
Message-ID: <amOVWgJ3BAJ8I/4+@devvm29614.prn0.facebook.com> (raw)
In-Reply-To: <20260724072419.62778bbe@kernel.org>
On Fri, Jul 24, 2026 at 07:24:19AM -0700, Jakub Kicinski wrote:
> On Thu, 23 Jul 2026 16:58:14 -0700 Bobby Eshleman wrote:
> > > > + if (info->attrs[NETDEV_A_DMABUF_RX_BUF_SIZE]) {
> > > > + u32 rx_buf_size = nla_get_u32(info->attrs[NETDEV_A_DMABUF_RX_BUF_SIZE]);
> > > > +
> > > > + if (!rx_buf_size || !is_power_of_2(rx_buf_size) ||
> > > > + rx_buf_size < PAGE_SIZE) {
> > >
> > > we should add a check: min: page-size in the Netlink policy?
> >
> > I played around with this adding:
> >
> > Documentation/netlink/specs/netdev.yaml:
> > definitions:
> > + -
> > + type: const
> > + name: page-size
> > + value: 4096 # dummy value, to pass ynl_gen_c.py checks
> > + header: asm/page.h
> > + scope: kernel
> >
> > Generating:
> >
> > +static const struct netlink_range_validation
> > netdev_a_dmabuf_rx_page_size_range = {
> > + .min = PAGE_SIZE,
> > + .max = U32_MAX,
> > +};
> > +
> >
> > ... but the dummy 4096 is kind of annoying. ynl_gen_c.py can't know the
> > value of PAGE_SIZE but needs some value for its arithmetic checks (e.g.,
> > confirm min < max is true).
> >
> > Should we stick with using a dummy value, or should we add a patch
> > teaching ynl_gen_c.py to allow value-less consts (skip the arithmetic
> > checks)?
>
> Let's stick to a dummy one for now, but maybe something obviously dummy
> like 0 ?
0 sounds good to me.
>
> BTW did you add both min and max checks? Cause the only risk with using
> a dummy value would be that the policy will be rendered inline, and
> inline policy is u16 so 64k wouldn't fit. But your sample above has a
> max of u32_max which forces the out-of-line policy, which is what we
> want.
Yep, u32_max:
+ name: rx-page-size
...
+ checks:
+ min: page-size
+ max: u32-max
Sorry, probably should have just sent the whole patch instead of
replying hunk-by-hunk.
BTW, how expressive do we want these policies? For example, would
absorbing the power_of_2 check into a policy be valid in the future? or
is that too bespoke?
Best,
Bobby
next prev parent reply other threads:[~2026-07-24 16:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 22:55 [PATCH net-next v5 0/3] net: devmem: allow rx-buf-size > PAGE_SIZE per binding Bobby Eshleman
2026-07-08 22:55 ` [PATCH net-next v5 1/3] net: devmem: allow rx-buf-size > PAGE_SIZE per dmabuf binding Bobby Eshleman
2026-07-21 18:07 ` Jakub Kicinski
2026-07-23 23:58 ` Bobby Eshleman
2026-07-24 14:24 ` Jakub Kicinski
2026-07-24 16:39 ` Bobby Eshleman [this message]
2026-07-24 19:58 ` Jakub Kicinski
2026-07-24 21:11 ` Bobby Eshleman
2026-07-08 22:55 ` [PATCH net-next v5 2/3] selftests/net: ncdevmem: add -b option to set rx-buf-size on bind Bobby Eshleman
2026-07-20 21:15 ` Mina Almasry
2026-07-21 0:28 ` Bobby Eshleman
2026-07-08 22:55 ` [PATCH net-next v5 3/3] selftests/net: devmem.py: add check_rx_large_niov Bobby Eshleman
2026-07-21 18:09 ` Jakub Kicinski
2026-07-22 0:22 ` Bobby Eshleman
2026-07-24 21:04 ` Bobby Eshleman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=amOVWgJ3BAJ8I/4+@devvm29614.prn0.facebook.com \
--to=bobbyeshleman@gmail.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=bobbyeshleman@meta.com \
--cc=christian.koenig@amd.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=joe@dama.to \
--cc=kraxel@redhat.com \
--cc=kuba@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=matttbe@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=skhawaja@google.com \
--cc=sumit.semwal@linaro.org \
--cc=vivek.kasireddy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox