Skip to contentSkip to conversation

BNXT changes

PATCH In review Ruifeng Wang 2 participants 6 messages Apr 13, 2022 – May 10, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

cover BNXT changes

This patch set includes changes proposed for BNXT PMD. Found these in code review.

Ruifeng Wang (3):
net/bnxt: defer completion index update net/bnxt: remove redundant ifdefs
net/bnxt: fix risk in Rx descriptor read in NEON path

 drivers/net/bnxt/bnxt_rxr.c           |  2 +-
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 net/bnxt: defer completion index update

When no packet is received, there is no need to update completion raw cons. Moved update down to remove unnecessary store in this case.

---
 drivers/net/bnxt/bnxt_rxr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_rxr.c +1 -1
index 5a9cf48e67..49b9f0aed4 100644
@@ -1096,7 +1096,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			break;
 	}
 
-	cpr->cp_raw_cons = raw_cons;
 	if (!nb_rx_pkts && !nb_rep_rx_pkts && !evt) {
 		/*
 		 * For PMD, there is no need to keep on pushing to REARM
@@ -1105,6 +1104,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		goto done;
 	}
 
+	cpr->cp_raw_cons = raw_cons;
 	/* Ring the completion queue doorbell. */
 	bnxt_db_cq(cpr);
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 net/bnxt: remove redundant ifdefs

In reply to Ruifeng Wang

NEON vector path is built only when Arm platform is 64-bit. The ifdefs in NEON path are of no use, hence remove.

---
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/bnxt/bnxt_rxtx_vec_neon.c +0 -4
index f15e2d3b4e..779e23ac4f 100644
@@ -220,13 +220,9 @@ recv_burst_vec_neon(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 		/* Copy four mbuf pointers to output array. */
 		t0 = vld1q_u64((void *)&rxr->rx_buf_ring[mbcons]);
-#ifdef RTE_ARCH_ARM64
 		t1 = vld1q_u64((void *)&rxr->rx_buf_ring[mbcons + 2]);
-#endif
 		vst1q_u64((void *)&rx_pkts[i], t0);
-#ifdef RTE_ARCH_ARM64
 		vst1q_u64((void *)&rx_pkts[i + 2], t1);
-#endif
 
 		/* Prefetch four descriptor pairs for next iteration. */
 		if (i + BNXT_RX_DESCS_PER_LOOP_VEC128 < nb_pkts) {
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/3 net/bnxt: fix risk in Rx descriptor read in NEON path

In reply to Ruifeng Wang

Rx descriptor contains a valid bit which indicates readiness of the rest of descriptor words. Hence, the word contains valid bit must be read prior to other words.

In NEON vector path, two contiguous 8B descriptor are loaded to a single NEON register. Given vector load ensures no 16B atomicity, read of the word that includes valid bit could be reordered after read of other words. In this case, data could be invalid.

Reloaded lower 64b after read barrier. This ensures what fetched is correct.

Also fixed comments that not pertains to Arm platform architecture.

Fixes deae85145c64 ("net/bnxt: handle multiple packets per loop in vector Rx")
---
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_rxtx_vec_neon.c +15 -2
index 779e23ac4f..32f8e59b3a 100644
@@ -231,25 +231,38 @@ recv_burst_vec_neon(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		}
 
 		/*
-		 * Load the four current descriptors into SSE registers in
-		 * reverse order to ensure consistent state.
+		 * Load the four current descriptors into NEON registers.
+		 * IO barriers are used to ensure consistent state.
 		 */
 		rxcmp1[3] = vld1q_u32((void *)&cpr->cp_desc_ring[cons + 7]);
 		rte_io_rmb();
+		/* Reload lower 64b of descriptors to make it ordered after info3_v. */
+		rxcmp1[3] = vreinterpretq_u32_u64(vld1q_lane_u64
+				((void *)&cpr->cp_desc_ring[cons + 7],
+				vreinterpretq_u64_u32(rxcmp1[3]), 0));
 		rxcmp[3] = vld1q_u32((void *)&cpr->cp_desc_ring[cons + 6]);
 
 		rxcmp1[2] = vld1q_u32((void *)&cpr->cp_desc_ring[cons + 5]);
 		rte_io_rmb();
+		rxcmp1[2] = vreinterpretq_u32_u64(vld1q_lane_u64
+				((void *)&cpr->cp_desc_ring[cons + 5],
+				vreinterpretq_u64_u32(rxcmp1[2]), 0));
 		rxcmp[2] = vld1q_u32((void *)&cpr->cp_desc_ring[cons + 4]);
 
 		t1 = vreinterpretq_u64_u32(vzip2q_u32(rxcmp1[2], rxcmp1[3]));
 
 		rxcmp1[1] = vld1q_u32((void *)&cpr->cp_desc_ring[cons + 3]);
 		rte_io_rmb();
+		rxcmp1[1] = vreinterpretq_u32_u64(vld1q_lane_u64
+				((void *)&cpr->cp_desc_ring[cons + 3],
+				vreinterpretq_u64_u32(rxcmp1[1]), 0));
 		rxcmp[1] = vld1q_u32((void *)&cpr->cp_desc_ring[cons + 2]);
 
 		rxcmp1[0] = vld1q_u32((void *)&cpr->cp_desc_ring[cons + 1]);
 		rte_io_rmb();
+		rxcmp1[0] = vreinterpretq_u32_u64(vld1q_lane_u64
+				((void *)&cpr->cp_desc_ring[cons + 1],
+				vreinterpretq_u64_u32(rxcmp1[0]), 0));
 		rxcmp[0] = vld1q_u32((void *)&cpr->cp_desc_ring[cons + 0]);
 
 		t0 = vreinterpretq_u64_u32(vzip2q_u32(rxcmp1[0], rxcmp1[1]));
Signature · 1 line
2.25.1
#4 lore raw
In reply to Ruifeng Wang
Quoted 8 lines · Ruifeng Wang

This patch set includes changes proposed for BNXT PMD. Found these in code review.

Ruifeng Wang (3):
net/bnxt: defer completion index update net/bnxt: remove redundant ifdefs
net/bnxt: fix risk in Rx descriptor read in NEON path

Thanks Ruifeng.
Let me review the patchset and get back.

Quoted 8 lines
 drivers/net/bnxt/bnxt_rxr.c           |  2 +-
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)

--
2.25.1

#5 lore raw
Quoted 6 lines · Ajit Khaparde
Quoted 4 lines · Ruifeng Wang

This patch set includes changes proposed for BNXT PMD. Found these in code review.

Quoted 6 lines
Quoted 4 lines

Ruifeng Wang (3):
net/bnxt: defer completion index update net/bnxt: remove redundant ifdefs
net/bnxt: fix risk in Rx descriptor read in NEON path

Thanks Ruifeng.
Let me review the patchset and get back.

Patches applied to dpdk-next-net-brcm. Thanks

Quoted 9 lines
Quoted 9 lines

 drivers/net/bnxt/bnxt_rxr.c           |  2 +-
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)

--
2.25.1