From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@amd.com, thomas@monjalon.net
Subject: [PATCH v2 09/10] net/bnxt: fix compressed Rx CQE handling
Date: Thu, 22 Feb 2024 11:47:59 -0800 [thread overview]
Message-ID: <20240222194800.80648-10-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20240222194800.80648-1-ajit.khaparde@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 5029 bytes --]
We were trying to reuse 32-byte CQE macros for
compressed CQE handling. And that was causing the packet
error bits to be misinterpreted.
Fix it by using appropriate macros.
Fixes: d58c6c077cc2 ("net/bnxt: add AVX2 Rx for compressed CQE")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_rxtx_vec_avx2.c | 39 ++++++++++++++++-----------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
index ce6b597611..976f258044 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
@@ -392,19 +392,21 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
0xFF, 0xFF, 3, 2, /* pkt_len */
0xFF, 0xFF, 0xFF, 0xFF); /* pkt_type (zeroes) */
const __m256i flags_type_mask =
- _mm256_set1_epi32(RX_PKT_CMPL_FLAGS_ITYPE_MASK);
+ _mm256_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_ITYPE_MASK);
const __m256i flags2_mask1 =
- _mm256_set1_epi32(CMPL_FLAGS2_VLAN_TUN_MSK);
+ _mm256_set1_epi32(CMPL_FLAGS2_VLAN_TUN_MSK_CRX);
const __m256i flags2_mask2 =
- _mm256_set1_epi32(RX_PKT_CMPL_FLAGS2_IP_TYPE);
+ _mm256_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_IP_TYPE);
const __m256i rss_mask =
- _mm256_set1_epi32(RX_PKT_CMPL_FLAGS_RSS_VALID);
+ _mm256_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_RSS_VALID);
__m256i t0, t1, flags_type, flags2, index, errors;
__m256i ptype_idx, ptypes, is_tunnel;
__m256i mbuf01, mbuf23, mbuf45, mbuf67;
__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5, rearm6, rearm7;
__m256i ol_flags, ol_flags_hi;
__m256i rss_flags;
+ __m256i errors_v2;
+ __m256i cs_err_v2;
/* Validate ptype table indexing at build time. */
bnxt_check_ptype_constants();
@@ -447,7 +449,6 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
cons += BNXT_RX_DESCS_PER_LOOP_VEC256,
mbcons += BNXT_RX_DESCS_PER_LOOP_VEC256) {
__m256i rxcmp0_1, rxcmp2_3, rxcmp4_5, rxcmp6_7, info3_v;
- __m256i errors_v2;
uint32_t num_valid;
/* Copy eight mbuf pointers to output array. */
@@ -470,6 +471,7 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
rxcmp2_3 = _mm256_loadu_si256((void *)&cp_desc_ring[cons + 2]);
rte_compiler_barrier();
rxcmp0_1 = _mm256_loadu_si256((void *)&cp_desc_ring[cons + 0]);
+ rte_compiler_barrier();
/* Compute packet type table indices for eight packets. */
t0 = _mm256_unpacklo_epi32(rxcmp0_1, rxcmp2_3);
@@ -477,19 +479,19 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
flags_type = _mm256_unpacklo_epi64(t0, t1);
ptype_idx = _mm256_and_si256(flags_type, flags_type_mask);
ptype_idx = _mm256_srli_epi32(ptype_idx,
- RX_PKT_CMPL_FLAGS_ITYPE_SFT -
+ RX_PKT_COMPRESS_CMPL_FLAGS_ITYPE_SFT -
BNXT_PTYPE_TBL_TYPE_SFT);
- t0 = _mm256_unpacklo_epi32(rxcmp0_1, rxcmp2_3);
- t1 = _mm256_unpacklo_epi32(rxcmp4_5, rxcmp6_7);
- flags2 = _mm256_unpackhi_epi64(t0, t1);
+ t0 = _mm256_unpackhi_epi32(rxcmp0_1, rxcmp2_3);
+ t1 = _mm256_unpackhi_epi32(rxcmp4_5, rxcmp6_7);
+ cs_err_v2 = _mm256_unpacklo_epi64(t0, t1);
- t0 = _mm256_srli_epi32(_mm256_and_si256(flags2, flags2_mask1),
- RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT -
+ t0 = _mm256_srli_epi32(_mm256_and_si256(cs_err_v2, flags2_mask1),
+ RX_PKT_COMPRESS_CMPL_METADATA1_SFT -
BNXT_PTYPE_TBL_VLAN_SFT);
ptype_idx = _mm256_or_si256(ptype_idx, t0);
- t0 = _mm256_srli_epi32(_mm256_and_si256(flags2, flags2_mask2),
+ t0 = _mm256_srli_epi32(_mm256_and_si256(cs_err_v2, flags2_mask2),
RX_PKT_CMPL_FLAGS2_IP_TYPE_SFT -
BNXT_PTYPE_TBL_IP_VER_SFT);
ptype_idx = _mm256_or_si256(ptype_idx, t0);
@@ -505,17 +507,22 @@ crx_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
* Compute ol_flags and checksum error table indices for eight
* packets.
*/
- is_tunnel = _mm256_and_si256(flags2, _mm256_set1_epi32(4));
+ is_tunnel = _mm256_and_si256(cs_err_v2,
+ _mm256_set1_epi32(BNXT_CRX_TUN_CS_CALC));
is_tunnel = _mm256_slli_epi32(is_tunnel, 3);
- flags2 = _mm256_and_si256(flags2, _mm256_set1_epi32(0x1F));
+
+ flags2 = _mm256_and_si256(cs_err_v2,
+ _mm256_set1_epi32(BNXT_CRX_CQE_CSUM_CALC_MASK));
+ flags2 = _mm256_srli_epi64(flags2, 8);
/* Extract errors_v2 fields for eight packets. */
t0 = _mm256_unpackhi_epi32(rxcmp0_1, rxcmp2_3);
t1 = _mm256_unpackhi_epi32(rxcmp4_5, rxcmp6_7);
errors_v2 = _mm256_unpacklo_epi64(t0, t1);
- errors = _mm256_srli_epi32(errors_v2, 4);
- errors = _mm256_and_si256(errors, _mm256_set1_epi32(0xF));
+ /* Compute errors out of cs_err_v2 to index into flags table. */
+ errors = _mm256_and_si256(cs_err_v2, _mm256_set1_epi32(0xF0));
+ errors = _mm256_srli_epi32(errors, 4);
errors = _mm256_and_si256(errors, flags2);
index = _mm256_andnot_si256(errors, flags2);
--
2.39.2 (Apple Git-143)
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
next prev parent reply other threads:[~2024-02-22 19:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 21:20 [PATCH 00/10] patchset for bnxt Ajit Khaparde
2024-02-21 21:20 ` [PATCH 01/10] net/bnxt: extend long bd check for VXLAN GPE Ajit Khaparde
2024-02-21 21:20 ` [PATCH 02/10] net/bnxt: add dual rate module detection log Ajit Khaparde
2024-02-21 21:20 ` [PATCH 03/10] net/bnxt: increase queue size for async handling Ajit Khaparde
2024-02-21 21:20 ` [PATCH 04/10] net/bnxt: fix AGG ID computation Ajit Khaparde
2024-02-21 21:20 ` [PATCH 05/10] net/bnxt: fix a null pointer dereference Ajit Khaparde
2024-02-21 21:20 ` [PATCH 06/10] net/bnxt: handle UDP GSO Tx Ajit Khaparde
2024-02-21 21:20 ` [PATCH 07/10] net/bnxt: add IPv6 flow label based RSS support Ajit Khaparde
2024-02-21 21:20 ` [PATCH 08/10] net/bnxt: fix compressed CQE handling Ajit Khaparde
2024-02-21 21:20 ` [PATCH 09/10] net/bnxt: fix compressed Rx " Ajit Khaparde
2024-02-21 21:20 ` [PATCH 10/10] doc: update release notes for bnxt Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 00/10] patchset " Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 01/10] net/bnxt: extend long bd check for VXLAN GPE Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 02/10] net/bnxt: add dual rate module detection log Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 03/10] net/bnxt: increase queue size for async handling Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 04/10] net/bnxt: fix AGG ID computation Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 05/10] net/bnxt: fix a null pointer dereference Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 06/10] net/bnxt: handle UDP GSO Tx Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 07/10] net/bnxt: add IPv6 flow label based RSS support Ajit Khaparde
2024-02-22 19:47 ` [PATCH v2 08/10] net/bnxt: fix compressed CQE handling Ajit Khaparde
2024-02-22 19:47 ` Ajit Khaparde [this message]
2024-02-22 19:48 ` [PATCH v2 10/10] doc: update release notes for bnxt Ajit Khaparde
2024-02-23 2:05 ` [PATCH v2 00/10] patchset " Ajit Khaparde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240222194800.80648-10-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).