From patchwork Tue Sep 1 21:55:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Lameter X-Patchwork-Id: 32762 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id CA9F4B7088 for ; Wed, 2 Sep 2009 03:57:57 +1000 (EST) Received: by ozlabs.org (Postfix) id B683DDDD0B; Wed, 2 Sep 2009 03:57:57 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 47D73DDD01 for ; Wed, 2 Sep 2009 03:57:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754796AbZIAR4u (ORCPT ); Tue, 1 Sep 2009 13:56:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754757AbZIAR4u (ORCPT ); Tue, 1 Sep 2009 13:56:50 -0400 Received: from smtp2.ultrahosting.com ([74.213.174.253]:54281 "EHLO smtp.ultrahosting.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754706AbZIAR4t (ORCPT ); Tue, 1 Sep 2009 13:56:49 -0400 Received: from localhost (smtp.ultrahosting.com [127.0.0.1]) by smtp.ultrahosting.com (Postfix) with ESMTP id 3E57582C826 for ; Tue, 1 Sep 2009 13:58:21 -0400 (EDT) X-Virus-Scanned: amavisd-new at ultrahosting.com Received: from smtp.ultrahosting.com ([74.213.174.253]) by localhost (smtp.ultrahosting.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zQlhuhi7BCt6 for ; Tue, 1 Sep 2009 13:58:16 -0400 (EDT) Received: from V090114053VZO-1 (unknown [74.213.171.31]) by smtp.ultrahosting.com (Postfix) with ESMTP id 6327682C7E8 for ; Tue, 1 Sep 2009 13:58:12 -0400 (EDT) Received: from cl (helo=localhost) by V090114053VZO-1 with local-esmtp (Exim 4.69) (envelope-from ) id 1MibKK-0007nd-Ib; Tue, 01 Sep 2009 17:55:44 -0400 Date: Tue, 1 Sep 2009 17:55:44 -0400 (EDT) From: Christoph Lameter X-X-Sender: cl@V090114053VZO-1 To: Eric Dumazet cc: Patrick McHardy , Mark Smith , Jarek Poplawski , netdev@vger.kernel.org Subject: Re: UDP is bypassing qdisc statistics .... In-Reply-To: <4A9D448D.6050309@gmail.com> Message-ID: References: <20090901063726.GA5222@ff.dom.local> <4A9D2DBF.8030200@trash.net> <4A9D3687.2020101@gmail.com> <4A9D3D9A.1030500@gmail.com> <4A9D410D.5000507@gmail.com> <4A9D448D.6050309@gmail.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Ok i got some meaningful statistics now. Why is the qlen zero for all devices? $ cat /proc/net/qdisc_stats Type Device St Bytes Packts Qlen Bklg Drops Requeu Overlimit TX0 root lo 0 0 0 0 0 0 0 0 RX root lo 0 0 0 0 0 0 0 0 TX0 root eth0 0 12463 91 0 0 0 0 0 TX1 root eth0 0 2954 39 0 0 0 0 0 TX2 root eth0 0 2132 23 0 0 0 0 0 TX3 root eth0 0 29293 210 0 0 0 0 0 TX4 root eth0 0 2805 31 0 0 0 0 0 TX5 root eth0 0 1286862317 3762765 0 0 643253 30886 0 TX6 root eth0 0 1310 17 0 0 0 0 0 TX7 root eth0 0 2860 31 0 0 0 0 0 --- net/sched/sch_api.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/net/sched/sch_api.c =================================================================== --- linux-2.6.orig/net/sched/sch_api.c 2009-09-01 12:27:24.000000000 -0500 +++ linux-2.6/net/sched/sch_api.c 2009-09-01 12:40:30.000000000 -0500 @@ -1699,6 +1699,77 @@ static const struct file_operations psch .llseek = seq_lseek, .release = single_release, }; + +static void dump_qdisc(struct seq_file *seq, struct net_device *dev, + struct Qdisc *q, char *inout, char *text) +{ + seq_printf(seq, "%3s %2s %6s %3lx %8lld %6d %4d %4d %6d %6d %6d\n", + inout, text, dev->name, q->state, + q->bstats.bytes, q->bstats.packets, + q->qstats.qlen, q->qstats.backlog, q->qstats.drops, + q->qstats.requeues, q->qstats.overlimits); +} + +static void dump_qdisc_root(struct seq_file *seq, struct net_device *dev, + struct Qdisc *root, char *inout) +{ + struct Qdisc *q; + int n = 0; + + if (!root) + return; + + dump_qdisc(seq, dev, root, inout, "root"); + + list_for_each_entry(q, &root->list, list) { + char buffer[10]; + + sprintf(buffer,"Q%d", ++n); + dump_qdisc(seq, dev, q, inout, buffer); + } +} + + +static int qdisc_show(struct seq_file *seq, void *v) +{ + struct net_device *dev; + + seq_printf(seq, "Type Device St Bytes Packts " + "Qlen Bklg Drops Requeu Overlimit\n"); + + read_lock(&dev_base_lock); + + for_each_netdev(&init_net, dev) { + struct netdev_queue *dev_queue; + int i; + + for (i = 0; i < dev->real_num_tx_queues; i++) { + char buffer[10]; + + dev_queue = netdev_get_tx_queue(dev, i); + sprintf(buffer, "TX%d", i); + dump_qdisc_root(seq, dev, dev_queue->qdisc_sleeping, buffer); + } + dev_queue = &dev->rx_queue; + dump_qdisc_root(seq, dev, dev_queue->qdisc_sleeping, "RX"); + } + + read_unlock(&dev_base_lock); + return 0; +} + +static int qdisc_open(struct inode *inode, struct file *file) +{ + return single_open(file, qdisc_show, PDE(inode)->data); +} + +static const struct file_operations qdisc_fops = { + .owner = THIS_MODULE, + .open = qdisc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; #endif static int __init pktsched_init(void) @@ -1706,6 +1777,7 @@ static int __init pktsched_init(void) register_qdisc(&pfifo_qdisc_ops); register_qdisc(&bfifo_qdisc_ops); proc_net_fops_create(&init_net, "psched", 0, &psched_fops); + proc_net_fops_create(&init_net, "qdisc_stats", 0, &qdisc_fops); rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL); rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL);