135. Stats Check tests

The support of stats checks by Poll Mode Drivers consists of the ability of the driver to properly report statistics upon request. Such statistics should include number of packets and bytes sent and recieved, as well as the number of dropped packets and transmission errors.

Note

Maximum Packet Length = MTU(Maximum Transmission Unit) + 14(src mac + dst mac) + 4(CRC) e.g., 1518 = 1500 + 14 + 4

135.1. Prerequisites

If using vfio the kernel must be >= 3.6+ and VT-d must be enabled in bios.When using vfio, use the following commands to load the vfio driver and bind it to the device under test:

modprobe vfio
modprobe vfio-pci
usertools/dpdk-devbind.py --bind=vfio-pci device_bus_id

Assuming that ports 0 and 1 of the test target are directly connected to the traffic generator, launch the testpmd application with the following arguments:

./build/app/testpmd -c ffffff -n 6 -- -i --portmask=0x3 --max-pkt-len=9600 \
--tx-offloads=0x00008000

The -n command is used to select the number of memory channels. It should match the number of memory channels on that setup.

Setting tx-offload to 0x8000 and the maximum packet length to 9600 (CRC included) makes input Jumbo Frames to be stored in multiple buffers by the hardware RX engine.

Start packet forwarding in the testpmd application with the start command. Then, for each port on the target make the Traffic Generator transmit a packet to the port of arbitrary size less than the MTU of the target port, checking that the same amount of frames and bytes are received back by the Traffic Generator from the port.

135.2. Functional Tests of Status Checks

Testing the support of Status Checks in Poll Mode Drivers consists of configuring the gathering the initial status of a port, sending a packet to that port, and checking the status of the port. The initial status and the new status are then compared for expected differences. The fields checked are RX-packets, RX-bytes, RX-errors, TX-packets, TX-errors, and TX-bytes.

135.3. Test Case: Status Checks

Check the initial state of the ports (Single example port shown):

testpmd> show port stats all
  ######################## NIC statistics for port 0  ########################
  RX-packets: 0        RX-missed: 0         RX-bytes:  0
  RX-errors: 0
  RX-nombuf:  0
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

Send a packet with size 50 bytes (Single example port show)

testpmd> show port stats all
  ######################## NIC statistics for port 0  ########################
  RX-packets: 1        RX-missed: 0         RX-bytes:  50
  RX-errors: 0
  RX-nombuf:  0
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

Verify that the increase in RX-bytes and RX-packets is as-expected, and no other information changed.