Skip to content

Commit 51ab299

Browse files
jpirkodavem330
authored andcommitted
net: sched: allow ingress and clsact qdiscs to share filter blocks
Benefit from the previously introduced shared filter blocks infrastructure and allow ingress and clsact qdisc instances to share filter blocks. The block index is coming from userspace as qdisc option. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Acked-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d47a6b0 commit 51ab299

File tree

1 file changed

+64
-16
lines changed

1 file changed

+64
-16
lines changed

net/sched/sch_ingress.c

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ static void clsact_chain_head_change(struct tcf_proto *tp_head, void *priv)
6161
struct mini_Qdisc_pair *miniqp = priv;
6262

6363
mini_qdisc_pair_swap(miniqp, tp_head);
64+
};
65+
66+
static void ingress_ingress_block_set(struct Qdisc *sch, u32 block_index)
67+
{
68+
struct ingress_sched_data *q = qdisc_priv(sch);
69+
70+
q->block_info.block_index = block_index;
71+
}
72+
73+
static u32 ingress_ingress_block_get(struct Qdisc *sch)
74+
{
75+
struct ingress_sched_data *q = qdisc_priv(sch);
76+
77+
return q->block_info.block_index;
6478
}
6579

6680
static int ingress_init(struct Qdisc *sch, struct nlattr *opt,
@@ -113,14 +127,16 @@ static const struct Qdisc_class_ops ingress_class_ops = {
113127
};
114128

115129
static struct Qdisc_ops ingress_qdisc_ops __read_mostly = {
116-
.cl_ops = &ingress_class_ops,
117-
.id = "ingress",
118-
.priv_size = sizeof(struct ingress_sched_data),
119-
.static_flags = TCQ_F_CPUSTATS,
120-
.init = ingress_init,
121-
.destroy = ingress_destroy,
122-
.dump = ingress_dump,
123-
.owner = THIS_MODULE,
130+
.cl_ops = &ingress_class_ops,
131+
.id = "ingress",
132+
.priv_size = sizeof(struct ingress_sched_data),
133+
.static_flags = TCQ_F_CPUSTATS,
134+
.init = ingress_init,
135+
.destroy = ingress_destroy,
136+
.dump = ingress_dump,
137+
.ingress_block_set = ingress_ingress_block_set,
138+
.ingress_block_get = ingress_ingress_block_get,
139+
.owner = THIS_MODULE,
124140
};
125141

126142
struct clsact_sched_data {
@@ -164,6 +180,34 @@ static struct tcf_block *clsact_tcf_block(struct Qdisc *sch, unsigned long cl,
164180
}
165181
}
166182

183+
static void clsact_ingress_block_set(struct Qdisc *sch, u32 block_index)
184+
{
185+
struct clsact_sched_data *q = qdisc_priv(sch);
186+
187+
q->ingress_block_info.block_index = block_index;
188+
}
189+
190+
static void clsact_egress_block_set(struct Qdisc *sch, u32 block_index)
191+
{
192+
struct clsact_sched_data *q = qdisc_priv(sch);
193+
194+
q->egress_block_info.block_index = block_index;
195+
}
196+
197+
static u32 clsact_ingress_block_get(struct Qdisc *sch)
198+
{
199+
struct clsact_sched_data *q = qdisc_priv(sch);
200+
201+
return q->ingress_block_info.block_index;
202+
}
203+
204+
static u32 clsact_egress_block_get(struct Qdisc *sch)
205+
{
206+
struct clsact_sched_data *q = qdisc_priv(sch);
207+
208+
return q->egress_block_info.block_index;
209+
}
210+
167211
static int clsact_init(struct Qdisc *sch, struct nlattr *opt,
168212
struct netlink_ext_ack *extack)
169213
{
@@ -215,14 +259,18 @@ static const struct Qdisc_class_ops clsact_class_ops = {
215259
};
216260

217261
static struct Qdisc_ops clsact_qdisc_ops __read_mostly = {
218-
.cl_ops = &clsact_class_ops,
219-
.id = "clsact",
220-
.priv_size = sizeof(struct clsact_sched_data),
221-
.static_flags = TCQ_F_CPUSTATS,
222-
.init = clsact_init,
223-
.destroy = clsact_destroy,
224-
.dump = ingress_dump,
225-
.owner = THIS_MODULE,
262+
.cl_ops = &clsact_class_ops,
263+
.id = "clsact",
264+
.priv_size = sizeof(struct clsact_sched_data),
265+
.static_flags = TCQ_F_CPUSTATS,
266+
.init = clsact_init,
267+
.destroy = clsact_destroy,
268+
.dump = ingress_dump,
269+
.ingress_block_set = clsact_ingress_block_set,
270+
.egress_block_set = clsact_egress_block_set,
271+
.ingress_block_get = clsact_ingress_block_get,
272+
.egress_block_get = clsact_egress_block_get,
273+
.owner = THIS_MODULE,
226274
};
227275

228276
static int __init ingress_module_init(void)

0 commit comments

Comments
 (0)