diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-09-17 16:55:06 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-09-19 15:26:01 +0300 |
commit | f7116fb4608500ad93eca03e0ad158b75fa85d0b (patch) | |
tree | 5565bd03953c0c7cb1dfa581d438d25f19e0039d /net/sched/sch_mqprio.c | |
parent | cbcca2e3961eac736566ac13ef0d0bf6f0b764ec (diff) | |
download | linux-f7116fb4608500ad93eca03e0ad158b75fa85d0b.tar.xz |
net: sched: move and reuse mq_change_real_num_tx()
The code for handling active queue changes is identical
between mq and mqprio, reuse it.
Suggested-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_mqprio.c')
-rw-r--r-- | net/sched/sch_mqprio.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 7f23a92849d5..0bc10234e306 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -306,28 +306,6 @@ static void mqprio_attach(struct Qdisc *sch) priv->qdiscs = NULL; } -static void mqprio_change_real_num_tx(struct Qdisc *sch, - unsigned int new_real_tx) -{ - struct net_device *dev = qdisc_dev(sch); - struct Qdisc *qdisc; - unsigned int i; - - for (i = new_real_tx; i < dev->real_num_tx_queues; i++) { - qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping; - /* Only update the default qdiscs we created, - * qdiscs with handles are always hashed. - */ - if (qdisc != &noop_qdisc && !qdisc->handle) - qdisc_hash_del(qdisc); - } - for (i = dev->real_num_tx_queues; i < new_real_tx; i++) { - qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping; - if (qdisc != &noop_qdisc && !qdisc->handle) - qdisc_hash_add(qdisc, false); - } -} - static struct netdev_queue *mqprio_queue_get(struct Qdisc *sch, unsigned long cl) { @@ -645,7 +623,7 @@ static struct Qdisc_ops mqprio_qdisc_ops __read_mostly = { .init = mqprio_init, .destroy = mqprio_destroy, .attach = mqprio_attach, - .change_real_num_tx = mqprio_change_real_num_tx, + .change_real_num_tx = mq_change_real_num_tx, .dump = mqprio_dump, .owner = THIS_MODULE, }; |