Re: [PATCH net v7 3/3] igb: do not split AF_XDP zero-copy frames over several Rx buffers
From: netdev-bot+sashiko
Date: Tue Nov 24 2026 - 06:29:07 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] This is a hardware-dependent DMA bound.
--
igb: do not split AF_XDP zero-copy frames over several Rx buffers
The patch programs SRRCTL.BSIZEPKT for AF_XDP zero-copy rings with the
same 2 KiB or 3 KiB buffer size as the other rings. Before, it used the
XSK frame size rounded down to 1 KiB. To keep DMA inside the XSK frame,
it relies on the receive length limit and adds checks on pool bind, MTU
change, ring setup and VF enable, so that the frame plus the timestamp
header fits.
Link: https://lore.kernel.org/all/20261028083344.3047350-3-p@xxxxxxx/
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index a59ee6575c560..d3165ae97b00d 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
[ ... ]
> @@ -4846,9 +4882,13 @@ void igb_setup_srrctl(struct igb_adapter *adapter, struct igb_ring *ring)
> u32 srrctl = 0;
> u32 buf_size;
>
> - if (ring->xsk_pool)
> - buf_size = xsk_pool_get_rx_frame_size(ring->xsk_pool);
> - else if (ring_uses_large_buffer(ring))
> + /* SRRCTL.BSIZEPKT has a 1 KiB granularity, so programming the XSK
> + * frame size would round it down and split frames over several
> + * buffers. XSK rings use the same buffer size as the other rings.
> + * While XDP is attached, the receive length limit keeps frames
> + * within the XSK frame, see igb_xsk_frame_fits().
> + */
> + if (ring_uses_large_buffer(ring))
> buf_size = IGB_RXBUFFER_3072;
> else
> buf_size = IGB_RXBUFFER_2048;
[Severity: Medium]
After this change, BSIZEPKT can be larger than the XSK frame. With 2 KiB
aligned chunks and the default headroom, the XSK frame is 1792 bytes, but
BSIZEPKT is now 2048 (or 3072 with the 3K buffer flag). Before, BSIZEPKT
was never larger than the XSK frame, so the MAC could not DMA past it,
whatever the packet length.
The commit message says the receive length limit is now the only thing
that keeps the MAC inside the frame. Does that limit cover every ingress
path once VFs are enabled?
With VFs, igb_set_rlpml() leaves the global RLPML at MAX_JUMBO_FRAME_SIZE
and limits the PF only through its pool's VMOLR:
if (igb_xdp_is_enabled(adapter)) {
pool_rlpml = min(pool_rlpml, adapter->max_frame_size);
if (!vfn)
rlpml = min(rlpml, adapter->max_frame_size);
}
wr32(E1000_RLPML, rlpml);
igb_vmm_control() turns on loopback and replication whenever VFs exist:
if (adapter->vfs_allocated_count) {
igb_vmdq_set_loopback_pf(hw, true);
igb_vmdq_set_replication_pf(hw, true);
A VF can also raise its own pool limit to 9728 with the
E1000_VF_SET_LPE mailbox message, which igb_set_vf_rlpml() handles.
The patch explicitly allows VFs to be enabled while a zero-copy socket
is bound to PF queue 0. So this setup can be reached: XDP and a 2 KiB
chunk XSK pool on PF queue 0, plus VFs assigned to guests.
Suppose the 82576/i350 internal switch does not apply the destination
pool's VMOLR.RLPML to VF-to-PF loopback frames. Could a VF then send a
jumbo frame to the PF MAC address and make the MAC write up to BSIZEPKT
bytes from the DMA start of the XSK frame?
For the second 2 KiB chunk of a 4 KiB page, the frame ends exactly at
the page boundary. That would mean writing 256 bytes past the page, or
1280 bytes with 3K buffers. Aligned-mode UMEM pages are DMA-mapped one
at a time, so those bytes would go into unrelated memory, or cause a
fault when an IOMMU is present.
The tests in the commit message only used wire frames from a peer. Was
the loopback path tested? One example would be a VF with MTU 9000
sending to the PF while a 2 KiB chunk zero-copy socket is bound to PF
queue 0.
igb_xsk_frame_fits() compares max_frame + IGB_TS_HDR_LEN with the XSK
frame size. It never compares the XSK frame size with the programmed
BSIZEPKT, so it would not catch an ingress path that skips the per-pool
length check.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120-igb-rx-ts-fix-v7-0-63b03045978e%40aweta.nl