Skip to contentSkip to conversation

net/bnxt: fix doorbell write ordering

PATCH In review Lance Richardson 2 participants 2 messages Dec 14, 2020 – Dec 17, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net/bnxt: fix doorbell write ordering

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 637e34befd9c ("net/bnxt: optimize Rx processing")

---
v2 - Fixed typo in commit log.

 drivers/net/bnxt/bnxt_rxr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +4 -4
index e2d388e69f..ffdeeecc3a 100644
@@ -917,17 +917,17 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		goto done;
 	}
 
-	rte_compiler_barrier();
+	/* Ring the completion queue doorbell. */
+	bnxt_db_cq(cpr);
+
+	/* Ring the receive descriptor doorbell. */
 	if (rx_raw_prod != rxr->rx_raw_prod)
 		bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 
-	rte_compiler_barrier();
 	/* Ring the AGG ring DB */
 	if (ag_raw_prod != rxr->ag_raw_prod)
 		bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 
-	bnxt_db_cq(cpr);
-
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
 		int i = RING_NEXT(rx_raw_prod);
Signature · 15 lines
2.25.1


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#1 lore raw
Quoted 7 lines · Lance Richardson

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.)

Quoted 5 lines
Fixes 637e34befd9c ("net/bnxt: optimize Rx processing")

Patch applied to dpdk-next-net-brcm.

Quoted 48 lines

---
v2 - Fixed typo in commit log.

 drivers/net/bnxt/bnxt_rxr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +4 -5
index e2d388e69f..ffdeeecc3a 100644
@@ -917,17 +917,17 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                goto done;
        }
 
-       rte_compiler_barrier();
+       /* Ring the completion queue doorbell. */
+       bnxt_db_cq(cpr);
+
+       /* Ring the receive descriptor doorbell. */
        if (rx_raw_prod != rxr->rx_raw_prod)
                bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 
-       rte_compiler_barrier();
        /* Ring the AGG ring DB */
        if (ag_raw_prod != rxr->ag_raw_prod)
                bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 
-       bnxt_db_cq(cpr);
-
        /* Attempt to alloc Rx buf in case of a previous allocation failure. */
        if (rc == -ENOMEM) {
                int i = RING_NEXT(rx_raw_prod);
--

2.25.1

--
This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.

Signature · 1 line
Ajit Khaparde