Skip to contentSkip to conversation

flow_offload: fix block stats

PATCH Applied John Hurley 3 participants 3 messages Feb 13, 2019 – Feb 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 flow_offload: fix block stats

With the introduction of flow_stats_update(), drivers now update the stats fields of the passed tc_cls_flower_offload struct, rather than call tcf_exts_stats_update() directly to update the stats of offloaded TC flower rules. However, if multiple qdiscs are registered to a TC shared block and a flower rule is applied, then, when getting stats for the rule, multiple callbacks may be made.

Take this into consideration by modifying flow_stats_update to gather the stats from all callbacks. Currently, the values in tc_cls_flower_offload only account for the last stats callback in the list.

Fixes 3b1903ef97c0 ("flow_offload: add statistics retrieval infrastructure and use it")
---
 include/net/flow_offload.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/net/flow_offload.h +3 -3
index a307ccb..d035183 100644
@@ -195,9 +195,9 @@ struct flow_stats {
 static inline void flow_stats_update(struct flow_stats *flow_stats,
 				     u64 bytes, u64 pkts, u64 lastused)
 {
-	flow_stats->pkts	= pkts;
-	flow_stats->bytes	= bytes;
-	flow_stats->lastused	= lastused;
+	flow_stats->pkts	+= pkts;
+	flow_stats->bytes	+= bytes;
+	flow_stats->lastused	= max_t(u64, flow_stats->lastused, lastused);
 }
 
 #endif /* _NET_FLOW_OFFLOAD_H */
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · John Hurley

With the introduction of flow_stats_update(), drivers now update the stats fields of the passed tc_cls_flower_offload struct, rather than call tcf_exts_stats_update() directly to update the stats of offloaded TC flower rules. However, if multiple qdiscs are registered to a TC shared block and a flower rule is applied, then, when getting stats for the rule, multiple callbacks may be made.

Quoted 7 lines

Take this into consideration by modifying flow_stats_update to gather the stats from all callbacks. Currently, the values in tc_cls_flower_offload only account for the last stats callback in the list.

Fixes 3b1903ef97c0 ("flow_offload: add statistics retrieval infrastructure and use it")
maintainer Applied
#2 lore raw
In reply to John Hurley

From: John Hurley <[email protected]>
Date: Wed, 13 Feb 2019 00:23:52 +0000

Quoted 7 lines

With the introduction of flow_stats_update(), drivers now update the stats fields of the passed tc_cls_flower_offload struct, rather than call tcf_exts_stats_update() directly to update the stats of offloaded TC flower rules. However, if multiple qdiscs are registered to a TC shared block and a flower rule is applied, then, when getting stats for the rule, multiple callbacks may be made.

Quoted 7 lines

Take this into consideration by modifying flow_stats_update to gather the stats from all callbacks. Currently, the values in tc_cls_flower_offload only account for the last stats callback in the list.

Fixes 3b1903ef97c0 ("flow_offload: add statistics retrieval infrastructure and use it")

Applied, thanks.