Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AF_XDP support is not compiled on Redhat9 #908

Open
bas-k opened this issue Jan 18, 2024 · 0 comments
Open

AF_XDP support is not compiled on Redhat9 #908

bas-k opened this issue Jan 18, 2024 · 0 comments

Comments

@bas-k
Copy link

bas-k commented Jan 18, 2024

When compiling the PF_RING code on Redhat 9 the AF_XDP support is not compiled.

The output of the configure script in the userland directory shows:

checking for nl_socket_alloc in -lnl-3... no
checking for pthread_setaffinity_np in -lpthread... yes
checking PF_RING ZC support... yes
checking PF_RING FT support... yes
checking PF_RING NPCAP support... yes
checking if r/w locks are supported... yes
checking Mellanox support (x64 and aarch64)... yes
checking PF_RING AF_XDP support... no
configure: creating ./config.status
config.status: creating lib/Makefile
config.status: creating lib/pfring_config
config.status: creating examples/Makefile
config.status: creating examples_zc/Makefile
config.status: creating examples_ft/Makefile
config.status: creating c++/Makefile

The configure scripts checks for the existance of xsk.h and if_xdp.h in the wrong location:

  • xsk.h is located in /usr/include/xdp/xsk.h on redhat9 and requires libxdp-devel to be installed.
  • if_xdp.h is located in /usr/src/kernels/$BUILD_KERNEL/include/uapi/linux/if_xdp.h

Also pfring_mod_af_xdp.c is including <bpf/xsk.h> which should be <xdp/xsk.h>

Updating all these items then results in a compilation error:

[root@local userland]# ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking linux/net_tstamp.h usability... yes
checking linux/net_tstamp.h presence... yes
checking for linux/net_tstamp.h... yes
checking librdi.h usability... no
checking librdi.h presence... no
checking for librdi.h... no
checking hiredis/hiredis.h usability... no
checking hiredis/hiredis.h presence... no
checking for hiredis/hiredis.h... no
checking for clock_gettime in -lrt... yes
checking for nl_handle_alloc in -lnl... no
checking for dlopen, dlsym in -ldl... yes
checking for nl_socket_alloc in -lnl-3... no
checking for pthread_setaffinity_np in -lpthread... yes
checking PF_RING ZC support... yes
checking PF_RING FT support... yes
checking PF_RING NPCAP support... yes
checking if r/w locks are supported... yes
checking Mellanox support (x64 and aarch64)... yes
checking PF_RING AF_XDP support... yes
configure: creating ./config.status
config.status: creating lib/Makefile
config.status: creating lib/pfring_config
config.status: creating examples/Makefile
config.status: creating examples_zc/Makefile
config.status: creating examples_ft/Makefile
config.status: creating c++/Makefile
config.status: creating nbpf/Makefile
config.status: creating wireshark/extcap/Makefile
config.status: creating lib/config.h
config.status: lib/config.h is unchanged
[root@local userland]# make
cd lib; make
make[1]: Entering directory '/opt/WORK/PF_RING/userland/lib'
ar x ../nbpf/libnbpf.a
cp ../nbpf/nbpf.h .
ar x libs/libpfring_zc_x86_64_core-avx2.a
cp /usr/src/linux-headers-5.14.0-362.13.1.el9_3.x86_64/include/uapi/linux/if_xdp.h ../../kernel/linux/
cp: cannot stat '/usr/src/linux-headers-5.14.0-362.13.1.el9_3.x86_64/include/uapi/linux/if_xdp.h': No such file or directory
make[1]: *** [Makefile:149: copy_if_xdp] Error 1
make[1]: Leaving directory '/opt/WORK/PF_RING/userland/lib'
make: *** [Makefile:12: libpfring] Error 2
[root@local userland]# lvi lib/Makefile.in
-bash: lvi: command not found
[root@local userland]# vi lib/Makefile.in
[root@local userland]# ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking linux/net_tstamp.h usability... yes
checking linux/net_tstamp.h presence... yes
checking for linux/net_tstamp.h... yes
checking librdi.h usability... no
checking librdi.h presence... no
checking for librdi.h... no
checking hiredis/hiredis.h usability... no
checking hiredis/hiredis.h presence... no
checking for hiredis/hiredis.h... no
checking for clock_gettime in -lrt... yes
checking for nl_handle_alloc in -lnl... no
checking for dlopen, dlsym in -ldl... yes
checking for nl_socket_alloc in -lnl-3... no
checking for pthread_setaffinity_np in -lpthread... yes
checking PF_RING ZC support... yes
checking PF_RING FT support... yes
checking PF_RING NPCAP support... yes
checking if r/w locks are supported... yes
checking Mellanox support (x64 and aarch64)... yes
checking PF_RING AF_XDP support... yes
configure: creating ./config.status
config.status: creating lib/Makefile
config.status: creating lib/pfring_config
config.status: creating examples/Makefile
config.status: creating examples_zc/Makefile
config.status: creating examples_ft/Makefile
config.status: creating c++/Makefile
config.status: creating nbpf/Makefile
config.status: creating wireshark/extcap/Makefile
config.status: creating lib/config.h
config.status: lib/config.h is unchanged
[root@local userland]# make
cd lib; make
make[1]: Entering directory '/opt/WORK/PF_RING/userland/lib'
ar x ../nbpf/libnbpf.a
cp ../nbpf/nbpf.h .
ar x libs/libpfring_zc_x86_64_core-avx2.a
cp /usr/src/kernels/5.14.0-362.13.1.el9_3.x86_64/include/uapi/linux/if_xdp.h ../../kernel/linux/
ar x libs/libpfring_nt_x86_64_core-avx2.a
ar x libs/libpfring_mlx_x86_64_core-avx2.a
ar x libs/libpfring_fiberblaze_x86_64_core-avx2.a
ar x libs/libnpcap_x86_64_core-avx2.a
ar x libs/libpfring_ft_x86_64_core-avx2_dl.a
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring.c -o pfring.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_mod.c -o pfring_mod.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_utils.c -o pfring_utils.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_mod_stack.c -o pfring_mod_stack.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_hw_filtering.c -o pfring_hw_filtering.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_runtime_manager.c -o pfring_runtime_manager.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_hw_timestamp.c -o pfring_hw_timestamp.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_mod_sysdig.c -o pfring_mod_sysdig.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_mod_pcap.c -o pfring_mod_pcap.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_device.c -o pfring_device.o
gcc -O2 -march=native -mtune=native  -Wall -Wno-stringop-truncation -Wno-address-of-packed-member -fPIC -I../../kernel -I../libpcap-1.10.1 -D HAVE_PF_RING_ZC -D HAVE_AF_XDP -D HAVE_FIBERBLAZE -D ENABLE_BPF -D ENABLE_HW_TIMESTAMP -D HAVE_NT -D HAVE_MLX -D HAVE_NPCAP  -D HAVE_PF_RING_FT  -c pfring_mod_af_xdp.c -o pfring_mod_af_xdp.o
pfring_mod_af_xdp.c: In function ‘pfring_mod_af_xdp_remove_xdp_program’:
pfring_mod_af_xdp.c:568:7: warning: implicit declaration of function ‘bpf_get_link_xdp_id’ [-Wimplicit-function-declaration]
  568 |   if (bpf_get_link_xdp_id(handle->if_index, &curr_prog_id, XDP_FLAGS_UPDATE_IF_NOEXIST)) {
      |       ^~~~~~~~~~~~~~~~~~~
pfring_mod_af_xdp.c:573:3: warning: implicit declaration of function ‘bpf_set_link_xdp_fd’; did you mean ‘bpf_link__fd’? [-Wimplicit-function-declaration]
  573 |   bpf_set_link_xdp_fd(handle->if_index, -1, XDP_FLAGS_UPDATE_IF_NOEXIST);
      |   ^~~~~~~~~~~~~~~~~~~
      |   bpf_link__fd
=*= making library libpfring.a =*=
ar rs libpfring.a pfring.o pfring_mod.o pfring_utils.o pfring_mod_stack.o pfring_hw_filtering.o pfring_runtime_manager.o pfring_hw_timestamp.o pfring_mod_sysdig.o pfring_mod_pcap.o pfring_device.o pfring_zc_dev_e1000.o pfring_zc_dev_e1000e.o pfring_zc_dev_ixgbe.o pfring_zc_dev_ixgbevf.o pfring_zc_dev_igb.o pfring_zc_dev_i40e.o pfring_zc_dev_iavf.o pfring_zc_dev_ice.o pfring_zc_dev_rss.o pfring_zc_dev_sal.o pfring_mod_zc.o pfring_mod_zc_dev.o pfring_mod_zc_spsc.o pfring_zc_cluster.o pfring_zc_mm.o uio_lib.o hugetlb_lib.o numa_lib.o pfring_zc_kvm.o pfring_zc_kvm_utils.o silicom_ts_card.o  pfring_mod_af_xdp.o pfring_mod_fiberblaze.o  pfring_mod_nt.o  pfring_mod_mlx.o  pfring_mod_timeline.o npcap_extract.o index_match.o npcap_utils.o npcap_compression.o npcap_index.o npcap_timeline.o npcap_storage.o npcap_notify.o npcap_hash_filter.o lzf_c.o lzf_d.o  pfring_ft_flow.o pfring_ft_hash.o pfring_ft_list.o pfring_ft_dpi.o pfring_ft_utils.o pfring_ft_table.o pfring_ft_fragment_hash.o pfring_ft_export.o pfring_ft_zmq.o  `ar t ../nbpf/libnbpf.a | grep -F .o | tr '\n' ' '`
ranlib libpfring.a
=*= making library libpfring.so =*=
gcc -Wl,-soname,libpfring.so.8 -g -shared pfring.o pfring_mod.o pfring_utils.o pfring_mod_stack.o pfring_hw_filtering.o pfring_runtime_manager.o pfring_hw_timestamp.o pfring_mod_sysdig.o pfring_mod_pcap.o pfring_device.o pfring_zc_dev_e1000.o pfring_zc_dev_e1000e.o pfring_zc_dev_ixgbe.o pfring_zc_dev_ixgbevf.o pfring_zc_dev_igb.o pfring_zc_dev_i40e.o pfring_zc_dev_iavf.o pfring_zc_dev_ice.o pfring_zc_dev_rss.o pfring_zc_dev_sal.o pfring_mod_zc.o pfring_mod_zc_dev.o pfring_mod_zc_spsc.o pfring_zc_cluster.o pfring_zc_mm.o uio_lib.o hugetlb_lib.o numa_lib.o pfring_zc_kvm.o pfring_zc_kvm_utils.o silicom_ts_card.o  pfring_mod_af_xdp.o pfring_mod_fiberblaze.o  pfring_mod_nt.o  pfring_mod_mlx.o  pfring_mod_timeline.o npcap_extract.o index_match.o npcap_utils.o npcap_compression.o npcap_index.o npcap_timeline.o npcap_storage.o npcap_notify.o npcap_hash_filter.o lzf_c.o lzf_d.o  pfring_ft_flow.o pfring_ft_hash.o pfring_ft_list.o pfring_ft_dpi.o pfring_ft_utils.o pfring_ft_table.o pfring_ft_fragment_hash.o pfring_ft_export.o pfring_ft_zmq.o  `ar t ../nbpf/libnbpf.a | grep -F .o | tr '\n' ' '` -lpthread  -lrt -ldl -lbpf -lelf -lm -ldl -o libpfring.so.8.7.0
=*= making library libpfring_min.so =*=
gcc -Wl,-soname,libpfring_min.so.8 -g -shared pfring.o pfring_mod.o pfring_utils.o pfring_mod_stack.o pfring_hw_filtering.o pfring_runtime_manager.o pfring_hw_timestamp.o pfring_mod_sysdig.o pfring_mod_pcap.o pfring_device.o pfring_zc_dev_e1000.o pfring_zc_dev_e1000e.o pfring_zc_dev_ixgbe.o pfring_zc_dev_ixgbevf.o pfring_zc_dev_igb.o pfring_zc_dev_i40e.o pfring_zc_dev_iavf.o pfring_zc_dev_ice.o pfring_zc_dev_rss.o pfring_zc_dev_sal.o pfring_mod_zc.o pfring_mod_zc_dev.o pfring_mod_zc_spsc.o pfring_zc_cluster.o pfring_zc_mm.o uio_lib.o hugetlb_lib.o numa_lib.o pfring_zc_kvm.o pfring_zc_kvm_utils.o silicom_ts_card.o  pfring_mod_af_xdp.o pfring_mod_fiberblaze.o  pfring_mod_nt.o  pfring_mod_mlx.o  pfring_mod_timeline.o npcap_extract.o index_match.o npcap_utils.o npcap_compression.o npcap_index.o npcap_timeline.o npcap_storage.o npcap_notify.o npcap_hash_filter.o lzf_c.o lzf_d.o  `ar t ../nbpf/libnbpf.a | grep -F .o | tr '\n' ' '` -lpthread  -lrt -ldl -lbpf -lelf -lm -ldl -o libpfring_min.so.8.7.0
make[1]: Leaving directory '/opt/WORK/PF_RING/userland/lib'
cd libpcap; make
make[1]: Entering directory '/opt/WORK/PF_RING/userland/libpcap-1.10.1'
VER=`cat ./VERSION`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' ./VERSION`; \
gcc  -shared -Wl,-soname,libpcap.so.$MAJOR_VER \
    -o libpcap.so.$VER pcap-linux.o fad-getad.o  pcap-usb-linux.o pcap-netfilter-linux.o  pcap.o gencode.o optimize.o nametoaddr.o etherent.o fmtutils.o savefile.o sf-pcap.o sf-pcapng.o pcap-common.o bpf_image.o bpf_filter.o bpf_dump.o scanner.o grammar.o strlcat.o strlcpy.o  ../lib/libpfring.a -lpthread  -lrt -ldl     -lrt -ldl
make[1]: Leaving directory '/opt/WORK/PF_RING/userland/libpcap-1.10.1'
cd examples; make
make[1]: Entering directory '/opt/WORK/PF_RING/userland/examples'
gcc  -O2 -march=native -mtune=native  -DHAVE_PF_RING -Wall -Wno-unused-function -Wno-format-truncation -Wno-address-of-packed-member -I../../kernel -I../lib -I../libpcap -Ithird-party `../lib/pfring_config --include` -D ENABLE_BPF  -D HAVE_PF_RING_ZC -D HAVE_PF_RING_FT pfcount.o ../libpcap/libpcap.a   ../lib/libpfring.a ../libpcap/libpcap.a   ../lib/libpfring.a `../lib/pfring_config --libs` `../libpcap/pcap-config --additional-libs --static` -lpthread  -lrt -ldl  -lrt -o pfcount
/usr/bin/ld: ../lib/libpfring.a(pfring_mod_af_xdp.o): in function `pfring_mod_af_xdp_stats':
pfring_mod_af_xdp.c:(.text+0xd3): undefined reference to `xsk_socket__fd'
/usr/bin/ld: ../lib/libpfring.a(pfring_mod_af_xdp.o): in function `pfring_mod_af_xdp_close':
pfring_mod_af_xdp.c:(.text+0x2d0): undefined reference to `xsk_socket__delete'
/usr/bin/ld: pfring_mod_af_xdp.c:(.text+0x2d9): undefined reference to `xsk_umem__delete'
/usr/bin/ld: pfring_mod_af_xdp.c:(.text+0x2f5): undefined reference to `bpf_get_link_xdp_id'
/usr/bin/ld: pfring_mod_af_xdp.c:(.text+0x30d): undefined reference to `bpf_set_link_xdp_fd'
/usr/bin/ld: ../lib/libpfring.a(pfring_mod_af_xdp.o): in function `pfring_mod_af_flush_tx_q':
pfring_mod_af_xdp.c:(.text+0x4e5): undefined reference to `xsk_socket__fd'
/usr/bin/ld: ../lib/libpfring.a(pfring_mod_af_xdp.o): in function `pfring_mod_af_xdp_open':
pfring_mod_af_xdp.c:(.text+0x124b): undefined reference to `xsk_umem__create'
/usr/bin/ld: pfring_mod_af_xdp.c:(.text+0x12b3): undefined reference to `xsk_socket__create'
/usr/bin/ld: pfring_mod_af_xdp.c:(.text+0x14d1): undefined reference to `xsk_socket__fd'
/usr/bin/ld: pfring_mod_af_xdp.c:(.text+0x154f): undefined reference to `xsk_socket__delete'
/usr/bin/ld: ../lib/libpfring.a(pfring_mod_af_xdp.o): in function `pfring_mod_af_xdp_get_selectable_fd':
pfring_mod_af_xdp.c:(.text+0x59): undefined reference to `xsk_socket__fd'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:83: pfcount] Error 1
make[1]: Leaving directory '/opt/WORK/PF_RING/userland/examples'
make: *** [Makefile:24: build_examples] Error 2

Is the compilation even possible or are we doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant