Re: [PATCH net-next v5 1/3] net: devmem: allow rx-buf-size > PAGE_SIZE per dmabuf binding

From: Bobby Eshleman

Date: Thu Jul 23 2026 - 19:58:54 EST


On Tue, Jul 21, 2026 at 11:07:13AM -0700, Jakub Kicinski wrote:
> On Wed, 08 Jul 2026 15:55:04 -0700 Bobby Eshleman wrote:
> > diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
> > index 5f143da7458c..70b902008bd3 100644
> > --- a/Documentation/netlink/specs/netdev.yaml
> > +++ b/Documentation/netlink/specs/netdev.yaml
> > @@ -598,6 +598,13 @@ attribute-sets:
> > type: u32
> > checks:
> > min: 1
> > + -
> > + name: rx-buf-size
>
> rx-page-size, we're modeling device pages.
> rx-buf-len exists in ethtool and is something else.
>
> > + 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)?

Best,
Bobby

>
> > + NL_SET_ERR_MSG_FMT(info->extack,
> > + "rx_buf_size %u must be a power of 2 >= page size (%lu)",
> > + rx_buf_size, PAGE_SIZE);
>
> This must point at _ATTR, the _FMT is unnecessary.
> --
> pw-bot: cr