[v2] net/iavf: fix outer udp checksum offload

Message ID 20221213014512.150575-1-zhichaox.zeng@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/iavf: fix outer udp checksum offload |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Zhichao Zeng Dec. 13, 2022, 1:45 a.m. UTC
Currently, when dealing with UDP tunnel pkts checksum offloading,
the outer-udp checksum will be offloaded by default. So the
'csum set outer-udp hw/sw' command does not work.

This patch fixes judgment of the EIPT flag and enables the
'csum set outer-udp hw/sw' command by adding judgment for the
outer-udp checksum offload flag.

Fixes: 0c550022fb82 ("net/iavf: fix Tx descriptors for IPsec")

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 drivers/net/iavf/iavf_rxtx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Ke Xu Dec. 14, 2022, 1:50 a.m. UTC | #1
> -----Original Message-----
> From: Zeng, ZhichaoX <zhichaox.zeng@intel.com>
> Sent: Tuesday, December 13, 2022 9:45 AM
> To: dev@dpdk.org
> Cc: Zhou, YidingX <yidingx.zhou@intel.com>; Xu, Ke1 <ke1.xu@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>; Zeng, ZhichaoX
> <zhichaox.zeng@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Nicolau, Radu <radu.nicolau@intel.com>
> Subject: [PATCH v2] net/iavf: fix outer udp checksum offload
> 
> Currently, when dealing with UDP tunnel pkts checksum offloading, the
> outer-udp checksum will be offloaded by default. So the 'csum set outer-udp
> hw/sw' command does not work.
> 
> This patch fixes judgment of the EIPT flag and enables the 'csum set outer-
> udp hw/sw' command by adding judgment for the outer-udp checksum
> offload flag.
> 
> Fixes: 0c550022fb82 ("net/iavf: fix Tx descriptors for IPsec")
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>

Verified and passed.

Verified applying only outer IP checksum without outer UDP checksum. Outer UDP checksum will be errors as this feature is to ignore this checksum error. Inner checksum is not influenced. Outer IP checksum is not influenced.

Verified applying all checksum HW offload.

> ---
>  drivers/net/iavf/iavf_rxtx.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
  
Qi Zhang Dec. 26, 2022, 2:34 a.m. UTC | #2
> -----Original Message-----
> From: Xu, Ke1 <ke1.xu@intel.com>
> Sent: Wednesday, December 14, 2022 9:51 AM
> To: Zeng, ZhichaoX <zhichaox.zeng@intel.com>; dev@dpdk.org
> Cc: Zhou, YidingX <yidingx.zhou@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Nicolau, Radu <radu.nicolau@intel.com>
> Subject: RE: [PATCH v2] net/iavf: fix outer udp checksum offload
> 
> 
> 
> > -----Original Message-----
> > From: Zeng, ZhichaoX <zhichaox.zeng@intel.com>
> > Sent: Tuesday, December 13, 2022 9:45 AM
> > To: dev@dpdk.org
> > Cc: Zhou, YidingX <yidingx.zhou@intel.com>; Xu, Ke1
> > <ke1.xu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Zeng, ZhichaoX
> > <zhichaox.zeng@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> > Beilei <beilei.xing@intel.com>; Nicolau, Radu <radu.nicolau@intel.com>
> > Subject: [PATCH v2] net/iavf: fix outer udp checksum offload
> >
> > Currently, when dealing with UDP tunnel pkts checksum offloading, the
> > outer-udp checksum will be offloaded by default. So the 'csum set
> > outer-udp hw/sw' command does not work.
> >
> > This patch fixes judgment of the EIPT flag and enables the 'csum set
> > outer- udp hw/sw' command by adding judgment for the outer-udp
> > checksum offload flag.
> >
> > Fixes: 0c550022fb82 ("net/iavf: fix Tx descriptors for IPsec")
> >
> > Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
> 
> Verified and passed.
> 
> Verified applying only outer IP checksum without outer UDP checksum. Outer
> UDP checksum will be errors as this feature is to ignore this checksum error.
> Inner checksum is not influenced. Outer IP checksum is not influenced.
> 
> Verified applying all checksum HW offload.
> 
> > ---
> >  drivers/net/iavf/iavf_rxtx.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index cf87a6beda..8d49967538 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2453,8 +2453,11 @@  iavf_fill_ctx_desc_tunnelling_field(volatile uint64_t *qw0,
 		 * Calculate the tunneling UDP checksum.
 		 * Shall be set only if L4TUNT = 01b and EIPT is not zero
 		 */
-		if (!(eip_typ & IAVF_TX_CTX_EXT_IP_NONE) &&
-		    (eip_typ & IAVF_TXD_CTX_UDP_TUNNELING))
+		if ((eip_typ & (IAVF_TX_CTX_EXT_IP_IPV6 |
+					IAVF_TX_CTX_EXT_IP_IPV4 |
+					IAVF_TX_CTX_EXT_IP_IPV4_NO_CSUM)) &&
+				(eip_typ & IAVF_TXD_CTX_UDP_TUNNELING) &&
+				(m->ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM))
 			eip_typ |= IAVF_TXD_CTX_QW0_L4T_CS_MASK;
 	}