diff options
author | David S. Miller | 2017-08-07 18:42:37 +0200 |
---|---|---|
committer | David S. Miller | 2017-08-07 18:42:37 +0200 |
commit | 71feeef678056a640466a6d1faee3a7bcbbccab9 (patch) | |
tree | 7e49037950eb4ac5cbf296134e5a0e3b7fe456ac /net/sched/cls_bpf.c | |
parent | Merge branch 'sctp-remove-typedefs-from-structures-part-5' (diff) | |
parent | net: sched: get rid of struct tc_to_netdev (diff) | |
download | kernel-qcow2-linux-71feeef678056a640466a6d1faee3a7bcbbccab9.tar.gz kernel-qcow2-linux-71feeef678056a640466a6d1faee3a7bcbbccab9.tar.xz kernel-qcow2-linux-71feeef678056a640466a6d1faee3a7bcbbccab9.zip |
Merge branch 'net-sched-summer-cleanup-part-2-ndo_setup_tc'
Jiri Pirko says:
====================
net: sched: summer cleanup part 2, ndo_setup_tc
This patchset focuses on ndo_setup_tc and its args.
Currently there are couple of things that do not make much sense.
The type is passed in struct tc_to_netdev, but as it is always
required, should be arg of the ndo. Other things are passed as args
but they are only relevant for cls offloads and not mqprio. Therefore,
they should be pushed to struct. As the tc_to_netdev struct in the end
is just a container of single pointer, we get rid of it and pass the
struct according to type. So in the end, we have:
ndo_setup_tc(dev, type, type_data_struct)
There are couple of cosmetics done on the way to make things smooth.
Also, reported error is consolidated to eopnotsupp in case the
asked offload is not supported.
v1->v2:
- added forgotten hns3pf bits
====================
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_bpf.c')
-rw-r--r-- | net/sched/cls_bpf.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index cf248c3137ad..2d4d06e41cd9 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c @@ -147,24 +147,18 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog, enum tc_clsbpf_command cmd) { struct net_device *dev = tp->q->dev_queue->dev; - struct tc_cls_bpf_offload bpf_offload = {}; - struct tc_to_netdev offload; + struct tc_cls_bpf_offload cls_bpf = {}; int err; - offload.type = TC_SETUP_CLSBPF; - offload.cls_bpf = &bpf_offload; - - bpf_offload.command = cmd; - bpf_offload.exts = &prog->exts; - bpf_offload.prog = prog->filter; - bpf_offload.name = prog->bpf_name; - bpf_offload.exts_integrated = prog->exts_integrated; - bpf_offload.gen_flags = prog->gen_flags; - - err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, - tp->chain->index, - tp->protocol, &offload); + tc_cls_common_offload_init(&cls_bpf.common, tp); + cls_bpf.command = cmd; + cls_bpf.exts = &prog->exts; + cls_bpf.prog = prog->filter; + cls_bpf.name = prog->bpf_name; + cls_bpf.exts_integrated = prog->exts_integrated; + cls_bpf.gen_flags = prog->gen_flags; + err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSBPF, &cls_bpf); if (!err && (cmd == TC_CLSBPF_ADD || cmd == TC_CLSBPF_REPLACE)) prog->gen_flags |= TCA_CLS_FLAGS_IN_HW; |