Skip to contentSkip to conversation

bnxt_en: Fix allocation of zero statistics block size regression.

PATCH Applied Michael Chan 3 participants 3 messages Aug 23, 2019 – Aug 24, 2019

Subsystems (3)
lore
Share & tools
lore

Michael Chan

author maintainer
#0 lore raw

PATCH 1/1 bnxt_en: Fix allocation of zero statistics block size regression.

Recent commit added logic to determine the appropriate statistics block size to allocate and the size is stored in bp->hw_ring_stats_size. But if the firmware spec is older than 1.6.0, it is 0 and not initialized. This causes the allocation to fail with size 0 and bnxt_open() to abort. Fix it by always initializing bp->hw_ring_stats_size to the legacy default size value.

Fixes 4e7485066373 ("bnxt_en: Allocate the larger per-ring statistics block for 57500 chips.")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -2
index 4c790ff..b9ad43d 100644
@@ -4985,6 +4985,7 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
 	struct hwrm_vnic_qcaps_input req = {0};
 	int rc;
 
+	bp->hw_ring_stats_size = sizeof(struct ctx_hw_stats);
 	if (bp->hwrm_spec_code < 0x10600)
 		return 0;
 
@@ -5004,8 +5005,6 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
 		if (bp->max_tpa_v2)
 			bp->hw_ring_stats_size =
 				sizeof(struct ctx_hw_stats_ext);
-		else
-			bp->hw_ring_stats_size = sizeof(struct ctx_hw_stats);
 	}
 	mutex_unlock(&bp->hwrm_cmd_lock);
 	return rc;
Signature · 1 line
2.5.1
Tested-by Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Michael Chan

Recent commit added logic to determine the appropriate statistics block size to allocate and the size is stored in bp->hw_ring_stats_size. But if the firmware spec is older than 1.6.0, it is 0 and not initialized. This causes the allocation to fail with size 0 and bnxt_open() to abort. Fix it by always initializing bp->hw_ring_stats_size to the legacy default size value.

Fixes 4e7485066373 ("bnxt_en: Allocate the larger per-ring statistics block for 57500 chips.")

Thanks, Michael!

Signature · 1 line
Jonathan
maintainer Applied
#2 lore raw
In reply to Michael Chan

From: Michael Chan <[email protected]>
Date: Fri, 23 Aug 2019 01:51:41 -0400

Quoted 10 lines

Recent commit added logic to determine the appropriate statistics block size to allocate and the size is stored in bp->hw_ring_stats_size. But if the firmware spec is older than 1.6.0, it is 0 and not initialized. This causes the allocation to fail with size 0 and bnxt_open() to abort. Fix it by always initializing bp->hw_ring_stats_size to the legacy default size value.

Fixes 4e7485066373 ("bnxt_en: Allocate the larger per-ring statistics block for 57500 chips.")

Applied.