From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 79B09A0524 for ; Fri, 5 Feb 2021 12:23:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71F344067B; Fri, 5 Feb 2021 12:23:25 +0100 (CET) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mails.dpdk.org (Postfix) with ESMTP id BB8F61606D2 for ; Fri, 5 Feb 2021 12:23:23 +0100 (CET) Received: by mail-wm1-f44.google.com with SMTP id m1so5625803wml.2 for ; Fri, 05 Feb 2021 03:23:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bUQwolaExnr6Eh0f556PjLNO2ntnnRXnQGxR/myuVPw=; b=WVM2AgHLGSXoxlCMEYZmXvoDmAJvougOhF6Gg0+4AVEveHHOzWlJJOF962puDzodu4 2fwGfw7F63CfsRxc2GIZoxOCrMASih8NVlc2GtF1UEokAnWSORXbk8omSX8tFpv8qCnU sbF2JdkJno7Z/m6JJNm93FAm8rx8LWIE5WXET0/hJeHuHAvnMuxI2r2wSEQy8EsLLEDC E8egdMuzGHwaP1Z6vzDJkWr6LBkwDnYdlA6nRF2yrzitrcrNTmPoV0QqZgGa7So2QhgP IbPuUPy0QNI+ujng3kBN+KThlumVm+vOF4wgde61QnaFA6ptlzmRziuUq8IaOW9WMC8H EhLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bUQwolaExnr6Eh0f556PjLNO2ntnnRXnQGxR/myuVPw=; b=cyyohPB+7VhdnYiw1Bzy8U4Yv+P4zix3UwXsKLuJNd/WnOEzSCGG+yADxTCNxPBfxR BCrMZFcC0mq1ndB6EGcghOgIhR4lTZBYzEbFgCU29ds+V11BPQSzqBZi6LILPGVzcziC V9CQMtRF3e0DphGa3XL/+sOYP9vgQEXEO4h2Yudm/53U6jebjfBto7GEblWDCua3StuI qIYqtP1SBB37udL+ngCk/fT38GqJoOz0MgLjgn50o1rcUl+a5eQ8t1v6K+SejJAkaafd Z6fg9g5z/y+dKaOUlOLUWfm64ssvK8KzN5TGGjRom9bil0uxRJEtEVt90EUF5GvQzfCE SqKQ== X-Gm-Message-State: AOAM530ChZfKqAzm59JNYAiojE9AoEJvq8mSUqI5HJ0dHlqwWVfJoGfp hI3vNg4jFvgVYcHdqhN1ib8= X-Google-Smtp-Source: ABdhPJwjFZ2R14Ge6dWHmLWFMmmhW3+QPDZST6gyVuw7LHA/OJPwz9qLVJ6DqdhCChDliM5DjoKQ5A== X-Received: by 2002:a1c:b1c3:: with SMTP id a186mr3234636wmf.8.1612524203517; Fri, 05 Feb 2021 03:23:23 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id c3sm6743010wrr.6.2021.02.05.03.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:23:22 -0800 (PST) From: luca.boccassi@gmail.com To: Lance Richardson Cc: Kalesh AP , Ajit Khaparde , dpdk stable Date: Fri, 5 Feb 2021 11:15:59 +0000 Message-Id: <20210205111920.1272063-73-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: set correct checksum status in mbuf' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/9784d3a37c39e6820fdb06ff04f958491c1d075b Thanks. Luca Boccassi --- >From 9784d3a37c39e6820fdb06ff04f958491c1d075b Mon Sep 17 00:00:00 2001 From: Lance Richardson Date: Fri, 18 Dec 2020 15:28:37 -0500 Subject: [PATCH] net/bnxt: set correct checksum status in mbuf [ upstream commit 48a580c5df78b3addac6f57969167bb86c7428f5 ] The setting of the mbuf ol_flags field for tunneled packets should be different depending upon whether DEV_RX_OFFLOAD_OUTER_* offloads are enabled. Initialize ol_flags mappings based on the receive offload configuration when the receive ring is initialized. Signed-off-by: Lance Richardson Reviewed-by: Kalesh AP Acked-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_rxr.c | 85 +++++++++++++++++++++------ drivers/net/bnxt/bnxt_rxr.h | 4 +- drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 6 +- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 6 +- 4 files changed, 80 insertions(+), 21 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index cba03bb38e..46e3fed127 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -407,43 +407,91 @@ bnxt_parse_pkt_type(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1) } static void __rte_cold -bnxt_init_ol_flags_tables(struct bnxt_rx_ring_info *rxr) +bnxt_init_ol_flags_tables(struct bnxt_rx_queue *rxq) { + struct bnxt_rx_ring_info *rxr = rxq->rx_ring; + struct rte_eth_conf *dev_conf; + bool outer_cksum_enabled; + uint64_t offloads; uint32_t *pt; int i; + dev_conf = &rxq->bp->eth_dev->data->dev_conf; + offloads = dev_conf->rxmode.offloads; + + outer_cksum_enabled = !!(offloads & (DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | + DEV_RX_OFFLOAD_OUTER_UDP_CKSUM)); + /* Initialize ol_flags table. */ pt = rxr->ol_flags_table; for (i = 0; i < BNXT_OL_FLAGS_TBL_DIM; i++) { pt[i] = 0; + if (i & RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN) pt[i] |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; - if (i & RX_PKT_CMPL_FLAGS2_IP_CS_CALC) - pt[i] |= PKT_RX_IP_CKSUM_GOOD; + if (i & (RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC << 3)) { + /* Tunnel case. */ + if (outer_cksum_enabled) { + if (i & RX_PKT_CMPL_FLAGS2_IP_CS_CALC) + pt[i] |= PKT_RX_IP_CKSUM_GOOD; - if (i & RX_PKT_CMPL_FLAGS2_L4_CS_CALC) - pt[i] |= PKT_RX_L4_CKSUM_GOOD; + if (i & RX_PKT_CMPL_FLAGS2_L4_CS_CALC) + pt[i] |= PKT_RX_L4_CKSUM_GOOD; - if (i & RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC) - pt[i] |= PKT_RX_OUTER_L4_CKSUM_GOOD; + if (i & RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC) + pt[i] |= PKT_RX_OUTER_L4_CKSUM_GOOD; + } else { + if (i & RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC) + pt[i] |= PKT_RX_IP_CKSUM_GOOD; + + if (i & RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC) + pt[i] |= PKT_RX_L4_CKSUM_GOOD; + } + } else { + /* Non-tunnel case. */ + if (i & RX_PKT_CMPL_FLAGS2_IP_CS_CALC) + pt[i] |= PKT_RX_IP_CKSUM_GOOD; + + if (i & RX_PKT_CMPL_FLAGS2_L4_CS_CALC) + pt[i] |= PKT_RX_L4_CKSUM_GOOD; + } } /* Initialize checksum error table. */ pt = rxr->ol_flags_err_table; for (i = 0; i < BNXT_OL_FLAGS_ERR_TBL_DIM; i++) { pt[i] = 0; - if (i & (RX_PKT_CMPL_ERRORS_IP_CS_ERROR >> 4)) - pt[i] |= PKT_RX_IP_CKSUM_BAD; - if (i & (RX_PKT_CMPL_ERRORS_L4_CS_ERROR >> 4)) - pt[i] |= PKT_RX_L4_CKSUM_BAD; + if (i & (RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC << 2)) { + /* Tunnel case. */ + if (outer_cksum_enabled) { + if (i & (RX_PKT_CMPL_ERRORS_IP_CS_ERROR >> 4)) + pt[i] |= PKT_RX_IP_CKSUM_BAD; - if (i & (RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR >> 4)) - pt[i] |= PKT_RX_EIP_CKSUM_BAD; + if (i & (RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR >> 4)) + pt[i] |= PKT_RX_EIP_CKSUM_BAD; - if (i & (RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR >> 4)) - pt[i] |= PKT_RX_OUTER_L4_CKSUM_BAD; + if (i & (RX_PKT_CMPL_ERRORS_L4_CS_ERROR >> 4)) + pt[i] |= PKT_RX_L4_CKSUM_BAD; + + if (i & (RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR >> 4)) + pt[i] |= PKT_RX_OUTER_L4_CKSUM_BAD; + } else { + if (i & (RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR >> 4)) + pt[i] |= PKT_RX_IP_CKSUM_BAD; + + if (i & (RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR >> 4)) + pt[i] |= PKT_RX_L4_CKSUM_BAD; + } + } else { + /* Non-tunnel case. */ + if (i & (RX_PKT_CMPL_ERRORS_IP_CS_ERROR >> 4)) + pt[i] |= PKT_RX_IP_CKSUM_BAD; + + if (i & (RX_PKT_CMPL_ERRORS_L4_CS_ERROR >> 4)) + pt[i] |= PKT_RX_L4_CKSUM_BAD; + } } } @@ -463,6 +511,7 @@ bnxt_set_ol_flags(struct bnxt_rx_ring_info *rxr, struct rx_pkt_cmpl *rxcmp, RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC | RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN); + flags |= (flags & RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC) << 3; errors = rte_le_to_cpu_16(rxcmp1->errors_v2) & (RX_PKT_CMPL_ERRORS_IP_CS_ERROR | RX_PKT_CMPL_ERRORS_L4_CS_ERROR | @@ -472,8 +521,10 @@ bnxt_set_ol_flags(struct bnxt_rx_ring_info *rxr, struct rx_pkt_cmpl *rxcmp, ol_flags = rxr->ol_flags_table[flags & ~errors]; - if (errors) + if (unlikely(errors)) { + errors |= (flags & RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC) << 2; ol_flags |= rxr->ol_flags_err_table[errors]; + } if (flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID) { mbuf->hash.rss = rte_le_to_cpu_32(rxcmp->rss_hash); @@ -1107,7 +1158,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq) bnxt_init_rxbds(ring, type, size); /* Initialize offload flags parsing table. */ - bnxt_init_ol_flags_tables(rxr); + bnxt_init_ol_flags_tables(rxq); prod = rxr->rx_prod; for (i = 0; i < ring->ring_size; i++) { diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h index 6ba997e150..46c34e6e16 100644 --- a/drivers/net/bnxt/bnxt_rxr.h +++ b/drivers/net/bnxt/bnxt_rxr.h @@ -42,8 +42,8 @@ static inline uint16_t bnxt_tpa_start_agg_id(struct bnxt *bp, /* Number of descriptors to process per inner loop in vector mode. */ #define RTE_BNXT_DESCS_PER_LOOP 4U -#define BNXT_OL_FLAGS_TBL_DIM 32 -#define BNXT_OL_FLAGS_ERR_TBL_DIM 16 +#define BNXT_OL_FLAGS_TBL_DIM 64 +#define BNXT_OL_FLAGS_ERR_TBL_DIM 32 struct bnxt_tpa_info { struct rte_mbuf *mbuf; diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c index 226a3f22d4..54f47a3fe1 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c @@ -80,7 +80,7 @@ descs_to_mbufs(uint32x4_t mm_rxcmp[4], uint32x4_t mm_rxcmp1[4], const uint32x4_t flags2_index_mask = vdupq_n_u32(0x1F); const uint32x4_t flags2_error_mask = vdupq_n_u32(0x0F); uint32x4_t flags_type, flags2, index, errors, rss_flags; - uint32x4_t tmp, ptype_idx; + uint32x4_t tmp, ptype_idx, is_tunnel; uint64x2_t t0, t1; uint32_t ol_flags; @@ -117,10 +117,14 @@ descs_to_mbufs(uint32x4_t mm_rxcmp[4], uint32x4_t mm_rxcmp1[4], vget_low_u64(t1))); /* Compute ol_flags and checksum error indexes for four packets. */ + is_tunnel = vandq_u32(flags2, vdupq_n_u32(4)); + is_tunnel = vshlq_n_u32(is_tunnel, 3); errors = vandq_u32(vshrq_n_u32(errors, 4), flags2_error_mask); errors = vandq_u32(errors, flags2); index = vbicq_u32(flags2, errors); + errors = vorrq_u32(errors, vshrq_n_u32(is_tunnel, 1)); + index = vorrq_u32(index, is_tunnel); /* Update mbuf rearm_data for four packets. */ GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags); diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c index 982dac0d9c..621f567890 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c @@ -73,7 +73,7 @@ descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4], const __m128i rss_mask = _mm_set1_epi32(RX_PKT_CMPL_FLAGS_RSS_VALID); __m128i t0, t1, flags_type, flags2, index, errors, rss_flags; - __m128i ptype_idx; + __m128i ptype_idx, is_tunnel; uint32_t ol_flags; /* Compute packet type table indexes for four packets */ @@ -100,6 +100,8 @@ descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4], t1 = _mm_unpackhi_epi32(mm_rxcmp1[2], mm_rxcmp1[3]); /* Compute ol_flags and checksum error indexes for four packets. */ + is_tunnel = _mm_and_si128(flags2, _mm_set1_epi32(4)); + is_tunnel = _mm_slli_epi32(is_tunnel, 3); flags2 = _mm_and_si128(flags2, _mm_set1_epi32(0x1F)); errors = _mm_srli_epi32(_mm_unpacklo_epi64(t0, t1), 4); @@ -107,6 +109,8 @@ descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4], errors = _mm_and_si128(errors, flags2); index = _mm_andnot_si128(errors, flags2); + 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); -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:32.535741146 +0000 +++ 0073-net-bnxt-set-correct-checksum-status-in-mbuf.patch 2021-02-05 11:18:28.846691874 +0000 @@ -1 +1 @@ -From 48a580c5df78b3addac6f57969167bb86c7428f5 Mon Sep 17 00:00:00 2001 +From 9784d3a37c39e6820fdb06ff04f958491c1d075b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 48a580c5df78b3addac6f57969167bb86c7428f5 ] + @@ -12,2 +13,0 @@ -Cc: stable@dpdk.org - @@ -25 +25 @@ -index 1edc8dac43..14901f1b99 100644 +index cba03bb38e..46e3fed127 100644 @@ -28 +28 @@ -@@ -416,43 +416,91 @@ bnxt_parse_pkt_type(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1) +@@ -407,43 +407,91 @@ bnxt_parse_pkt_type(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1) @@ -135 +135 @@ -@@ -472,6 +520,7 @@ bnxt_set_ol_flags(struct bnxt_rx_ring_info *rxr, struct rx_pkt_cmpl *rxcmp, +@@ -463,6 +511,7 @@ bnxt_set_ol_flags(struct bnxt_rx_ring_info *rxr, struct rx_pkt_cmpl *rxcmp, @@ -143 +143 @@ -@@ -481,8 +530,10 @@ bnxt_set_ol_flags(struct bnxt_rx_ring_info *rxr, struct rx_pkt_cmpl *rxcmp, +@@ -472,8 +521,10 @@ bnxt_set_ol_flags(struct bnxt_rx_ring_info *rxr, struct rx_pkt_cmpl *rxcmp, @@ -155 +155 @@ -@@ -1125,7 +1176,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq) +@@ -1107,7 +1158,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq) @@ -162 +162 @@ - raw_prod = rxr->rx_raw_prod; + prod = rxr->rx_prod; @@ -165 +165 @@ -index 4db1e8761e..b2942030ab 100644 +index 6ba997e150..46c34e6e16 100644 @@ -180 +180 @@ -index d9ac822be8..4839e2a38d 100644 +index 226a3f22d4..54f47a3fe1 100644 @@ -208 +208 @@ -index 7f5825d333..c2523040e8 100644 +index 982dac0d9c..621f567890 100644