mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <razor@blackwall.org>
To: Hangbin Liu <liuhangbin@gmail.com>, netdev@vger.kernel.org
Cc: Jay Vosburgh <jv@jvosburgh.net>,
	Andy Gospodarek <andy@greyhouse.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jarod Wilson <jarod@redhat.com>, Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] Bonding: update bond device XFRM features based on current active slave
Date: Wed, 18 Sep 2024 12:40:27 +0300	[thread overview]
Message-ID: <a475dfac-3bd7-4877-bab4-3c08259501c2@blackwall.org> (raw)
In-Reply-To: <20240918083533.21093-1-liuhangbin@gmail.com>

On 18/09/2024 11:35, Hangbin Liu wrote:
> XFRM offload is supported in active-backup mode. However, if the current
> active slave does not support it, we should disable it on bond device.
> Otherwise, ESP traffic may fail due to the downlink not supporting the
> feature.
> 
> Reproducer:
>   # ip link add bond0 type bond
>   # ip link add type veth
>   # ip link set bond0 type bond mode 1 miimon 100
>   # ip link set veth0 master bond0
>   # ethtool -k veth0 | grep esp
>   tx-esp-segmentation: off [fixed]
>   esp-hw-offload: off [fixed]
>   esp-tx-csum-hw-offload: off [fixed]
>   # ethtool -k bond0 | grep esp
>   tx-esp-segmentation: on
>   esp-hw-offload: on
>   esp-tx-csum-hw-offload: on
> 
> After fix:
>   # ethtool -k bond0 | grep esp
>   tx-esp-segmentation: off [requested on]
>   esp-hw-offload: off [requested on]
>   esp-tx-csum-hw-offload: off [requested on]
> 
> Fixes: a3b658cfb664 ("bonding: allow xfrm offload setup post-module-load")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>  drivers/net/bonding/bond_main.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index b560644ee1b1..33f7fde15c65 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1353,6 +1353,10 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
>  				call_netdevice_notifiers(NETDEV_NOTIFY_PEERS,
>  							 bond->dev);
>  			}
> +
> +#ifdef CONFIG_XFRM_OFFLOAD
> +			netdev_update_features(bond->dev);
> +#endif /* CONFIG_XFRM_OFFLOAD */
>  		}
>  	}
>  
> @@ -1524,6 +1528,11 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
>  		features = netdev_increment_features(features,
>  						     slave->dev->features,
>  						     mask);
> +#ifdef CONFIG_XFRM_OFFLOAD
> +		if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP &&
> +		    slave == rtnl_dereference(bond->curr_active_slave))
> +			features &= slave->dev->features & BOND_XFRM_FEATURES;
> +#endif /* CONFIG_XFRM_OFFLOAD */
>  	}
>  	features = netdev_add_tso_features(features, mask);
>  

Nice catch,
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>


  reply	other threads:[~2024-09-18  9:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18  8:35 Hangbin Liu
2024-09-18  9:40 ` Nikolay Aleksandrov [this message]
2024-09-24 13:17 ` Paolo Abeni
2024-09-25  6:47   ` Hangbin Liu
2024-09-25 13:21     ` Hangbin Liu

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=a475dfac-3bd7-4877-bab4-3c08259501c2@blackwall.org \
    --to=razor@blackwall.org \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jarod@redhat.com \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®