rte_cio_wmb is a light weight version of IO memory barrier that
guarantees that the stores to the coherent memory prior to the
the rte_cio_rmb() call are visible to the NIC HW before the doorbell
ring(or any other stores to the MMIO registers) that follows it.[1]

Fixes: 5e02e19eb14e ("net/ena: fix unneeded doorbell submission")
Cc: sta...@dpdk.org

[1] http://code.dpdk.org/dpdk/v20.02/source/lib/librte_eal/common/
include/generic/rte_atomic.h#L137

Signed-off-by: Gavin Hu <gavin...@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com>
---
 drivers/net/ena/ena_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 665afee4f..c268788fd 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1425,7 +1425,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, 
unsigned int count)
                 * Add memory barrier to make sure the desc were written before
                 * issue a doorbell
                 */
-               rte_wmb();
+               rte_cio_wmb();
                ena_com_write_sq_doorbell(rxq->ena_com_io_sq);
 
                rxq->next_to_use = next_to_use;
@@ -2344,7 +2344,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct 
rte_mbuf **tx_pkts,
                        PMD_DRV_LOG(DEBUG, "llq tx max burst size of queue %d"
                                " achieved, writing doorbell to send burst\n",
                                tx_ring->id);
-                       rte_wmb();
+                       rte_cio_wmb();
                        ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
                }
 
@@ -2367,7 +2367,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct 
rte_mbuf **tx_pkts,
        /* If there are ready packets to be xmitted... */
        if (sent_idx > 0) {
                /* ...let HW do its best :-) */
-               rte_wmb();
+               rte_cio_wmb();
                ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
                tx_ring->tx_stats.doorbells++;
                tx_ring->next_to_use = next_to_use;
-- 
2.17.1

Reply via email to