DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Yang, Qiming" <qiming.yang@intel.com>
To: "Zhang, Peng1X" <peng1x.zhang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Xing, Beilei" <beilei.xing@intel.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>,
	"Zhang, Peng1X" <peng1x.zhang@intel.com>
Subject: RE: [PATCH 2/2] net/iavf: support inner and outer checksum offload
Date: Tue, 30 Aug 2022 08:12:22 +0000	[thread overview]
Message-ID: <MWHPR11MB1886C9FED7123142438309ADE5799@MWHPR11MB1886.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220812165223.470777-2-peng1x.zhang@intel.com>



> -----Original Message-----
> From: peng1x.zhang@intel.com <peng1x.zhang@intel.com>
> Sent: Saturday, August 13, 2022 12:52 AM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Zhang, Peng1X <peng1x.zhang@intel.com>
> Subject: [PATCH 2/2] net/iavf: support inner and outer checksum offload
> 
> From: Peng Zhang <peng1x.zhang@intel.com>

No need this line.

> 
> Add the support of inner and outer Tx checksum offload for tunneling
> packets by configuring tunneling parameters in Tx descriptors, including
> outer L3/L4 checksum offload.

Enable inner and outer Tx checksum offload for tunnel patch by configure ol_flags.

> 
> Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c |  3 +-
>  drivers/net/iavf/iavf_rxtx.c   | 51 +++++++++++++++++++++++++++++++---
>  drivers/net/iavf/iavf_rxtx.h   |  8 +++++-
>  3 files changed, 56 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 506fcff6e3..59238ecceb 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -1140,7 +1140,8 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct
> rte_eth_dev_info *dev_info)
>  		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |
>  		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |
>  		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |
> -		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
> +		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE |
> +		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM;

Add this line after outer_ipv4_chsum

> 
>  	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_CRC)
>  		dev_info->rx_offload_capa |=
> RTE_ETH_RX_OFFLOAD_KEEP_CRC; diff --git a/drivers/net/iavf/iavf_rxtx.c
> b/drivers/net/iavf/iavf_rxtx.c index adec58e90a..7cbebafc09 100644
> --- a/drivers/net/iavf/iavf_rxtx.c
> +++ b/drivers/net/iavf/iavf_rxtx.c
> @@ -2334,7 +2334,7 @@ static inline uint16_t
> iavf_calc_context_desc(uint64_t flags, uint8_t vlan_flag)  {
>  	if (flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG |
> -			RTE_MBUF_F_TX_TUNNEL_MASK))
> +	    RTE_MBUF_F_TX_TUNNEL_MASK |
> RTE_MBUF_F_TX_OUTER_IP_CKSUM))

OUTER_UDP_CKSUM?

>  		return 1;
>  	if (flags & RTE_MBUF_F_TX_VLAN &&
>  	    vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2)
> @@ -2399,6 +2399,44 @@ iavf_fill_ctx_desc_tunnelling_field(volatile
> uint64_t *qw0,
>  	break;
>  	}
> 
> +	/* L4TUNT: L4 Tunneling Type */
> +	switch (m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
> +	case RTE_MBUF_F_TX_TUNNEL_IPIP:
> +		/* for non UDP / GRE tunneling, set to 00b */
> +		break;
> +	case RTE_MBUF_F_TX_TUNNEL_VXLAN:
> +	case RTE_MBUF_F_TX_TUNNEL_GTP:
> +	case RTE_MBUF_F_TX_TUNNEL_GENEVE:
> +		eip_typ |= IAVF_TXD_CTX_UDP_TUNNELING;
> +		break;
> +	case RTE_MBUF_F_TX_TUNNEL_GRE:
> +		eip_typ |= IAVF_TXD_CTX_GRE_TUNNELING;
> +		break;
> +	default:
> +		PMD_TX_LOG(ERR, "Tunnel type not supported");
> +		return;
> +	}
> +
> +	/* L4TUNLEN: L4 Tunneling Length, in Words
> +	 *
> +	 * We depend on app to set rte_mbuf.l2_len correctly.
> +	 * For IP in GRE it should be set to the length of the GRE
> +	 * header;
> +	 * For MAC in GRE or MAC in UDP it should be set to the length
> +	 * of the GRE or UDP headers plus the inner MAC up to including
> +	 * its last Ethertype.
> +	 * If MPLS labels exists, it should include them as well.
> +	 */
> +	eip_typ |= (m->l2_len >> 1) << IAVF_TXD_CTX_QW0_NATLEN_SHIFT;
> +
> +	/**
> +	 * 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))
> +		eip_typ |= IAVF_TXD_CTX_QW0_L4T_CS_MASK;
> +
>  	*qw0 = eip_typ << IAVF_TXD_CTX_QW0_TUN_PARAMS_EIPT_SHIFT |
>  		eip_len <<
> IAVF_TXD_CTX_QW0_TUN_PARAMS_EIPLEN_SHIFT |
>  		eip_noinc <<
> IAVF_TXD_CTX_QW0_TUN_PARAMS_EIP_NOINC_SHIFT;
> @@ -2417,7 +2455,7 @@ iavf_fill_ctx_desc_segmentation_field(volatile
> uint64_t *field,
>  		total_length = m->pkt_len - (m->l2_len + m->l3_len + m-
> >l4_len);
> 
>  		if (m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
> -			total_length -= m->outer_l3_len;
> +			total_length -= m->outer_l3_len +  m->outer_l2_len;

Not related, delete

>  	}
> 
>  #ifdef RTE_LIBRTE_IAVF_DEBUG_TX
> @@ -2535,8 +2573,13 @@ iavf_build_data_desc_cmd_offset_fields(volatile
> uint64_t *qw1,
>  	}
> 
>  	/* Set MACLEN */
> -	offset |= (m->l2_len >> 1) << IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
> -
> +	if (m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
> +		offset |= (m->outer_l2_len >> 1)
> +			<< IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
> +	else
> +		offset |= (m->l2_len >> 1)
> +			<< IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
> +
>  	/* Enable L3 checksum offloading inner */
>  	if (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
>  		if (m->ol_flags & RTE_MBUF_F_TX_IPV4) { diff --git
> a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h index
> 1695e43cd5..4b40ad3615 100644
> --- a/drivers/net/iavf/iavf_rxtx.h
> +++ b/drivers/net/iavf/iavf_rxtx.h
> @@ -26,6 +26,8 @@
>  #define IAVF_TX_NO_VECTOR_FLAGS (				 \
>  		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		 \
>  		RTE_ETH_TX_OFFLOAD_TCP_TSO |		 \
> +		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |    \
> +		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
>  		RTE_ETH_TX_OFFLOAD_SECURITY)
> 
>  #define IAVF_TX_VECTOR_OFFLOAD (				 \
> @@ -56,7 +58,8 @@
>  #define IAVF_TX_CKSUM_OFFLOAD_MASK (		 \
>  		RTE_MBUF_F_TX_IP_CKSUM |		 \
>  		RTE_MBUF_F_TX_L4_MASK |		 \
> -		RTE_MBUF_F_TX_TCP_SEG)
> +		RTE_MBUF_F_TX_TCP_SEG |          \

UDP

> +		RTE_MBUF_F_TX_OUTER_IP_CKSUM)
> 
>  #define IAVF_TX_OFFLOAD_MASK (  \
>  		RTE_MBUF_F_TX_OUTER_IPV6 |		 \
> @@ -67,6 +70,9 @@
>  		RTE_MBUF_F_TX_IP_CKSUM |		 \
>  		RTE_MBUF_F_TX_L4_MASK |		 \
>  		RTE_MBUF_F_TX_TCP_SEG |		 \
> +		RTE_MBUF_F_TX_TUNNEL_MASK |	\
> +		RTE_MBUF_F_TX_OUTER_IP_CKSUM |  \
> +		RTE_MBUF_F_TX_OUTER_UDP_CKSUM | \
>  		RTE_ETH_TX_OFFLOAD_SECURITY)
> 
>  #define IAVF_TX_OFFLOAD_NOTSUP_MASK \
> --
> 2.25.1


  reply	other threads:[~2022-08-30  8:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 16:52 [PATCH 1/2] net/iavf: enable TSO offloading for tunnel cases peng1x.zhang
2022-08-12 16:52 ` [PATCH 2/2] net/iavf: support inner and outer checksum offload peng1x.zhang
2022-08-30  8:12   ` Yang, Qiming [this message]
2022-09-01  9:33   ` [PATCH v2] net/iavf: enable inner and outer Tx " Peng Zhang
2022-09-01 11:04     ` Zhang, Qi Z
2022-09-05  2:25     ` Yang, Qiming
2022-09-20  9:14     ` [PATCH v3] " Zhichao Zeng
2022-09-22  9:02       ` Xu, Ke1
2022-09-25  5:58         ` Zhang, Qi Z
2022-08-30  7:52 ` [PATCH 1/2] net/iavf: enable TSO offloading for tunnel cases Yang, Qiming
2022-09-26  5:17 ` [PATCH v2] net/iavf: fix TSO offload for tunnel case Zhichao Zeng
2022-09-26  9:48   ` Xu, Ke1
2022-09-27  2:33   ` Zhang, Qi Z
2022-09-27  9:56   ` [PATCH v3] " Zhichao Zeng
2022-09-29  5:27     ` [PATCH v4] " Zhichao Zeng
2022-09-30  3:46       ` Xu, Ke1
2022-09-30  9:05       ` Nicolau, Radu
2022-10-08  7:55         ` Zhang, Qi Z
2022-08-26 14:46 [PATCH 2/2] net/iavf: support inner and outer checksum offload Buckley, Daniel M
2022-08-30  2:22 Xu, Ke1

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=MWHPR11MB1886C9FED7123142438309ADE5799@MWHPR11MB1886.namprd11.prod.outlook.com \
    --to=qiming.yang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=peng1x.zhang@intel.com \
    /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).