DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Li, Xiaoyun" <xiaoyun.li@intel.com>
To: "Xing, Beilei" <beilei.xing@intel.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/iavf: fix VLAN insert issue
Date: Thu, 4 Feb 2021 06:46:54 +0000	[thread overview]
Message-ID: <CY4PR11MB17509B8C0312E0F0F2BCA8AA99B39@CY4PR11MB1750.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MN2PR11MB380796337F9CF368A04D4C01F7B39@MN2PR11MB3807.namprd11.prod.outlook.com>



> -----Original Message-----
> From: Xing, Beilei <beilei.xing@intel.com>
> Sent: Thursday, February 4, 2021 14:36
> To: Li, Xiaoyun <xiaoyun.li@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> dev@dpdk.org
> Subject: RE: [PATCH] net/iavf: fix VLAN insert issue
> 
> 
> 
> > -----Original Message-----
> > From: Li, Xiaoyun <xiaoyun.li@intel.com>
> > Sent: Thursday, February 4, 2021 11:11 AM
> > To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; dev@dpdk.org
> > Cc: Li, Xiaoyun <xiaoyun.li@intel.com>
> > Subject: [PATCH] net/iavf: fix VLAN insert issue
> >
> > The new VIRTCHNL_VF_OFFLOAD_VLAN_V2 capability allows PF to set the
> > location of TX VLAN insertion.
> >
> > So VF needs to insert VLAN tag according to the location flags.
> >
> > Fixes: 1c301e8c3cff ("net/iavf: support new VLAN capabilities")
> >
> > Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> > ---
> >  drivers/net/iavf/iavf_rxtx.c | 45
> > +++++++++++++++++++++++++++++++-----
> >  drivers/net/iavf/iavf_rxtx.h |  3 +++
> >  2 files changed, 42 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/iavf/iavf_rxtx.c
> > b/drivers/net/iavf/iavf_rxtx.c index 3d471d9acc..af5a28d84d 100644
> > --- a/drivers/net/iavf/iavf_rxtx.c
> > +++ b/drivers/net/iavf/iavf_rxtx.c
> >
> >  /* Check if the context descriptor is needed for TX offloading */
> > static inline uint16_t -iavf_calc_context_desc(uint64_t flags)
> > +iavf_calc_context_desc(uint64_t flags, uint8_t vlan_flag)
> >  {
> > -	static uint64_t mask = PKT_TX_TCP_SEG;
> > -
> > -	return (flags & mask) ? 1 : 0;
> > +	if (flags & PKT_TX_TCP_SEG)
> > +		return 1;
> > +	if (flags & PKT_TX_VLAN_PKT &&
> > +	    vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2)
> > +		return 1;
> > +	return 0;
> 
> How about merging if condition?
> 
> if ((flags & PKT_TX_TCP_SEG) ||
>     (flags & PKT_TX_VLAN_PKT &&
>      vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2))
> 	 return 1;
> else
> 	 return 0;
> 
Both are OK. In case there are new offloads in the future which needs context desc. The previous code looks more clear which offload takes effect?

> >  }
> >

  reply	other threads:[~2021-02-04  6:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04  3:11 Xiaoyun Li
2021-02-04  6:35 ` Xing, Beilei
2021-02-04  6:46   ` Li, Xiaoyun [this message]
2021-02-04  6:57 ` Xing, Beilei
2021-02-04  8:12   ` Zhang, Qi Z

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=CY4PR11MB17509B8C0312E0F0F2BCA8AA99B39@CY4PR11MB1750.namprd11.prod.outlook.com \
    --to=xiaoyun.li@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@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).