Compiling and Installing XPF
Obtaining the Source Code
- Create directories.
1 2 3
mkdir -p /home/source_code mkdir -p /home/patch_code/ovs_patch mkdir -p /home/rpm_packet
The preceding directories are only an example. You can customize directory names as required. Ensure that the directory names in the commands in subsequent operations are consistent with the custom names.
- Obtain the DPDK source code.
- Obtain the OVS source code.
- Obtain the patch code.
- Obtain the OVS flow table normalization software package.
- Download the software package.
- Copy the compressed RPM package to the /home/rpm_packet directory on the server.
- Decompress the package.
1tar -xzf /home/rpm_packet/OVSOE_ALL.tar.gz -C /home/rpm_packet && rm -rf /home/rpm_packet/OVSOE_ALL.tar.gz
The directory structure is as follows:

- Obtain the OVS flow table normalization software patch and digital signature file.
- Download the binary patch package.
- Copy the package to the /home/rpm_packet directory on the server.
Installing the XPF Binary Library
- Go to the directory where the source code is stored.
1cd /home/source_code
- Decompress the DPDK source package.
1tar -xf dpdk-19.11.tar.xz && rm -f dpdk-19.11.tar.xz
- Decompress the OVS source package.
1tar -xzf openvswitch-2.12.0.tar.gz && rm -f openvswitch-2.12.0.tar.gz
- (Optional) Install the patch for the corresponding source code.Skip this step if the downloaded code is the source code of the ovx_xpf_v2.12.0 branch.
1patch -d openvswitch-2.12.0 -p1 < ../patch_code/ovs_patch/xpf.patch
- Forcibly install the OVS flow table normalization software package.
1rpm -ivh --nodeps /home/rpm_packet/xpf-1.0.0-1.aarch64.rpm /home/rpm_packet/xpf-devel-1.0.0-1.aarch64.rpm
- Decompress and install the patch for the OVS flow table normalization software package.
cd /home/rpm_packet unzip xpf-1.0.0-1.aarch64-patch.zip mv xpf-1.0.0-1.aarch64-patch/*.so /usr/lib64
Compiling and Installing DPDK
- Go to the /home/source_code/dpdk-19.11 directory.
1cd /home/source_code/dpdk-19.11
- Compile and install DPDK.
1 2 3 4 5
make O=arm64-armv8a-linuxapp-gcc T=arm64-armv8a-linuxapp-gcc config sed -ri 's,(RTE_APP_TEST=).*,\1n,' arm64-armv8a-linuxapp-gcc/.config sed -ri 's,(RTE_BUILD_SHARED_LIB=).*,\1y,' arm64-armv8a-linuxapp-gcc/.config make O=arm64-armv8a-linuxapp-gcc -j 96 make install O=arm64-armv8a-linuxapp-gcc prefix=/usr libdir=/lib64
If the /usr/lib64 directory contains the librtexxx_xxx.so dynamic library file, the DPDK compilation and installation are complete.
Compiling and Installing OVS
- Go to the root directory of source code.
1cd /home/source_code/openvswitch-2.12.0
- Compile and install OVS.
1 2 3
./boot.sh ./configure CFLAGS="-g -O2 -march=armv8-a+crc" --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/lib64 --enable-ssl --enable-shared --with-dpdk=yes --enable-Werror make -j 96 && make install
The boot.sh script is used to generate the modified configure file by using Libtool, add the corresponding macro definition, and enable XPF code.
- Copy the header file.
1 2 3
cp config.h /usr/include/openvswitch mkdir /usr/include/openvswitch/lib cp lib/*.h /usr/include/openvswitch/lib/
- Recompile and reinstall OVS.The OVS flow table normalization software package depends on the open source OVS, and the secondary developed OVS depends on the XPF library. Therefore, you need to compile OVS twice. The first round is to compile the open source OVS and copy necessary header files. The second round is to compile the secondary developed OVS.
make clean ./configure CFLAGS="-g -O2 -march=armv8-a+crc -ftree-vectorize -I/usr/include/xpf-1.0.0/xpf_include" --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/lib64 --enable-ssl --enable-shared --with-dpdk=yes --enable-Werror --enable-xpf make -j 96 && make install
- (Optional) Configure OVS to start in service mode.You need to run multiple commands to manually start, stop, and restart the OVS service. Running OVS in service mode can greatly simplify related operations.
- Switch to the rhel directory in the OVS source code directory, copy the etc_init.d_openvswitch file to the /etc/init.d directory, rename the file as openvswitch, and change the file execution permission to 755.
1 2 3
cd rhel/ cp etc_init_.d_openvswitch /etc/init.d/openvswitch chmod 755 /etc/init.d/openvswitch

- Run OVS in service mode.
After the OVS startup configuration is complete (see Running and Verifying XPF), you can start, stop, and restart OVS in service mode.
- Start the OVS service.
1service openvswitch start

- Stop the OVS service.
1service openvswitch stop

- Restart the OVS service.
1service openvswitch restart

- Start the OVS service.
- Switch to the rhel directory in the OVS source code directory, copy the etc_init.d_openvswitch file to the /etc/init.d directory, rename the file as openvswitch, and change the file execution permission to 755.
Parent topic: OVS Flow Table Normalization