public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 net 0/8] xsk: tailroom reservation and MTU validation
@ 2026-04-02 15:49 Maciej Fijalkowski
  2026-04-02 15:49 ` [PATCH v6 net 1/8] xsk: tighten UMEM headroom validation to account for tailroom and min frame Maciej Fijalkowski
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Maciej Fijalkowski @ 2026-04-02 15:49 UTC (permalink / raw)
  To: netdev
  Cc: bpf, magnus.karlsson, stfomichev, kuba, pabeni, horms,
	larysa.zaremba, aleksander.lobakin, bjorn, Maciej Fijalkowski

v5->v6:
- refrain from relying on umem refcnt when disabling zc on error path
  (Sashiko)
- have a separate __xsk_pool_get_rx_frame_size() which preserves old
  behavior and use it on copy path (Sashiko)
- drop driver cleanups

v4->v5:
- add further review tags from Bjorn
- fix ./test_progs -t xsk
 * do so by making the procfs reading common so test_xsk.c can use it
- get back to idea of relying on pool->umem->zc in
  xsk_pool_get_tailroom(); that is because we now call its caller
  (xsk_pool_get_rx_frame_size()) before getting down to driver via
  ndo_bpf - we do it to rule out invalid setups in terms of MTU vs xsk
  frame size/number of exposed segments by driver
- bring back explicit rejection of mbuf && segs == 1 combo

v3->v4:
- allow exact 128 bytes of space when user defined headroom is deducted
  from total frame size
- provide a routine for reading procfs entries within xskxceiver
  * use it to fetch cache line size and calculate skb_shared_info size
    on our own
- clean up gve and igc xsk pool enablement routines
- include mtu vs frame size * max zc segments validation in
  xp_assign_dev()

v2->v3:
- add tags from Bjorn/Stan
- provide at least 128 bytes instead ETH_ZLEN when validating frame
  headroom
  * this way we can get rid of i40e/ice changes
  * make sure xsk_pool_get_rx_frame_size() returns value 128b-aligned
  * and remove pre-check from idpf
- separate XDP_UMEM_SG_FLAG fixes from MTU validation in xsk_bind()
- make drop_idx a local variable in xsk's xdp drop prog
- adjust rx_dropped to new 128b related values
- move ugly placed define (Bjorn)
- remove READ_ONCE when fetching netdev->mtu (Bjorn)

v1->v2:
- remove xsk_pool_get_tailroom() definition for !CONFIG_XDP_SOCKETS
  (Stan)
- do not rely on pool->umem->zc when configuring tailroom (Stan, Bjorn)
- simplify dbuff setting in ZC drivers (Bjorn)
- use defines for {head,tail}room in tests (Bjorn)
- return EINVAL instead of EOPNOTSUPP when mtu setting is wrong (Bjorn)
- include vlan headers and fcs length when validating mtu (Olek)
- tighten umem headroom validation when registering umem (Sashiko AI)
- set XDP_USE_SG in xp_assign_dev_shared() (Sashiko AI)
- adjust rx dropped xskxceiver test

Hi,

here we fix a long-standing issue regarding multi-buffer scenario in ZC
mode - we have not been providing space at the end of the buffer where
multi-buffer XDP works on skb_shared_info. This has been brought to our
attention via [0].

Unaligned mode does not get any specific treatment, it is user's
responsibility to properly handle XSK addresses in queues.

With adjustments included here in this set against xskxceiver I have
been able to pass the full test suite on ice.

Thanks,
Maciej

[0]: https://community.intel.com/t5/Ethernet-Products/X710-XDP-Packet-Corruption-Issue-DRV-MODE-Zero-Copy-Multi-Buffer/m-p/1724208


Maciej Fijalkowski (8):
  xsk: tighten UMEM headroom validation to account for tailroom and min
    frame
  xsk: respect tailroom for ZC setups
  xsk: fix XDP_UMEM_SG_FLAG issues
  xsk: validate MTU against usable frame size on bind
  selftests: bpf: introduce a common routine for reading procfs
  selftests: bpf: fix pkt grow tests
  selftests: bpf: have a separate variable for drop test
  selftests: bpf: adjust rx_dropped xskxceiver's test to respect
    tailroom

 include/net/xdp_sock.h                        |  2 +-
 include/net/xdp_sock_drv.h                    | 23 +++++++-
 net/xdp/xdp_umem.c                            |  3 +-
 net/xdp/xsk.c                                 |  4 +-
 net/xdp/xsk_buff_pool.c                       | 32 ++++++++++-
 .../selftests/bpf/prog_tests/test_xsk.c       | 55 +++++++++----------
 .../selftests/bpf/prog_tests/test_xsk.h       | 23 ++++++++
 tools/testing/selftests/bpf/prog_tests/xsk.c  | 19 +++++++
 .../selftests/bpf/progs/xsk_xdp_progs.c       |  4 +-
 tools/testing/selftests/bpf/xskxceiver.c      | 23 ++++++++
 10 files changed, 150 insertions(+), 38 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-04-07  1:50 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 15:49 [PATCH v6 net 0/8] xsk: tailroom reservation and MTU validation Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 1/8] xsk: tighten UMEM headroom validation to account for tailroom and min frame Maciej Fijalkowski
2026-04-04  0:01   ` Jakub Kicinski
2026-04-04 10:07     ` Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 2/8] xsk: respect tailroom for ZC setups Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 3/8] xsk: fix XDP_UMEM_SG_FLAG issues Maciej Fijalkowski
2026-04-03 23:56   ` Jakub Kicinski
2026-04-04 10:11     ` Maciej Fijalkowski
2026-04-07  1:45       ` Jakub Kicinski
2026-04-02 15:49 ` [PATCH v6 net 4/8] xsk: validate MTU against usable frame size on bind Maciej Fijalkowski
2026-04-04  0:03   ` Jakub Kicinski
2026-04-04 10:02     ` Maciej Fijalkowski
2026-04-06 18:00       ` Jakub Kicinski
2026-04-02 15:49 ` [PATCH v6 net 5/8] selftests: bpf: introduce a common routine for reading procfs Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 6/8] selftests: bpf: fix pkt grow tests Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 7/8] selftests: bpf: have a separate variable for drop test Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 8/8] selftests: bpf: adjust rx_dropped xskxceiver's test to respect tailroom Maciej Fijalkowski
2026-04-07  1:50 ` [PATCH v6 net 0/8] xsk: tailroom reservation and MTU validation patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox