bnxt_en: Fix statistics counters issue during ifdown with older firmware.
authorMichael Chan <michael.chan@broadcom.com>
Tue, 23 Jun 2020 23:01:37 +0000 (19:01 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Jun 2020 03:13:58 +0000 (20:13 -0700)
commitc2dec363feb41544a76c8083aca2378990e17166
treea502af2c8ae3c3b794479c8086034d0696d12bf9
parentfed7edd18143c68c63ea049999a7e861123de6de
bnxt_en: Fix statistics counters issue during ifdown with older firmware.

On older firmware, the hardware statistics are not cleared when the
driver frees the hardware stats contexts during ifdown.  The driver
expects these stats to be cleared and saves a copy before freeing
the stats contexts.  During the next ifup, the driver will likely
allocate the same hardware stats contexts and this will cause a big
increase in the counters as the old counters are added back to the
saved counters.

We fix it by making an additional firmware call to clear the counters
before freeing the hw stats contexts when the firmware is the older
20.x firmware.

Fixes: b8875ca356f1 ("bnxt_en: Save ring statistics before reset.")
Reported-by: Jakub Kicinski <kicinski@fb.com>
Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Tested-by: Jakub Kicinski <kicinski@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c