Commit 68d64063 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

net: cls_bpf: allow offloaded filters to update stats

Call into offloaded filters to update stats.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7533fdc0
...@@ -490,6 +490,7 @@ enum tc_clsbpf_command { ...@@ -490,6 +490,7 @@ enum tc_clsbpf_command {
TC_CLSBPF_ADD, TC_CLSBPF_ADD,
TC_CLSBPF_REPLACE, TC_CLSBPF_REPLACE,
TC_CLSBPF_DESTROY, TC_CLSBPF_DESTROY,
TC_CLSBPF_STATS,
}; };
struct tc_cls_bpf_offload { struct tc_cls_bpf_offload {
......
...@@ -221,6 +221,15 @@ static void cls_bpf_stop_offload(struct tcf_proto *tp, ...@@ -221,6 +221,15 @@ static void cls_bpf_stop_offload(struct tcf_proto *tp,
prog->offloaded = false; prog->offloaded = false;
} }
static void cls_bpf_offload_update_stats(struct tcf_proto *tp,
struct cls_bpf_prog *prog)
{
if (!prog->offloaded)
return;
cls_bpf_offload_cmd(tp, prog, TC_CLSBPF_STATS);
}
static int cls_bpf_init(struct tcf_proto *tp) static int cls_bpf_init(struct tcf_proto *tp)
{ {
struct cls_bpf_head *head; struct cls_bpf_head *head;
...@@ -577,6 +586,8 @@ static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, ...@@ -577,6 +586,8 @@ static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
tm->tcm_handle = prog->handle; tm->tcm_handle = prog->handle;
cls_bpf_offload_update_stats(tp, prog);
nest = nla_nest_start(skb, TCA_OPTIONS); nest = nla_nest_start(skb, TCA_OPTIONS);
if (nest == NULL) if (nest == NULL)
goto nla_put_failure; goto nla_put_failure;
......
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