[dpdk-dev] Compiling RSS ebpf

Sameeh Jubran sameeh at daynix.com
Wed Jun 6 14:06:31 CEST 2018


On Tue, May 29, 2018 at 6:48 PM, Ophir Munk <ophirmu at mellanox.com> wrote:

> Hi Sameeh,
>
> RSS ebpf source code compilation is planned for dpdk next releases.
>
>
>
> In order to compile the current tap_bpf_program.c code you will need
> definitions found in iproute2:
>
>
>
> https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/
>
>
>
> 1.       Please clone iproute2 tree and make it accessible to your build
> environment, say under directory <iproute2_root_tree>.
>
>
>
> 2.       Please add "bpf_api.h" file inclusion in tap_bpf_program.c
> (following tap_rss.h inclusion, see [1])
>
>
>
> 3.       When running the clang command please include the iproute2
> include directory, for example,
>
> clang -I <iproute2_root_tree>/iproute2/include -O2 -emit-llvm -c
> tap_bpf_program.c -o - | llc -march=bpf -filetype=obj -o tap_bpf_program.o
>
>
>
> That’s all is needed.
>

I have just tested this and this indeed solved the compilation errors!

It'll be great if you'll add them to the documentation as it is misleading
and not up-to-date :)

Thanks

>
>
> [1]
>
> ------------------------------------------------------------
> -------------------------------------------
>
> diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_
> program.c
>
> index 1cb7382..d65f9b8 100644
>
> --- a/drivers/net/tap/tap_bpf_program.c
>
> +++ b/drivers/net/tap/tap_bpf_program.c
>
> @@ -17,6 +17,7 @@
>
> #include <linux/bpf.h>
>
>
>
>   #include "tap_rss.h"
>
>   +#include "bpf_api.h"
>
>
>
>    /** Create IPv4 address */
>
>     #define IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \
>
> ------------------------------------------------------------
> -------------------------------------------
>
>
>
> Regards,
>
> Ophir
>
>
>
> *From:* Sameeh Jubran [mailto:sameeh at daynix.com]
> *Sent:* Friday, May 25, 2018 11:54 AM
> *To:* dev at dpdk.org; Ophir Munk <ophirmu at mellanox.com>
> *Cc:* Yan Vugenfirer <yan at daynix.com>
> *Subject:* Re: Compiling RSS ebpf
>
>
>
> Ping.
>
>
>
> On Sun, May 13, 2018 at 1:16 PM, Sameeh Jubran <sameeh at daynix.com> wrote:
>
> Sorry I have accidentally sent my last email without finishing it.
>
>
>
> I believe it is due misconfiguration of the linux headers and their
> inclusion. Anyone else faced these errors?
>
>
>
>
>
> On Sun, May 13, 2018 at 1:10 PM, Sameeh Jubran <sameeh at daynix.com> wrote:
>
> Hi All,
>
>
>
> I am attempting to compile the rss epbf program dpdk and I am getting too
> much compilation errors, is there anything specific that I need to
> configure when compiling?
>
>
>
> I am running the following line:
>
>
>
>  clang -O2 -emit-llvm -c tap_bpf_program.c -o - | llc -march=bpf
> -filetype=obj -o tap_bpf_program.o
>
>
>
> I think it is due to some misconfiguration of
>
> The errors I am getting:
>
>
>
> tap_bpf_program.c:157:37: warning: implicit declaration of function
> 'offsetof' is invalid in C99 [-Wimplicit-function-declaration]
>
>                 __u8 *src_dst_addr = data + off + offsetof(struct iphdr,
> saddr);
>
>                                                   ^
>
> tap_bpf_program.c:157:46: error: expected expression
>
>                 __u8 *src_dst_addr = data + off + offsetof(struct iphdr,
> saddr);
>
>                                                            ^
>
> tap_bpf_program.c:157:60: error: use of undeclared identifier 'saddr'
>
>                 __u8 *src_dst_addr = data + off + offsetof(struct iphdr,
> saddr);
>
>                                                                          ^
>
> tap_bpf_program.c:180:11: error: use of undeclared identifier 'TC_ACT_OK'
>
>                         return TC_ACT_OK;
>
>                                ^
>
> tap_bpf_program.c:182:15: error: expected expression
>
>                                         offsetof(struct ipv6hdr, saddr);
>
>                                                  ^
>
> tap_bpf_program.c:182:31: error: use of undeclared identifier 'saddr'
>
>                                         offsetof(struct ipv6hdr, saddr);
>
>                                                                  ^
>
> tap_bpf_program.c:204:10: error: use of undeclared identifier 'TC_ACT_PIPE'
>
>                 return TC_ACT_PIPE;
>
>                        ^
>
> tap_bpf_program.c:212:9: error: use of undeclared identifier
> 'TC_ACT_RECLASSIFY'
>
>         return TC_ACT_RECLASSIFY;
>
>                ^
>
> tap_bpf_program.c:222:1: error: expected parameter declarator
>
> RSS(l3_l4)
>
> ^
>
> tap_bpf_program.c:216:12: note: expanded from macro 'RSS'
>
>         __section(#L) int                               \
>
>                   ^
>
> <scratch space>:76:1: note: expanded from here
>
> "l3_l4"
>
> ^
>
> tap_bpf_program.c:222:1: error: expected ')'
>
> tap_bpf_program.c:216:12: note: expanded from macro 'RSS'
>
>         __section(#L) int                               \
>
>                   ^
>
> <scratch space>:76:1: note: expanded from here
>
> "l3_l4"
>
> ^
>
> tap_bpf_program.c:222:1: note: to match this '('
>
> tap_bpf_program.c:216:11: note: expanded from macro 'RSS'
>
>         __section(#L) int                               \
>
>                  ^
>
> tap_bpf_program.c:222:1: warning: type specifier missing, defaults to
> 'int' [-Wimplicit-int]
>
> RSS(l3_l4)
>
> ^
>
> tap_bpf_program.c:216:2: note: expanded from macro 'RSS'
>
>         __section(#L) int                               \
>
>         ^
>
> tap_bpf_program.c:222:1: error: expected ';' after top level declarator
>
> tap_bpf_program.c:216:16: note: expanded from macro 'RSS'
>
>         __section(#L) int                               \
>
>                       ^
>
> fatal error: too many errors emitted, stopping now [-ferror-limit=]
>
> 6 warnings and 20 errors generated.
>
> sameeh at bark:~/Builds/bpf_rss/dpdk/drivers/net/tap$ clear
>
>
>
> --
>
> Respectfully,
>
> *Sameeh Jubran*
>
> *Linkedin*
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fil.linkedin.com%2Fpub%2Fsameeh-jubran%2F87%2F747%2Fa8a&data=02%7C01%7Cophirmu%40mellanox.com%7Ce218efbbd4794adad85308d5c21d0017%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636628352172243393&sdata=q2cAsmMGwY04jnUU6o54qJNarP%2FXc5Zb0dfisZG1kE0%3D&reserved=0>
>
> *Software Engineer @ Daynix
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.daynix.com&data=02%7C01%7Cophirmu%40mellanox.com%7Ce218efbbd4794adad85308d5c21d0017%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636628352172243393&sdata=c4cl%2FHYq7Mluic4%2F1CADH1eMc6Ht2eDEbzrpbWoJrRI%3D&reserved=0>.*
>
>
>
>
>
> --
>
> Respectfully,
>
> *Sameeh Jubran*
>
> *Linkedin*
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fil.linkedin.com%2Fpub%2Fsameeh-jubran%2F87%2F747%2Fa8a&data=02%7C01%7Cophirmu%40mellanox.com%7Ce218efbbd4794adad85308d5c21d0017%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636628352172243393&sdata=q2cAsmMGwY04jnUU6o54qJNarP%2FXc5Zb0dfisZG1kE0%3D&reserved=0>
>
> *Software Engineer @ Daynix
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.daynix.com&data=02%7C01%7Cophirmu%40mellanox.com%7Ce218efbbd4794adad85308d5c21d0017%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636628352172399649&sdata=QVj0xITWkmUnArcklNhzuIlcxd4DMpUuDGZHVKiDlnI%3D&reserved=0>.*
>
>
>
>
>
> --
>
> Respectfully,
>
> *Sameeh Jubran*
>
> *Linkedin*
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fil.linkedin.com%2Fpub%2Fsameeh-jubran%2F87%2F747%2Fa8a&data=02%7C01%7Cophirmu%40mellanox.com%7Ce218efbbd4794adad85308d5c21d0017%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636628352172399649&sdata=QWu2yfldJjjq3P0S2V3WAk9TUbJebFEAJN%2F14s1IUHs%3D&reserved=0>
>
> *Software Engineer @ Daynix
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.daynix.com&data=02%7C01%7Cophirmu%40mellanox.com%7Ce218efbbd4794adad85308d5c21d0017%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636628352172399649&sdata=QVj0xITWkmUnArcklNhzuIlcxd4DMpUuDGZHVKiDlnI%3D&reserved=0>.*
>



-- 
Respectfully,
*Sameeh Jubran*
*Linkedin <https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a>*
*Software Engineer @ Daynix <http://www.daynix.com>.*


More information about the dev mailing list