[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AE068EB.70005@gmail.com>
Date: Thu, 22 Oct 2009 16:15:07 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Stephen Hemminger <stephen.hemminger@...tta.com>
CC: Linux Netdev List <netdev@...r.kernel.org>,
Benjamin LaHaise <bcrl@...et.ca>
Subject: [PATCH iproute2] ip: Support IFLA_TXQLEN in ip link command
We currently use an expensive ioctl() to get device txqueuelen, while
rtnetlink gave it to us for free. This patch speeds up ip link operation
when many devices are registered.
Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
---
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 267ecb3..f06a3f7 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -252,9 +252,12 @@ int print_linkinfo(const struct sockaddr_nl *who,
if (tb[IFLA_OPERSTATE])
print_operstate(fp, *(__u8 *)RTA_DATA(tb[IFLA_OPERSTATE]));
- if (filter.showqueue)
- print_queuelen(fp, (char*)RTA_DATA(tb[IFLA_IFNAME]));
-
+ if (filter.showqueue) {
+ if (tb[IFLA_TXQLEN])
+ fprintf(fp, "qlen %d ", *(int *)RTA_DATA(tb[IFLA_TXQLEN]));
+ else
+ print_queuelen(fp, (char *)RTA_DATA(tb[IFLA_IFNAME]));
+ }
if (!filter.family || filter.family == AF_PACKET) {
SPRINT_BUF(b1);
fprintf(fp, "%s", _SL_);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists