Commit 9798e6fe authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

net: act_mirred: allow statistic updates from offloaded actions

Implement .stats_update() callback.  The implementation
is generic and can be reused by other simple actions if
needed.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 19d0f54e
...@@ -204,6 +204,13 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a, ...@@ -204,6 +204,13 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
return retval; return retval;
} }
static void tcf_stats_update(struct tc_action *a, u64 bytes, u32 packets,
u64 lastuse)
{
tcf_lastuse_update(&a->tcfa_tm);
_bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), bytes, packets);
}
static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind,
int ref) int ref)
{ {
...@@ -281,6 +288,7 @@ static struct tc_action_ops act_mirred_ops = { ...@@ -281,6 +288,7 @@ static struct tc_action_ops act_mirred_ops = {
.type = TCA_ACT_MIRRED, .type = TCA_ACT_MIRRED,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.act = tcf_mirred, .act = tcf_mirred,
.stats_update = tcf_stats_update,
.dump = tcf_mirred_dump, .dump = tcf_mirred_dump,
.cleanup = tcf_mirred_release, .cleanup = tcf_mirred_release,
.init = tcf_mirred_init, .init = tcf_mirred_init,
......
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