Re: [PATCH bpf-next] bpftool: specify XDP Hints ifname when loading program

From: Quentin Monnet
Date: Mon May 15 2023 - 12:55:55 EST


2023-05-15 18:30 UTC+0200 ~ Niklas Söderlund <niklas.soderlund@xxxxxxxxxxxx>
> On 2023-05-12 15:36:47 +0200, Larysa Zaremba wrote:
>> [You don't often get email from larysa.zaremba@xxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>>
>> On Fri, May 12, 2023 at 11:23:00AM +0100, Quentin Monnet wrote:
>>> 2023-05-11 17:13 UTC+0200 ~ Larysa Zaremba <larysa.zaremba@xxxxxxxxx>
>>>> Add ability to specify a network interface used to resolve
>>>> XDP Hints kfuncs when loading program through bpftool.
>>>>
>>>> Usage:
>>>> bpftool prog load <bpf_obj_path> <pin_path> dev xdpmeta <ifname>
>>>
>>> Thanks for this patch!
>>>
>>> Regarding the command-line syntax, I'm not a big fan of the optional
>>> sub-keyword for the device for XDP hints. I must admit I had not
>>> anticipated other another use for the "dev" keyword. Instead, have you
>>> considered one of the following:
>>>
>>> 1) Adding a different keyword ("xdpmeta_dev"?) and making it
>>> incompatible with "dev"
>>>
>>> 2) Another alternative would be adding a sub-keyword for offload too:
>>>
>>> bpftool p l [...] dev <[offload <ifname> | xdpmeta <ifname>]>
>>>
>>> If the ifname is provided with no sub-keyword, we would consider it for
>>> offload for legacy support, possibly warn that the syntax is deprecated.
>>>
>>> What do you think?
>>>
>>
>> I think first option would look a little bit nicer, but I like the idea to
>> deprecate "dev <ifname>". In my current version, forgetting to add "xdpmeta"
>> resulted in not very descriptive errors, this may confuse new users. So what
>> about:
>
> I agree the first option looks a little bit nicer, but I think both
> options would work.
>
>>
>> bpftool prog load [...] xdpmeta_dev/offload_dev <ifname>
>>
>> "dev <ifname>" syntax would still work, but with a big warning, like this:
>>
>> 'bpftool prog [...] dev <ifname>' syntax is deprecated. Going further, please
>> use 'offload_dev <ifname>' to offload program to device. For XDP hints
>> applications, use 'xdpmeta_dev <ifname>'.

OK let's go with this

Thanks,
Quentin