[dpdk-dev] [RFC v2 6/7] net/af_xdp: load BPF file

Björn Töpel bjorn.topel at gmail.com
Wed May 9 09:02:22 CEST 2018


2018-03-09 0:15 GMT+01:00 Stephen Hemminger <stephen at networkplumber.org>:
> On Thu,  8 Mar 2018 21:52:48 +0800
> Qi Zhang <qi.z.zhang at intel.com> wrote:
>
>> +struct bpf_insn prog[] = {
>> +     {
>> +             .code = 0x85, //call imm
>> +             .dst_reg = 0,
>> +             .src_reg = 0,
>> +             .off = 0,
>> +             .imm = BPF_FUNC_xdpsk_redirect,
>> +     },
>> +     {
>> +             .code = 0x95, //exit
>> +             .dst_reg = 0,
>> +             .src_reg = 0,
>> +             .off = 0,
>> +             .imm = 0,
>> +     },
>> +};
>> +
>> +int load_bpf_file(void)
>> +{
>> +     int fd;
>> +
>> +     fd = bpf_load_program(BPF_PROG_TYPE_XDP, prog,
>> +                           ARRAY_SIZE(prog),
>> +                           "GPL", 0,
>> +                           bpf_log_buf, BPF_LOG_BUF_SIZE);
>
> Still have license conflict here. The short bpf program is in BSD code and therefore
> is BSD, not GPL. But kernel won't let you load non-GPL programs.
>

Raising a dead thread! Loading a bpf program that's *not* gpl is not
an issue. The only think to keep in mind is that some bpf helpers are
gpl only -- still -- loading non-gpl bpf code is perfectly ok. So, the
issue here is that bpf_load_program passes "GPL" and therefore making
the program gpl.


Björn

> Please check with Intel open source compliance to find a GPL solution.
>
> A possible license safe solution is more complex. You need to provide original program
> source for the BPF program under dual clause (GPL-2/BSD-3); then read in that object
> file and load it.  A user wishing to exercise their GPL rights can then take your
> source file and modify and create new file to load.
>
> Doing this also creates additional GPL issues for appliance vendors using AF_XDP.
> They need to make available the source of all these XDP BPF programs.
>
> Complying with mixed licenses is hard.


More information about the dev mailing list