diff mbox series

[v2] net/i40e: fix incorrect checksum flag of L4 checksum

Message ID 20201203075030.70053-1-murphyx.yang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers show
Series [v2] net/i40e: fix incorrect checksum flag of L4 checksum | expand

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Murphy Yang Dec. 3, 2020, 7:50 a.m. UTC
When send tunneled packet that inner L4 checksum value is correct,
the test_pmd output log shows 'ol_flags' value is
'PKT_RX_L4_CKSUM_UNKNOWN', but expected value is
'PKT_RX_L4_CKSUM_GOOD'.

If the inner l4 checksum is correctly, mark the 'PKT_RX_L4_CKSUM_GOOD'
flag to 'l3_l4e_flags' for sse and 'l3_l4_flags_shuf' for avx2 to
ensure that the 'ol_flags' can match correct flags.

Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")
Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")

Signed-off-by: Murphy Yang <murphyx.yang@intel.com>
---
v2:
- update the comments.
 drivers/net/i40e/i40e_rxtx_vec_avx2.c | 40 ++++++++++++++++-----------
 drivers/net/i40e/i40e_rxtx_vec_sse.c  | 20 ++++++++------
 2 files changed, 35 insertions(+), 25 deletions(-)

Comments

Guo, Jia Dec. 4, 2020, 2:18 a.m. UTC | #1
Acked-by: Jeff Guo <jia.guo@intel.com>

> -----Original Message-----
> From: Murphy Yang <murphyx.yang@intel.com>
> Sent: Thursday, December 3, 2020 3:51 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>; Guo, Jia <jia.guo@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Yang, MurphyX <murphyx.yang@intel.com>
> Subject: [PATCH v2] net/i40e: fix incorrect checksum flag of L4 checksum
> 
> When send tunneled packet that inner L4 checksum value is correct, the
> test_pmd output log shows 'ol_flags' value is
> 'PKT_RX_L4_CKSUM_UNKNOWN', but expected value is
> 'PKT_RX_L4_CKSUM_GOOD'.
> 
> If the inner l4 checksum is correctly, mark the 'PKT_RX_L4_CKSUM_GOOD'
> flag to 'l3_l4e_flags' for sse and 'l3_l4_flags_shuf' for avx2 to ensure that the
> 'ol_flags' can match correct flags.
> 
> Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")
> Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")
> 
> Signed-off-by: Murphy Yang <murphyx.yang@intel.com>
> ---
> v2:
> - update the comments.
>  drivers/net/i40e/i40e_rxtx_vec_avx2.c | 40 ++++++++++++++++-----------
> drivers/net/i40e/i40e_rxtx_vec_sse.c  | 20 ++++++++------
>  2 files changed, 35 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
> b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
> index 7a558fc73a..fe6ec7deef 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
> @@ -342,24 +342,32 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue
> *rxq, struct rte_mbuf **rx_pkts,
>  	 */
>  	const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0,
> 0,
>  			/* shift right 1 bit to make sure it not exceed 255 */
> -			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD) >> 1,
> -			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_EIP_CKSUM_BAD) >> 1,
> -			(PKT_RX_L4_CKSUM_BAD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_L4_CKSUM_BAD) >> 1,
> -			PKT_RX_IP_CKSUM_BAD >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_L4_CKSUM_GOOD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD  |
> +			 PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD  |
> +			 PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_GOOD |
> +			 PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_GOOD |
> +			 PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_L4_CKSUM_BAD  |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_L4_CKSUM_BAD  |
> PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_L4_CKSUM_GOOD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_L4_CKSUM_GOOD |
> PKT_RX_IP_CKSUM_GOOD) >> 1,
>  			/* second 128-bits */
>  			0, 0, 0, 0, 0, 0, 0, 0,
> -			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD) >> 1,
> -			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_EIP_CKSUM_BAD) >> 1,
> -			(PKT_RX_L4_CKSUM_BAD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_L4_CKSUM_BAD) >> 1,
> -			PKT_RX_IP_CKSUM_BAD >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_L4_CKSUM_GOOD) >> 1);
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD  |
> +			 PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD  |
> +			 PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_GOOD |
> +			 PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_GOOD |
> +			 PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_L4_CKSUM_BAD  |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_L4_CKSUM_BAD  |
> PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_L4_CKSUM_GOOD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_L4_CKSUM_GOOD |
> PKT_RX_IP_CKSUM_GOOD) >> 1);
> 
>  	const __m256i cksum_mask = _mm256_set1_epi32(
>  			PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_IP_CKSUM_BAD | diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c
> b/drivers/net/i40e/i40e_rxtx_vec_sse.c
> index 4b2b6a28fc..0bcb48e24e 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
> @@ -254,16 +254,18 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq,
> volatile union i40e_rx_desc *rxdp,
> 
>  	const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
>  			/* shift right 1 bit to make sure it not exceed 255 */
> -			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD |
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD  |
>  			 PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_EIP_CKSUM_BAD |
> -			 PKT_RX_L4_CKSUM_BAD) >> 1,
> -			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_EIP_CKSUM_BAD) >> 1,
> -			(PKT_RX_L4_CKSUM_BAD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_L4_CKSUM_BAD) >> 1,
> -			PKT_RX_IP_CKSUM_BAD >> 1,
> -			(PKT_RX_IP_CKSUM_GOOD |
> PKT_RX_L4_CKSUM_GOOD) >> 1);
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_BAD  |
> +			 PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_GOOD |
> +			 PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_EIP_CKSUM_BAD |
> PKT_RX_L4_CKSUM_GOOD |
> +			 PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_L4_CKSUM_BAD  |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_L4_CKSUM_BAD  |
> PKT_RX_IP_CKSUM_GOOD) >> 1,
> +			(PKT_RX_L4_CKSUM_GOOD |
> PKT_RX_IP_CKSUM_BAD) >> 1,
> +			(PKT_RX_L4_CKSUM_GOOD |
> PKT_RX_IP_CKSUM_GOOD) >> 1);
> 
>  	/* Unpack "status" from quadword 1, bits 0:32 */
>  	vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);
> --
> 2.17.1
Zhang, Qi Z Dec. 11, 2020, 2:16 a.m. UTC | #2
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Guo, Jia
> Sent: Friday, December 4, 2020 10:19 AM
> To: Yang, MurphyX <murphyx.yang@intel.com>; dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang, MurphyX
> <murphyx.yang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix incorrect checksum flag of L4
> checksum
> 
> Acked-by: Jeff Guo <jia.guo@intel.com>
> 
> > -----Original Message-----
> > From: Murphy Yang <murphyx.yang@intel.com>
> > Sent: Thursday, December 3, 2020 3:51 PM
> > To: dev@dpdk.org
> > Cc: Yang, Qiming <qiming.yang@intel.com>; Yang, SteveX
> > <stevex.yang@intel.com>; Guo, Jia <jia.guo@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Yang, MurphyX <murphyx.yang@intel.com>
> > Subject: [PATCH v2] net/i40e: fix incorrect checksum flag of L4
> > checksum
> >
> > When send tunneled packet that inner L4 checksum value is correct, the
> > test_pmd output log shows 'ol_flags' value is
> > 'PKT_RX_L4_CKSUM_UNKNOWN', but expected value is
> > 'PKT_RX_L4_CKSUM_GOOD'.
> >
> > If the inner l4 checksum is correctly, mark the 'PKT_RX_L4_CKSUM_GOOD'
> > flag to 'l3_l4e_flags' for sse and 'l3_l4_flags_shuf' for avx2 to
> > ensure that the 'ol_flags' can match correct flags.
> >
> > Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector
> > Rx")
> > Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")
> >
> > Signed-off-by: Murphy Yang <murphyx.yang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
diff mbox series

Patch

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index 7a558fc73a..fe6ec7deef 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -342,24 +342,32 @@  _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 	 */
 	const __m256i l3_l4_flags_shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
 			/* shift right 1 bit to make sure it not exceed 255 */
-			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD) >> 1,
-			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
-			(PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
-			PKT_RX_IP_CKSUM_BAD >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+			 PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+			 PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+			 PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+			 PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1,
 			/* second 128-bits */
 			0, 0, 0, 0, 0, 0, 0, 0,
-			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD) >> 1,
-			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
-			(PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
-			PKT_RX_IP_CKSUM_BAD >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1);
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+			 PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+			 PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+			 PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+			 PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
 
 	const __m256i cksum_mask = _mm256_set1_epi32(
 			PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 4b2b6a28fc..0bcb48e24e 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -254,16 +254,18 @@  desc_to_olflags_v(struct i40e_rx_queue *rxq, volatile union i40e_rx_desc *rxdp,
 
 	const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
 			/* shift right 1 bit to make sure it not exceed 255 */
-			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
 			 PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD |
-			 PKT_RX_L4_CKSUM_BAD) >> 1,
-			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
-			(PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
-			PKT_RX_IP_CKSUM_BAD >> 1,
-			(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1);
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD  |
+			 PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+			 PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD |
+			 PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_L4_CKSUM_BAD  | PKT_RX_IP_CKSUM_GOOD) >> 1,
+			(PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD) >> 1,
+			(PKT_RX_L4_CKSUM_GOOD | PKT_RX_IP_CKSUM_GOOD) >> 1);
 
 	/* Unpack "status" from quadword 1, bits 0:32 */
 	vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);