Frames can be transmitted from the host and receive on the same port without a pluggable module or cabling using the host-loopback feature.
About this task
This describes command examples to perform a simple host-loopback test including:
- How to start the driver and ntservice.
- How to configure host loopback of a port.
- How to capture and generate frames using Napatech tools.
Procedure
-
Load the driver and start the ntservice daemon.
/opt/napatech3/bin/ntstart.sh
An output example:Loading nt3gd driver [Done] Creating driver device file [Done] Loading nt3gd_netdev driver [Done] Creating driver device file [Done] Starting NTService (this may take a while) [Done]
-
Start the monitoring tool to see the SmartNIC status.
/opt/napatech3/bin/monitoring
An output example:*──────────────────── monitoring (v. 3.25.3.105-a94a9e59) ─────────────────────┐ │ P A Type Link Down Rx Tx Max Temp. │ │ 0 0 SFP28-SR-DR 25G Full 0 0.00M 0.00M 9018 48.10 C │ │ 1 0 SFP28-SR-DR 25G Full 0 0.00M 0.00M 9018 48.50 C │ └──────────────────────────────────────────────────────────────────────────────┘ Port 0 - Adapter 0 Intf 0: NT50B01_2x25 ┌──────────────────────────────────────────────────────────────────────────────┐ │ RX RMON1 counters Totals │ │ Packets : #000000000000000000 Octets : #000000000000000000 │ │ Broadcast : #000000000000000000 Multicast : #000000000000000000 │ │ 64 octets : #000000000000000000 65-127 octets : #000000000000000000 │ │ 128-255 octets : #000000000000000000 256-511 octets : #000000000000000000 │ │ 512-1023 octets : #000000000000000000 1024-1518 octets: #000000000000000000 │ │ Undersize : #000000000000000000 Oversize : #000000000000000000 │ └──────────────────────────────────────────────────────────────────────────────┘ Reset Tx/Rx 0RMON 1ExtRMON 2Checksum 3Decode 4Drop 5IPF Dec/Hex Tot/Spd Quit Sensors Color stat XTimeSync IEEE 1588 PTP EStream LFlowstat FDump
Note: It may fail to run the monitoring tool with the following error on some Linux distributions:Error opening terminal: xterm-256color.
To fix this issue, run the following command.source /opt/napatech3/bin/nt_terminfo_setup.sh
An output example:TERMINFO_DIRS env variable has been set (=/opt/napatech3/lib/terminfo)
Start the monitoring tool again. -
Configure the host loopback on a port of the SmartNIC.
/opt/napatech3/bin/config --cmd set --port 0 --host_loopback on
The link status of port 0 in the monitoring tool is changed to H-Loopback.*──────────────────── monitoring (v. 3.25.3.105-a94a9e59) ─────────────────────┐ │ P A Type Link Down Rx Tx Max Temp. │ │ 0 0 SFP28-SR-DR H-Loopback 0 0.00M 0.00M 9018 47.90 C │ │ 1 0 SFP28-SR-DR 25G Full 0 0.00M 0.00M 9018 49.30 C │ └──────────────────────────────────────────────────────────────────────────────┘ ...
-
Configure a filter to capture frames on port 0.
/opt/napatech3/bin/ntpl -e "Assign[streamid=0]=Port==0"
-
On one terminal, run throughput to receive packets.
/opt/napatech3/bin/throughput -s 0
An output example:Throughput: 0 packets @ 0 pps, 0 packets dropped, Wire: 0.000 Mbps Pci: 0.000 Mbps Throughput: 0 packets @ 0 pps, 0 packets dropped, Wire: 0.000 Mbps Pci: 0.000 Mbps ...
-
On another terminal, run pktgen to generate and transmit 1,000
frames.
/opt/napatech3/bin/pktgen -p 0 -n 1000
An output example:... Using 15.85 MB TX host buffer Using timeout = 1000 [ms] of NT_NetTxGet() Sent 1000 packets in total onto port 0
-
Press Ctrl+c to stop
throughput.
An output example:
... Throughput: 0 packets @ 0 pps, 0 packets dropped, Wire: 0.000 Mbps Pci: 0.000 Mbps Throughput: 1000 packets @ 1000 pps, 0 packets dropped, Wire: 8.192 Mbps Pci: 8.320 Mbps Throughput: 1000 packets @ 0 pps, 0 packets dropped, Wire: 0.000 Mbps Pci: 0.000 Mbps Throughput: 1000 packets @ 0 pps, 0 packets dropped, Wire: 0.000 Mbps Pci: 0.000 Mbps ^CThroughput: 1000 packets @ 0 pps, 0 packets dropped, Wire: 0.000 Mbps Pci: 0.000 Mbps Done: Received: 1000 packets Wire: 1024000 bytes Pci: 1040000 bytes Dropped: 0 packets 0 bytes Max throughput: 1000 pps Wire: 8.192 Mbps Pci: 8.320 Mbps Min throughput: 0 pps Wire: 0.000 Mbps Pci: 0.000 Mbps Avg throughput: 200 pps Wire: 1.638 Mbps Pci: 1.664 Mbps Total throughput: Received: 1000 packets Wire: 1024000 bytes Pci: 1040000 bytes Dropped: 0 packets 0 bytes
-
Check the statistics in the monitoring tool.
An output example:
*──────────────────── monitoring (v. 3.25.3.105-a94a9e59) ─────────────────────┐ │ P A Type Link Down Rx Tx Max Temp. │ │ 0 0 SFP28-SR-DR H-Loopback 0 0.00M 0.00M 9018 46.10 C │ │ 1 0 SFP28-SR-DR 25G Full 0 0.00M 0.00M 9018 47.50 C │ └──────────────────────────────────────────────────────────────────────────────┘ Port 0 - Adapter 0 Intf 0: NT50B01_2x25 ┌──────────────────────────────────────────────────────────────────────────────┐ │ RX RMON1 counters Totals │ │ Packets : #000000000000001000 Octets : #000000000001024000 │ │ Broadcast : #000000000000000000 Multicast : #000000000000000000 │ │ 64 octets : #000000000000000000 65-127 octets : #000000000000000000 │ │ 128-255 octets : #000000000000000000 256-511 octets : #000000000000000000 │ │ 512-1023 octets : #000000000000000000 1024-1518 octets: #000000000000001000 │ │ Undersize : #000000000000000000 Oversize : #000000000000000000 │ │ Fragments : #000000000000000000 Collisions : #000000000000000000 │ │ Drop events : #000000000000000000 Crc/Align errors: #000000000000000000 │ │ Jabbers : #000000000000000000 Ext drops : #000000000000000000 │ └──────────────────────────────────────────────────────────────────────────────┘ Reset Tx/Rx 0RMON 1ExtRMON 2Checksum 3Decode 4Drop 5IPF Dec/Hex Tot/Spd Quit Sensors Color stat XTimeSync IEEE 1588 PTP EStream LFlowstat FDump
The monitoring tool shows that 1000 packets and 1,024,000 bytes are received. -
Disable the host loopback feature on port 0 of the SmartNIC.
/opt/napatech3/bin/config --cmd set --port 0 --host_loopback off
Results
The driver is loaded and frames are generated/received using the pktgen and throughput tools. The monitoring tool is used to check the link status and port statistics.