[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250113143719.7948-10-shaw.leon@gmail.com>
Date: Mon, 13 Jan 2025 22:37:17 +0800
From: Xiao Liang <shaw.leon@...il.com>
To: netdev@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Kuniyuki Iwashima <kuniyu@...zon.com>,
Jakub Kicinski <kuba@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Simon Horman <horms@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Donald Hunter <donald.hunter@...il.com>,
Alexander Aring <alex.aring@...il.com>,
Stefan Schmidt <stefan@...enfreihafen.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Steffen Klassert <steffen.klassert@...unet.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
linux-rdma@...r.kernel.org,
linux-can@...r.kernel.org,
osmocom-net-gprs@...ts.osmocom.org,
bpf@...r.kernel.org,
linux-ppp@...r.kernel.org,
wireguard@...ts.zx2c4.com,
linux-wireless@...r.kernel.org,
b.a.t.m.a.n@...ts.open-mesh.org,
bridge@...ts.linux.dev,
linux-wpan@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH net-next v8 09/11] rtnetlink: Create link directly in target net namespace
Make rtnl_newlink_create() create device in target namespace directly.
Avoid extra netns change when link netns is provided.
Device drivers has been converted to be aware of link netns, that is not
assuming device netns is and link netns is the same when ops->newlink()
is called.
Signed-off-by: Xiao Liang <shaw.leon@...il.com>
---
net/core/rtnetlink.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index cce5bcd1f257..65f09ab616b5 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3784,8 +3784,8 @@ static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
name_assign_type = NET_NAME_ENUM;
}
- dev = rtnl_create_link(link_net ? : tgt_net, ifname,
- name_assign_type, ops, tb, extack);
+ dev = rtnl_create_link(tgt_net, ifname, name_assign_type, ops, tb,
+ extack);
if (IS_ERR(dev)) {
err = PTR_ERR(dev);
goto out;
@@ -3805,11 +3805,6 @@ static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
err = rtnl_configure_link(dev, ifm, portid, nlh);
if (err < 0)
goto out_unregister;
- if (link_net) {
- err = dev_change_net_namespace(dev, tgt_net, ifname);
- if (err < 0)
- goto out_unregister;
- }
if (tb[IFLA_MASTER]) {
err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]), extack);
if (err)
--
2.47.1
Powered by blists - more mailing lists