.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* net/sched/sch_ingress.c - Ingress and clsact qdisc |
---|
2 | | - * |
---|
3 | | - * This program is free software; you can redistribute it and/or |
---|
4 | | - * modify it under the terms of the GNU General Public License |
---|
5 | | - * as published by the Free Software Foundation; either version |
---|
6 | | - * 2 of the License, or (at your option) any later version. |
---|
7 | 3 | * |
---|
8 | 4 | * Authors: Jamal Hadi Salim 1999 |
---|
9 | 5 | */ |
---|
.. | .. |
---|
82 | 78 | { |
---|
83 | 79 | struct ingress_sched_data *q = qdisc_priv(sch); |
---|
84 | 80 | struct net_device *dev = qdisc_dev(sch); |
---|
| 81 | + int err; |
---|
| 82 | + |
---|
| 83 | + if (sch->parent != TC_H_INGRESS) |
---|
| 84 | + return -EOPNOTSUPP; |
---|
85 | 85 | |
---|
86 | 86 | net_inc_ingress_queue(); |
---|
87 | 87 | |
---|
88 | 88 | mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress); |
---|
89 | 89 | |
---|
90 | | - q->block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; |
---|
| 90 | + q->block_info.binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS; |
---|
91 | 91 | q->block_info.chain_head_change = clsact_chain_head_change; |
---|
92 | 92 | q->block_info.chain_head_change_priv = &q->miniqp; |
---|
93 | 93 | |
---|
94 | | - return tcf_block_get_ext(&q->block, sch, &q->block_info, extack); |
---|
| 94 | + err = tcf_block_get_ext(&q->block, sch, &q->block_info, extack); |
---|
| 95 | + if (err) |
---|
| 96 | + return err; |
---|
| 97 | + |
---|
| 98 | + mini_qdisc_pair_block_init(&q->miniqp, q->block); |
---|
| 99 | + |
---|
| 100 | + return 0; |
---|
95 | 101 | } |
---|
96 | 102 | |
---|
97 | 103 | static void ingress_destroy(struct Qdisc *sch) |
---|
98 | 104 | { |
---|
99 | 105 | struct ingress_sched_data *q = qdisc_priv(sch); |
---|
| 106 | + |
---|
| 107 | + if (sch->parent != TC_H_INGRESS) |
---|
| 108 | + return; |
---|
100 | 109 | |
---|
101 | 110 | tcf_block_put_ext(q->block, sch, &q->block_info); |
---|
102 | 111 | net_dec_ingress_queue(); |
---|
.. | .. |
---|
106 | 115 | { |
---|
107 | 116 | struct nlattr *nest; |
---|
108 | 117 | |
---|
109 | | - nest = nla_nest_start(skb, TCA_OPTIONS); |
---|
| 118 | + nest = nla_nest_start_noflag(skb, TCA_OPTIONS); |
---|
110 | 119 | if (nest == NULL) |
---|
111 | 120 | goto nla_put_failure; |
---|
112 | 121 | |
---|
.. | .. |
---|
118 | 127 | } |
---|
119 | 128 | |
---|
120 | 129 | static const struct Qdisc_class_ops ingress_class_ops = { |
---|
| 130 | + .flags = QDISC_CLASS_OPS_DOIT_UNLOCKED, |
---|
121 | 131 | .leaf = ingress_leaf, |
---|
122 | 132 | .find = ingress_find, |
---|
123 | 133 | .walk = ingress_walk, |
---|
.. | .. |
---|
130 | 140 | .cl_ops = &ingress_class_ops, |
---|
131 | 141 | .id = "ingress", |
---|
132 | 142 | .priv_size = sizeof(struct ingress_sched_data), |
---|
133 | | - .static_flags = TCQ_F_CPUSTATS, |
---|
| 143 | + .static_flags = TCQ_F_INGRESS | TCQ_F_CPUSTATS, |
---|
134 | 144 | .init = ingress_init, |
---|
135 | 145 | .destroy = ingress_destroy, |
---|
136 | 146 | .dump = ingress_dump, |
---|
.. | .. |
---|
215 | 225 | struct net_device *dev = qdisc_dev(sch); |
---|
216 | 226 | int err; |
---|
217 | 227 | |
---|
| 228 | + if (sch->parent != TC_H_CLSACT) |
---|
| 229 | + return -EOPNOTSUPP; |
---|
| 230 | + |
---|
218 | 231 | net_inc_ingress_queue(); |
---|
219 | 232 | net_inc_egress_queue(); |
---|
220 | 233 | |
---|
221 | 234 | mini_qdisc_pair_init(&q->miniqp_ingress, sch, &dev->miniq_ingress); |
---|
222 | 235 | |
---|
223 | | - q->ingress_block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; |
---|
| 236 | + q->ingress_block_info.binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS; |
---|
224 | 237 | q->ingress_block_info.chain_head_change = clsact_chain_head_change; |
---|
225 | 238 | q->ingress_block_info.chain_head_change_priv = &q->miniqp_ingress; |
---|
226 | 239 | |
---|
.. | .. |
---|
229 | 242 | if (err) |
---|
230 | 243 | return err; |
---|
231 | 244 | |
---|
| 245 | + mini_qdisc_pair_block_init(&q->miniqp_ingress, q->ingress_block); |
---|
| 246 | + |
---|
232 | 247 | mini_qdisc_pair_init(&q->miniqp_egress, sch, &dev->miniq_egress); |
---|
233 | 248 | |
---|
234 | | - q->egress_block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_EGRESS; |
---|
| 249 | + q->egress_block_info.binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS; |
---|
235 | 250 | q->egress_block_info.chain_head_change = clsact_chain_head_change; |
---|
236 | 251 | q->egress_block_info.chain_head_change_priv = &q->miniqp_egress; |
---|
237 | 252 | |
---|
.. | .. |
---|
242 | 257 | { |
---|
243 | 258 | struct clsact_sched_data *q = qdisc_priv(sch); |
---|
244 | 259 | |
---|
| 260 | + if (sch->parent != TC_H_CLSACT) |
---|
| 261 | + return; |
---|
| 262 | + |
---|
245 | 263 | tcf_block_put_ext(q->egress_block, sch, &q->egress_block_info); |
---|
246 | 264 | tcf_block_put_ext(q->ingress_block, sch, &q->ingress_block_info); |
---|
247 | 265 | |
---|
.. | .. |
---|
250 | 268 | } |
---|
251 | 269 | |
---|
252 | 270 | static const struct Qdisc_class_ops clsact_class_ops = { |
---|
| 271 | + .flags = QDISC_CLASS_OPS_DOIT_UNLOCKED, |
---|
253 | 272 | .leaf = ingress_leaf, |
---|
254 | 273 | .find = clsact_find, |
---|
255 | 274 | .walk = ingress_walk, |
---|
.. | .. |
---|
262 | 281 | .cl_ops = &clsact_class_ops, |
---|
263 | 282 | .id = "clsact", |
---|
264 | 283 | .priv_size = sizeof(struct clsact_sched_data), |
---|
265 | | - .static_flags = TCQ_F_CPUSTATS, |
---|
| 284 | + .static_flags = TCQ_F_INGRESS | TCQ_F_CPUSTATS, |
---|
266 | 285 | .init = clsact_init, |
---|
267 | 286 | .destroy = clsact_destroy, |
---|
268 | 287 | .dump = ingress_dump, |
---|