From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@amd.com, thomas@monjalon.net
Subject: [PATCH v2 08/10] net/bnxt: fix compressed CQE handling
Date: Thu, 22 Feb 2024 11:47:58 -0800 [thread overview]
Message-ID: <20240222194800.80648-9-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20240222194800.80648-1-ajit.khaparde@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 5570 bytes --]
We were trying to reuse parts of 32-byte CQE handling for
compressed CQE handling. And that was causing the packet
errors to be misinterpreted.
Fix it by using separate code for the compressed CQE handling.
Fixes: 812fd99f8c4e ("net/bnxt: add SSE Rx for compressed CQE")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 107 ++++++++++++++++++++++++++-
1 file changed, 105 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 6c0e33200c..e367fbfbd1 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -112,6 +112,109 @@ descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4],
errors = _mm_or_si128(errors, _mm_srli_epi32(is_tunnel, 1));
index = _mm_or_si128(index, is_tunnel);
+ /* Update mbuf rearm_data for four packets. */
+ GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
+ _mm_store_si128((void *)&mbuf[0]->rearm_data,
+ _mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
+
+ GET_OL_FLAGS(rss_flags, index, errors, 1, ol_flags);
+ _mm_store_si128((void *)&mbuf[1]->rearm_data,
+ _mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
+
+ GET_OL_FLAGS(rss_flags, index, errors, 2, ol_flags);
+ _mm_store_si128((void *)&mbuf[2]->rearm_data,
+ _mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
+
+ GET_OL_FLAGS(rss_flags, index, errors, 3, ol_flags);
+ _mm_store_si128((void *)&mbuf[3]->rearm_data,
+ _mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
+
+ /* Update mbuf rx_descriptor_fields1 for four packets. */
+ GET_DESC_FIELDS(mm_rxcmp[0], mm_rxcmp1[0], shuf_msk, ptype_idx, 0, t0);
+ _mm_store_si128((void *)&mbuf[0]->rx_descriptor_fields1, t0);
+
+ GET_DESC_FIELDS(mm_rxcmp[1], mm_rxcmp1[1], shuf_msk, ptype_idx, 1, t0);
+ _mm_store_si128((void *)&mbuf[1]->rx_descriptor_fields1, t0);
+
+ GET_DESC_FIELDS(mm_rxcmp[2], mm_rxcmp1[2], shuf_msk, ptype_idx, 2, t0);
+ _mm_store_si128((void *)&mbuf[2]->rx_descriptor_fields1, t0);
+
+ GET_DESC_FIELDS(mm_rxcmp[3], mm_rxcmp1[3], shuf_msk, ptype_idx, 3, t0);
+ _mm_store_si128((void *)&mbuf[3]->rx_descriptor_fields1, t0);
+}
+
+static inline void
+crx_descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4],
+ __m128i mbuf_init, const __m128i shuf_msk,
+ struct rte_mbuf **mbuf, struct bnxt_rx_ring_info *rxr)
+{
+ const __m128i flags_type_mask =
+ _mm_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_ITYPE_MASK);
+ const __m128i flags2_mask1 =
+ _mm_set1_epi32(CMPL_FLAGS2_VLAN_TUN_MSK_CRX);
+ const __m128i flags2_mask2 =
+ _mm_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_IP_TYPE);
+ const __m128i rss_mask =
+ _mm_set1_epi32(RX_PKT_COMPRESS_CMPL_FLAGS_RSS_VALID);
+ const __m128i cs_err_mask =
+ _mm_set1_epi32(RX_PKT_COMPRESS_CMPL_CS_ERROR_CALC_MASK |
+ BNXT_RXC_METADATA1_VLAN_VALID);
+ const __m128i crx_flags_mask =
+ _mm_set1_epi32(BNXT_CRX_CQE_CSUM_CALC_MASK);
+ const __m128i crx_tun_cs =
+ _mm_set1_epi32(BNXT_CRX_TUN_CS_CALC);
+ __m128i t0, t1, flags_type, flags, index, errors, rss_flags;
+ __m128i ptype_idx, is_tunnel;
+ uint32_t ol_flags;
+ __m128i cs_err;
+ __m128i t3, t4;
+
+ /* Validate ptype table indexing at build time. */
+ bnxt_check_ptype_constants();
+
+ /* Compute packet type table indexes for four packets */
+ t0 = _mm_unpacklo_epi32(mm_rxcmp[0], mm_rxcmp[1]);
+ t3 = _mm_unpackhi_epi32(mm_rxcmp[0], mm_rxcmp[1]);
+ t1 = _mm_unpacklo_epi32(mm_rxcmp[2], mm_rxcmp[3]);
+ t4 = _mm_unpackhi_epi32(mm_rxcmp[2], mm_rxcmp[3]);
+ flags_type = _mm_unpacklo_epi64(t0, t1);
+ ptype_idx = _mm_srli_epi32(_mm_and_si128(flags_type, flags_type_mask),
+ RX_PKT_CMPL_FLAGS_ITYPE_SFT - BNXT_PTYPE_TBL_TYPE_SFT);
+
+ flags = _mm_unpacklo_epi64(t0, t1);
+
+ ptype_idx = _mm_or_si128(ptype_idx,
+ _mm_srli_epi32(_mm_and_si128(flags, flags2_mask1),
+ RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT -
+ BNXT_PTYPE_TBL_VLAN_SFT));
+ ptype_idx = _mm_or_si128(ptype_idx,
+ _mm_srli_epi32(_mm_and_si128(flags, flags2_mask2),
+ RX_PKT_CMPL_FLAGS2_IP_TYPE_SFT -
+ BNXT_PTYPE_TBL_IP_VER_SFT));
+
+ /* Extract RSS valid flags for four packets. */
+ rss_flags = _mm_srli_epi32(_mm_and_si128(flags, rss_mask), 9);
+
+ /* Extract cs_err fields for four packets. */
+ cs_err = _mm_unpacklo_epi64(t3, t4);
+ cs_err = _mm_and_si128(cs_err, cs_err_mask);
+ flags = _mm_and_si128(cs_err, crx_flags_mask);
+
+ /* Compute ol_flags and checksum error indexes for four packets. */
+ is_tunnel = _mm_and_si128(flags, crx_tun_cs);
+ is_tunnel = _mm_slli_epi32(is_tunnel, 0x20);
+ flags = _mm_or_si128(flags, is_tunnel);
+
+ flags = _mm_srli_si128(flags, 1);
+
+ errors = _mm_and_si128(cs_err, _mm_set1_epi32(0xF0));
+ errors = _mm_and_si128(_mm_srli_epi32(errors, 4), flags);
+
+ index = _mm_andnot_si128(errors, flags);
+ /* reuse is_tunnel - just shift right one bit to index correctly. */
+ errors = _mm_or_si128(errors, _mm_srli_epi32(is_tunnel, 1));
+ index = _mm_or_si128(index, is_tunnel);
+
/* Update mbuf rearm_data for four packets. */
GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
_mm_store_si128((void *)&mbuf[0]->rearm_data,
@@ -392,8 +495,8 @@ crx_burst_vec_sse(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
if (num_valid == 0)
break;
- descs_to_mbufs(rxcmp, rxcmp1, mbuf_init, shuf_msk, &rx_pkts[nb_rx_pkts],
- rxr);
+ crx_descs_to_mbufs(rxcmp, rxcmp1, mbuf_init, shuf_msk,
+ &rx_pkts[nb_rx_pkts], rxr);
nb_rx_pkts += num_valid;
if (num_valid < BNXT_RX_DESCS_PER_LOOP_VEC128)
--
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 ` Ajit Khaparde [this message]
2024-02-22 19:47 ` [PATCH v2 09/10] net/bnxt: fix compressed Rx CQE handling Ajit Khaparde
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-9-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).