forked from Minki/linux
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: b8875ca356
("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>
This commit is contained in:
parent
fed7edd181
commit
c2dec363fe
@ -6292,6 +6292,7 @@ int bnxt_hwrm_set_coal(struct bnxt *bp)
|
||||
|
||||
static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
|
||||
{
|
||||
struct hwrm_stat_ctx_clr_stats_input req0 = {0};
|
||||
struct hwrm_stat_ctx_free_input req = {0};
|
||||
int i;
|
||||
|
||||
@ -6301,6 +6302,7 @@ static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
|
||||
if (BNXT_CHIP_TYPE_NITRO_A0(bp))
|
||||
return;
|
||||
|
||||
bnxt_hwrm_cmd_hdr_init(bp, &req0, HWRM_STAT_CTX_CLR_STATS, -1, -1);
|
||||
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_STAT_CTX_FREE, -1, -1);
|
||||
|
||||
mutex_lock(&bp->hwrm_cmd_lock);
|
||||
@ -6310,7 +6312,11 @@ static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
|
||||
|
||||
if (cpr->hw_stats_ctx_id != INVALID_STATS_CTX_ID) {
|
||||
req.stat_ctx_id = cpu_to_le32(cpr->hw_stats_ctx_id);
|
||||
|
||||
if (BNXT_FW_MAJ(bp) <= 20) {
|
||||
req0.stat_ctx_id = req.stat_ctx_id;
|
||||
_hwrm_send_message(bp, &req0, sizeof(req0),
|
||||
HWRM_CMD_TIMEOUT);
|
||||
}
|
||||
_hwrm_send_message(bp, &req, sizeof(req),
|
||||
HWRM_CMD_TIMEOUT);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user