public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Menglong Dong <menglong8.dong@gmail.com>
Cc: dsahern@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: vrf: don't down netif when add slave
Date: Thu, 31 Jul 2025 15:08:24 +0300	[thread overview]
Message-ID: <aItcuFGx1S7ySE3y@shredder> (raw)
In-Reply-To: <20250731112219.121778-1-dongml2@chinatelecom.cn>

On Thu, Jul 31, 2025 at 07:22:19PM +0800, Menglong Dong wrote:
> For now, cycle_netdev() will be called to flush the neighbor cache when
> add slave by downing and upping the slave netdev. When the slave has
> vlan devices, the data transmission can interrupted.
> 
> Optimize it by notifying the NETDEV_CHANGEADDR instead, which will also
> flush the neighbor cache. It's a little ugly, and maybe we can introduce
> a new event to do such flush :/

Cycling the netdev is not only about neighbors, but also about moving
routes to the correct table (see the comment above the function):

ip link add name dummy1 up type dummy
sysctl -wq net.ipv6.conf.dummy1.keep_addr_on_down=1
ip address add 192.0.2.1/24 dev dummy1
ip address add 2001:db8:1::1/64 dev dummy1
ip link add name vrf1 up type vrf table 100
ip link set dev dummy1 master vrf1
ip -4 route show table 100
192.0.2.0/24 dev dummy1 proto kernel scope link src 192.0.2.1 
local 192.0.2.1 dev dummy1 proto kernel scope host src 192.0.2.1 
broadcast 192.0.2.255 dev dummy1 proto kernel scope link src 192.0.2.1 
ip -6 route show table 100
local 2001:db8:1::1 dev dummy1 proto kernel metric 0 pref medium
2001:db8:1::/64 dev dummy1 proto kernel metric 256 pref medium
local fe80::f877:f7ff:fecb:bfb dev dummy1 proto kernel metric 0 pref medium
fe80::/64 dev dummy1 proto kernel metric 256 pref medium
multicast ff00::/8 dev dummy1 proto kernel metric 256 pref medium

And it doesn't happen with your patch:

ip link add name dummy1 up type dummy
sysctl -wq net.ipv6.conf.dummy1.keep_addr_on_down=1
ip address add 192.0.2.1/24 dev dummy1
ip address add 2001:db8:1::1/64 dev dummy1
ip link add name vrf1 up type vrf table 100
ip link set dev dummy1 master vrf1
ip -4 route show table 100
ip -6 route show table 100

You can try configuring the VLAN devices with "loose_binding on".

  reply	other threads:[~2025-07-31 12:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 11:22 [PATCH net-next] net: vrf: don't down netif when add slave Menglong Dong
2025-07-31 12:08 ` Ido Schimmel [this message]
2025-07-31 12:19   ` Menglong Dong

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=aItcuFGx1S7ySE3y@shredder \
    --to=idosch@idosch.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menglong8.dong@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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