Commit 95dc1929 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

pkt_sched: give visibility to mq slave qdiscs

Commit 6da7c8fc ("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: default avatarEric Dumazet <edumazet@google.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fbec3706
...@@ -88,6 +88,7 @@ int unregister_qdisc(struct Qdisc_ops *qops); ...@@ -88,6 +88,7 @@ int unregister_qdisc(struct Qdisc_ops *qops);
void qdisc_get_default(char *id, size_t len); void qdisc_get_default(char *id, size_t len);
int qdisc_set_default(const char *id); int qdisc_set_default(const char *id);
void qdisc_list_add(struct Qdisc *q);
void qdisc_list_del(struct Qdisc *q); void qdisc_list_del(struct Qdisc *q);
struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
......
...@@ -271,11 +271,12 @@ static struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle) ...@@ -271,11 +271,12 @@ static struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle)
return NULL; return NULL;
} }
static void qdisc_list_add(struct Qdisc *q) void qdisc_list_add(struct Qdisc *q)
{ {
if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS))
list_add_tail(&q->list, &qdisc_dev(q)->qdisc->list); list_add_tail(&q->list, &qdisc_dev(q)->qdisc->list);
} }
EXPORT_SYMBOL(qdisc_list_add);
void qdisc_list_del(struct Qdisc *q) void qdisc_list_del(struct Qdisc *q)
{ {
......
...@@ -78,14 +78,19 @@ static void mq_attach(struct Qdisc *sch) ...@@ -78,14 +78,19 @@ static void mq_attach(struct Qdisc *sch)
{ {
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
struct mq_sched *priv = qdisc_priv(sch); struct mq_sched *priv = qdisc_priv(sch);
struct Qdisc *qdisc; struct Qdisc *qdisc, *old;
unsigned int ntx; unsigned int ntx;
for (ntx = 0; ntx < dev->num_tx_queues; ntx++) { for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
qdisc = priv->qdiscs[ntx]; qdisc = priv->qdiscs[ntx];
qdisc = dev_graft_qdisc(qdisc->dev_queue, qdisc); old = dev_graft_qdisc(qdisc->dev_queue, qdisc);
if (qdisc) if (old)
qdisc_destroy(qdisc); qdisc_destroy(old);
#ifdef CONFIG_NET_SCHED
if (ntx < dev->real_num_tx_queues)
qdisc_list_add(qdisc);
#endif
} }
kfree(priv->qdiscs); kfree(priv->qdiscs);
priv->qdiscs = NULL; priv->qdiscs = NULL;
......
...@@ -167,15 +167,17 @@ static void mqprio_attach(struct Qdisc *sch) ...@@ -167,15 +167,17 @@ static void mqprio_attach(struct Qdisc *sch)
{ {
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
struct mqprio_sched *priv = qdisc_priv(sch); struct mqprio_sched *priv = qdisc_priv(sch);
struct Qdisc *qdisc; struct Qdisc *qdisc, *old;
unsigned int ntx; unsigned int ntx;
/* Attach underlying qdisc */ /* Attach underlying qdisc */
for (ntx = 0; ntx < dev->num_tx_queues; ntx++) { for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
qdisc = priv->qdiscs[ntx]; qdisc = priv->qdiscs[ntx];
qdisc = dev_graft_qdisc(qdisc->dev_queue, qdisc); old = dev_graft_qdisc(qdisc->dev_queue, qdisc);
if (qdisc) if (old)
qdisc_destroy(qdisc); qdisc_destroy(old);
if (ntx < dev->real_num_tx_queues)
qdisc_list_add(qdisc);
} }
kfree(priv->qdiscs); kfree(priv->qdiscs);
priv->qdiscs = NULL; priv->qdiscs = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment