[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1305168451-14491-1-git-send-email-xiaosuo@gmail.com>
Date: Thu, 12 May 2011 10:47:31 +0800
From: Changli Gao <xiaosuo@...il.com>
To: shemminger@...tta.com
Cc: netdev@...r.kernel.org, kuznet@....inr.ac.ru,
Changli Gao <xiaosuo@...il.com>
Subject: [PATCH] iproute2: use IFLA_TXQLEN when it is available
Use IFLA_TXQLEN when it is available, to avoid additional system calls.
Signed-off-by: Changli Gao <xiaosuo@...il.com>
---
ip/ipaddress.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index a1f78b9..59afafd 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -285,8 +285,16 @@ 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]) {
+ __u32 txqlen = *(__u32 *)RTA_DATA(tb[IFLA_TXQLEN]);
+
+ if (txqlen)
+ fprintf(fp, "qlen %u", txqlen);
+ } else {
+ print_queuelen(fp, (char*)RTA_DATA(tb[IFLA_IFNAME]));
+ }
+ }
if (!filter.family || filter.family == AF_PACKET) {
SPRINT_BUF(b1);
--
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