Commit fbbdbc64 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

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: 4e748506 ("bnxt_en: Allocate the larger per-ring statistics block for 57500 chips.")
Reported-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Tested-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
Acked-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dd016aca
...@@ -4985,6 +4985,7 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp) ...@@ -4985,6 +4985,7 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
struct hwrm_vnic_qcaps_input req = {0}; struct hwrm_vnic_qcaps_input req = {0};
int rc; int rc;
bp->hw_ring_stats_size = sizeof(struct ctx_hw_stats);
if (bp->hwrm_spec_code < 0x10600) if (bp->hwrm_spec_code < 0x10600)
return 0; return 0;
...@@ -5004,8 +5005,6 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp) ...@@ -5004,8 +5005,6 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
if (bp->max_tpa_v2) if (bp->max_tpa_v2)
bp->hw_ring_stats_size = bp->hw_ring_stats_size =
sizeof(struct ctx_hw_stats_ext); sizeof(struct ctx_hw_stats_ext);
else
bp->hw_ring_stats_size = sizeof(struct ctx_hw_stats);
} }
mutex_unlock(&bp->hwrm_cmd_lock); mutex_unlock(&bp->hwrm_cmd_lock);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment