Re: [PATCH v6 net 4/8] xsk: validate MTU against usable frame size on bind

Maciej Fijalkowski
2026-04-04T10:02:47Z

On Fri, Apr 03, 2026 at 05:03:57PM -0700, Jakub Kicinski wrote:
> On Thu, 2 Apr 2026 17:49:54 +0200 Maciej Fijalkowski wrote:
> > AF_XDP bind currently accepts zero-copy pool configurations without
> > verifying that the device MTU fits into the usable frame space provided
> > by the UMEM chunk.
> >
> > This becomes a problem since we started to respect tailroom which is
> > subtracted from chunk_size (among with headroom). 2k chunk size might
> > not provide enough space for standard 1500 MTU, so let us catch such
> > settings at bind time. Furthermore, validate whether underlying HW will
> > be able to satisfy configured MTU wrt XSK's frame size multiplied by
> > supported Rx buffer chain length (that is exposed via
> > net_device::xdp_zc_max_segs).
>
> For multi-buf - I suppose it's fine, but wouldn't this be potentially
> a regression for setups which use single buf? Suddenly we expect the
> user to provide space for shinfo which was not part of the initial
> AF_XDP design?

For single buf xsk_pool_get_tailroom() gives you 0 so it is not taken into
account when we do comparison of mtu vs xsk frame size (in this case frame
size is defined as chunk size minus headrooms (xdp and user provided
one)).