Napatech DPDK Installation and Configuration

Running Open-Source Libraries and Applications with Napatech SmartNICs

Platform
Napatech SmartNIC
Content Type
Application Note
Capture Software Version
Link™ Capture Software 12.11

Download, install the Napatech DPDK package and configure huge pages.

Before you begin

The Napatech driver and Napatech SmartNICs must be installed and started before Napatech DPDK PMD can be used. See Before you begin.

About this task

This procedure describes commands to download, install Napatech DPDK and configure huge pages.

Procedure

  1. Set the environment variable NAPATECH3_PATH to indicate where the Napatech driver is installed before compiling Napatech DPDK.
    export NAPATECH3_PATH=/opt/napatech3
    Note: /opt/napatech3 is the default installation directory. If the driver is installed elsewhere, the correct installation directory must be used.
  2. Download the package or clone. In this example, the v21.05.0 release is used. You can find the latest release information at https://github.com/napatech/dpdk/releases.
    wget https://github.com/napatech/dpdk/archive/dpdk-21.05.0_2.10.tar.gz
    tar xvf v21.05.0_2.10.tar.gz
    cd dpdk-21.05.0_2.10/
    Or
    git clone https://github.com/napatech/dpdk.git
  3. Build libraries, drivers and test applications.
    meson build
    cd build
    ninja
  4. Enable and reserve memory for huge pages to run DPDK applications.
    The following is an example to enable memory for huge pages while the kernel is running. The setting will not remain after a system reboot.
    echo 32 > /proc/sys/vm/nr_hugepages
    mkdir /mnt/huge
    mount -t hugetlbfs nodev /mnt/huge
    Memory can be reserved in a specific NUMA node. The following command example is to allocate 1 GB huge page memory on NUMA node 0.
    echo 32 > \
    /sys/devices/system/node/node0/hugepages/hugepages-1048576kB/nr_hugepages
    Run the following command to check memory for huge pages.
    cat /proc/meminfo | grep Huge
    An output example:
    AnonHugePages:    251904 kB
    HugePages_Total:      32
    HugePages_Free:       32
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:    1048576 kB
    
  5. Add the kernel parameters to the file /etc/default/grub as shown in the following example to enable memory for huge pages at boot time.
    GRUB_CMDLINE_LINUX_DEFAULT="default_hugepagesz=1G hugepagesz=1G hugepages=32"
    Run the following command after editing the file.
    sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    Use the following command if you are using UEFI based boot,
    sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
    Edit the file /etc/fstab and add the following entry to avoid remounting after a system restart.
    nodev /mnt/huge hugetlbfs defaults 0 0
    And reboot.
    reboot