* [PATCH 1/3] net/bnxt: defer completion index update
2022-04-13 10:31 [PATCH 0/3] BNXT changes Ruifeng Wang
@ 2022-04-13 10:31 ` Ruifeng Wang
2022-04-13 10:31 ` [PATCH 2/3] net/bnxt: remove redundant ifdefs Ruifeng Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Ruifeng Wang @ 2022-04-13 10:31 UTC (permalink / raw)
To: ajit.khaparde, somnath.kotur; +Cc: dev, honnappa.nagarahalli, nd, Ruifeng Wang
When no packet is received, there is no need to update completion raw cons.
Moved update down to remove unnecessary store in this case.
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
drivers/net/bnxt/bnxt_rxr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 5a9cf48e67..49b9f0aed4 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -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);
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] net/bnxt: remove redundant ifdefs
2022-04-13 10:31 [PATCH 0/3] BNXT changes Ruifeng Wang
2022-04-13 10:31 ` [PATCH 1/3] net/bnxt: defer completion index update Ruifeng Wang
@ 2022-04-13 10:31 ` Ruifeng Wang
2022-04-13 10:31 ` [PATCH 3/3] net/bnxt: fix risk in Rx descriptor read in NEON path Ruifeng Wang
2022-04-13 22:12 ` [PATCH 0/3] BNXT changes Ajit Khaparde
3 siblings, 0 replies; 6+ messages in thread
From: Ruifeng Wang @ 2022-04-13 10:31 UTC (permalink / raw)
To: ajit.khaparde, somnath.kotur; +Cc: dev, honnappa.nagarahalli, nd, 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.
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index f15e2d3b4e..779e23ac4f 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -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) {
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] net/bnxt: fix risk in Rx descriptor read in NEON path
2022-04-13 10:31 [PATCH 0/3] BNXT changes Ruifeng Wang
2022-04-13 10:31 ` [PATCH 1/3] net/bnxt: defer completion index update Ruifeng Wang
2022-04-13 10:31 ` [PATCH 2/3] net/bnxt: remove redundant ifdefs Ruifeng Wang
@ 2022-04-13 10:31 ` Ruifeng Wang
2022-04-13 22:12 ` [PATCH 0/3] BNXT changes Ajit Khaparde
3 siblings, 0 replies; 6+ messages in thread
From: Ruifeng Wang @ 2022-04-13 10:31 UTC (permalink / raw)
To: ajit.khaparde, somnath.kotur
Cc: dev, honnappa.nagarahalli, nd, Ruifeng Wang, lance.richardson, stable
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")
Cc: lance.richardson@broadcom.com
Cc: stable@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index 779e23ac4f..32f8e59b3a 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -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]));
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] BNXT changes
2022-04-13 10:31 [PATCH 0/3] BNXT changes Ruifeng Wang
` (2 preceding siblings ...)
2022-04-13 10:31 ` [PATCH 3/3] net/bnxt: fix risk in Rx descriptor read in NEON path Ruifeng Wang
@ 2022-04-13 22:12 ` Ajit Khaparde
2022-05-10 5:17 ` Ajit Khaparde
3 siblings, 1 reply; 6+ messages in thread
From: Ajit Khaparde @ 2022-04-13 22:12 UTC (permalink / raw)
To: Ruifeng Wang; +Cc: somnath.kotur, dev, honnappa.nagarahalli, nd
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
On Wed, Apr 13, 2022 at 3:32 AM Ruifeng Wang <ruifeng.wang@arm.com> wrote:
>
> 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.
>
> 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
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] BNXT changes
2022-04-13 22:12 ` [PATCH 0/3] BNXT changes Ajit Khaparde
@ 2022-05-10 5:17 ` Ajit Khaparde
0 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2022-05-10 5:17 UTC (permalink / raw)
To: Ruifeng Wang; +Cc: Somnath Kotur, dpdk-dev, Honnappa Nagarahalli, nd
[-- Attachment #1: Type: text/plain, Size: 744 bytes --]
On Wed, Apr 13, 2022 at 3:12 PM Ajit Khaparde
<ajit.khaparde@broadcom.com> wrote:
>
> On Wed, Apr 13, 2022 at 3:32 AM Ruifeng Wang <ruifeng.wang@arm.com> wrote:
> >
> > 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.
Patches applied to dpdk-next-net-brcm. Thanks
>
> >
> > 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
> >
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread