linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"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>, Shuah Khan <shuah@kernel.org>,
	Xiao Liang <shaw.leon@gmail.com>,
	Kuniyuki Iwashima <kuniyu@amazon.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>,
	Etienne Champetier <champetier.etienne@gmail.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net 1/3] ipvlan: fix NETDEV_UP/NETDEV_DOWN event handling
Date: Thu, 3 Apr 2025 17:00:14 +0200	[thread overview]
Message-ID: <Z-6ifi46d2JmnIch@krikkit> (raw)
In-Reply-To: <Z-6IbvorOVx6hpxM@fedora>

2025-04-03, 13:09:02 +0000, Hangbin Liu wrote:
> Hi Sabrina,
> On Thu, Apr 03, 2025 at 12:28:54PM +0200, Sabrina Dubroca wrote:
> > Hello Hangbin,
> > 
> > 2025-04-03, 08:58:55 +0000, Hangbin Liu wrote:
> > > When setting the lower-layer link up/down, the ipvlan device synchronizes
> > > its state via netif_stacked_transfer_operstate(), which only checks the
> > > carrier state. However, setting the link down does not necessarily change
> > > the carrier state for virtual interfaces like bonding. This causes the
> > > ipvlan state to become out of sync with the lower-layer link state.
> > > 
> > > If the lower link and ipvlan are in the same namespace, this issue is
> > > hidden because ip link show checks the link state in IFLA_LINK and has
> > > a m_flag to control the state, displaying M-DOWN in the flags. However,
> > > if the ipvlan and the lower link are in different namespaces, this
> > > information is not available, and the ipvlan link state remains unchanged.
> > 
> > Is the issue with the actual behavior (sending/receiving packets,
> > etc), or just in how it's displayed by iproute?
> 
> The upper link in netns up while lower link down will cause the traffic break
> in the pod.

That seems like the correct behavior based on the actual (not
displayed) state of the links.


I wonder if netif_stacked_transfer_operstate should consider the admin
state of the lower device as well as link state:

@@ -10724,7 +10724,7 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev,
 	else
 		netif_testing_off(dev);
 
-	if (netif_carrier_ok(rootdev))
+	if (netif_carrier_ok(rootdev) && rootdev->flags & IFF_UP)
 		netif_carrier_on(dev);
 	else
 		netif_carrier_off(dev);


but I haven't looked at all the consequences and possible side
effects.

-- 
Sabrina

  reply	other threads:[~2025-04-03 15:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03  8:58 [PATCH net 0/3] fix ipvlan/macvlan link event handing Hangbin Liu
2025-04-03  8:58 ` [PATCH net 1/3] ipvlan: fix NETDEV_UP/NETDEV_DOWN event handling Hangbin Liu
2025-04-03 10:28   ` Sabrina Dubroca
2025-04-03 13:09     ` Hangbin Liu
2025-04-03 15:00       ` Sabrina Dubroca [this message]
2025-04-14  7:02         ` Hangbin Liu
2025-04-03  8:58 ` [PATCH net 2/3] macvlan: " Hangbin Liu
2025-04-03  8:58 ` [PATCH net 3/3] selftests/rtnetlink.sh: add vlan/ipvlan/macvlan link state test 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=Z-6ifi46d2JmnIch@krikkit \
    --to=sd@queasysnail.net \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=champetier.etienne@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=sdf@fomichev.me \
    --cc=shaw.leon@gmail.com \
    --cc=shuah@kernel.org \
    --cc=venkat.x.venkatsubra@oracle.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).