From: Nikolay Aleksandrov <razor@blackwall.org>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, 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>,
Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/2] bonding: fix xfrm offload feature setup on active-backup mode
Date: Thu, 12 Dec 2024 11:43:15 +0200 [thread overview]
Message-ID: <d5606430-16cf-4a2b-ac29-88b73b4ef284@blackwall.org> (raw)
In-Reply-To: <Z1qvb7Nz7zAv0L1w@fedora>
On 12/12/24 11:39, Hangbin Liu wrote:
> On Thu, Dec 12, 2024 at 11:19:33AM +0200, Nikolay Aleksandrov wrote:
>>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>> index 49dd4fe195e5..7daeab67e7b5 100644
>>> --- a/drivers/net/bonding/bond_main.c
>>> +++ b/drivers/net/bonding/bond_main.c
>>> @@ -4389,7 +4389,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 2a6a424806aa..7fe8c62366eb 100644
>>> --- a/drivers/net/bonding/bond_netlink.c
>>> +++ b/drivers/net/bonding/bond_netlink.c
>>> @@ -568,18 +568,21 @@ 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);
>>> + netif_carrier_on(bond_dev);
>>
>> The patch looks good, but I'm curious why the carrier on here?
>
> The current code set netif_carrier_off(bond_dev) after register_netdevice()
> success, So I make it on if register failed.
>
> Thanks
> hangbin
I don't like adding code just for symmetry alone, I think you should drop it
unless there is an actual reason to turn carrier on.
>>
>>> + unregister_netdevice(bond_dev);
>>> }
>>>
>>> return err;
next prev parent reply other threads:[~2024-12-12 9:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 7:11 [PATCH net 0/2] bond: fix xfrm offload feature during init Hangbin Liu
2024-12-11 7:11 ` [PATCH net 1/2] bonding: fix xfrm offload feature setup on active-backup mode Hangbin Liu
2024-12-12 9:19 ` Nikolay Aleksandrov
2024-12-12 9:39 ` Hangbin Liu
2024-12-12 9:43 ` Nikolay Aleksandrov [this message]
2024-12-13 3:10 ` Hangbin Liu
2024-12-11 7:11 ` [PATCH net 2/2] selftests: bonding: add ipsec offload test Hangbin Liu
2024-12-12 14:27 ` [PATCH net 0/2] bond: fix xfrm offload feature during init Jakub Kicinski
2024-12-13 7:18 ` Hangbin Liu
2024-12-14 3:31 ` Jakub Kicinski
2025-01-02 2:44 ` Hangbin Liu
2025-01-02 3:33 ` Jianbo Liu
2025-01-03 11:05 ` Hangbin Liu
2025-01-06 10:47 ` Hangbin Liu
2025-01-08 2:46 ` Hangbin Liu
2025-01-08 3:40 ` Jianbo Liu
2025-01-08 7:14 ` Hangbin Liu
2025-01-09 1:26 ` Jianbo Liu
2025-01-09 8:37 ` Hangbin Liu
2025-01-09 9:51 ` Jianbo Liu
2025-01-09 10:17 ` Hangbin Liu
2025-01-09 12:21 ` Jianbo Liu
2025-01-15 9:19 ` Hangbin Liu
2025-01-17 7:54 ` Steffen Klassert
2025-01-20 16:16 ` Cosmin Ratiu
2025-01-20 23:59 ` Hangbin Liu
2025-02-20 10:48 ` Cosmin Ratiu
2025-02-20 11:18 ` Hangbin Liu
2025-02-20 11: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=d5606430-16cf-4a2b-ac29-88b73b4ef284@blackwall.org \
--to=razor@blackwall.org \
--cc=andrew+netdev@lunn.ch \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.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
all inboxes | Powered by JetHome®