From: Jakub Kicinski <kuba@kernel.org>
To: David Wei <dw@davidwei.uk>
Cc: Jiri Pirko <jiri@resnulli.us>,
Sabrina Dubroca <sd@queasysnail.net>,
maciek@machnikowski.net, horms@kernel.org,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next v13 1/4] netdevsim: allow two netdevsim ports to be connected
Date: Fri, 23 Feb 2024 16:44:23 -0800 [thread overview]
Message-ID: <20240223164423.6b77cf09@kernel.org> (raw)
In-Reply-To: <20240222050840.362799-2-dw@davidwei.uk>
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
next prev parent reply other threads:[~2024-02-24 0:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 5:08 [PATCH net-next v13 0/4] netdevsim: link and forward skbs between ports David Wei
2024-02-22 5:08 ` [PATCH net-next v13 1/4] netdevsim: allow two netdevsim ports to be connected David Wei
2024-02-24 0:44 ` Jakub Kicinski [this message]
2024-02-24 17:33 ` David Wei
2024-02-26 15:05 ` Jakub Kicinski
2024-02-22 5:08 ` [PATCH net-next v13 2/4] netdevsim: forward skbs from one connected port to another David Wei
2024-02-22 5:08 ` [PATCH net-next v13 3/4] netdevsim: add selftest for forwarding skb between connected ports David Wei
2024-02-22 5:08 ` [PATCH net-next v13 4/4] netdevsim: fix rtnetlink.sh selftest David Wei
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=20240223164423.6b77cf09@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=maciek@machnikowski.net \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
/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;
as well as URLs for NNTP newsgroup(s).