[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c51765ec-b072-4c01-8dce-c2fa51f1941c@davidwei.uk>
Date: Sat, 24 Feb 2024 09:33:02 -0800
From: David Wei <dw@...idwei.uk>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Jiri Pirko <jiri@...nulli.us>, Sabrina Dubroca <sd@...asysnail.net>,
maciek@...hnikowski.net, horms@...nel.org, netdev@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next v13 1/4] netdevsim: allow two netdevsim ports to
be connected
On 2024-02-23 16:44, Jakub Kicinski wrote:
> On Wed, 21 Feb 2024 21:08:37 -0800 David Wei wrote:
>> + if (!netdev_is_nsim(dev_b)) {
>> + pr_err("Device with ifindex %u in netnsfd %d is not a netdevsim\n", ifidx_b, netnsfd_b);
>
> nit: the string format can overflow the 80 char limit, but if there
> are arguments and they don't fit in the limit, please put them on
> the next line.
Yep I'll fix that.
>
>> + goto out_err;
>> + }
>> +
>> + if (dev_a == dev_b) {
>> + pr_err("Cannot link a netdevsim to itself\n");
>> + goto out_err;
>> + }
>> +
>> + err = 0;
>
> Why zero..
Sorry left over from a previous iteration.
>
>> + nsim_a = netdev_priv(dev_a);
>> + peer = rtnl_dereference(nsim_a->peer);
>> + if (peer) {
>> + pr_err("Netdevsim %d:%u is already linked\n", netnsfd_a, ifidx_a);
>> + goto out_err;
>
> I'd think if we hit this we should return -EBUSY?
> Unless peer == dev_b, but that may be splitting hair.
What would returning -EBUSY do?
>
> You should also implement .ndo_get_iflink, so that ip link can display
> the peer information.
(Y)
Powered by blists - more mailing lists