DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: David Marchand <david.marchand@redhat.com>
Cc: Anurag Mandal <anurag.mandal@intel.com>, <dev@dpdk.org>,
	<anatoly.burakov@intel.com>
Subject: Re: [PATCH 2/4] net/ice: add vector tunnel context encoding
Date: Mon, 24 Aug 2026 15:57:21 +0100	[thread overview]
Message-ID: <aoxb0VAWa5U6zlCE@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <CAJFAV8z+ce0FBGQ5LvecKY__W_B8PWBoh2MJWcYZHVtcyDRSmQ@mail.gmail.com>

On Mon, Aug 24, 2026 at 04:51:11PM +0200, David Marchand wrote:
> On Mon, 24 Aug 2026 at 12:23, Anurag Mandal <anurag.mandal@intel.com> wrote:
> >
> > Added helpers to encode tunnel context descriptors,
> > and checksum offsets.
> >
> > Signed-off-by: Anurag Mandal <anurag.mandal@intel.com>
> > ---
> >  drivers/net/intel/ice/ice_rxtx_vec_common.h | 53 ++++++++++++++++++++-
> >  1 file changed, 51 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/intel/ice/ice_rxtx_vec_common.h b/drivers/net/intel/ice/ice_rxtx_vec_common.h
> > index 1d83a087cc..b84456357f 100644
> > --- a/drivers/net/intel/ice/ice_rxtx_vec_common.h
> > +++ b/drivers/net/intel/ice/ice_rxtx_vec_common.h
> > @@ -123,8 +123,12 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
> >
> >         /* Tx Checksum Offload */
> >         /* SET MACLEN */
> > -       td_offset |= (tx_pkt->l2_len >> 1) <<
> > -               CI_TX_DESC_LEN_MACLEN_S;
> > +       if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
> > +               td_offset |= (tx_pkt->outer_l2_len >> 1) <<
> > +                       CI_TX_DESC_LEN_MACLEN_S;
> > +       else
> > +               td_offset |= (tx_pkt->l2_len >> 1) <<
> > +                       CI_TX_DESC_LEN_MACLEN_S;
> >
> >         /* Enable L3 checksum offload */
> >         if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
> > @@ -172,4 +176,49 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
> >
> >         *txd_hi |= ((uint64_t)td_cmd) << CI_TXD_QW1_CMD_S;
> >  }
> > +
> > +static inline uint64_t
> > +ice_txd_tunneling_ctx(const struct rte_mbuf *tx_pkt)
> > +{
> > +       const uint64_t ol_flags = tx_pkt->ol_flags;
> > +       uint64_t ctx = 0;
> > +
> > +       if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK))
> > +               return 0;
> > +
> > +       if (ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM)
> > +               ctx |= ICE_TX_CTX_EIPT_IPV4;
> > +       else if (ol_flags & RTE_MBUF_F_TX_OUTER_IPV4)
> > +               ctx |= ICE_TX_CTX_EIPT_IPV4_NO_CSUM;
> > +       else if (ol_flags & RTE_MBUF_F_TX_OUTER_IPV6)
> > +               ctx |= ICE_TX_CTX_EIPT_IPV6;
> > +
> > +       ctx |= (uint64_t)(tx_pkt->outer_l3_len >> 2) << ICE_TXD_CTX_QW0_EIPLEN_S;
> > +
> > +       switch (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
> > +       case RTE_MBUF_F_TX_TUNNEL_IPIP:
> > +               break;
> > +       case RTE_MBUF_F_TX_TUNNEL_VXLAN:
> > +       case RTE_MBUF_F_TX_TUNNEL_VXLAN_GPE:
> > +       case RTE_MBUF_F_TX_TUNNEL_GTP:
> > +       case RTE_MBUF_F_TX_TUNNEL_GENEVE:
> > +               ctx |= ICE_TXD_CTX_UDP_TUNNELING;
> > +               break;
> > +       case RTE_MBUF_F_TX_TUNNEL_GRE:
> > +               ctx |= ICE_TXD_CTX_GRE_TUNNELING;
> > +               break;
> > +       default:
> > +               PMD_TX_LOG(ERR, "Tunnel type not supported");
> > +               return ctx;
> > +       }
> > +
> > +       ctx |= (uint64_t)(tx_pkt->l2_len >> 1) << ICE_TXD_CTX_QW0_NATLEN_S;
> > +
> > +       if ((ctx & ICE_TXD_CTX_QW0_EIPT_M) &&
> > +                       (ctx & ICE_TXD_CTX_UDP_TUNNELING) &&
> > +                       (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM))
> > +               ctx |= ICE_TXD_CTX_QW0_L4T_CS_M;
> > +
> > +       return ctx;
> > +}
> >  #endif
> 
> Why copy/paste this code in a new helper?
> The scalar path seems to have the same code, simply moving existing
> code should be enough, or do I miss something?
> 
> 
> Besides, all of this looks really close to the iavf code.
> Can this be factorised in drivers/net/intel/common in some way?
> 

I was looking at that myself earlier in the summer, and have a half-done
prototype lying around somewhere. There are enough inconsistentencies in
the implementations to be annoying, and the options for VLAN tag placement
I remember struggling with a bit too.

In short, it's being looked at, but maybe not this release....

/Bruce

  reply	other threads:[~2026-08-24 14:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 10:21 [PATCH 0/4] net/ice: support outer checksum in vector Tx Anurag Mandal
2026-08-24 10:21 ` [PATCH 1/4] net/common: share Tx context descriptor flag Anurag Mandal
2026-08-24 10:21 ` [PATCH 2/4] net/ice: add vector tunnel context encoding Anurag Mandal
2026-08-24 14:37   ` Bruce Richardson
2026-08-24 14:51   ` David Marchand
2026-08-24 14:57     ` Bruce Richardson [this message]
2026-08-24 10:21 ` [PATCH 3/4] net/ice: add AVX2 context descriptor Tx path Anurag Mandal
2026-08-24 14:47   ` Bruce Richardson
2026-08-24 10:21 ` [PATCH 4/4] net/ice: add AVX-512 " Anurag Mandal

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=aoxb0VAWa5U6zlCE@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=anurag.mandal@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    /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