From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH vz10 1/3] ms/bonding: fix xfrm offload feature setup on active-backup mode
Date: Thu, 24 Sep 2026 14:38:01 +0200 [thread overview]
Message-ID: <c7d51421-1a01-4bfb-ac1f-29ce1a17badb@virtuozzo.com> (raw)
In-Reply-To: <20260831234036.1649006-1-eva.kurchatova@virtuozzo.com>
On 9/1/26 01:39, Eva Kurchatova wrote:
> From: Hangbin Liu <liuhangbin@gmail.com>
>
> The active-backup bonding mode supports XFRM ESP offload. However, when
> a bond is added using command like `ip link add bond0 type bond mode 1
> miimon 100`, the `ethtool -k` command shows that the XFRM ESP offload is
> disabled. This occurs because, in bond_newlink(), we change bond link
> first and register bond device later. So the XFRM feature update in
> bond_option_mode_set() is not called as the bond device is not yet
> registered, leading to the offload feature not being set successfully.
>
> To resolve this issue, we can modify the code order in bond_newlink() to
> ensure that the bond device is registered first before changing the bond
> link parameters. This change will allow the XFRM ESP offload feature to be
> correctly enabled.
>
> Fixes: 007ab5345545 ("bonding: fix feature flag setting at init time")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> Link: https://patch.msgid.link/20250925023304.472186-1-liuhangbin@gmail.com
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
>
> The ipsec offload selftest that came with this fix is in the tree, the
> fix was not, so bond0 is created with the features off and the test
> sees no offloaded packets.
>
> (cherry picked from commit 5b66169f6be4847008c0aea50885ff0632151479)
While backporting this patch you have adapted it, in particular here - dropped 2 hunks.
Please ALWAYS mention any changes you do when backporting a patch from other repo/upstream.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-139651
> Feature: fix ms/net
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> ---
> drivers/net/bonding/bond_main.c | 2 +-
> drivers/net/bonding/bond_netlink.c | 16 +++++++++-------
> include/net/bonding.h | 1 +
> 3 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 67fd0c4cfb2e..79f2a4183d8a 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -4401,7 +4401,7 @@ void bond_work_init_all(struct bonding *bond)
> INIT_DELAYED_WORK(&bond->slave_arr_work, bond_slave_arr_handler);
> }
>
> -static void bond_work_cancel_all(struct bonding *bond)
> +void bond_work_cancel_all(struct bonding *bond)
> {
> cancel_delayed_work_sync(&bond->mii_work);
> cancel_delayed_work_sync(&bond->arp_work);
> diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
> index d066a6d948f7..4f2b0f398a5b 100644
> --- a/drivers/net/bonding/bond_netlink.c
> +++ b/drivers/net/bonding/bond_netlink.c
> @@ -595,18 +595,20 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev,
> struct nlattr *tb[], struct nlattr *data[],
> struct netlink_ext_ack *extack)
> {
> + struct bonding *bond = netdev_priv(bond_dev);
> int err;
>
> - err = bond_changelink(bond_dev, tb, data, extack);
> - if (err < 0)
> + err = register_netdevice(bond_dev);
> + if (err)
> return err;
>
> - err = register_netdevice(bond_dev);
> - if (!err) {
> - struct bonding *bond = netdev_priv(bond_dev);
> + netif_carrier_off(bond_dev);
> + bond_work_init_all(bond);
>
> - netif_carrier_off(bond_dev);
> - bond_work_init_all(bond);
> + err = bond_changelink(bond_dev, tb, data, extack);
> + if (err) {
> + bond_work_cancel_all(bond);
> + unregister_netdevice(bond_dev);
> }
>
> return err;
> diff --git a/include/net/bonding.h b/include/net/bonding.h
> index e06f0d63b2c1..bd56ad976cfb 100644
> --- a/include/net/bonding.h
> +++ b/include/net/bonding.h
> @@ -711,6 +711,7 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,
> int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave);
> void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay);
> void bond_work_init_all(struct bonding *bond);
> +void bond_work_cancel_all(struct bonding *bond);
>
> #ifdef CONFIG_PROC_FS
> void bond_create_proc_entry(struct bonding *bond);
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-09-24 12:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 23:39 Eva Kurchatova
2026-08-31 23:39 ` [Devel] [PATCH vz10 2/3] selftests: bonding: run the LACPDU test in its own netns Eva Kurchatova
2026-09-24 12:58 ` Konstantin Khorenko
2026-08-31 23:39 ` [Devel] [PATCH vz10 3/3] selftests: bonding: do not build on the namespaces of a killed run Eva Kurchatova
2026-09-24 12:53 ` Konstantin Khorenko
2026-09-24 12:59 ` Konstantin Khorenko
2026-09-24 12:38 ` Konstantin Khorenko [this message]
2026-09-24 12:58 ` [Devel] [PATCH vz10 1/3] ms/bonding: fix xfrm offload feature setup on active-backup mode Konstantin Khorenko
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=c7d51421-1a01-4bfb-ac1f-29ce1a17badb@virtuozzo.com \
--to=khorenko@virtuozzo.com \
--cc=devel@openvz.org \
--cc=eva.kurchatova@virtuozzo.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