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
- Obtain the DPDK source code.
- Download the source code.
- Copy the source code to the /home/source_code directory on the server.
- Obtain the OVS source code.
- Download the source code.
- Method 1 (recommended):
Download the source code of the ovs_xpf_v1.2.10 branch for which the open source xpf.patch has been installed.
https://github.com/kunpengcompute/ovs/archive/ovs_xpf_v2.12.0.zip
- Method 2:
Download the source code of v2.12.0 released in the open source community.
https://www.openvswitch.org/releases/openvswitch-2.12.0.tar.gz
- Method 1 (recommended):
- Copy the source code to the /home/source_code directory on the server.
- Download the source code.
- Obtain the patch code.
- Obtain the OVS flow table normalization installation package.
- Download the binary RPM package, development package (compilation header file), and digital signature file.
- Method 1: Download them from software.
- Method 2: Download them from the Kunpeng community:
https://www.hikunpeng.com/en/developer/boostkit/virtualization
- Obtain the software verification tool.
- Verify the installation package integrity based on the OpenPGP Signature Verification Guide obtained in 5.b.
- 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.gzThe directory structure is as follows:

- Download the binary RPM package, development package (compilation header file), and digital signature file.
Installing the XPF Binary Library
- Go to the /home/source_code directory.
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 - Install the patch for the corresponding source code.
1patch -d openvswitch-2.12.0 -p1 < ../patch_code/ovs_patch/xpf.patch
Skip this step if the downloaded code is the source code of the ovx_xpf_v2.12.0 branch.
- Forcibly install the OVS flow table normalization installation 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
Replace /home/rpm_packet/ with the actual path.
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.
- Run the following command if the source code of the ovs_xpf_v1.2.10 branch is downloaded from the Kunpeng community:
1cd /home/source_code/ovs-ovs_xpf_v2.12.0 - Run the following command if the code is downloaded from the official OVS website:
1cd /home/source_code/openvswitch-2.12.0
- Run the following command if the source code of the ovs_xpf_v1.2.10 branch is downloaded from the Kunpeng community:
- 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
- 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.
1 2 3
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.
- The OVS flow table normalization installation 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 step is to compile the open source OVS and copy necessary header files. The second step is to compile the secondary developed OVS.
- The boot.sh script is used to generate the modified configure file by using Libtool, add the corresponding macro definition, and enable XPF code.