bnxt: count packets discarded because of netpoll
authorJakub Kicinski <kuba@kernel.org>
Fri, 27 Aug 2021 15:27:44 +0000 (08:27 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 28 Aug 2021 00:14:22 +0000 (17:14 -0700)
commit40bedf7cb2ac949052bf9741ccb9d673d782ae2c
tree282d5ee01659f0f754b87d35bf4160b2b98cbe57
parent4baf0e0b329874ec5e85480f53851b5f05a7ae58
bnxt: count packets discarded because of netpoll

bnxt may discard packets if Rx completions are consumed
in an attempt to let netpoll make progress. It should be
extremely rare in practice but nonetheless such events
should be counted.

Since completion ring memory is allocated dynamically use
a similar scheme to what is done for HW stats to save them.

Report the stats in rx_dropped and per-netdev ethtool
counter. Chances that users care which ring dropped are
very low.

v3: only save the stat to rx_dropped on reset,
rx_total_netpoll_discards will now only show drops since
last reset, similar to other "total_discard" counters.

Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c