netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	Fabio Checconi <fabio@gandalf.sssup.it>,
	Luigi Rizzo <rizzo@iet.unipi.it>,
	netdev@vger.kernel.org
Subject: QFQ debugfs
Date: Fri, 4 Mar 2011 09:20:53 -0800	[thread overview]
Message-ID: <20110304092053.37c5f9ff@nehalam> (raw)
In-Reply-To: <1299221426.2547.47.camel@edumazet-laptop>

This is quick hack to put a debugfs hook on:
  debug/qfq/<device>

dumps internal state

---
 net/sched/sch_qfq.c |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

--- a/net/sched/sch_qfq.c	2011-03-04 08:24:39.138728524 -0800
+++ b/net/sched/sch_qfq.c	2011-03-04 08:44:10.889972934 -0800
@@ -14,6 +14,7 @@
 #include <linux/errno.h>
 #include <linux/netdevice.h>
 #include <linux/pkt_sched.h>
+#include <linux/debugfs.h>
 #include <net/sch_generic.h>
 #include <net/pkt_sched.h>
 #include <net/pkt_cls.h>
@@ -144,6 +145,7 @@ struct qfq_group {
 struct qfq_sched {
 	struct tcf_proto *filter_list;
 	struct Qdisc_class_hash clhash;
+	struct dentry	     *debugfs;
 
 	u64		V;		/* Precise virtual time. */
 	u32		wsum;		/* weight sum */
@@ -1025,6 +1027,55 @@ static unsigned int qfq_drop(struct Qdis
 	return 0;
 }
 
+static struct dentry *qfq_debug;
+
+static int qfq_debug_show(struct seq_file *seq, void *v)
+{
+	struct Qdisc *sch = seq->private;
+	const struct qfq_sched *q = qdisc_priv(sch);
+	unsigned int i, j;
+
+	seq_printf(seq, "V=%llu wsum=%u\n", q->V, q->wsum);
+	for (i = 0; i < QFQ_MAX_STATE; i++)
+		seq_printf(seq, "%lx%c", q->bitmaps[i],
+			   (i & 3) == 3 ? '\n' : ' ');
+
+	for (i = 0; i <= QFQ_MAX_INDEX; i++) {
+		const struct qfq_group *grp = &q->groups[i];
+		seq_printf(seq, "%d: S=%llu F=%llu shift=%u index=%u front=%u full=%#lx\n",
+			   i, (unsigned long long)grp->S,
+			   (unsigned long long)grp->F,
+			   grp->slot_shift, grp->index,
+			   grp->front, grp->full_slots);
+
+		for (j = 0; j < QFQ_MAX_SLOTS; j++) {
+			const struct qfq_class *cl;
+			struct hlist_node *n;
+
+			hlist_for_each_entry(cl, n, &grp->slots[j], next) {
+				seq_printf(seq, "  %d: S=%llu F=%llu inv_w=%u lmax=%u\n",
+					   j, cl->S, cl->F,
+					   cl->inv_w, cl->lmax);
+			}
+		}
+	}
+	return 0;
+}
+
+static int qfq_debug_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, qfq_debug_show, inode->i_private);
+}
+
+static const struct file_operations qfq_debug_fops = {
+	.owner		= THIS_MODULE,
+	.open		= qfq_debug_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+
+
 static int qfq_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
 {
 	struct qfq_sched *q = qdisc_priv(sch);
@@ -1042,6 +1093,9 @@ static int qfq_init_qdisc(struct Qdisc *
 			INIT_HLIST_HEAD(&grp->slots[j]);
 	}
 
+	q->debugfs = debugfs_create_file(sch->dev_queue->dev->name,
+					 S_IRUGO, qfq_debug, sch,
+					 &qfq_debug_fops);
 	return 0;
 }
 
@@ -1121,11 +1175,16 @@ static struct Qdisc_ops qfq_qdisc_ops __
 
 static int __init qfq_init(void)
 {
+	qfq_debug = debugfs_create_dir("qfq", NULL);
+
 	return register_qdisc(&qfq_qdisc_ops);
 }
 
 static void __exit qfq_exit(void)
 {
+	if (qfq_debug)
+		debugfs_remove(qfq_debug);
+
 	unregister_qdisc(&qfq_qdisc_ops);
 }
 

      parent reply	other threads:[~2011-03-04 17:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01  1:17 [PATCH] sched: QFQ - quick fair queue scheduler (v2) Stephen Hemminger
2011-03-01  5:28 ` Eric Dumazet
2011-03-02  2:06 ` Fabio Checconi
2011-03-02 11:17   ` Eric Dumazet
2011-03-02 16:11     ` Stephen Hemminger
2011-03-02 16:18       ` Eric Dumazet
2011-03-02 17:31         ` Eric Dumazet
2011-03-02 18:16           ` Patrick McHardy
2011-03-03  9:35             ` Eric Dumazet
2011-03-02 23:55           ` Stephen Hemminger
2011-03-03  8:19           ` Fabio Checconi
2011-03-03  8:27             ` Eric Dumazet
2011-03-03 10:40               ` Eric Dumazet
2011-03-03 15:07                 ` Fabio Checconi
2011-03-03 15:25                   ` Eric Dumazet
2011-03-03 15:31                     ` Eric Dumazet
2011-03-03 15:39                       ` Eric Dumazet
2011-03-03 15:18                 ` Eric Dumazet
     [not found]                   ` <20110303161912.GC29685@gandalf.sssup.it>
     [not found]                     ` <1299170053.2983.134.camel@edumazet-laptop>
     [not found]                       ` <20110303181339.GD29685@gandalf.sssup.it>
     [not found]                         ` <1299180567.2547.4.camel@edumazet-laptop>
     [not found]                           ` <1299192974.2547.13.camel@edumazet-laptop>
     [not found]                             ` <20110304064302.GE29685@gandalf.sssup.it>
     [not found]                               ` <1299222074.2547.50.camel@edumazet-laptop>
     [not found]                                 ` <AANLkTinAGjZ5SAOA1iUAFu5rtYydeb6Soy_Xg5kMvn-z@mail.gmail.com>
     [not found]                                   ` <1299274468.2758.4.camel@edumazet-laptop>
     [not found]                                     ` <AANLkTikeQCfShKfZWq2Y7V_MA4iRjQvWWtkC68rK9nUm@mail.gmail.com>
     [not found]                                       ` <1299277003.2758.52.camel@edumazet-laptop>
     [not found]                                         ` <AANLkTinR7QDC2uGjQurJQ1JfBA7q1pxyewePggh87z8E@mail.gmail.com>
     [not found]                                           ` <1299278778.2758.53.camel@edumazet-laptop>
     [not found]                                             ` <AANLkTikBoQd+ZA1kY0F0MvUsJ8Y=9KwGkfmZNdi4hLXz@mail.gmail.com>
     [not found]                                               ` <20110304150741.5d4aa354@nehalam>
     [not found]                                                 ` <AANLkTi=HBDayfd0bEA+AQqzjTKMajghet=UJAw9vL56A@mail.gmail.com>
     [not found]                                                   ` <20110309110242.3307ca69@nehalam>
     [not found]                                                     ` <1300016057.2761.16.camel@edumazet-laptop>
     [not found]                                                       ` <1300034690.2761.29.camel@edumazet-laptop>
2011-03-23  6:45                                                         ` [BUG] net_sched: failed bisection Eric Dumazet
2011-03-24  6:53                                                           ` [PATCH] net_sched: fix THROTTLED/RUNNING race Eric Dumazet
2011-03-24  7:13                                                             ` David Miller
2011-03-03  9:07             ` [PATCH] sched: QFQ - quick fair queue scheduler (v2) Eric Dumazet
2011-03-02 11:50 ` Patrick McHardy
2011-03-02 15:41 ` Eric Dumazet
2011-03-02 15:53 ` Eric Dumazet
2011-03-03 16:03 ` Eric Dumazet
2011-03-03 16:48   ` [PATCH] sched: QFQ - quick fair queue scheduler (v3) Stephen Hemminger
2011-03-03 22:28     ` Eric Dumazet
2011-03-03 22:59       ` Stephen Hemminger
2011-03-03 23:02         ` [PATCH] sched: QFQ - quick fair queue scheduler (v3.1) Stephen Hemminger
2011-03-03 23:12           ` Eric Dumazet
2011-03-04  0:03       ` [PATCH] sched: QFQ - quick fair queue scheduler (v3) Stephen Hemminger
2011-03-04  0:30         ` [PATCH] sched: QFQ - quick fair queue scheduler (v4) Stephen Hemminger
2011-03-04  6:50           ` Eric Dumazet
2011-03-04 17:17             ` Stephen Hemminger
2011-03-04 17:18             ` Stephen Hemminger
2011-03-04 17:20             ` Stephen Hemminger [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=20110304092053.37c5f9ff@nehalam \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fabio@gandalf.sssup.it \
    --cc=netdev@vger.kernel.org \
    --cc=rizzo@iet.unipi.it \
    /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).