hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/net/sched/sch_mq.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * net/sched/sch_mq.c Classful multiqueue dummy scheduler
34 *
45 * Copyright (c) 2009 Patrick McHardy <kaber@trash.net>
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * version 2 as published by the Free Software Foundation.
96 */
107
118 #include <linux/types.h>
....@@ -38,9 +35,8 @@
3835 return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_MQ, &opt);
3936 }
4037
41
-static void mq_offload_stats(struct Qdisc *sch)
38
+static int mq_offload_stats(struct Qdisc *sch)
4239 {
43
- struct net_device *dev = qdisc_dev(sch);
4440 struct tc_mq_qopt_offload opt = {
4541 .command = TC_MQ_STATS,
4642 .handle = sch->handle,
....@@ -50,8 +46,7 @@
5046 },
5147 };
5248
53
- if (tc_can_offload(dev) && dev->netdev_ops->ndo_setup_tc)
54
- dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_MQ, &opt);
49
+ return qdisc_offload_dump_helper(sch, TC_SETUP_QDISC_MQ, &opt);
5550 }
5651
5752 static void mq_destroy(struct Qdisc *sch)
....@@ -172,9 +167,8 @@
172167
173168 spin_unlock_bh(qdisc_lock(qdisc));
174169 }
175
- mq_offload_stats(sch);
176170
177
- return 0;
171
+ return mq_offload_stats(sch);
178172 }
179173
180174 static struct netdev_queue *mq_queue_get(struct Qdisc *sch, unsigned long cl)
....@@ -197,6 +191,7 @@
197191 struct Qdisc **old, struct netlink_ext_ack *extack)
198192 {
199193 struct netdev_queue *dev_queue = mq_queue_get(sch, cl);
194
+ struct tc_mq_qopt_offload graft_offload;
200195 struct net_device *dev = qdisc_dev(sch);
201196
202197 if (dev->flags & IFF_UP)
....@@ -207,6 +202,14 @@
207202 new->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT;
208203 if (dev->flags & IFF_UP)
209204 dev_activate(dev);
205
+
206
+ graft_offload.handle = sch->handle;
207
+ graft_offload.graft_params.queue = cl - 1;
208
+ graft_offload.graft_params.child_handle = new ? new->handle : 0;
209
+ graft_offload.command = TC_MQ_GRAFT;
210
+
211
+ qdisc_offload_graft_helper(qdisc_dev(sch), sch, new, *old,
212
+ TC_SETUP_QDISC_MQ, &graft_offload, extack);
210213 return 0;
211214 }
212215
....@@ -245,7 +248,7 @@
245248 sch = dev_queue->qdisc_sleeping;
246249 if (gnet_stats_copy_basic(&sch->running, d, sch->cpu_bstats,
247250 &sch->bstats) < 0 ||
248
- gnet_stats_copy_queue(d, NULL, &sch->qstats, sch->q.qlen) < 0)
251
+ qdisc_qstats_copy(d, sch) < 0)
249252 return -1;
250253 return 0;
251254 }