net: sched: push cls related args into cls_common structure

As ndo_setup_tc is generic offload op for whole tc subsystem, does not
really make sense to have cls-specific args. So move them under
cls_common structurure which is embedded in all cls structs.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko
2017-08-07 10:15:29 +02:00
committed by David S. Miller
parent 74897ef0a5
commit 5fd9fc4e20
39 changed files with 101 additions and 144 deletions

View File

@@ -153,6 +153,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
offload.cls_bpf = &bpf_offload;
tc_cls_common_offload_init(&bpf_offload.common, tp);
bpf_offload.command = cmd;
bpf_offload.exts = &prog->exts;
bpf_offload.prog = prog->filter;
@@ -160,11 +161,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
bpf_offload.exts_integrated = prog->exts_integrated;
bpf_offload.gen_flags = prog->gen_flags;
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSBPF,
tp->q->handle,
tp->chain->index,
tp->protocol, &offload);
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSBPF, &offload);
if (!err && (cmd == TC_CLSBPF_ADD || cmd == TC_CLSBPF_REPLACE))
prog->gen_flags |= TCA_CLS_FLAGS_IN_HW;

View File

@@ -232,14 +232,14 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f)
if (!tc_can_offload(dev, tp))
return;
tc_cls_common_offload_init(&offload.common, tp);
offload.command = TC_CLSFLOWER_DESTROY;
offload.prio = tp->prio;
offload.cookie = (unsigned long)f;
tc->cls_flower = &offload;
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER, tp->q->handle,
tp->chain->index, tp->protocol, tc);
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER, tc);
}
static int fl_hw_replace_filter(struct tcf_proto *tp,
@@ -264,6 +264,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
f->hw_dev = dev;
}
tc_cls_common_offload_init(&offload.common, tp);
offload.command = TC_CLSFLOWER_REPLACE;
offload.prio = tp->prio;
offload.cookie = (unsigned long)f;
@@ -274,9 +275,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
tc->cls_flower = &offload;
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
tp->q->handle, tp->chain->index,
tp->protocol, tc);
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER, tc);
if (!err)
f->flags |= TCA_CLS_FLAGS_IN_HW;
@@ -294,6 +293,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
if (!tc_can_offload(dev, tp))
return;
tc_cls_common_offload_init(&offload.common, tp);
offload.command = TC_CLSFLOWER_STATS;
offload.prio = tp->prio;
offload.cookie = (unsigned long)f;
@@ -301,8 +301,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
tc->cls_flower = &offload;
dev->netdev_ops->ndo_setup_tc(dev, TC_CLSFLOWER_STATS, tp->q->handle,
tp->chain->index, tp->protocol, tc);
dev->netdev_ops->ndo_setup_tc(dev, TC_CLSFLOWER_STATS, tc);
}
static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f)

View File

@@ -58,14 +58,14 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
struct tc_cls_matchall_offload mall_offload = {0};
int err;
tc_cls_common_offload_init(&mall_offload.common, tp);
offload.cls_mall = &mall_offload;
offload.cls_mall->command = TC_CLSMATCHALL_REPLACE;
offload.cls_mall->exts = &head->exts;
offload.cls_mall->cookie = cookie;
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL,
tp->q->handle, tp->chain->index,
tp->protocol, &offload);
&offload);
if (!err)
head->flags |= TCA_CLS_FLAGS_IN_HW;
@@ -80,13 +80,13 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
struct tc_to_netdev offload;
struct tc_cls_matchall_offload mall_offload = {0};
tc_cls_common_offload_init(&mall_offload.common, tp);
offload.cls_mall = &mall_offload;
offload.cls_mall->command = TC_CLSMATCHALL_DESTROY;
offload.cls_mall->exts = NULL;
offload.cls_mall->cookie = cookie;
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL, tp->q->handle,
tp->chain->index, tp->protocol, &offload);
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL, &offload);
}
static void mall_destroy(struct tcf_proto *tp)

View File

@@ -437,11 +437,10 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle)
offload.cls_u32 = &u32_offload;
if (tc_should_offload(dev, tp, 0)) {
tc_cls_common_offload_init(&u32_offload.common, tp);
offload.cls_u32->command = TC_CLSU32_DELETE_KNODE;
offload.cls_u32->knode.handle = handle;
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32,
tp->q->handle, tp->chain->index,
tp->protocol, &offload);
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, &offload);
}
}
@@ -458,14 +457,13 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
offload.cls_u32 = &u32_offload;
tc_cls_common_offload_init(&u32_offload.common, tp);
offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
offload.cls_u32->hnode.divisor = h->divisor;
offload.cls_u32->hnode.handle = h->handle;
offload.cls_u32->hnode.prio = h->prio;
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, tp->q->handle,
tp->chain->index, tp->protocol,
&offload);
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, &offload);
if (tc_skip_sw(flags))
return err;
@@ -481,14 +479,13 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
offload.cls_u32 = &u32_offload;
if (tc_should_offload(dev, tp, 0)) {
tc_cls_common_offload_init(&u32_offload.common, tp);
offload.cls_u32->command = TC_CLSU32_DELETE_HNODE;
offload.cls_u32->hnode.divisor = h->divisor;
offload.cls_u32->hnode.handle = h->handle;
offload.cls_u32->hnode.prio = h->prio;
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32,
tp->q->handle, tp->chain->index,
tp->protocol, &offload);
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, &offload);
}
}
@@ -505,6 +502,7 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
if (!tc_should_offload(dev, tp, flags))
return tc_skip_sw(flags) ? -EINVAL : 0;
tc_cls_common_offload_init(&u32_offload.common, tp);
offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
offload.cls_u32->knode.handle = n->handle;
offload.cls_u32->knode.fshift = n->fshift;
@@ -520,9 +518,7 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
if (n->ht_down)
offload.cls_u32->knode.link_handle = n->ht_down->handle;
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, tp->q->handle,
tp->chain->index, tp->protocol,
&offload);
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, &offload);
if (!err)
n->flags |= TCA_CLS_FLAGS_IN_HW;

View File

@@ -42,8 +42,7 @@ static void mqprio_destroy(struct Qdisc *sch)
struct tc_mqprio_qopt offload = { 0 };
struct tc_to_netdev tc = { { .mqprio = &offload } };
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MQPRIO,
sch->handle, 0, 0, &tc);
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MQPRIO, &tc);
} else {
netdev_set_num_tc(dev, 0);
}
@@ -151,8 +150,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
struct tc_mqprio_qopt offload = *qopt;
struct tc_to_netdev tc = { { .mqprio = &offload } };
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MQPRIO,
sch->handle, 0, 0, &tc);
err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MQPRIO, &tc);
if (err)
return err;