Commit 95dc19299f741c986227ec33e23cbf9b3321f812

Authored by Eric Dumazet
Committed by David S. Miller
1 parent fbec370638

pkt_sched: give visibility to mq slave qdiscs

Commit 6da7c8fcbcbd ("qdisc: allow setting default queuing discipline")
added the ability to change default qdisc from pfifo_fast to say fq

But as most modern ethernet devices are multiqueue, we cant really
see all the statistics from "tc -s qdisc show", as the default root
qdisc is mq.

This patch adds the calls to qdisc_list_add() to mq and mqprio

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 4 changed files with 18 additions and 9 deletions Side-by-side Diff

include/net/pkt_sched.h
... ... @@ -88,6 +88,7 @@
88 88 void qdisc_get_default(char *id, size_t len);
89 89 int qdisc_set_default(const char *id);
90 90  
  91 +void qdisc_list_add(struct Qdisc *q);
91 92 void qdisc_list_del(struct Qdisc *q);
92 93 struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
93 94 struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
... ... @@ -271,11 +271,12 @@
271 271 return NULL;
272 272 }
273 273  
274   -static void qdisc_list_add(struct Qdisc *q)
  274 +void qdisc_list_add(struct Qdisc *q)
275 275 {
276 276 if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS))
277 277 list_add_tail(&q->list, &qdisc_dev(q)->qdisc->list);
278 278 }
  279 +EXPORT_SYMBOL(qdisc_list_add);
279 280  
280 281 void qdisc_list_del(struct Qdisc *q)
281 282 {
... ... @@ -78,14 +78,19 @@
78 78 {
79 79 struct net_device *dev = qdisc_dev(sch);
80 80 struct mq_sched *priv = qdisc_priv(sch);
81   - struct Qdisc *qdisc;
  81 + struct Qdisc *qdisc, *old;
82 82 unsigned int ntx;
83 83  
84 84 for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
85 85 qdisc = priv->qdiscs[ntx];
86   - qdisc = dev_graft_qdisc(qdisc->dev_queue, qdisc);
87   - if (qdisc)
88   - qdisc_destroy(qdisc);
  86 + old = dev_graft_qdisc(qdisc->dev_queue, qdisc);
  87 + if (old)
  88 + qdisc_destroy(old);
  89 +#ifdef CONFIG_NET_SCHED
  90 + if (ntx < dev->real_num_tx_queues)
  91 + qdisc_list_add(qdisc);
  92 +#endif
  93 +
89 94 }
90 95 kfree(priv->qdiscs);
91 96 priv->qdiscs = NULL;
net/sched/sch_mqprio.c
... ... @@ -167,15 +167,17 @@
167 167 {
168 168 struct net_device *dev = qdisc_dev(sch);
169 169 struct mqprio_sched *priv = qdisc_priv(sch);
170   - struct Qdisc *qdisc;
  170 + struct Qdisc *qdisc, *old;
171 171 unsigned int ntx;
172 172  
173 173 /* Attach underlying qdisc */
174 174 for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
175 175 qdisc = priv->qdiscs[ntx];
176   - qdisc = dev_graft_qdisc(qdisc->dev_queue, qdisc);
177   - if (qdisc)
178   - qdisc_destroy(qdisc);
  176 + old = dev_graft_qdisc(qdisc->dev_queue, qdisc);
  177 + if (old)
  178 + qdisc_destroy(old);
  179 + if (ntx < dev->real_num_tx_queues)
  180 + qdisc_list_add(qdisc);
179 181 }
180 182 kfree(priv->qdiscs);
181 183 priv->qdiscs = NULL;