net/i40e: fix Rx packet statistics
authorAlvin Zhang <alvinx.zhang@intel.com>
Thu, 30 Sep 2021 05:19:57 +0000 (13:19 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Fri, 8 Oct 2021 06:18:31 +0000 (08:18 +0200)
commit39e4a2577fd05199f53182b7c8509aeed40dc07f
tree50ed1e1d8f19a62f70cba5ac562cea7edc89dfe0
parent9381e4c04b6aea54c85fa6bc298deb5a4f4e6719
net/i40e: fix Rx packet statistics

Some packets are discarded by the NIC because they are larger than
the MTU, these packets should be counted as "RX error" instead of
"RX packet", for example:

  pkt1 = Ether()/IP()/Raw('x' * 1400)
  pkt2 = Ether()/IP()/Raw('x' * 1500)

  ---------------- Forward statistics for port 0 -----------------
  RX-packets: 2 RX-dropped: 0 RX-total: 2
  TX-packets: 1 TX-dropped: 0 TX-total: 1
  ----------------------------------------------------------------

  Here the packet pkt2 has been discarded, but still was counted
  by "RX-packets"

The register 'GL_RXERR1' can count above discarded packets.
This patch adds reading and calculation of the 'GL_RXERR1' counter
when reporting DPDK statistics.

Fixes: f4a91c38b4ad ("i40e: add extended stats")
Cc: stable@dpdk.org
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev.h