Commit 3bb23421 authored by Roi Dayan's avatar Roi Dayan Committed by David S. Miller

net/sched: Fix update of lastuse in act modules implementing stats_update

We need to update lastuse to to the most updated value between what
is already set and the new value.
If HW matching fails, i.e. because of an issue, the stats are not updated
but it could be that software did match and updated lastuse.

Fixes: 5712bf9c ("net/sched: act_mirred: Use passed lastuse argument")
Fixes: 9fea47d9 ("net/sched: act_gact: Update statistics when offloaded to hardware")
Signed-off-by: default avatarRoi Dayan <roid@mellanox.com>
Reviewed-by: default avatarPaul Blakey <paulb@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 90045fc9
...@@ -159,7 +159,7 @@ static void tcf_gact_stats_update(struct tc_action *a, u64 bytes, u32 packets, ...@@ -159,7 +159,7 @@ static void tcf_gact_stats_update(struct tc_action *a, u64 bytes, u32 packets,
if (action == TC_ACT_SHOT) if (action == TC_ACT_SHOT)
this_cpu_ptr(gact->common.cpu_qstats)->drops += packets; this_cpu_ptr(gact->common.cpu_qstats)->drops += packets;
tm->lastuse = lastuse; tm->lastuse = max_t(u64, tm->lastuse, lastuse);
} }
static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a,
......
...@@ -239,7 +239,7 @@ static void tcf_stats_update(struct tc_action *a, u64 bytes, u32 packets, ...@@ -239,7 +239,7 @@ static void tcf_stats_update(struct tc_action *a, u64 bytes, u32 packets,
struct tcf_t *tm = &m->tcf_tm; struct tcf_t *tm = &m->tcf_tm;
_bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), bytes, packets); _bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), bytes, packets);
tm->lastuse = lastuse; tm->lastuse = max_t(u64, tm->lastuse, lastuse);
} }
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,
......
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