[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240223164423.6b77cf09@kernel.org>
Date: Fri, 23 Feb 2024 16:44:23 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: David Wei <dw@...idwei.uk>
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 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.
> + goto out_err;
> + }
> +
> + if (dev_a == dev_b) {
> + pr_err("Cannot link a netdevsim to itself\n");
> + goto out_err;
> + }
> +
> + err = 0;
Why zero..
> + 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.
You should also implement .ndo_get_iflink, so that ip link can display
the peer information.
--
pw-bot: cr
Powered by blists - more mailing lists