From: Jay Vosburgh <jay.vosburgh@canonical.com>
To: Nikolay Aleksandrov <razor@blackwall.org>
Cc: netdev@vger.kernel.org, monis@voltaire.com, syoshida@redhat.com,
andy@greyhouse.net, kuba@kernel.org, davem@davemloft.net,
pabeni@redhat.com, edumazet@google.com,
syzbot+9dfc3f3348729cc82277@syzkaller.appspotmail.com
Subject: Re: [PATCH net v2 1/4] bonding: add bond_ether_setup helper
Date: Tue, 14 Mar 2023 08:34:55 -0700 [thread overview]
Message-ID: <28497.1678808095@famine> (raw)
In-Reply-To: <20230314111426.1254998-2-razor@blackwall.org>
Nikolay Aleksandrov <razor@blackwall.org> wrote:
>Add bond_ether_setup helper which will be used in the following patches
>to fix all ether_setup() calls in the bonding driver. It takes care of both
>IFF_MASTER and IFF_SLAVE flags, the former is always restored and the
>latter only if it was set.
>
>Fixes: e36b9d16c6a6d ("bonding: clean muticast addresses when device changes type")
>Fixes: 7d5cd2ce5292 ("bonding: correctly handle bonding type change on enslave failure")
>Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
>---
> drivers/net/bonding/bond_main.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 00646aa315c3..d41024ad2c18 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -1775,6 +1775,18 @@ void bond_lower_state_changed(struct slave *slave)
> slave_err(bond_dev, slave_dev, "Error: %s\n", errmsg); \
> } while (0)
>
>+/* ether_setup() resets bond_dev's flags so we always have to restore
>+ * IFF_MASTER, and only restore IFF_SLAVE if it was set
>+ */
>+static void bond_ether_setup(struct net_device *bond_dev)
>+{
>+ unsigned int slave_flag = bond_dev->flags & IFF_SLAVE;
>+
>+ ether_setup(bond_dev);
>+ bond_dev->flags |= IFF_MASTER | slave_flag;
>+ bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
>+}
Is setting IFF_MASTER always correct here? I note that patch #2
is replacing code that does not set IFF_MASTER, whereas patch #3 is
replacing code that does set IFF_MASTER.
Presuming that this is the desired behavior, perhaps mention
explicitly in the commentary that bond_ether_setup() is only for use on
a bond master device. The nomenclature "bond_dev" does imply that, but
it's not explicit.
Also, why is the call to ether_setup() from bond_setup() not
also being converted to bond_ether_setup()?
-J
>+
> /* enslave device <slave> to bond device <master> */
> int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
> struct netlink_ext_ack *extack)
>--
>2.39.2
>
---
-Jay Vosburgh, jay.vosburgh@canonical.com
next prev parent reply other threads:[~2023-03-14 15:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 11:14 [PATCH net v2 0/4] bonding: properly restore flags when bond changes ether type Nikolay Aleksandrov
2023-03-14 11:14 ` [PATCH net v2 1/4] bonding: add bond_ether_setup helper Nikolay Aleksandrov
2023-03-14 14:58 ` Michal Kubiak
2023-03-14 15:08 ` Nikolay Aleksandrov
2023-03-14 15:12 ` Nikolay Aleksandrov
2023-03-14 15:34 ` Jay Vosburgh [this message]
2023-03-14 15:37 ` Nikolay Aleksandrov
2023-03-15 7:55 ` Jakub Kicinski
2023-03-15 8:21 ` Nikolay Aleksandrov
2023-03-14 11:14 ` [PATCH net v2 2/4] bonding: restore IFF_MASTER/SLAVE flags on bond enslave ether type change Nikolay Aleksandrov
2023-03-14 15:09 ` Michal Kubiak
2023-03-14 15:13 ` Nikolay Aleksandrov
2023-03-14 11:14 ` [PATCH net v2 3/4] bonding: restore bond's IFF_SLAVE flag if a non-eth dev enslave fails Nikolay Aleksandrov
2023-03-14 15:07 ` Michal Kubiak
2023-03-14 11:14 ` [PATCH net v2 4/4] selftests: bonding: add tests for ether type changes Nikolay Aleksandrov
2023-03-14 15:04 ` Michal Kubiak
2023-03-14 15:15 ` [PATCH net v2 0/4] bonding: properly restore flags when bond changes ether type Jonathan Toppins
2023-03-14 16:20 ` Jay Vosburgh
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=28497.1678808095@famine \
--to=jay.vosburgh@canonical.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=monis@voltaire.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=syoshida@redhat.com \
--cc=syzbot+9dfc3f3348729cc82277@syzkaller.appspotmail.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).