* [PATCH net] net/sched: Fix update of lastuse in act modules implementing stats_update
@ 2017-12-26 5:48 Roi Dayan
2018-01-02 18:28 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Roi Dayan @ 2017-12-26 5:48 UTC (permalink / raw)
To: David S. Miller, netdev
Cc: Paul Blakey, Jiri Pirko, Cong Wang, Jamal Hadi Salim, Or Gerlitz,
Roi Dayan
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: 5712bf9c5c30 ("net/sched: act_mirred: Use passed lastuse argument")
Fixes: 9fea47d93bcc ("net/sched: act_gact: Update statistics when offloaded to hardware")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
net/sched/act_gact.c | 2 +-
net/sched/act_mirred.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index e29a48e..a0ac42b 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -159,7 +159,7 @@ static void tcf_gact_stats_update(struct tc_action *a, u64 bytes, u32 packets,
if (action == TC_ACT_SHOT)
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,
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 8b3e5938..08b6184 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -239,7 +239,7 @@ static void tcf_stats_update(struct tc_action *a, u64 bytes, u32 packets,
struct tcf_t *tm = &m->tcf_tm;
_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,
--
2.7.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] net/sched: Fix update of lastuse in act modules implementing stats_update
2017-12-26 5:48 [PATCH net] net/sched: Fix update of lastuse in act modules implementing stats_update Roi Dayan
@ 2018-01-02 18:28 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-01-02 18:28 UTC (permalink / raw)
To: roid; +Cc: netdev, paulb, jiri, xiyou.wangcong, jhs, ogerlitz
From: Roi Dayan <roid@mellanox.com>
Date: Tue, 26 Dec 2017 07:48:51 +0200
> 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: 5712bf9c5c30 ("net/sched: act_mirred: Use passed lastuse argument")
> Fixes: 9fea47d93bcc ("net/sched: act_gact: Update statistics when offloaded to hardware")
> Signed-off-by: Roi Dayan <roid@mellanox.com>
> Reviewed-by: Paul Blakey <paulb@mellanox.com>
> Acked-by: Jiri Pirko <jiri@mellanox.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-02 18:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-26 5:48 [PATCH net] net/sched: Fix update of lastuse in act modules implementing stats_update Roi Dayan
2018-01-02 18:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox