I'm trying to load my first eBPF program to the XDP hook, but can't use DRV_MODE.

To be more specific, I'm using Ubuntu 20.04 LTS (GNU/Linux 5.4.0-100-generic x86_64), with a NIC ca:00.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]. And I updated the driver to the latest version:

driver: mlx5_core
version: 5.6-2.0.9
firmware-version: 22.32.2004 (DEL0000000027)
bus-info: 0000:ca:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: yes

But I still can't load the program in driver mode.

bpf_set_link_xdp_fd(ifindex, prog_fd, XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_DRV_MODE).

I'm stuck here, and can't find messages about whether this Mellanox driver support XDP native mode or not(actually the NIC is pretty good I think it should support XDP native mode).

Can anyone give me some guidance that may sort me out?


1 Answer 1


Yes, the mlx5 driver supports XDP since Linux 4.9 according to https://docs.cilium.io/en/latest/gettingstarted/kubeproxy-free/#xdp-acceleration.

Your program is likely rejected for another reason. Either something unrelated to driver-mode itself (e.g., rejected by verifier) or you're doing something that isn't supported by the driver.

  • Thanks! But the problem is when I change to generic mode, it will work. So it seems only about the mode... Jul 17, 2022 at 2:38
  • That would suggest it's the second reason: you're doing something that isn't supported by the driver. I would suggest to open a question on StackOverflow, tagged bpf, with the source code of your BPF program (if small), to ask what could be rejected by the driver.
    – pchaigno
    Jul 17, 2022 at 14:53
  • 1
    Thanks, I solved the problem! It's because the MTU size is too large for xdp. Jul 19, 2022 at 3:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .