Commit 51ab2994 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

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: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d47a6b0e
......@@ -61,6 +61,20 @@ static void clsact_chain_head_change(struct tcf_proto *tp_head, void *priv)
struct mini_Qdisc_pair *miniqp = priv;
mini_qdisc_pair_swap(miniqp, tp_head);
};
static void ingress_ingress_block_set(struct Qdisc *sch, u32 block_index)
{
struct ingress_sched_data *q = qdisc_priv(sch);
q->block_info.block_index = block_index;
}
static u32 ingress_ingress_block_get(struct Qdisc *sch)
{
struct ingress_sched_data *q = qdisc_priv(sch);
return q->block_info.block_index;
}
static int ingress_init(struct Qdisc *sch, struct nlattr *opt,
......@@ -120,6 +134,8 @@ static struct Qdisc_ops ingress_qdisc_ops __read_mostly = {
.init = ingress_init,
.destroy = ingress_destroy,
.dump = ingress_dump,
.ingress_block_set = ingress_ingress_block_set,
.ingress_block_get = ingress_ingress_block_get,
.owner = THIS_MODULE,
};
......@@ -164,6 +180,34 @@ static struct tcf_block *clsact_tcf_block(struct Qdisc *sch, unsigned long cl,
}
}
static void clsact_ingress_block_set(struct Qdisc *sch, u32 block_index)
{
struct clsact_sched_data *q = qdisc_priv(sch);
q->ingress_block_info.block_index = block_index;
}
static void clsact_egress_block_set(struct Qdisc *sch, u32 block_index)
{
struct clsact_sched_data *q = qdisc_priv(sch);
q->egress_block_info.block_index = block_index;
}
static u32 clsact_ingress_block_get(struct Qdisc *sch)
{
struct clsact_sched_data *q = qdisc_priv(sch);
return q->ingress_block_info.block_index;
}
static u32 clsact_egress_block_get(struct Qdisc *sch)
{
struct clsact_sched_data *q = qdisc_priv(sch);
return q->egress_block_info.block_index;
}
static int clsact_init(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
......@@ -222,6 +266,10 @@ static struct Qdisc_ops clsact_qdisc_ops __read_mostly = {
.init = clsact_init,
.destroy = clsact_destroy,
.dump = ingress_dump,
.ingress_block_set = clsact_ingress_block_set,
.egress_block_set = clsact_egress_block_set,
.ingress_block_get = clsact_ingress_block_get,
.egress_block_get = clsact_egress_block_get,
.owner = THIS_MODULE,
};
......
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