Cross-Compile Data Plane Development Kit (DPDK) for Different Intel Platforms

ID 659244
Updated 9/24/2018
Version Latest




In some Data Plane Development Kit (DPDK) production environments, the target deployment platform is often different from the compile server. DPDK uses platform-specific instructions to optimize performance, which can lead to a problem where DPDK applications cannot operate on the deployment platform. In this article, you will learn how to compile DPDK for different Intel platforms using a single server.

The code and DPDK application in this article are all from DPDK-17.11, and the compiler is the GNU Compiler Collection (gcc).

The problem

Below, l2fwd is compiled by using T=x86_64-native-linuxapp-gcc on an Intel® Xeon® processor E5 2658 v4. When it is executed on an Intel Atom® processor C3858, an illegal instruction is encountered:

[root@wd-06-dnv ~]# ./l2fwd -c 0xc0 -n 2 -m 1024 -- -p 0x1
Illegal instruction (core dumped)

The solution

When compiling DPDK, specify the target platform by using the -march parameter of gcc. DPDK defines common compiler parameters for most platforms. These files are in the catalog mk/machine:

[dong@WD-03-BDW machine]$ ls
armv7a  default  dpaa2  ivb     nhm     silvermont  thunderx  wsm
armv8a  dpaa     hsw    native  power8  snb         tilegx    xgene1

These configurations are chosen through config/defconfig_xxxx; for example, config/defconfig_x86_64-native-linuxapp-gcc:

#include "common_linuxapp"



Thus, as for the Intel® platform, we create different configuration files in the catalog config so as to use different T (target template for DPDK “make” command) to flexibly compile DPDK applications for the target platform.

A Simple Case: Configure and Cross-Compile

To demonstrate the process, we'll use Intel® Xeon® processor E5645 as a target platform to show how to create new configuration files and then cross compile.

Create configuration

Before creating configuration files, you'll need to add the code name of your target Intel platform into the catalog machine.

If you don't know the code name of a target platform, you can find it at the Intel ARK website.

When you search the Intel ARK website for Intel Xeon processor E5645, you'll find the following information:

product details
Figure 1. Product specification for Intel Xeon processor E5645

The platform code name for Intel Xeon processor E5645 is Westmere. Using Table 1 (below) to find the DPDK abbreviation for code name Westmere, we see it is wsm.

Table 1: Processor Code Name Abbreviations


Code Name

wsm Westmere
nhm Nehalem
snb Sandy Bridge
ivb Ivy Bridge
hsw Haswell

In the config catalog, copy defconfig_x86_64-native-linuxapp-gcc, and rename as defconfig_x86_64-wsm-linuxapp-gcc.

[dong@WD-03-BDW config]$ cp defconfig_x86_64-native-linuxapp-gcc defconfig_x86_64-wsm-linuxapp-gcc
[dong@WD-03-BDW config]$ ls
common_armv8a_linuxapp                 defconfig_i686-native-linuxapp-gcc
common_base                            defconfig_i686-native-linuxapp-icc
common_bsdapp                          defconfig_ppc_64-power8-linuxapp-gcc
common_linuxapp                        defconfig_x86_64-native-bsdapp-clang
defconfig_arm64-armv8a-linuxapp-clang  defconfig_x86_64-native-bsdapp-gcc
defconfig_arm64-armv8a-linuxapp-gcc    defconfig_x86_64-native-linuxapp-clang
defconfig_arm64-dpaa2-linuxapp-gcc     defconfig_x86_64-native-linuxapp-gcc
defconfig_arm64-dpaa-linuxapp-gcc      defconfig_x86_64-native-linuxapp-icc
defconfig_arm64-thunderx-linuxapp-gcc  defconfig_x86_64-wsm-linuxapp-gcc
defconfig_arm64-xgene1-linuxapp-gcc    defconfig_x86_x32-native-linuxapp-gcc

Modify defconfig_x86_64-wsm-linuxapp-gcc, and change the platform to wsm.

#include "common_linuxapp"



Compile DPDK

Use T=x86_64-wsm-linuxapp-gcc to compile DPDK. When compiling DPDK applications, the RTE_TARGET that is used should be set to x86_64-wsm-linuxapp-gcc.

[dong@WD-03-BDW dpdk-17.11]$ make config T=x86_64-wsm-linuxapp-gcc
Configuration done using x86_64-wsm-linuxapp-gcc
[dong@WD-03-BDW dpdk-17.11]$ make -j50 install T=x86_64-wsm-linuxapp-gcc
Output…… omitted
[dong@WD-03-BDW dpdk-17.11]$ ls
app         doc          LICENSE.GPL   pkg         x86_64-native-linuxapp-gcc
build       drivers      LICENSE.LGPL  README      x86_64-wsm-linuxapp-gcc
buildtools  examples     MAINTAINERS
config      GNUmakefile  Makefile      test
devtools    lib          mk            usertools
[dong@WD-03-BDW dpdk-17.11]$ export RTE_TARGET=x86_64-wsm-linuxapp-gcc
[dong@WD-03-BDW dpdk-17.11]$ export RTE_SDK=/home/dong/work/dpdk/tags/dpdk-17.11
Enter into example/l2fwd
[dong@WD-03-BDW l2fwd]$ make
  CC main.o
  LD l2fwd

This is a simple cross-compile procedure for different Intel platforms. Now that you've created the configuration, you can use x86_64-wsm-linuxapp-gcc directly.

A Complex Case: Missing Target Platform Configuration Files

The Intel Xeon E5645 example above is an ideal case. Sometimes you may find the configuration files of the target platform are not in the mk/machine catalog.

This is the case with the Intel Atom processor C3858, which is code-named Denverton and has a DPDK abbreviation of dnv.

At present, many companies use Industrial Personal Computer (IPC), and DPDK applications that are based on Intel platforms to build network devices. The CPUs in those IPCs are of high, middle, and low end performance, in all fields (for example, the CPU of tablet computers), and in all series of Intel processors. Indeed, Intel DPDK engineers can't provide all the configuration files. So you need to create the configuration files in the mk/machine catalog .

Create configuration

At this time DPDK doesn't offer the corresponding compiler options, so you have to make sure that the corresponding gcc -match is on this platform:

[root@wd-06-dnv ~]# gcc -c -Q -march=native --help=target | grep march
-march= slm

Add the new catalog in mk/machine. The code name for Intel Atom processor C3858 is Denverton, abbreviated as dnv:

[dong@WD-03-BDW machine]$ cp -r hsw dnv
[dong@WD-03-BDW machine]$ ls
armv7a  default  dpaa   hsw  native  power8      snb       tilegx  xgene1
armv8a  dnv      dpaa2  ivb  nhm     silvermont  thunderx  wsm

Modify mk/machine/dnv/,and set –march to be slm

MACHINE_CFLAGS = -march=slm

Compile DPDK

After completing the above steps, use x86_64-dnv-linuxapp-gcc to recompile DPDK and l2fwd. We renamed the new l2fwd as l2fwd-dnv. We then tested l2fwd-dnv on Intel Atom processor C3858, and it ran successfully:

[root@wd-06-dnv ~]# ./l2fwd-dnv -c 0xC0 -n 2 -m 512 -- -p 0x1
EAL: Detected 12 lcore(s)
EAL: Probing VFIO support...
EAL: PCI device 0000:03:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:158b net_i40e
EAL: PCI device 0000:03:00.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:158b net_i40e
EAL: PCI device 0000:08:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:15e4 net_ixgbe
EAL: PCI device 0000:08:00.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:15e4 net_ixgbe
EAL: PCI device 0000:08:10.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:15c5 net_ixgbe_vf
EAL: PCI device 0000:0a:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:15e4 net_ixgbe
EAL: PCI device 0000:0a:00.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:15e4 net_ixgbe
MAC updating enabled
Notice: odd number of ports in portmask.
Lcore 6: RX port 0
Initializing port 0... PMD: ixgbe_dev_link_status_print():  Port 0: Link Down
Port 0, MAC address: A4:BF:01:18:DA:5C

Checking link status...............................done


In this article, we showed how to configure a DPDK compile server to cross-compile DPDK for different Intel platforms using a single server. Now you can get started compiling DPDK for different Intel platforms.

About the Author

Wang Dong is an Intel Data Center Platform Application Engineer, whose technical scope includes DPDK, QAT, and FPGA.