Message ID | 20170210141933.6e51418e@cakuba.netronome.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Sat, Feb 11, 2017 at 12:19 AM, Jakub Kicinski <jakub.kicinski@netronome.com> wrote: > FWIW I tested this one and it works. I also tested this version which > would take advantage of @offloaded: I assume that if we go on the existing suggestion, the below is what you prefer, so I will pick it up, let know if you think otherwise. > diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c > index d9c97018317d..51d464f991ff 100644 > --- a/net/sched/cls_bpf.c > +++ b/net/sched/cls_bpf.c > @@ -568,8 +568,8 @@ static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, > struct sk_buff *skb, struct tcmsg *tm) > { > struct cls_bpf_prog *prog = (struct cls_bpf_prog *) fh; > + u32 gen_flags, bpf_flags = 0; > struct nlattr *nest; > - u32 bpf_flags = 0; > int ret; > > if (prog == NULL) > @@ -601,8 +601,11 @@ static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, > bpf_flags |= TCA_BPF_FLAG_ACT_DIRECT; > if (bpf_flags && nla_put_u32(skb, TCA_BPF_FLAGS, bpf_flags)) > goto nla_put_failure; > - if (prog->gen_flags && > - nla_put_u32(skb, TCA_BPF_FLAGS_GEN, prog->gen_flags)) > + > + gen_flags = prog->gen_flags; > + if (!prog->offloaded) > + gen_flags |= TCA_CLS_FLAGS_SKIP_HW; > + if (gen_flags && nla_put_u32(skb, TCA_BPF_FLAGS_GEN, gen_flags)) > goto nla_put_failure; > > nla_nest_end(skb, nest);
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index d9c97018317d..51d464f991ff 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c @@ -568,8 +568,8 @@ static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, struct sk_buff *skb, struct tcmsg *tm) { struct cls_bpf_prog *prog = (struct cls_bpf_prog *) fh; + u32 gen_flags, bpf_flags = 0; struct nlattr *nest; - u32 bpf_flags = 0; int ret; if (prog == NULL) @@ -601,8 +601,11 @@ static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, bpf_flags |= TCA_BPF_FLAG_ACT_DIRECT; if (bpf_flags && nla_put_u32(skb, TCA_BPF_FLAGS, bpf_flags)) goto nla_put_failure; - if (prog->gen_flags && - nla_put_u32(skb, TCA_BPF_FLAGS_GEN, prog->gen_flags)) + + gen_flags = prog->gen_flags; + if (!prog->offloaded) + gen_flags |= TCA_CLS_FLAGS_SKIP_HW; + if (gen_flags && nla_put_u32(skb, TCA_BPF_FLAGS_GEN, gen_flags)) goto nla_put_failure; nla_nest_end(skb, nest);