net/bnxt: fix doorbell write ordering
authorLance Richardson <lance.richardson@broadcom.com>
Mon, 14 Dec 2020 18:56:38 +0000 (13:56 -0500)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:06 +0000 (16:03 +0100)
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")
Cc: stable@dpdk.org
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>
drivers/net/bnxt/bnxt_rxr.c

index e2d388e..ffdeeec 100644 (file)
@@ -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);