netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Patrick McHardy <kaber@trash.net>,
	Mark Smith <lk-netdev@lk-netdev.nosense.org>,
	Jarek Poplawski <jarkao2@gmail.com>,
	netdev@vger.kernel.org, davem@linux-foundation.org
Subject: Re: UDP is bypassing qdisc statistics ....
Date: Tue, 01 Sep 2009 17:34:28 +0200	[thread overview]
Message-ID: <4A9D3F04.40409@gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0909011526480.12112@V090114053VZO-1>

Christoph Lameter a écrit :
> On Tue, 1 Sep 2009, Patrick McHardy wrote:
> 
>> That explains it. The bnx2 driver uses multiple TX queues, but
>> tc_dump_qdisc() only dumps the statistics from queue number 0.
> 
> There are no stats in other queues either... This is the result after
> sending 10000 or so packets. Maybe I am not catching all the qdiscs?
> 
> (this is the result of a pretty raw patch to dump all qdiscs)
> 
> #cat /proc/net/qdisc_stats
> Type Device State Bytes Packets Qlen Backlog Drops Requeues Overlimits
> TX root <NULL> 0 0 0 0 0 0 0 0
> RX root <NULL> 0 0 0 0 0 0 0 0
> TX root  eth0 0 24830 155 0 0 0 0 0
> RX root <NULL> 0 0 0 0 0 0 0 0
> TX root <NULL> 0 0 0 0 0 0 0 0
> RX root <NULL> 0 0 0 0 0 0 0 0
> TX root <NULL> 0 0 0 0 0 0 0 0
> RX root <NULL> 0 0 0 0 0 0 0 0
> TX root <NULL> 0 0 0 0 0 0 0 0
> RX root <NULL> 0 0 0 0 0 0 0 0
> 
> ---
>  net/sched/sch_api.c |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 64 insertions(+)
> 
> Index: linux-2.6/net/sched/sch_api.c
> ===================================================================
> --- linux-2.6.orig/net/sched/sch_api.c	2009-08-31 21:19:04.000000000 +0000
> +++ linux-2.6/net/sched/sch_api.c	2009-09-01 14:30:40.000000000 +0000
> @@ -1699,6 +1699,69 @@ static const struct file_operations psch
>  	.llseek = seq_lseek,
>  	.release = single_release,
>  };
> +
> +static void dump_qdisc(struct seq_file *seq, struct Qdisc *q, char *inout, char *text)
> +{
> +	seq_printf(seq, "%2s %2s %5s %lx %lld %d %d %d %d %d %d\n",
> +		inout, text, q->dev_queue->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 Qdisc *root, char *inout)
> +{
> +	struct Qdisc *q;
> +	int n = 0;
> +
> +	if (!root)
> +		return;
> +
> +	dump_qdisc(seq, root, inout, "root");
> +
> +	list_for_each_entry(q, &root->list, list) {
> +		char buffer[10];
> +
> +		sprintf(buffer,"%d", ++n);
> +		dump_qdisc(seq, q, inout, buffer);
> +	}
> +}
> +
> +
> +static int qdisc_show(struct seq_file *seq, void *v)
> +{
> +	struct net_device *dev;
> +
> +	seq_printf(seq, "Type Device State Bytes Packets "
> +			"Qlen Backlog Drops Requeues Overlimits\n");
> +
> +	read_lock(&dev_base_lock);
> +
> +	for_each_netdev(&init_net, dev) {
> +		struct netdev_queue *dev_queue;
> +
> +		dev_queue = netdev_get_tx_queue(dev, 0);
> +		dump_qdisc_root(seq, dev_queue->qdisc_sleeping, "TX");

you should iterate here 

	for (i = 0 ; i < dev->real_num_tx_queues; i++) {
		dev_queue = netdev_get_tx_queue(dev, i);
		dump_qdisc_root(seq, dev_queue->qdisc_sleeping, "TX");
	}


> +		dev_queue = &dev->rx_queue;
> +		dump_qdisc_root(seq, 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 +1769,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);


      reply	other threads:[~2009-09-01 15:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-31 21:46 UDP is bypassing qdisc statistics Christoph Lameter
2009-08-31 19:54 ` Eric Dumazet
2009-08-31 20:58   ` Mark Smith
2009-09-01  6:37     ` Jarek Poplawski
2009-09-01  7:00       ` Eric Dumazet
2009-09-01  9:37         ` Mark Smith
2009-09-01 18:03       ` Christoph Lameter
2009-09-01 14:20         ` Patrick McHardy
2009-09-01 14:58           ` Eric Dumazet
2009-09-01 19:05             ` Christoph Lameter
2009-09-01 15:28               ` Eric Dumazet
2009-09-01 19:35                 ` Christoph Lameter
2009-09-01 15:43                   ` Eric Dumazet
2009-09-01 15:58                     ` Eric Dumazet
2009-09-01 20:13                       ` Christoph Lameter
2009-09-01 21:55                       ` Christoph Lameter
2009-09-01 20:24                         ` Jarek Poplawski
2009-09-02  1:36                           ` Christoph Lameter
2009-09-01 18:29           ` Christoph Lameter
2009-09-01 19:30           ` Christoph Lameter
2009-09-01 15:34             ` Eric Dumazet [this message]

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=4A9D3F04.40409@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=cl@linux-foundation.org \
    --cc=davem@linux-foundation.org \
    --cc=jarkao2@gmail.com \
    --cc=kaber@trash.net \
    --cc=lk-netdev@lk-netdev.nosense.org \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).