Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2] ip: drop unnecessary fallback to ioctl for tx queue length
@ 2026-07-28 21:38 Stephen Hemminger
  2026-08-03 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2026-07-28 21:38 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger

Kernel has been reporting TxQ length with netlink since
the 2.5 so the ioctl path is dead code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 ip/ipaddress.c | 25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 7e4cb77c..6fa02c77 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -159,30 +159,11 @@ int get_operstate(const char *name)
 
 static void print_queuelen(FILE *f, struct rtattr *tb[IFLA_MAX + 1])
 {
-	int qlen;
+	if (tb[IFLA_TXQLEN]) {
+		__u32 qlen = rta_getattr_u32(tb[IFLA_TXQLEN]);
 
-	if (tb[IFLA_TXQLEN])
-		qlen = rta_getattr_u32(tb[IFLA_TXQLEN]);
-	else {
-		struct ifreq ifr = {};
-		int s = socket(AF_INET, SOCK_STREAM, 0);
-
-		if (s < 0)
-			return;
-
-		strcpy(ifr.ifr_name, rta_getattr_str(tb[IFLA_IFNAME]));
-		if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) {
-			fprintf(stderr,
-				"ioctl(SIOCGIFTXQLEN) failed: %s\n",
-				strerror(errno));
-			close(s);
-			return;
-		}
-		close(s);
-		qlen = ifr.ifr_qlen;
+		print_uint(PRINT_ANY, "txqlen", "qlen %u", qlen);
 	}
-	if (qlen)
-		print_int(PRINT_ANY, "txqlen", "qlen %d", qlen);
 }
 
 static const char *link_modes[] = {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] ip: drop unnecessary fallback to ioctl for tx queue length
  2026-07-28 21:38 [PATCH iproute2] ip: drop unnecessary fallback to ioctl for tx queue length Stephen Hemminger
@ 2026-08-03 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-03 19:00 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Tue, 28 Jul 2026 14:38:43 -0700 you wrote:
> Kernel has been reporting TxQ length with netlink since
> the 2.5 so the ioctl path is dead code.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  ip/ipaddress.c | 25 +++----------------------
>  1 file changed, 3 insertions(+), 22 deletions(-)

Here is the summary with links:
  - [iproute2] ip: drop unnecessary fallback to ioctl for tx queue length
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=faceb3260ab2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-03 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 21:38 [PATCH iproute2] ip: drop unnecessary fallback to ioctl for tx queue length Stephen Hemminger
2026-08-03 19:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox