[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250221032449.73597-1-kuniyu@amazon.com>
Date: Thu, 20 Feb 2025 19:24:49 -0800
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <shaw.leon@...il.com>
CC: <alex.aring@...il.com>, <andrew+netdev@...n.ch>,
<b.a.t.m.a.n@...ts.open-mesh.org>, <bpf@...r.kernel.org>,
<bridge@...ts.linux.dev>, <davem@...emloft.net>, <donald.hunter@...il.com>,
<dsahern@...nel.org>, <edumazet@...gle.com>, <herbert@...dor.apana.org.au>,
<horms@...nel.org>, <kuba@...nel.org>, <kuniyu@...zon.com>,
<linux-can@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <linux-ppp@...r.kernel.org>,
<linux-rdma@...r.kernel.org>, <linux-wireless@...r.kernel.org>,
<linux-wpan@...r.kernel.org>, <miquel.raynal@...tlin.com>,
<netdev@...r.kernel.org>, <osmocom-net-gprs@...ts.osmocom.org>,
<pabeni@...hat.com>, <shuah@...nel.org>, <stefan@...enfreihafen.org>,
<steffen.klassert@...unet.com>, <wireguard@...ts.zx2c4.com>
Subject: Re: [PATCH net-next v10 02/13] rtnetlink: Pack newlink() params into struct
From: Xiao Liang <shaw.leon@...il.com>
Date: Wed, 19 Feb 2025 20:50:28 +0800
> There are 4 net namespaces involved when creating links:
>
> - source netns - where the netlink socket resides,
> - target netns - where to put the device being created,
> - link netns - netns associated with the device (backend),
> - peer netns - netns of peer device.
>
> Currently, two nets are passed to newlink() callback - "src_net"
> parameter and "dev_net" (implicitly in net_device). They are set as
> follows, depending on netlink attributes in the request.
>
> +------------+-------------------+---------+---------+
> | peer netns | IFLA_LINK_NETNSID | src_net | dev_net |
> +------------+-------------------+---------+---------+
> | | absent | source | target |
> | absent +-------------------+---------+---------+
> | | present | link | link |
> +------------+-------------------+---------+---------+
> | | absent | peer | target |
> | present +-------------------+---------+---------+
> | | present | peer | link |
> +------------+-------------------+---------+---------+
>
> When IFLA_LINK_NETNSID is present, the device is created in link netns
> first and then moved to target netns. This has some side effects,
> including extra ifindex allocation, ifname validation and link events.
> These could be avoided if we create it in target netns from
> the beginning.
>
> On the other hand, the meaning of src_net parameter is ambiguous. It
> varies depending on how parameters are passed. It is the effective
> link (or peer netns) by design, but some drivers ignore it and use
> dev_net instead.
>
> To provide more netns context for drivers, this patch packs existing
> newlink() parameters, along with the source netns, link netns and peer
> netns, into a struct. The old "src_net" is renamed to "net" to avoid
> confusion with real source netns, and will be deprecated later. The use
> of src_net are converted to params->net trivially.
>
> Signed-off-by: Xiao Liang <shaw.leon@...il.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>
Powered by blists - more mailing lists