Skip to content

Commit

Permalink
net/bnxt: fix ring teardown
Browse files Browse the repository at this point in the history
Check for valid bit while scanning for hwrm_done completion
during ring teardown. Not checking the valid bit could cause a
ring overflow when we ring the doorbell.

Fixes: 4fb6ab3 ("net/bnxt: check flush status during ring free")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
  • Loading branch information
ajitkhaparde committed Jan 12, 2022
1 parent 6c63f34 commit 54c6aad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/bnxt/bnxt_rxr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,9 @@ int bnxt_flush_rx_cmp(struct bnxt_cp_ring_info *cpr)
cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];

if (!bnxt_cpr_cmp_valid(rxcmp, raw_cons, ring_mask + 1))
break;

if (CMP_TYPE(rxcmp) == CMPL_BASE_TYPE_HWRM_DONE)
return 1;

Expand Down
3 changes: 3 additions & 0 deletions drivers/net/bnxt/bnxt_txr.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ int bnxt_flush_tx_cmp(struct bnxt_cp_ring_info *cpr)
cons = RING_CMPL(ring_mask, raw_cons);
txcmp = (struct tx_cmpl *)&cp_desc_ring[cons];

if (!bnxt_cpr_cmp_valid(txcmp, raw_cons, ring_mask + 1))
break;

opaque = rte_cpu_to_le_32(txcmp->opaque);
raw_cons = NEXT_RAW_CMP(raw_cons);

Expand Down

0 comments on commit 54c6aad

Please sign in to comment.