Performing a Test with testpmd

Link-Inline™ Software User Guide

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

This describes testpmd command examples to perform a simple test including how to configure the SmartNIC with simple flow rules and how to run the monitoring tool.

About this task

testpmd is a testing utility provided by the Data Plane Development Kit (DPDK) to test the functionality of network devices with DPDK. It is a command-line tool that provides a simple interface to configure and test with the SmartNIC.

Note: Each command must be in a single line without any line breaks.

Procedure

  1. Start testpmd.
    For example:
    dpdk-testpmd -- -i
    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)
    …
    …
    Configuring Port 0 (socket 1)
    ETHDEV: INF: PCI:0000:42:00.0:intf_0: link is up
    Port 0: 00:0D:E9:07:9D:17
    Configuring Port 1 (socket 1)
    ETHDEV: INF: PCI:0000:42:00.0:intf_1: link is up
    Port 1: 00:0D:E9:07:9D:18
    Checking link statuses...
    Done
  2. Check the port status.
    testpmd> show port info all
    Information about ports including the link status is displayed. An output example:
    ********************* Infos for port 0  *********************
    MAC address: 00:0D:E9:07:9D:17
    Device name: ntnic0
    Driver name: net_ntnic
    Firmware-version: 200-9563-55-11
    Connect to socket: 1
    memory allocation on the socket: 1
    Link status: up
    Link speed: 100 Gbps
    Link duplex: full-duplex
    Autoneg status: On
    MTU: 1500
    …
    …
    ********************* Infos for port 1  *********************
    MAC address: 00:0D:E9:07:9D:18
    Device name: ntnic1
    Driver name: net_ntnic
    Firmware-version: 200-9563-55-11
    Connect to socket: 1
    memory allocation on the socket: 1
    Link status: up
    Link speed: 100 Gbps
    Link duplex: full-duplex
    Autoneg status: On
    MTU: 1500
    …
    …
    The link status is displayed after the Link status field in the output. If the link is up, it displays up, and if the link is down, it displays down.
  3. Start the monitoring tool on another terminal.
    It is also possible to check the link status using the monitoring tool.
    cd /opt/ntinl/tools/ntnic-tools/build/monitoring/
    ./monitoring
    An output example:
     ┌─────────────────────────── monitoring pci:0000:42:00.0 fpga:200-9563-55-11 ──────────────────────────┐
     │  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       0.00       0.00     0.00     0.00  ♦│
     │     1  phys  00.0   phy1     present    up     100G   1500       0.00       0.00     0.00     0.00  ▒│
     │                                                                                                     ▒│
     └──────────────────────────────────────────────────────────────────────────────────────────────────────┘
      MAC: 00:0d:e9:07:9d:17
     ┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
     │                                             Rx counters                                              │
     │ Packets         : 00000000000000000  Octets          :  00000000000000000                            │
     │ Broadcast       : 00000000000000000  Multicast       :  00000000000000000                            │
     │ Unicast         : 00000000000000000  Crc errors      :  00000000000000000                            │
     │ 64 octets       : 00000000000000000  65-127 octets   :  00000000000000000                            │
     │ 128-255 octets  : 00000000000000000  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     :  00000000000000000                            │
     └──────────────────────────────────────────────────────────────────────────────────────────────────────┘
      Reset  Port   TX/Rx  Queue  Color  Flowstat
    Pressing the r key resets the counters. Resetting counters applies only to the current monitoring instance. If you restart the monitoring tool, the accumulated values are displayed.
    Note: The monitoring tool fails to start if no application is running.
  4. Apply simple flow rules.
    This is an example to forward all received frames on port 0 to queue 0 on the host.
    Testpmd> flow create 0 group 0 pattern end actions queue index 0 / end
    Flow rule #0 created
    In the following example, the command creates a flow rule for hairpinning of frames with a specific source IPv4 address on port 0 to 1.
    Testpmd> flow create 0 ingress pattern eth / ipv4 src is 20.10.10.48 / end actions port_id id 1 / end
    Flow rule #1 created
    This command configures the SmartNIC to process received frames with IPv4 source address 20.10.10.48 on port 0 and transmit on port 1.
    Note: Traffic must contain frames with the specified IP address.
    Alternatively multiple flow rules can be configured using a file as follows:
    testpmd> load /home/scripts/flow-create-commands.txt
  5. Start forwarding.
    The forwarding mode is set to IO by default. In this mode, received frames from a port are forwarded to a TX queue to be transmitted on another port.
    testpmd> show config fwd
    testpmd> start
    An output example:
    testpmd> show config fwd
    io packet forwarding - ports=2 - cores=1 - streams=2 - NUMA support enabled, MP allocation mode: native
    Logical Core 1 (socket 1) forwards packets on 2 streams:
      RX P=0/Q=0 (socket 1) -> TX P=1/Q=0 (socket 1) peer=02:00:00:00:00:01
      RX P=1/Q=0 (socket 1) -> TX P=0/Q=0 (socket 1) peer=02:00:00:00:00:00
    testpmd>
    testpmd> start
    io packet forwarding - ports=2 - cores=1 - streams=2 - NUMA support enabled, MP allocation mode: native
    Logical Core 1 (socket 1) forwards packets on 2 streams:
      RX P=0/Q=0 (socket 1) -> TX P=1/Q=0 (socket 1) peer=02:00:00:00:00:01
      RX P=1/Q=0 (socket 1) -> TX P=0/Q=0 (socket 1) peer=02:00:00:00:00:00
    …
    …
  6. Check the forwarding statistics.
    testpmd> show fwd stats all
    An output example:
      ---------------------- Forward statistics for port 0  ----------------------
      RX-packets: 52534986       RX-dropped: 0             RX-total: 52534986
      TX-packets: 52685399       TX-dropped: 0             TX-total: 52685399
      ----------------------------------------------------------------------------
    
      ---------------------- Forward statistics for port 1  ----------------------
      RX-packets: 52685401       RX-dropped: 0             RX-total: 52685401
      TX-packets: 52534984       TX-dropped: 0             TX-total: 52534984
      ----------------------------------------------------------------------------
    
      +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
      RX-packets: 105220387      RX-dropped: 0             RX-total: 105220387
      TX-packets: 105220383      TX-dropped: 0             TX-total: 105220383
      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. Check port statistics and queue statistics in the monitoring tool.
    An output example:
     ┌─────────────────────────── monitoring pci:0000:42:00.0 fpga:200-9563-55-11 ──────────────────────────┐
     │  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    9999.97    9999.92     1.54     1.53  ♦│
     │     1  phys  00.0   phy1     present    up     100G   1500    9999.97    9999.95     1.53     1.54  ▒│
     │                                                                                                     ▒│
     │                                                                                                     ▒│
     │                                                                                                     ▒│
     └──────────────────────────────────────────────────────────────────────────────────────────────────────┘
      MAC: 00:0d:e9:07:9d:17
     ┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
     │                                             Rx counters                                              │
     │ Packets         : 00000001121650307  Octets          :  00000888756488689                            │
     │ Broadcast       : 00000000000000000  Multicast       :  00000000000000000                            │
     │ Unicast         : 00000001121650307  Crc errors      :  00000000000000000                            │
     │ 64 octets       : 00000000000917716  65-127 octets   :  00000000048330913                            │
     │ 128-255 octets  : 00000000098662822  256-511 octets  :  00000000196970521                            │
     │ 512-1023 octets : 00000000390863874  1024-1518 octets:  00000000385904461                            │
     │ 1519-2047 octets: 00000000000000000  2048-4095 octets:  00000000000000000                            │
     │ 4096-8191 octets: 00000000000000000  8192-max octets :  00000000000000000                            │
     │ Undersize       : 00000000000000000  Oversize        :  00000000000000000                            │
     │ Fragments       : 00000000000000000  Drop events     :  00000000000000000                            │
     │                                                                                                      │
     └──────────────────────────────────────────────────────────────────────────────────────────────────────┘
      Reset  Port   TX/Rx  Queue  Color  Flowstat
    
    
    To view queue statistics, press the q key. An output example:
     ┌─────────────────────────── monitoring pci:0000:42:00.0 fpga:200-9563-55-11 ──────────────────────────┐
     │  Queue  Owner   Dest           Packets              Octets      VQ Drop pkts      VQ Drop octets     │
     │ *   0   phy0  ctl/in  #000001228421505  #00000972808211415  #000000000001071  #00000000000831933    ♦│
     │     1   phy1  ctl/in  #000000804520410  #00000636117712463  #000000000000521  #00000000000418798    ▒│
     │     2     -unused-    #000000000000000  #00000000000000000  #000000000000000  #00000000000000000    ▒│
     │     3     -unused-    #000000000000000  #00000000000000000  #000000000000000  #00000000000000000    ▒│
     │     4     -unused-    #000000000000000  #00000000000000000  #000000000000000  #00000000000000000    ▒│
     └──────────────────────────────────────────────────────────────────────────────────────────────────────┘
    
     ┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
     │ QueueId:   0                                                                                         │
     │ flush packets   : 000000000000000  flush octets    : 00000000000000000                               │
     │ drop packets    : 000000000000000  drop octets     : 00000000000000000                               │
     │                                                                                                      │
     │                                                                                                      │
     │                                                                                                      │
     └──────────────────────────────────────────────────────────────────────────────────────────────────────┘
      Reset  Port   TX/Rx  Queue  Color  Flowstat
    
  8. Stop the monitoring tool.
  9. Delete the flow rules and stop testpmd.
    testpmd> flow destroy 0 rule 0
    Flow rule #0 destroyed
    testpmd> flow destroy 0 rule 1
    Flow rule #1 destroyed
    testpmd> quit
    
    Stopping port 0...
    Stopping ports...
    Done
    
    Stopping port 1...
    Stopping ports...
    Done
    
    Shutting down port 0...
    Closing ports...
    Port 0 is closed
    Done
    
    Shutting down port 1...
    Closing ports...
    Port 1 is closed
    Done
    
    Bye...