Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling and Installing XPF

Obtaining the Source Code

  1. Create directories.
    1
    2
    3
    mkdir -p /home/source_code
    mkdir -p /home/patch_code/ovs_patch
    mkdir -p /home/rpm_packet
    
  2. Obtain the DPDK source code.
    1. Download the source code.
    2. Copy the source code to the /home/source_code directory on the server.
  3. Obtain the OVS source code.
    1. Download the source code.
    2. Copy the source code to the /home/source_code directory on the server.
  4. Obtain the patch code.
    1. Download the patch code.

      https://github.com/kunpengcompute/ovs/releases/download/v2.12.0/xpf.patch

    2. Copy the patch code to the /home/patch_code/ovs_patch directory on the server.
  5. Obtain the OVS flow table normalization installation package.
    1. Download the binary RPM package, development package (compilation header file), and digital signature file.
    2. Obtain the software verification tool.
    3. Verify the installation package integrity based on the OpenPGP Signature Verification Guide obtained in 5.b.
    4. Copy the compressed RPM package to the /home/rpm_packet directory on the server.
    5. Decompress the package.
      1
      tar -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:

Installing the XPF Binary Library

  1. Go to the /home/source_code directory.
    1
    cd /home/source_code
    
  2. Decompress the DPDK source package.
    1
    tar -xf dpdk-19.11.tar.xz && rm -f dpdk-19.11.tar.xz
    
  3. Decompress the OVS source package.
    1
    tar -xzf openvswitch-2.12.0.tar.gz && rm -f openvswitch-2.12.0.tar.gz
    
  4. Install the patch for the corresponding source code.
    1
    patch -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.

  5. Forcibly install the OVS flow table normalization installation package.
    1
    rpm -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

  1. Go to the /home/source_code/dpdk-19.11 directory.
    1
    cd /home/source_code/dpdk-19.11
    
  2. 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

  1. 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:
      1
      cd /home/source_code/ovs-ovs_xpf_v2.12.0
      
    • Run the following command if the code is downloaded from the official OVS website:
      1
      cd /home/source_code/openvswitch-2.12.0
      
  2. 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
    
  3. 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/
    
  4. 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
    
  5. (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.

    1. 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
      

    2. 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.
        1
        service openvswitch start
        

      • Stop the OVS service.
        1
        service openvswitch stop
        

      • Restart the OVS service.
        1
        service openvswitch restart
        

  • 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.