bnxt_en: Fix ethtool -S statitics with XDP or TCs enabled.
authorMichael Chan <michael.chan@broadcom.com>
Wed, 26 Aug 2020 05:08:34 +0000 (01:08 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:14:17 +0000 (19:14 +0200)
commit214c198323335c277e7bf998194c348c72652dd0
treef7ceb39abe711ae5c18815c966f1bee41e06488c
parent376326004a42a194216ee3a210996e6f193fd2de
bnxt_en: Fix ethtool -S statitics with XDP or TCs enabled.

[ Upstream commit 7de651490c27ebc5edb5c7224c368bd0cd5b3862 ]

We are returning the wrong count for ETH_SS_STATS in get_sset_count()
when XDP or TCs are enabled.  In a recent commit, we got rid of
irrelevant counters when the ring is RX only or TX only, but we
did not make the proper adjustments for the count.  As a result,
when we have XDP or TCs enabled, we are returning an excess count
because some of the rings are TX only.  This causes ethtool -S to
display extra counters with no counter names.

Fix bnxt_get_num_ring_stats() by not assuming that all rings will
always have RX and TX counters in combined mode.

Fixes: 125592fbf467 ("bnxt_en: show only relevant ethtool stats for a TX or RX ring")
Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c