DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet
@ 2021-12-08  9:56 Kevin Liu
  2021-12-12 14:35 ` [PATCH v2] net/ice: fix Tx Checksum offload Kevin Liu
  2022-01-02  8:46 ` [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet Zhang, Qi Z
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Liu @ 2021-12-08  9:56 UTC (permalink / raw)
  To: dev; +Cc: robinx.zhang, jie1x.wang, Kevin Liu

In ice_txd_enable_offload(), when set tunnel packet Tx checksum
offload enable, td_offset should be set with outer l2/l3 len instead
of inner l2/l3 len.

This patch fix the bug that the checksum engine can forward tunnle
packets.

Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")

Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
---
 drivers/net/ice/ice_rxtx_vec_common.h | 52 +++++++++++++++++++--------
 1 file changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index dfe60c81d9..8ff01046e1 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -364,23 +364,45 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
 	uint32_t td_offset = 0;
 
 	/* Tx Checksum Offload */
-	/* SET MACLEN */
-	td_offset |= (tx_pkt->l2_len >> 1) <<
+	/*Tunnel package usage outer len enable L2/L3 checksum offload*/
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+		/* SET MACLEN */
+		td_offset |= (tx_pkt->outer_l2_len >> 1) <<
 			ICE_TX_DESC_LEN_MACLEN_S;
 
-	/* Enable L3 checksum offload */
-	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+		/* Enable L3 checksum offload */
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
+	} else {
+		/* SET MACLEN */
+		td_offset |= (tx_pkt->l2_len >> 1) <<
+			ICE_TX_DESC_LEN_MACLEN_S;
+
+		/* Enable L3 checksum offload */
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
 	}
 
 	/* Enable L4 checksum offloads */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] net/ice: fix Tx Checksum offload
  2021-12-08  9:56 [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet Kevin Liu
@ 2021-12-12 14:35 ` Kevin Liu
  2022-01-10  9:36   ` Zhang, Qi Z
  2022-01-02  8:46 ` [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet Zhang, Qi Z
  1 sibling, 1 reply; 7+ messages in thread
From: Kevin Liu @ 2021-12-12 14:35 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, qi.z.zhang, stevex.yang, Kevin Liu, stable

The tunnel packets is missing some information after Tx forwarding.

In ice_txd_enable_offload, when set tunnel packet Tx checksum
offload enable, td_offset should be set with outer l2/l3 len instead
of inner l2/l3 len.

In ice_txd_enable_checksum, td_offset should also be set with outer
l3 len.

This patch fix the bug that the checksum engine can forward Ipv4/Ipv6
tunnel packets.

Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")
Fixes: 17c7d0f9d6a4 ("net/ice: support basic Rx/Tx")
Cc: stable@dpdk.org

Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
---
v2:
- Refine the title and fix code in ice_txd_enable_checksum.
---
 drivers/net/ice/ice_rxtx.c            | 41 ++++++++++++++-------
 drivers/net/ice/ice_rxtx_vec_common.h | 52 +++++++++++++++++++--------
 2 files changed, 66 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index f6d8564ab8..d50acf5391 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2490,18 +2490,35 @@ ice_txd_enable_checksum(uint64_t ol_flags,
 			<< ICE_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloads */
-	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-		*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
-		*td_offset |= (tx_offload.l3_len >> 2) <<
-			      ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
-		*td_offset |= (tx_offload.l3_len >> 2) <<
-			      ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
-		*td_offset |= (tx_offload.l3_len >> 2) <<
-			      ICE_TX_DESC_LEN_IPLEN_S;
+	/*Tunnel package usage outer len enable L3 checksum offload*/
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			*td_offset |= (tx_offload.outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			*td_offset |= (tx_offload.outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			*td_offset |= (tx_offload.outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
+	} else {
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			*td_offset |= (tx_offload.l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			*td_offset |= (tx_offload.l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			*td_offset |= (tx_offload.l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
 	}
 
 	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index dfe60c81d9..8ff01046e1 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -364,23 +364,45 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
 	uint32_t td_offset = 0;
 
 	/* Tx Checksum Offload */
-	/* SET MACLEN */
-	td_offset |= (tx_pkt->l2_len >> 1) <<
+	/*Tunnel package usage outer len enable L2/L3 checksum offload*/
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+		/* SET MACLEN */
+		td_offset |= (tx_pkt->outer_l2_len >> 1) <<
 			ICE_TX_DESC_LEN_MACLEN_S;
 
-	/* Enable L3 checksum offload */
-	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+		/* Enable L3 checksum offload */
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
+	} else {
+		/* SET MACLEN */
+		td_offset |= (tx_pkt->l2_len >> 1) <<
+			ICE_TX_DESC_LEN_MACLEN_S;
+
+		/* Enable L3 checksum offload */
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
 	}
 
 	/* Enable L4 checksum offloads */
-- 
2.33.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet
  2021-12-08  9:56 [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet Kevin Liu
  2021-12-12 14:35 ` [PATCH v2] net/ice: fix Tx Checksum offload Kevin Liu
@ 2022-01-02  8:46 ` Zhang, Qi Z
  2022-01-04  8:35   ` Liu, KevinX
  1 sibling, 1 reply; 7+ messages in thread
From: Zhang, Qi Z @ 2022-01-02  8:46 UTC (permalink / raw)
  To: Liu, KevinX, dev; +Cc: Zhang, RobinX, Wang, Jie1X, Liu, KevinX



> -----Original Message-----
> From: Kevin Liu <kevinx.liu@intel.com>
> Sent: Wednesday, December 8, 2021 5:56 PM
> To: dev@dpdk.org
> Cc: Zhang, RobinX <robinx.zhang@intel.com>; Wang, Jie1X
> <jie1x.wang@intel.com>; Liu, KevinX <kevinx.liu@intel.com>
> Subject: [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet
> 
> In ice_txd_enable_offload(), when set tunnel packet Tx checksum offload
> enable, td_offset should be set with outer l2/l3 len instead of inner l2/l3 len.
> 
> This patch fix the bug that the checksum engine can forward tunnle packets.

s/tunnle/tunnel

> 
> Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")
> 
> Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
> ---
>  drivers/net/ice/ice_rxtx_vec_common.h | 52 +++++++++++++++++++--------
>  1 file changed, 37 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_rxtx_vec_common.h
> b/drivers/net/ice/ice_rxtx_vec_common.h
> index dfe60c81d9..8ff01046e1 100644
> --- a/drivers/net/ice/ice_rxtx_vec_common.h
> +++ b/drivers/net/ice/ice_rxtx_vec_common.h
> @@ -364,23 +364,45 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
>  	uint32_t td_offset = 0;
> 
>  	/* Tx Checksum Offload */
> -	/* SET MACLEN */
> -	td_offset |= (tx_pkt->l2_len >> 1) <<
> +	/*Tunnel package usage outer len enable L2/L3 checksum offload*/
> +	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
> +		/* SET MACLEN */
> +		td_offset |= (tx_pkt->outer_l2_len >> 1) <<
>  			ICE_TX_DESC_LEN_MACLEN_S;
> 
> -	/* Enable L3 checksum offload */
> -	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
> -		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
> -		td_offset |= (tx_pkt->l3_len >> 2) <<
> -			ICE_TX_DESC_LEN_IPLEN_S;
> -	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
> -		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
> -		td_offset |= (tx_pkt->l3_len >> 2) <<
> -			ICE_TX_DESC_LEN_IPLEN_S;
> -	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
> -		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
> -		td_offset |= (tx_pkt->l3_len >> 2) <<
> -			ICE_TX_DESC_LEN_IPLEN_S;
> +		/* Enable L3 checksum offload */
> +		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
> +			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
> +			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
> +				ICE_TX_DESC_LEN_IPLEN_S;

Is this fix also cover IPv4 Tx checksum offload? 
Please refine the title to reflect what exactly the patch does if necessary.

Btw, could you also check if any fix needed in ice_txd_enable_checksum?
I saw inconsistent offset configure on l3_len between scaler path and vector path.
Its better to always keep them identical.  



^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet
  2022-01-02  8:46 ` [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet Zhang, Qi Z
@ 2022-01-04  8:35   ` Liu, KevinX
  0 siblings, 0 replies; 7+ messages in thread
From: Liu, KevinX @ 2022-01-04  8:35 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: Zhang, RobinX, Wang, Jie1X, Yang, SteveX



> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: 2022年1月2日 16:46
> To: Liu, KevinX <kevinx.liu@intel.com>; dev@dpdk.org
> Cc: Zhang, RobinX <robinx.zhang@intel.com>; Wang, Jie1X
> <jie1x.wang@intel.com>; Liu, KevinX <kevinx.liu@intel.com>
> Subject: RE: [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet
> 
> 
> 
> > -----Original Message-----
> > From: Kevin Liu <kevinx.liu@intel.com>
> > Sent: Wednesday, December 8, 2021 5:56 PM
> > To: dev@dpdk.org
> > Cc: Zhang, RobinX <robinx.zhang@intel.com>; Wang, Jie1X
> > <jie1x.wang@intel.com>; Liu, KevinX <kevinx.liu@intel.com>
> > Subject: [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet
> >
> > In ice_txd_enable_offload(), when set tunnel packet Tx checksum
> > offload enable, td_offset should be set with outer l2/l3 len instead of inner
> l2/l3 len.
> >
> > This patch fix the bug that the checksum engine can forward tunnle packets.
> 
> s/tunnle/tunnel
> 
> >
> > Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")
> >
> > Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
> > ---
> >  drivers/net/ice/ice_rxtx_vec_common.h | 52
> > +++++++++++++++++++--------
> >  1 file changed, 37 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/net/ice/ice_rxtx_vec_common.h
> > b/drivers/net/ice/ice_rxtx_vec_common.h
> > index dfe60c81d9..8ff01046e1 100644
> > --- a/drivers/net/ice/ice_rxtx_vec_common.h
> > +++ b/drivers/net/ice/ice_rxtx_vec_common.h
> > @@ -364,23 +364,45 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
> > uint32_t td_offset = 0;
> >
> >  /* Tx Checksum Offload */
> > -/* SET MACLEN */
> > -td_offset |= (tx_pkt->l2_len >> 1) <<
> > +/*Tunnel package usage outer len enable L2/L3 checksum offload*/ if
> > +(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
> > +/* SET MACLEN */
> > +td_offset |= (tx_pkt->outer_l2_len >> 1) <<
> >  ICE_TX_DESC_LEN_MACLEN_S;
> >
> > -/* Enable L3 checksum offload */
> > -if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { -td_cmd |=
> > ICE_TX_DESC_CMD_IIPT_IPV4_CSUM; -td_offset |= (tx_pkt->l3_len >> 2)
> <<
> > -ICE_TX_DESC_LEN_IPLEN_S; -} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
> > -td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4; -td_offset |= (tx_pkt->l3_len >>
> > 2) << -ICE_TX_DESC_LEN_IPLEN_S; -} else if (ol_flags &
> > RTE_MBUF_F_TX_IPV6) { -td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6; -
> td_offset
> > |= (tx_pkt->l3_len >> 2) << -ICE_TX_DESC_LEN_IPLEN_S;
> > +/* Enable L3 checksum offload */
> > +if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { td_cmd |=
> > +ICE_TX_DESC_CMD_IIPT_IPV4_CSUM; td_offset |= (tx_pkt-
> >outer_l3_len >>
> > +2) << ICE_TX_DESC_LEN_IPLEN_S;
> 
> Is this fix also cover IPv4 Tx checksum offload?
Yes, cover it.
> Please refine the title to reflect what exactly the patch does if necessary.
> 
> Btw, could you also check if any fix needed in ice_txd_enable_checksum?
> I saw inconsistent offset configure on l3_len between scaler path and vector
> path.
> Its better to always keep them identical.
> 
> 
I checked code in ice_txd_enable_checksum, and it should also be fixed here. I will send a new patch of v2.

Thanks
Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v2] net/ice: fix Tx Checksum offload
  2021-12-12 14:35 ` [PATCH v2] net/ice: fix Tx Checksum offload Kevin Liu
@ 2022-01-10  9:36   ` Zhang, Qi Z
  0 siblings, 0 replies; 7+ messages in thread
From: Zhang, Qi Z @ 2022-01-10  9:36 UTC (permalink / raw)
  To: Liu, KevinX, dev; +Cc: Yang, Qiming, Yang, SteveX, stable



> -----Original Message-----
> From: Liu, KevinX <kevinx.liu@intel.com>
> Sent: Sunday, December 12, 2021 10:35 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Yang, SteveX <stevex.yang@intel.com>; Liu, KevinX
> <kevinx.liu@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/ice: fix Tx Checksum offload
> 
> The tunnel packets is missing some information after Tx forwarding.
> 
> In ice_txd_enable_offload, when set tunnel packet Tx checksum offload enable,
> td_offset should be set with outer l2/l3 len instead of inner l2/l3 len.
> 
> In ice_txd_enable_checksum, td_offset should also be set with outer
> l3 len.
> 
> This patch fix the bug that the checksum engine can forward Ipv4/Ipv6 tunnel
> packets.
> 
> Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")
> Fixes: 17c7d0f9d6a4 ("net/ice: support basic Rx/Tx")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kevin Liu <kevinx.liu@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet
@ 2021-12-09  2:08 Kevin Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Liu @ 2021-12-09  2:08 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, qi.z.zhang, stevex.yang, Kevin Liu, stable

In ice_txd_enable_offload(), when set tunnel packet Tx checksum
offload enable, td_offset should be set with outer l2/l3 len instead
of inner l2/l3 len.

This patch fix the bug that the checksum engine can forward tunnle
packets.

Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")
Cc: stable@dpdk.org

Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
---
 drivers/net/ice/ice_rxtx_vec_common.h | 52 +++++++++++++++++++--------
 1 file changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index dfe60c81d9..8ff01046e1 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -364,23 +364,45 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
 	uint32_t td_offset = 0;
 
 	/* Tx Checksum Offload */
-	/* SET MACLEN */
-	td_offset |= (tx_pkt->l2_len >> 1) <<
+	/*Tunnel package usage outer len enable L2/L3 checksum offload*/
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+		/* SET MACLEN */
+		td_offset |= (tx_pkt->outer_l2_len >> 1) <<
 			ICE_TX_DESC_LEN_MACLEN_S;
 
-	/* Enable L3 checksum offload */
-	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+		/* Enable L3 checksum offload */
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
+	} else {
+		/* SET MACLEN */
+		td_offset |= (tx_pkt->l2_len >> 1) <<
+			ICE_TX_DESC_LEN_MACLEN_S;
+
+		/* Enable L3 checksum offload */
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
 	}
 
 	/* Enable L4 checksum offloads */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet
@ 2021-12-08  9:13 Kevin Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Liu @ 2021-12-08  9:13 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, qi.z.zhang, stevex.yang, Kevin Liu

In ice_txd_enable_offload(), when set tunnel packet Tx checksum
offload enable, td_offset should be set with outer l2/l3 len instead
of inner l2/l3 len.

This patch fix the bug that the checksum engine can forward tunnle
packets.

Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")

Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
---
 drivers/net/ice/ice_rxtx_vec_common.h | 52 +++++++++++++++++++--------
 1 file changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index dfe60c81d9..8ff01046e1 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -364,23 +364,45 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
 	uint32_t td_offset = 0;
 
 	/* Tx Checksum Offload */
-	/* SET MACLEN */
-	td_offset |= (tx_pkt->l2_len >> 1) <<
+	/*Tunnel package usage outer len enable L2/L3 checksum offload*/
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+		/* SET MACLEN */
+		td_offset |= (tx_pkt->outer_l2_len >> 1) <<
 			ICE_TX_DESC_LEN_MACLEN_S;
 
-	/* Enable L3 checksum offload */
-	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
-	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
-		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+		/* Enable L3 checksum offload */
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
+	} else {
+		/* SET MACLEN */
+		td_offset |= (tx_pkt->l2_len >> 1) <<
+			ICE_TX_DESC_LEN_MACLEN_S;
+
+		/* Enable L3 checksum offload */
+		if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+			td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+			td_offset |= (tx_pkt->l3_len >> 2) <<
+				ICE_TX_DESC_LEN_IPLEN_S;
+		}
 	}
 
 	/* Enable L4 checksum offloads */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-10  9:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08  9:56 [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet Kevin Liu
2021-12-12 14:35 ` [PATCH v2] net/ice: fix Tx Checksum offload Kevin Liu
2022-01-10  9:36   ` Zhang, Qi Z
2022-01-02  8:46 ` [PATCH] net/ice: fix error forwarding IPv6 VXLAN packet Zhang, Qi Z
2022-01-04  8:35   ` Liu, KevinX
  -- strict thread matches above, loose matches on Subject: below --
2021-12-09  2:08 Kevin Liu
2021-12-08  9:13 Kevin Liu

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).