xdp-tutorial icon indicating copy to clipboard operation
xdp-tutorial copied to clipboard

AF_XDP zero copy - Operation not supported error

Open sadsiddi opened this issue 4 years ago • 2 comments

Hi, I am trying to enable AF_XDP zero copy mode and i see the error in Cent OS 8(kernel 4.18), but SKB mode and DRV mode with copy works fine. The driver is ixgbe 5.6.5 which supports AF_XDP zero copy as per the documentation. strace shows the failure is during bind ./af_xdp_user -d eth2 -z -q 1

bind(3, {sa_family=0x2c /* AF_??? */, sa_data="\4\0006\1\0\0\0\0\0\0\0\0\0\0"}, 16) = -1 EOPNOTSUPP (Operation not supported)

The ethtool shows i have combined queues and not separate rx/tx queues. Is that a problem? [root@localhost ~]# ethtool -l eth2 Channel parameters for eth2: Pre-set maximums: RX: 0 TX: 0 Other: 1 Combined: 63 Current hardware settings: RX: 0 TX: 0 Other: 1 Combined: 9

[root@localhost ~]# ethtool -i eth2 driver: ixgbe version: 5.6.5 firmware-version: 0x61c10001 expansion-rom-version: bus-info: 0000:00:06.0 supports-statistics: yes supports-test: yes supports-eeprom-access: yes supports-register-dump: yes supports-priv-flags: yes

Any ideas what is missing?

Thank you Saddique

sadsiddi avatar May 13 '20 22:05 sadsiddi

Did a quick test here on my setup which is an older 5.4.0 bpf-next kernel, and an older ixgbe driver but it works fine here, even with not combining the queues (this should only result in not receiving all traffic).

Channel parameters for eno2:
Pre-set maximums:
RX:		0
TX:		0
Other:		1
Combined:	63
Current hardware settings:
RX:		0
TX:		0
Other:		1
Combined:	28

ethtool -i eno2
driver: ixgbe
version: 5.1.0-k
firmware-version: 0x800007f4, 17.5.10
expansion-rom-version: 
bus-info: 0000:01:00.1
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes

Does it work without zero copy?

Looking at the kernel code, I see the following in xdp_umem_assign_dev():

130  	if (!dev->netdev_ops->ndo_bpf || !dev->netdev_ops->ndo_xsk_wakeup) {
131  		err = -EOPNOTSUPP;
132  		goto err_unreg_umem;
133  	}

So it looks like a drive operation not being supported. Check the driver to make sure both functions are registered and supported.

chaudron avatar May 14 '20 07:05 chaudron

Thanks for your reply. The skb mode and driver mode with copy works fine for the same nic/driver. drvmode with copy: bind(3, {sa_family=0x2c /* AF_??? */, sa_data="\2\0006\1\0\0\0\0\0\0\0\0\0\0"}, 16) = 0

The driver 5.6.5 from intel clearly mentions that this Zero-copy is supported from Kernel 4.18

"This driver supports XDP (Express Data Path) on kernel 4.14 and later. Note that XDP is blocked for frame sizes larger than 3KB. This driver supports AF_XDP zero-copy on kernel 4.18 and later"

Can i dump anything which can tell if ndo_bpf is not registered?

sadsiddi avatar May 14 '20 08:05 sadsiddi