[1/3] net/bnxt: fix vector mode for P7 devices

Message ID 20240606233116.38445-2-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted
Delegated to: Ajit Khaparde
Headers
Series bnxt bug fixes |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Ajit Khaparde June 6, 2024, 11:31 p.m. UTC
  Fix vector code to update the producer index correctly especially
for P7 devices where the code needs to handle epoch bit indication
correctly to the hardware.

Fixes: 30656a1cace8 ("net/bnxt: refactor epoch setting")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ring.h            | 3 ++-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h
index 1bae4b33d9..b33fb75284 100644
--- a/drivers/net/bnxt/bnxt_ring.h
+++ b/drivers/net/bnxt/bnxt_ring.h
@@ -89,7 +89,8 @@  static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)
 	if (db->db_64) {
 		uint64_t key_idx = db->db_key64 | db_idx;
 
-		rte_write64(key_idx, doorbell);
+		rte_compiler_barrier();
+		rte_write64_relaxed(key_idx, doorbell);
 	} else {
 		uint32_t key_idx = db->db_key32 | db_idx;
 
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_common.h b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
index 2294f0aa3c..f608b5152e 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
@@ -88,7 +88,11 @@  bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr)
 	}
 
 	rxq->rxrearm_start += nb;
-	bnxt_db_write(&rxr->rx_db, rxq->rxrearm_start - 1);
+	/*
+	 * We can pass rxq->rxrearm_star - 1 as well, but then the epoch
+	 * bit calculation is messed up.
+	 */
+	bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 	if (rxq->rxrearm_start >= rxq->nb_rx_desc)
 		rxq->rxrearm_start = 0;