public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Kubiak <michal.kubiak@intel.com>
To: Nikolay Aleksandrov <razor@blackwall.org>
Cc: <netdev@vger.kernel.org>, <monis@voltaire.com>,
	<syoshida@redhat.com>, <j.vosburgh@gmail.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 2/4] bonding: restore IFF_MASTER/SLAVE flags on bond enslave ether type change
Date: Tue, 14 Mar 2023 16:09:51 +0100	[thread overview]
Message-ID: <ZBCOP1NrTEw8cMq7@localhost.localdomain> (raw)
In-Reply-To: <20230314111426.1254998-3-razor@blackwall.org>

On Tue, Mar 14, 2023 at 01:14:24PM +0200, Nikolay Aleksandrov wrote:
> If the bond enslaves non-ARPHRD_ETHER device (changes its type), then
> releases it and enslaves ARPHRD_ETHER device (changes back) then we
> use ether_setup() to restore the bond device type but it also resets its
> flags and removes IFF_MASTER and IFF_SLAVE[1]. Use the bond_ether_setup
> helper to restore both after such transition.
> 
> [1] reproduce (nlmon is non-ARPHRD_ETHER):
>  $ ip l add nlmon0 type nlmon
>  $ ip l add bond2 type bond mode active-backup
>  $ ip l set nlmon0 master bond2
>  $ ip l set nlmon0 nomaster
>  $ ip l add bond1 type bond
>  (we use bond1 as ARPHRD_ETHER device to restore bond2's mode)
>  $ ip l set bond1 master bond2
>  $ ip l sh dev bond2
>  37: bond2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
>     link/ether be:d7:c5:40:5b:cc brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 1500
>  (notice bond2's IFF_MASTER is missing)
> 
> Fixes: e36b9d16c6a6 ("bonding: clean muticast addresses when device changes type")
> Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
> ---
>  drivers/net/bonding/bond_main.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index d41024ad2c18..cd94baccdac5 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1878,10 +1878,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
>  
>  			if (slave_dev->type != ARPHRD_ETHER)
>  				bond_setup_by_slave(bond_dev, slave_dev);
> -			else {
> -				ether_setup(bond_dev);
> -				bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
> -			}
> +			else
> +				bond_ether_setup(bond_dev);

As I already commented on your previous patch: there is the first call
of "bond_ether_setup()".
Please think about merging this patch with the previous one to avoid the
compilation warning.

Thanks,
Michal


>  
>  			call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE,
>  						 bond_dev);
> -- 
> 2.39.2
> 

  reply	other threads:[~2023-03-14 15:10 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
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 [this message]
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=ZBCOP1NrTEw8cMq7@localhost.localdomain \
    --to=michal.kubiak@intel.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=j.vosburgh@gmail.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