Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: stephen@networkplumber.org
Cc: netdev@vger.kernel.org, leonro@nvidia.com,
	linux-rdma@vger.kernel.org, David Ahern <dahern@nvidia.com>
Subject: [PATCH iproute2-next v2 4/4] devlink: Drop now duplicate pid fallback for netns
Date: Tue, 12 May 2026 13:34:07 -0600	[thread overview]
Message-ID: <20260512193412.32019-5-dsahern@kernel.org> (raw)
In-Reply-To: <20260512193412.32019-1-dsahern@kernel.org>

From: David Ahern <dahern@nvidia.com>

Now that netns_get_fd handles by name and pid, the special
handling in devlink to fallback to PID can be removed with
both cases handled by the FD attribute.

Signed-off-by: David Ahern <dahern@nvidia.com>
---
 devlink/devlink.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 730515a78950..908a0e32be2b 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -428,12 +428,6 @@ static void dl_arg_inc(struct dl *dl)
 	dl->argv++;
 }
 
-static void dl_arg_dec(struct dl *dl)
-{
-	dl->argc++;
-	dl->argv--;
-}
-
 static char *dl_argv_next(struct dl *dl)
 {
 	char *ret;
@@ -2153,14 +2147,12 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
 			err = dl_argv_str(dl, &netns_str);
 			if (err)
 				return err;
-			opts->netns = netns_get_fd(netns_str);
-			if ((int)opts->netns < 0) {
-				dl_arg_dec(dl);
-				err = dl_argv_uint32_t(dl, &opts->netns);
-				if (err)
-					return err;
-				opts->netns_is_pid = true;
-			}
+
+			err = netns_get_fd(netns_str);
+			if (err < 0)
+				return err;
+
+			opts->netns = err;
 			o_found |= DL_OPT_NETNS;
 		} else if (dl_argv_match(dl, "action") &&
 			   (o_all & DL_OPT_RELOAD_ACTION)) {
@@ -2725,10 +2717,7 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl)
 		mnl_attr_put_u8(nlh, DEVLINK_ATTR_TRAP_ACTION,
 				opts->trap_action);
 	if (opts->present & DL_OPT_NETNS)
-		mnl_attr_put_u32(nlh,
-				 opts->netns_is_pid ? DEVLINK_ATTR_NETNS_PID :
-						      DEVLINK_ATTR_NETNS_FD,
-				 opts->netns);
+		mnl_attr_put_u32(nlh, DEVLINK_ATTR_NETNS_FD, opts->netns);
 	if (opts->present & DL_OPT_RELOAD_ACTION)
 		mnl_attr_put_u8(nlh, DEVLINK_ATTR_RELOAD_ACTION,
 				opts->reload_action);
-- 
2.43.0


      parent reply	other threads:[~2026-05-12 19:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 19:34 [PATCH iproute2-next v2 0/4] Allow rdma dev netns to take a pid David Ahern
2026-05-12 19:34 ` [PATCH iproute2-next v2 1/4] namespace: Add fallback to netns by pid David Ahern
2026-05-12 19:34 ` [PATCH iproute2-next v2 2/4] iplink: Drop pid fallback code for netns David Ahern
2026-05-12 19:34 ` [PATCH iproute2-next v2 3/4] rdma: Allow netns to be specified by pid David Ahern
2026-05-12 19:34 ` David Ahern [this message]

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=20260512193412.32019-5-dsahern@kernel.org \
    --to=dsahern@kernel.org \
    --cc=dahern@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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