This series introduces support for TCP devmem with netkit devices. When a physical device leases a queue to a netkit device, the netkit device is free to bind-rx on that queue. This works out-of-the-box and for this RX path this series only introduces tests. The tx path, via bind-tx, is less forgiving. Before the skb ever encounters the netkit forwarding policy or BPF redirection verdict, the skb is dropped because the upper devmem TX path deems the underlying netkit device unsuitable for DMA and netmem TX.
This patch series introduces netkit and queue leasing awareness to bind-tx and the devmem TX path, so that devmem packets do not prematurely drop even when destined for a suitable netkit device. When bind-tx is called on a netkit device that has been leased a queue from a physical device, the binding looks up and remembers the physical device if it supports netmem tx. This physical device is then used in bind-tx and TX skb validation where the checks for netmem_tx are performed on the physical device instead of the virtual device. If no queue has been leased or the physical device doesn't support netmem TX, then as usual these checks will fail. If BPF redirect or ip forwarding lands the skb in the TX path of a device that does not support netmem, then validate_xmit_unreadable_skb() will fail and the pkt dropped. This series depends on the queue leasing series: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Bobby Eshleman <[email protected]> --- Bobby Eshleman (6): net: devmem: support TX through netkit leased queues selftests: drv-net: extract _find_bss_map_id helper in NetDrvContEnv selftests: drv-net: add skip-config flag to ncdevmem selftests: drv-net: add primary RX redirect support to NetDrvContEnv selftests: drv-net: add netkit devmem RX test selftests: drv-net: add netkit devmem TX test net/core/dev.c | 26 +++-- net/core/devmem.c | 16 ++- net/core/devmem.h | 6 +- net/core/netdev-genl.c | 38 ++++++- tools/testing/selftests/drivers/net/hw/.gitignore | 1 + tools/testing/selftests/drivers/net/hw/Makefile | 1 + tools/testing/selftests/drivers/net/hw/ncdevmem.c | 58 ++++++---- .../testing/selftests/drivers/net/hw/nk_devmem.py | 123 +++++++++++++++++++++ .../drivers/net/hw/nk_primary_rx_redirect.bpf.c | 41 +++++++ tools/testing/selftests/drivers/net/lib/py/env.py | 60 ++++++++-- 10 files changed, 314 insertions(+), 56 deletions(-) --- base-commit: 6c80a1ec8984e01a4d92225ecaba66ab74063d2c change-id: 20260313-scratch-bobbyeshleman-tcp-dm-netkit5-fb85f437568c Best regards, -- Bobby Eshleman <[email protected]>

