netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Cosmin Ratiu <cratiu@nvidia.com>
Cc: "razor@blackwall.org" <razor@blackwall.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Tariq Toukan <tariqt@nvidia.com>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"liali@redhat.com" <liali@redhat.com>,
	"jv@jvosburgh.net" <jv@jvosburgh.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"horms@kernel.org" <horms@kernel.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Boris Pismenny <borisp@nvidia.com>,
	Jianbo Liu <jianbol@nvidia.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>
Subject: Re: [PATCH net v2] bonding: Correctly support GSO ESP offload
Date: Fri, 24 Jan 2025 11:10:30 +0000	[thread overview]
Message-ID: <Z5N1JiVml-YE6L-5@fedora> (raw)
In-Reply-To: <2c92e0c58e7d0ab4b06c16f9f1f67f6f9e48d35b.camel@nvidia.com>

On Fri, Jan 24, 2025 at 10:35:40AM +0000, Cosmin Ratiu wrote:
> On Fri, 2025-01-24 at 09:54 +0000, Hangbin Liu wrote:
> > On Fri, Jan 24, 2025 at 10:57:44AM +0200, Cosmin Ratiu wrote:
> > > ---
> > >  drivers/net/bonding/bond_main.c | 19 ++++++++++---------
> > >  1 file changed, 10 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/drivers/net/bonding/bond_main.c
> > > b/drivers/net/bonding/bond_main.c
> > > index 7b78c2bada81..e45bba240cbc 100644
> > > --- a/drivers/net/bonding/bond_main.c
> > > +++ b/drivers/net/bonding/bond_main.c
> > > @@ -1538,17 +1538,20 @@ static netdev_features_t
> > > bond_fix_features(struct net_device *dev,
> > >  				 NETIF_F_HIGHDMA | NETIF_F_LRO)
> > >  
> > >  #define BOND_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
> > > -				 NETIF_F_RXCSUM |
> > > NETIF_F_GSO_SOFTWARE)
> > > +				 NETIF_F_RXCSUM |
> > > NETIF_F_GSO_SOFTWARE | \
> > > +				 NETIF_F_GSO_PARTIAL)
> > >  
> > >  #define BOND_MPLS_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
> > >  				 NETIF_F_GSO_SOFTWARE)
> > >  
> > > +#define BOND_GSO_PARTIAL_FEATURES (NETIF_F_GSO_ESP)
> > > +
> > >  
> > >  static void bond_compute_features(struct bonding *bond)
> > >  {
> > > +	netdev_features_t gso_partial_features =
> > > BOND_GSO_PARTIAL_FEATURES;
> > >  	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
> > >  					IFF_XMIT_DST_RELEASE_PERM;
> > > -	netdev_features_t gso_partial_features = NETIF_F_GSO_ESP;
> > >  	netdev_features_t vlan_features = BOND_VLAN_FEATURES;
> > >  	netdev_features_t enc_features  = BOND_ENC_FEATURES;
> > >  #ifdef CONFIG_XFRM_OFFLOAD
> > > @@ -1582,8 +1585,9 @@ static void bond_compute_features(struct
> > > bonding *bond)
> > >  							 
> > > BOND_XFRM_FEATURES);
> > >  #endif /* CONFIG_XFRM_OFFLOAD */
> > >  
> > > -		if (slave->dev->hw_enc_features &
> > > NETIF_F_GSO_PARTIAL)
> > > -			gso_partial_features &= slave->dev-
> > > >gso_partial_features;
> > > +		gso_partial_features =
> > > netdev_increment_features(gso_partial_features,
> > > +								
> > > slave->dev->gso_partial_features,
> > > +								
> > > BOND_GSO_PARTIAL_FEATURES);
> > >  
> > >  		mpls_features =
> > > netdev_increment_features(mpls_features,
> > >  							  slave-
> > > >dev->mpls_features,
> > > @@ -1598,12 +1602,8 @@ static void bond_compute_features(struct
> > > bonding *bond)
> > >  	}
> > >  	bond_dev->hard_header_len = max_hard_header_len;
> > >  
> > > -	if (gso_partial_features & NETIF_F_GSO_ESP)
> > > -		bond_dev->gso_partial_features |= NETIF_F_GSO_ESP;
> > > -	else
> > > -		bond_dev->gso_partial_features &=
> > > ~NETIF_F_GSO_ESP;
> > > -
> > >  done:
> > > +	bond_dev->gso_partial_features = gso_partial_features;
> > >  	bond_dev->vlan_features = vlan_features;
> > >  	bond_dev->hw_enc_features = enc_features |
> > > NETIF_F_GSO_ENCAP_ALL |
> > >  				    NETIF_F_HW_VLAN_CTAG_TX |
> > 
> >         if (!bond_has_slaves(bond))
> >                 goto done;
> > 
> > If there is no slaves, should we add the gso_partial_features?
> 
> The other partial feature sets are added after 'done:', why not do the
> same for gso_partial_features for consistency? 'gso_partial_features'
> is otherwise not set anywhere else and relies on it being set to zero
> when allocated in alloc_netdev_mqs. I think it's better for it to be
> explicitly initialized in all cases here, like the other feature sets.
> 
> Cosmin.

OK.

Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>

  reply	other threads:[~2025-01-24 11:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24  8:57 [PATCH net v2] bonding: Correctly support GSO ESP offload Cosmin Ratiu
2025-01-24  9:54 ` Hangbin Liu
2025-01-24 10:35   ` Cosmin Ratiu
2025-01-24 11:10     ` Hangbin Liu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-24  8:33 Cosmin Ratiu

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=Z5N1JiVml-YE6L-5@fedora \
    --to=liuhangbin@gmail.com \
    --cc=borisp@nvidia.com \
    --cc=cratiu@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jianbol@nvidia.com \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=liali@redhat.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=tariqt@nvidia.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).