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

sched: act_vlan: implement stats_update callback

Implement this callback in order to get the offloaded stats added to the
kernel stats.
Reported-by: default avatarPengfei Liu <pengfeil@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 27382472
...@@ -301,6 +301,19 @@ static int tcf_vlan_walker(struct net *net, struct sk_buff *skb, ...@@ -301,6 +301,19 @@ static int tcf_vlan_walker(struct net *net, struct sk_buff *skb,
return tcf_generic_walker(tn, skb, cb, type, ops, extack); return tcf_generic_walker(tn, skb, cb, type, ops, extack);
} }
static void tcf_vlan_stats_update(struct tc_action *a, u64 bytes, u32 packets,
u64 lastuse, bool hw)
{
struct tcf_vlan *v = to_vlan(a);
struct tcf_t *tm = &v->tcf_tm;
_bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), bytes, packets);
if (hw)
_bstats_cpu_update(this_cpu_ptr(a->cpu_bstats_hw),
bytes, packets);
tm->lastuse = max_t(u64, tm->lastuse, lastuse);
}
static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index) static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index)
{ {
struct tc_action_net *tn = net_generic(net, vlan_net_id); struct tc_action_net *tn = net_generic(net, vlan_net_id);
...@@ -325,6 +338,7 @@ static struct tc_action_ops act_vlan_ops = { ...@@ -325,6 +338,7 @@ static struct tc_action_ops act_vlan_ops = {
.init = tcf_vlan_init, .init = tcf_vlan_init,
.cleanup = tcf_vlan_cleanup, .cleanup = tcf_vlan_cleanup,
.walk = tcf_vlan_walker, .walk = tcf_vlan_walker,
.stats_update = tcf_vlan_stats_update,
.get_fill_size = tcf_vlan_get_fill_size, .get_fill_size = tcf_vlan_get_fill_size,
.lookup = tcf_vlan_search, .lookup = tcf_vlan_search,
.size = sizeof(struct tcf_vlan), .size = sizeof(struct tcf_vlan),
......
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