Re: [PATCH net] bpf: xdp: fallback to SKB mode if DRV flag is absent.

From: Jakub Kicinski
Date: Tue Oct 15 2024 - 11:51:35 EST


On Tue, 15 Oct 2024 03:36:32 +0000 Hangbin Liu wrote:
> After commit c8a36f1945b2 ("bpf: xdp: Fix XDP mode when no mode flags
> specified"), the mode is automatically set to XDP_MODE_DRV if the driver
> implements the .ndo_bpf function. However, for drivers like bonding, which
> only support native XDP for specific modes, this may result in an
> "unsupported" response.
>
> In such cases, let's fall back to SKB mode if the user did not explicitly
> request DRV mode.

Looks like the issue is reported by QA rather than a real user.
A weak -1 from me on building such unreliable heuristics into
the kernel. As BPF CI's failure points out the ops can return
EOPNOTSUPP for multiple reasons while dev_xdp_mode() only checks
if the driver *has* ndo_bpf, not if it fails.