Skip to content

Commit

Permalink
net/bnxt: fix doorbell write ordering
Browse files Browse the repository at this point in the history
[ upstream commit 73d1cc9 ]

Write completion queue doorbell before receive descriptor
doorbell to avoid possibility of completion queue overflow
when completion queue size is equal to receive descriptor
ring size. Remove unnecessary compiler barriers (db write
functions have the necessary barriers.)

Fixes: 637e34b ("net/bnxt: optimize Rx processing")

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
  • Loading branch information
Lance Richardson authored and bluca committed Feb 2, 2021
1 parent fe18437 commit 21d9bef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/bnxt/bnxt_rxr.c
Expand Up @@ -907,15 +907,17 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
goto done;
}

/* Ring the completion queue doorbell. */
bnxt_db_cq(cpr);

/* Ring the receive descriptor doorbell. */
if (prod != rxr->rx_prod)
bnxt_db_write(&rxr->rx_db, rxr->rx_prod);

/* Ring the AGG ring DB */
if (ag_prod != rxr->ag_prod)
bnxt_db_write(&rxr->ag_db, rxr->ag_prod);

bnxt_db_cq(cpr);

/* Attempt to alloc Rx buf in case of a previous allocation failure. */
if (rc == -ENOMEM) {
int i = RING_NEXT(rxr->rx_ring_struct, prod);
Expand Down

0 comments on commit 21d9bef

Please sign in to comment.