linux/drivers
Wei Fang 25eb3058eb net: fec: add AF_XDP zero-copy support
This patch adds AF_XDP zero-copy support for both TX and RX on the FEC
driver. It introduces new functions for XSK buffer allocation, RX/TX
queue processing in zero-copy mode, and XSK pool setup/teardown.

For RX, fec_alloc_rxq_buffers_zc() is added to allocate RX buffers from
XSK pool. And fec_enet_rx_queue_xsk() is used to process the frames from
the RX queue which is bound to the AF_XDP socket. Similar to the copy
mode, the zero-copy mode also supports XDP_TX, XDP_PASS, XDP_DROP and
XDP_REDIRECT actions. In addition, fec_enet_xsk_tx_xmit() is similar to
fec_enet_xdp_tx_xmit() and is used to handle XDP_TX action in zero-copy
mode.

For TX, there are two cases, one is the frames from the AF_XDP socket,
so fec_enet_xsk_xmit() is added to directly transmit the frames from
the socket and the buffer type is marked as FEC_TXBUF_T_XSK_XMIT. The
other one is the frames from the RX queue (XDP_TX action), the buffer
type is marked as FEC_TXBUF_T_XSK_TX. Therefore, fec_enet_tx_queue()
could correctly clean the TX queue base on the buffer type.

Also, some tests have been done on the i.MX93-EVK board with the xdpsock
tool, the following are the results.

Env: i.MX93 connects to a packet generator, the link speed is 1Gbps, and
flow-control is off. The RX packet size is 64 bytes including FCS. Only
one RX queue (CPU) is used to receive frames.

1. MAC swap L2 forwarding
1.1 Zero-copy mode
root@imx93evk:~# ./xdpsock -i eth0 -l -z
 sock0@eth0:0 l2fwd xdp-drv
                   pps            pkts           1.00
rx                 414715         415455
tx                 414715         415455

1.2 Copy mode
root@imx93evk:~# ./xdpsock -i eth0 -l -c
 sock0@eth0:0 l2fwd xdp-drv
                   pps            pkts           1.00
rx                 356396         356609
tx                 356396         356609

2. TX only
2.1 Zero-copy mode
root@imx93evk:~# ./xdpsock -i eth0 -t -s 64 -z
 sock0@eth0:0 txonly xdp-drv
                   pps            pkts           1.00
rx                 0              0
tx                 1119573        1126720

2.2 Copy mode
root@imx93evk:~# ./xdpsock -i eth0 -t -s 64 -c
sock0@eth0:0 txonly xdp-drv
                   pps            pkts           1.00
rx                 0              0
tx                 406864         407616

Signed-off-by: Wei Fang <wei.fang@nxp.com>
Link: https://patch.msgid.link/20260205085742.2685134-16-wei.fang@nxp.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-02-10 10:58:20 +01:00
..
accel accel/amdxdna: Block running under a hypervisor 2025-12-15 13:00:03 -06:00
accessibility treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
acpi
amba soc: driver updates for 6.19 2025-12-05 17:29:04 -08:00
android rust_binder: remove spin_lock() in rust_shrink_free_page() 2025-12-29 11:34:16 +01:00
ata
atm
auxdisplay
base Driver core fixes for 6.19-rc7 2026-01-24 10:13:22 -08:00
bcma
block block-6.19-20260130 2026-01-30 13:18:32 -08:00
bluetooth Bluetooth: hci_qca: Enable HFP hardware offload for WCN6855 and WCN7850 2026-01-29 13:37:44 -05:00
bus
cache cache: Support cache maintenance for HiSilicon SoC Hydra Home Agent 2025-11-21 18:42:02 +00:00
cdrom cdrom: Call cdrom_mrw_exit from cdrom_release function 2025-07-22 19:10:17 -06:00
cdx
char Char/Misc/IIO driver updates for 6.19-rc1 2025-12-06 18:34:24 -08:00
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto crypto/ccp: Allow multiple streams on the same root bridge 2026-01-30 14:27:53 -08:00
cxl
dax
dca Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
devfreq PM / devfreq: Fix typo in DFSO_DOWNDIFFERENTIAL macro name 2025-11-26 13:58:59 +09:00
dibs
dio
dma
dma-buf
dpll dpll: zl3073x: Include current frequency in supported frequencies list 2026-02-06 20:44:20 -08:00
edac
eisa
extcon extcon: max14526: depends on I2C to prevent build warning/errors 2025-09-08 15:13:06 +09:00
firewire firewire: core: fix race condition against transaction list 2026-01-29 08:03:55 +09:00
firmware
fpga
fsi
fwctl
gnss
gpib
gpio
gpu Rust fixes for v6.19 2026-01-30 16:15:59 -08:00
greybus
hid hid-for-linus-2026010801 2026-01-08 07:44:48 -08:00
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
idle
iio
infiniband net/mlx5: Fix 1600G link mode enum naming 2026-02-05 18:29:04 -08:00
input Input updates for v6.19-rc6 2026-01-25 09:42:25 -08:00
interconnect interconnect: debugfs: initialize src_node and dst_node to empty strings 2026-01-12 01:58:36 +02:00
iommu
ipack driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
irqchip
isdn
leds
macintosh
mailbox
mcb
md block-6.19-20260130 2026-01-30 13:18:32 -08:00
media
memory
memstick
message
mfd
misc
mmc
most
mtd
mux
net net: fec: add AF_XDP zero-copy support 2026-02-10 10:58:20 +01:00
nfc nfc: nxp-nci: remove interrupt trigger type 2026-02-06 20:54:50 -08:00
ntb
nubus
nvdimm
nvme
nvmem
of dma-mapping fixes for Linux 6.19 2026-01-30 13:15:04 -08:00
opp OPP: Initialize scope-based pointers inline 2025-10-23 11:58:05 +05:30
parisc
parport
pci
pcmcia
peci
perf
phy Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-01-22 20:14:36 -08:00
pinctrl
platform
pmdomain
pnp
power
powercap
pps printk changes for 6.19 2025-12-03 12:42:36 -08:00
ps3
ptp drivers: Add support for DPLL reference count tracking 2026-02-05 15:57:46 +01:00
pwm
rapidio
ras
regulator
remoteproc
resctrl arm_mpam: Use non-atomic bitops when modifying feature bitmap 2026-01-16 12:04:20 +00:00
reset
rpmsg rpmsg: glink: remove duplicate code for rpmsg device remove 2025-11-26 10:16:10 -06:00
rtc RTC for 6.19 2025-12-13 17:09:06 +12:00
s390
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging
target scsi: firewire: sbp-target: Fix overflow in sbp_make_tpg() 2026-01-23 22:41:21 -05:00
tc
tee QCOMTEE fixes2 for v6.18 2025-11-21 21:27:20 +01:00
thermal
thunderbolt
tty
ufs
uio
usb
vdpa
vfio
vhost vsock: add netns support to virtio transports 2026-01-27 10:45:38 +01:00
video
virt coco/tsm: Remove unused variable tsm_rwsem 2026-01-23 13:09:51 -08:00
virtio virtio: clean up features qword/dword terms 2025-11-27 02:03:07 -05:00
w1
watchdog
xen
zorro
Kconfig
Makefile