Subject: Re: [PATCH bpf-next v2 5/8] libbpf, xsk: select AF_XDP BPF program based on kernel version

From: Björn Töpel <[email-masked]>
Date: Wed, 20 Jan 2021 15:49:45 +0100

On 2021-01-20 14:25, Björn Töpel wrote:
> On 2021-01-20 13:52, Toke Høiland-Jørgensen wrote:
>> Björn Töpel <[email-masked]> writes:
>>
>>> From: Björn Töpel <[email-masked]>
>>>
>>> Add detection for kernel version, and adapt the BPF program based on
>>> kernel support. This way, users will get the best possible performance
>>> from the BPF program.
>>
>> Please do explicit feature detection instead of relying on the kernel
>> version number; some distro kernels are known to have a creative notion
>> of their own version, which is not really related to the features they
>> actually support (I'm sure you know which one I'm referring to ;)).
>>
> 
> Right. For a *new* helper, like bpf_redirect_xsk, we rely on rejection
> from the verifier to detect support. What about "bpf_redirect_map() now
> supports passing return value as flags"? Any ideas how to do that in a
> robust, non-version number-based scheme?
>

Just so that I understand this correctly. Red^WSome distro vendors
backport the world, and call that franken kernel, say, 3.10. Is that
interpretation correct? My hope was that wasn't the case. :-(

Would it make sense with some kind of BPF-specific "supported features"
mechanism? Something else with a bigger scope (whole kernel)?

Cheers,
Björn