Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: David Ahern <dsahern@kernel.org>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	 Eric Dumazet <edumazet@google.com>
Subject: [PATCH iproute2-next] ll_map: add RTEXT_FILTER_NAME_ONLY to ll_link_get() and ll_init_map()
Date: Wed, 20 May 2026 10:30:43 +0000	[thread overview]
Message-ID: <20260520103043.1131213-1-edumazet@google.com> (raw)

iproute2 can spend considerable amount of time in ll_init_map()
or ll_link_get() to dump verbose netdev attributes, contributing
to RTNL pressure.

Add RTEXT_FILTER_NAME_ONLY new flag so that rtnl_fill_ifinfo()
limits its output to:

    - struct nlmsghdr
    - IFLA_IFNAME
    - IFLA_PROP_LIST (alternate names)

This is supported in linux 7.2+ (and ignored in old kernels).

RTNL avoidance should be automatically provided in upcoming
kernel patches.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 lib/ll_map.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/ll_map.c b/lib/ll_map.c
index 07937e27d4f6fb5506a3da6e9318270635224364..21dd124960a604b0cd8912a11e1808c0eec5dc3e 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -273,7 +273,8 @@ static int ll_link_get(const char *name, int index)
 		.n.nlmsg_type = RTM_GETLINK,
 		.ifm.ifi_index = index,
 	};
-	__u32 filt_mask = RTEXT_FILTER_VF | RTEXT_FILTER_SKIP_STATS;
+	__u32 filt_mask = RTEXT_FILTER_VF | RTEXT_FILTER_SKIP_STATS |
+			  RTEXT_FILTER_NAME_ONLY;
 	struct rtnl_handle rth = {};
 	struct nlmsghdr *answer;
 	int rc = 0;
@@ -393,7 +394,8 @@ void ll_init_map(struct rtnl_handle *rth)
 
 	if (rtnl_linkdump_req_filter(rth, AF_UNSPEC,
 				     RTEXT_FILTER_VF |
-				     RTEXT_FILTER_SKIP_STATS) < 0) {
+				     RTEXT_FILTER_SKIP_STATS |
+				     RTEXT_FILTER_NAME_ONLY) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
-- 
2.54.0.631.ge1b05301d1-goog


             reply	other threads:[~2026-05-20 10:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 10:30 Eric Dumazet [this message]
2026-05-22 22:20 ` [PATCH iproute2-next] ll_map: add RTEXT_FILTER_NAME_ONLY to ll_link_get() and ll_init_map() patchwork-bot+netdevbpf

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=20260520103043.1131213-1-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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