Performing a Test with ntmain and forward applications

Link-Inline™ Software User Guide

Platform
Napatech SmartNIC
Content Type
User Guide
Capture Software Version
Link-Inline™ Software 3.2

Use this procedure to run the ntmain and forward applications in the bare-metal environment.

Before you begin

Make sure that you have:

About this task

This procedure describes ntmain and forward command examples to perform a simple test including:
  • How to enable virtual functions.
  • How to apply the Napatech patch and build the standard DPDK including the forward application.
  • How to run the monitoring tool.

This figure shows the test setup.

The SmartNIC delivers traffic with VLAN ID 44 to the virtual function 4, and traffic with VLAN ID 45 to the virtual function 5. After the forward application configures the SmartNIC to match flows of the received frames for offloading to the SmartNIC, frames that match the learned flows are transmitted on the specified port without being delivered to the host.

The ntmain application uses the Napatech DPDK PMD (ntnic), while the forward application uses the standard DPDK virtio PMD with the Napatech patch. In the ntmain application, the VLAN ID of each virtual function is passed to the Napatech DPDK PMD which creates a table of VLAN IDs with associated virtual functions. The SmartNIC delivers traffic based on the VLAN ID of each frame to each virtual function. As shown in the figure, received frames with VLAN ID 44 are delivered to the virtual function 4, and received frames with VLAN ID 45 are delivered to the virtual function 5. The forward application configures new flow rules for offloading to the SmartNIC. Frames that match the learned flows are transmitted on the specified port without being delivered to the host. See Configuring flows in a user-application container.

Procedure

  1. Activate virtual functions.
    For example:
    DEV=$(lspci -Dd 18f4: | cut -d' ' -f1 | head -1)
    echo 4 > /sys/bus/pci/devices/$DEV/sriov_numvfs
    Verify:
    lspci -k| grep -A1 Napatech
    An output example:
    42:00.0 Network controller: Napatech A/S NT200A02 Network Adapter
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:00.4 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:00.5 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:00.6 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    42:00.7 Network controller: Napatech A/S Device 051a
            Subsystem: Napatech A/S Device 0001
            Kernel driver in use: vfio-pci
    
  2. Clone and build the standard DPDK.
    cd /opt/ntinl/
    git clone https://dpdk.org/git/dpdk-stable dpdk
    cd dpdk
    git checkout v<version>
     
    # Copy the Napatech patch and apply to the standard DPDK.
    cp /opt/ntinl/patch/dpdk_v<version>_virtio.patch .
    patch -p1 < dpdk_v<version>_virtio.patch
     
    # Create a symlink to the forward applicaiton of the Napatech DPDK package.
    ln -s /opt/ntinl/examples_v<version>/examples/forward examples/forward
     
    # Add the forward application to the examples/meson.build file.
    sed -i "s/'vmdq_dcb',/'vmdq_dcb', \n\t'forward',/" examples/meson.build
     
    meson -Dexamples=all build
    ninja -C build
    ninja -C build install
    • version is the version identifier of the supported DPDK package.
    The Napatech patch must be applied to the standard DPDK to enable hardware offloading features of the DPDK rte_flow API functions.
  3. Start transmitting traffic from the traffic generator.
    Traffic must include frames with VLAN ID 44 and 45.
  4. Start the ntmain application.
    cd /opt/ntinl/examples_v<version>/examples/ntmain/build
    ./ntmain --vfio-vf-token=<UUID> \-a <PCI_ID>.0,exception_path=1 \
    -a <PCI_ID>.4,vlan=44,sep=1 \
    -a <PCI_ID>.5,vlan=45,sep=1 \
    -a <PCI_ID>.6,vlan=46,sep=1 \
    -a <PCI_ID>.7,vlan=47,sep=1 \
    --file-prefix=<prefix> --
    where:
    • version is the version identifier of the package.
    • --vfio-vf-token=<UUID>: Specifies a VFIO (Virtual Function I/O) VF (Virtual Function) token file. Set --vfio-vf-token to the UUID, which is generated using the uuidgen command. For example:
      uuidgen
      14d63f20-8445-11ea-8900-1f9ce7d5650d
    • -a <PCI ID>.x: Specifies the PCI IDs of the physical and virtual functions. Virtual function 4 to 7 are specified.
      • -a <PCI_ID>.0,exception_path=1: Configures the SmartNIC to forward non-matched frames to queue 0 of the physical function.
      • -a <PCI_ID>.4,vlan=44: vlan=44 applies VLAN ID 44 to virtual function 4. The application configures the SmartNIC to filter frames with VLAN ID 44 and deliver them to virtual function 4. Using the sep=1 option, each socket file is placed in its individual directory. The socket path of virtual function 4 is /usr/local/var/run/stdvio4/stdvio4.
    • --file-prefix=<prefix>: This option sets a file prefix for log files and other output files generated by the ntmain application.
    For example:
    cd /opt/ntinl/examples_v22.11.1/examples/ntmain/build
    ./ntmain --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d \
    -a 0000:42:00.0,exception_path=1 \
    -a 0000:42:00.4,vlan=44,sep=1 \
    -a 0000:42:00.5,vlan=45,sep=1 \
    -a 0000:42:00.6,vlan=46,sep=1 \
    -a 0000:42:00.7,vlan=47,sep=1 \
    --file-prefix=p1 --
    An output example:
    EAL: Detected CPU lcores: 32
    EAL: Detected NUMA nodes: 2
    EAL: Detected static linkage of DPDK
    EAL: Multi-process socket /var/run/dpdk/p1/mp_socket
    EAL: Selected IOVA mode 'VA'
    EAL: VFIO support initialized
    EAL: Using IOMMU type 1 (Type 1)
    EAL: Probe PCI driver: net_ntnic (18f4:1c5) device: 0000:42:00.0 (socket 1)
    ETHDEV: WRN: iova mode (2) should be PA for performance reasons
    ETHDEV: INF: NT VFIO device setup 0000:42:00.0
    NTHW: INF: PCI:0000:42:00.0: FPGA 0200-9563-55-16 (C8255B3710) [644B901E]
    EAL: Probe PCI driver: net_nt_vf (18f4:51a) device: 0000:42:00.4 (socket 1)
    VDPA: INF: Probe NT200A02 VF : 42:00:4
    VDPA: INF: ntvf_vdpa_pci_probe: [../drivers/net/ntnic/ntnic_vf_vdpa.c:1316] 0000:42:00.4
    …
    …
  5. Start the forward application on another terminal.
    For example:
    /opt/ntinl/dpdk/build/examples/dpdk-forward --no-pci \
    --vdev=virtio_user0,path=/usr/local/var/run/stdvio4/stdvio4,server=1,mac=52:54:00:12:34:59,packed_vq=1 \
    --vdev=virtio_user1,path=/usr/local/var/run/stdvio5/stdvio5,server=1,mac=52:54:00:12:34:58,packed_vq=1 \
    --file-prefix=c1 -- -i 0 -e 1
    where:
    • --no-pci: Configures DPDK not to use any physical PCIe devices as the forward application uses virtio interfaces.
    • --vdev=virtio_user0 and --vdev=virtio_user1: Represents the name of the virtio. Two virtual functions are attached to the forward application.
    • path=/usr/local/var/run/stdvio4/stdvio4: Specifies the path to the virtio user socket file. Each socket file is placed in its individual directory as the sep=1 option is used in the ntmain application. See Step 4.
    • server=1: Indicates that this interface runs as a server.
    • mac=52:54:00:12:34:59 specifies the MAC address for this Virtio User interface.
    • packed_vq=1: The packed virtqueue feature is used. Supports only packed virtqueue.
    • --file-prefix=c1: This option sets a file prefix for log files and other output files generated by the forward application.
    • -- -i 0 -e 1: These are command-line parameters passed directly to the forward application. They are specific to the application itself and not DPDK parameters.
      • -i 0: Specifies port 0 as the ingress port.
      • -e 1: Specifies port 1 as the egress port.
    An output example:
    Forward DPDK app - Forwarding packets between two ports.
    -------------------------------------------------------.
    EAL: Detected CPU lcores: 32
    EAL: Detected NUMA nodes: 2
    EAL: Detected static linkage of DPDK
    EAL: Multi-process socket /var/run/dpdk/c1/mp_socket
    EAL: Selected IOVA mode 'VA'
    EAL: VFIO support initialized
    vhost_user_start_server(): (/usr/local/var/run/stdvio4/stdvio4) waiting for client connection...
    vhost_user_start_server(): (/usr/local/var/run/stdvio5/stdvio5) waiting for client connection...
    TELEMETRY: No legacy callbacks, legacy socket not created
    Ingress port:     0
    Eegress port:     1
    Set filter:       yes
    Number of queues: 1
    HW offload:       1
    Debug print:      disabled
    
    Number of ports found:      2
    Virtio path (0): /usr/local/var/run/stdvio4/stdvio4
    Virtual port (0): 4
    Server version 0.1
    PCI ID: 0000:42:00.0
    Meter version 0.1
    Virtio path (1): /usr/local/var/run/stdvio5/stdvio5
    Virtual port (1): 5
    Core 1 RX port 0 -> TX port 1 using queue 0
    Core 2 RX port 1 -> TX port 0 using queue 0
    Core 3 acting as worker core for learn/unlearn
    Core 0 acting as worker core for statistics output
    
    Press U to unlearn flows
    Press L to learn flows
    Press 1 to to delete default flows
    Press 2 to to setup default flows
    Press Q to quit
    
    Q: 1 R0.0: 143836 F: 0 R1.0: 0 F: 0
  6. Start the monitoring tool on a new terminal.
    /opt/ntinl/tools/ntnic-tools/build/monitoring/monitoring
    An output example:
     ┌─────────────────────────── monitoring pci:0000:42:00.0 fpga:200-9563-55-16 ──────────────────────────┐
     │  Port  Type   PCI   Intf       NIM    Link    Speed    MTU    Rx Mbps    Tx Mbps  Rx Mpps  Tx Mpps   │
     │ *   0  phys  00.0   phy0     present    up     100G   1500     499.99       0.00     0.38     0.00  ♦│
     │     1  phys  00.0   phy1     present    up     100G   1500       0.00     499.99     0.00     0.38  ▒│
     │     2  virt  00.4    VF4      packed    up      N/A   1500       0.00       0.00     0.00     0.00  ▒│
     │     3  virt  00.5    VF5      packed    up      N/A   1500       0.00       0.00     0.00     0.00  ▒│
     │     4  virt  00.6    VF6  unattached  down      N/A   1500       0.00       0.00     0.00     0.00  ▒│
     └──────────────────────────────────────────────────────────────────────────────────────────────────────┘
      MAC: 00:0d:e9:07:9d:17
     ┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
     │                                             Rx counters                                              │
     │ Packets         : 00000009700851292  Octets          :  00001377520883464                            │
     │ Broadcast       : 00000000000000000  Multicast       :  00000000000000000                            │
     │ Unicast         : 00000009700851292  Crc errors      :  00000000000000000                            │
     │ 64 octets       : 00000000000000000  65-127 octets   :  00000000000000000                            │
     │ 128-255 octets  : 00000009700851292  256-511 octets  :  00000000000000000                            │
     │ 512-1023 octets : 00000000000000000  1024-1518 octets:  00000000000000000                            │
     │ 1519-2047 octets: 00000000000000000  2048-4095 octets:  00000000000000000                            │
     │ 4096-8191 octets: 00000000000000000  8192-max octets :  00000000000000000                            │
     │ Undersize       : 00000000000000000  Oversize        :  00000000000000000                            │
     │ Fragments       : 00000000000000000  Drop events     :  00000000208262682                            │
     └──────────────────────────────────────────────────────────────────────────────────────────────────────┘
    The monitoring tool shows that frames are received on port 0 and are forwarded on port 1.
  7. To see the help output of the ntmain application, run:
    cd /opt/ntinl/examples_v<version>/examples/ntmain/build
    ./ntmain -- -h\
    where:
    • version is the version identifier of the corresponding package.
    An output example:
    EAL: Detected CPU lcores: 32
    EAL: Detected NUMA nodes: 2
    EAL: Detected static linkage of DPDK
    EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
    EAL: Selected IOVA mode 'VA'
    EAL: VFIO support initialized
    EAL: Using IOMMU type 1 (Type 1)
    EAL: Probe PCI driver: net_ntnic (18f4:1c5) device: 0000:42:00.0 (socket 1)
    …
    …
    
    ./ntmain [-h][-v]
      -h                 : Display help
      --queues <number>  : Number of queues to use for VFs
    Note: For the help output of the DPDK EAL parameters, run the ./ntmain -h command.
  8. To see the help output of the forward application, run:
    /opt/ntinl/dpdk/build/examples/dpdk-forward -- -h
    where:
    • version is the version identifier of the corresponding package.
    An output example:
    Forward DPDK app - Forwarding packets between two ports.
    -------------------------------------------------------.
    EAL: Detected CPU lcores: 32
    EAL: Detected NUMA nodes: 2
    EAL: Detected static linkage of DPDK
    EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
    EAL: Selected IOVA mode 'VA'
    EAL: VFIO support initialized
    TELEMETRY: No legacy callbacks, legacy socket not created
    
    /opt/ntinl/dpdk/build/examples/dpdk-forward [-h][-i port no][-e port no][-s][-n][-d][-f]
      -h         : Display help
      -i port no : Ingress port number. Default port no. is port 0
      -e port no : Eegress port number. Default port no. is port 1
      -f         : Do not set filters (VLAN or MAC)
      -n         : Disable HW offload
      -s         : Extended statistics
      -m         : Meter flow statistics
      -d         : Debug print out
    Note: For the help output of the DPDK EAL parameters, run the ./dpdk-forward -h command.