[SOLVED] Building DPDK using ports

Started by mutahir, April 08, 2020, 05:46:31 PM

Previous topic - Next topic
April 08, 2020, 05:46:31 PM Last Edit: April 28, 2020, 09:41:38 AM by franco
Hi All

Our company is testing the performance of OPNSense on our custom board based on an Intel Denverton chip. Since we are using the Denverton chip therefore we wanted to explore how DPDK can be used on OPNSense.

Right now we are having trouble building the DPDK sources using the steps given below.

We followed the build instructions using the following link and were able to build an image.
https://github.com/opnsense/tools.

After building the image we tried to add DPDK into the image as well. We did this by adding the following line to the file /usr/tools/onfig/20.1/ports.conf

net/dpdk

and building the ports and specifically the DPDK port using the command
@freebsd:/usr/tools # make ports-dpdk

However the build fails with the following error.

FAILED: kernel/freebsd/contigmem.ko
make -f ../kernel/freebsd/BSDmakefile.meson KMOD_OBJDIR=kernel/freebsd KMOD_SRC=../kernel/freebsd/contigmem/contigmem.c KMOD=contigmem 'KMOD_CFLAGS=-I/usr/obj/usr/ports/net/dpdk/work/dpdk-19.11/_build -I/usr/obj/usr/ports/net/dpdk/work/dpdk-19.11/config -include rte_config.h' CC=clang
ld: bad -rpath option
*** Error code 1

Has any one ever had any experience integrating the DPDK libraries into an OPNSense build. Did anyone come across this error when integrating DPDK into OPNSense image

Side note, I was able to build the DPDK port freebsd OS on which I was trying to build the  OPNSense image

Thanks

Hi there,

Trying this locally now on a box..

# opnsense-code tools src ports
# cd /usr/src && git checkout stable/20.1 && git pull
# cd /usr/ports/net/dpdk && make package


Cheers,
Franco

Ok, I have the same error, but slightly more relevant:

clang -O2 -pipe -DHARDENEDBSD -fno-strict-aliasing -DHARDENEDBSD -include rte_config.h  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I/usr/obj/usr/ports/net/dpdk/work/dpdk-19.11/_build -I/usr/obj/usr/ports/net/dpdk/work/dpdk-19.11/config -I. -I/usr/src/sys -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -MD  -MF.depend.contigmem.o -MTcontigmem.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-error-address-of-packed-member  -mno-aes -mno-avx  -std=iso9899:1999 -c /usr/obj/usr/ports/net/dpdk/work/dpdk-19.11/kernel/freebsd/contigmem/contigmem.c -o contigmem.o
ld -rpath,/usr/local/lib -d -warn-common -r -d -o contigmem.ko contigmem.o
ld: bad -rpath option
*** Error code 1

I think HBSD uses a different LD so you're seeing this error... hold on.


Cheers,
Franco

./librte_rawdev_skeleton.so -> dpdk/pmds-20.0/librte_rawdev_skeleton.so
./librte_rawdev_skeleton.so.20.0 -> dpdk/pmds-20.0/librte_rawdev_skeleton.so.20.0
====> Compressing man pages (compress-man)
===>  Building package for dpdk-19.11_2
root@sensey:/usr/ports/net/dpdk # git diff
diff --git a/Mk/Uses/ssl.mk b/Mk/Uses/ssl.mk
index bb416032191..8e3dfd7dcf1 100644
--- a/Mk/Uses/ssl.mk
+++ b/Mk/Uses/ssl.mk
@@ -129,6 +129,6 @@ MAKE_ENV+=          OPENSSLRPATH=${OPENSSLRPATH}
OPENSSL_LDFLAGS+=      -Wl,-rpath,${OPENSSLRPATH}
.endif

-LDFLAGS+=              ${OPENSSL_LDFLAGS}
+#LDFLAGS+=             ${OPENSSL_LDFLAGS}

.endif


Cheers,
Franco

Thanks Franco.

Your suggestion worked and it builds dpdk now.


Ok, good. But keep in mind this is just a workaround for the time being.


Cheers,
Franco

Thanks again for the guidance

I am running into one more issues. When I build the virtual image using the command

make vm-vmdk ADDITIONS="dpdk"

I can see the DPDK included in the build logs

Installing dpdk-19.11_2...
`-- Installing openssl-1.1.1d,1...
`-- Extracting openssl-1.1.1d,1: .......... done


When I run the image in VirtualBox, I am able to see the library installed and I was able to run DPDK tests on the image. Now when I tried to build the serial image using the command

make serial ADDITIONS="dpdk"

The DPDK library is not installed or built and when the image is run, the DPDK library is not included in the image.

Is there a special mechanism to add ports to a serial image compared to a VM image.

Thanks and Regards

You probably have a serial image around already so it's not rebuilt. "vm" uses "-vmdk" parameter which also forced a rebuild. If you use "serial-again" it should work.


Cheers,
Franco

Thanks again for the help. I tried what you suggested and now the DPDK library is built into the image