Building Streams applications with DPDK operators
Setting environment variables
DPDK utilizes pkg-config for applications to easily build and link to DPDK libraries. If DPDK is installed system-wide, then no action needs to be performed. Otherwise, pkg-config needs to be informed about the custom DPDK installation.
pkgconf --cflags libdpdk
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:<path-to-dpdk-install-dir>/lib64/pkgconfig
Try the pkgconf command again to verify the DPDK install can be found.
- Configure ld.so.conf[.d] and run ldconfig, or
- Set the LD_LIBRARY_PATH environment variable
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path-to-dpdk-install-dir>/lib64
Gathering system information for Streams operators
To configure DPDK operators, you will need to know how many processors the machine has, and how they are distributed amoung the machine's NUMA nodes. Use this command to display that information:
lscpu
You will also need the PCI bus address of the adapter, the Linux interface names of the adapter's ports, and the NUMA node number the adapter is connected to.
For example, the following DPDK-provided user tool can be used to find the PCI bus address and Linux interface name ethernet adapters on a system:
dpdk-devbind.py --status
To determine the NUMA node number the adapter is connected to, check the interface or PCI device enter either of these commands at a prompt:
cat /sys/class/net/$LINUX_INTERFACE/device/numa_node
cat /sys/devices/pciXXXX:YY/XXXX:YY:ZZ/numa_node
Building the Streams DPDK 'glue' library
The network toolkit contains C source code for a 'glue' library for DPDK operators to integrate with DPDK.
IMPORTANT: The default glue code contains configuration and settings specific to tested ethernet adapters. Users may need to modify the code for their needs. For example, hardware offloads may not be supported for certain adapters. See the streams_source/init.c file for potential changes.
- Navigate to $STREAMS_INSTALL/toolkits/com.teracloud.streams.network/impl/src/source/dpdk
- Compile the code using make
- Copy the network toolkit to a new location. For example, run the following command:
cp -r $STREAMS_INSTALL/toolkits/com.teracloud.streams.network custom-network-toolkit - Navigate to impl/src/source/dpdk in the copied toolkit
- Compile the code using make
- Specify your copied toolkit path in the -t parameter of sc when compiling or set the location in STREAMS_SPLPATH environment variable.
Once the glue library is built, Streams applications that reference the network toolkit will need to be built to include the glue library in their SABs.
Next steps
In order to run Streams applications that utilize DPDK operators, the standalone executable need to be given Linux capabilities or the Streams domain and instance need to be configured to pass the necessary capabilities to the PE when it launches. For instructions on how to do this, see Running applications with operators requiring Linux capabilities.