From: Menglong Dong <menglong8.dong@gmail.com>
To: dsahern@kernel.org
Cc: 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: [PATCH net-next] net: vrf: don't down netif when add slave
Date: Thu, 31 Jul 2025 19:22:19 +0800 [thread overview]
Message-ID: <20250731112219.121778-1-dongml2@chinatelecom.cn> (raw)
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 :/
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
drivers/net/vrf.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 3ccd649913b5..d90bdf1fe747 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1042,17 +1042,15 @@ static int vrf_rtable_create(struct net_device *dev)
static void cycle_netdev(struct net_device *dev,
struct netlink_ext_ack *extack)
{
- unsigned int flags = dev->flags;
int ret;
if (!netif_running(dev))
return;
- ret = dev_change_flags(dev, flags & ~IFF_UP, extack);
- if (ret >= 0)
- ret = dev_change_flags(dev, flags, extack);
+ ret = call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
+ ret = notifier_to_errno(ret);
- if (ret < 0) {
+ if (ret) {
netdev_err(dev,
"Failed to cycle device %s; route tables might be wrong!\n",
dev->name);
--
2.50.1
next reply other threads:[~2025-07-31 11:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-31 11:22 Menglong Dong [this message]
2025-07-31 12:08 ` Ido Schimmel
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=20250731112219.121778-1-dongml2@chinatelecom.cn \
--to=menglong8.dong@gmail.com \
--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=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
all inboxes | Powered by JetHome®