Skip to content

Commit d1a0075

Browse files
ozshlomoSaeed Mahameed
authored andcommitted
net/sched: TC, fix raw counter initialization
Freed counters may be reused by fs core. As such, raw counters may not be initialized to zero. Cache the counter values when the action stats object is initialized to have a proper base value for calculating the difference from the previous query. Fixes: 2b68d65 ("net/mlx5e: TC, support per action stats") Signed-off-by: Oz Shlomo <[email protected]> Reviewed-by: Paul Blakey <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 78dee7b commit d1a0075

File tree

1 file changed

+5
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en/tc

1 file changed

+5
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ mlx5e_tc_act_stats_add(struct mlx5e_tc_act_stats_handle *handle,
6464
{
6565
struct mlx5e_tc_act_stats *act_stats, *old_act_stats;
6666
struct rhashtable *ht = &handle->ht;
67+
u64 lastused;
6768
int err = 0;
6869

6970
act_stats = kvzalloc(sizeof(*act_stats), GFP_KERNEL);
@@ -73,6 +74,10 @@ mlx5e_tc_act_stats_add(struct mlx5e_tc_act_stats_handle *handle,
7374
act_stats->tc_act_cookie = act_cookie;
7475
act_stats->counter = counter;
7576

77+
mlx5_fc_query_cached_raw(counter,
78+
&act_stats->lastbytes,
79+
&act_stats->lastpackets, &lastused);
80+
7681
rcu_read_lock();
7782
old_act_stats = rhashtable_lookup_get_insert_fast(ht,
7883
&act_stats->hash,

0 commit comments

Comments
 (0)