Skip to content

Commit fed06ee

Browse files
ogerlitzdavem330
authored andcommitted
net/mlx5e: Disable preemption when doing TC statistics upcall
When called by HW offloading drivers, the TC action (e.g net/sched/act_mirred.c) code uses this_cpu logic, e.g _bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), bytes, packets) per the kernel documention, preemption should be disabled, add that. Before the fix, when running with CONFIG_PREEMPT set, we get a BUG: using smp_processor_id() in preemptible [00000000] code: tc/3793 asserion from the TC action (mirred) stats_update callback. Fixes: aad7e08 ('net/mlx5e: Hardware offloaded flower filter statistics support') Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0c8ef29 commit fed06ee

File tree

1 file changed

+4
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+4
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,10 +1087,14 @@ int mlx5e_stats_flower(struct mlx5e_priv *priv,
10871087

10881088
mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse);
10891089

1090+
preempt_disable();
1091+
10901092
tcf_exts_to_list(f->exts, &actions);
10911093
list_for_each_entry(a, &actions, list)
10921094
tcf_action_stats_update(a, bytes, packets, lastuse);
10931095

1096+
preempt_enable();
1097+
10941098
return 0;
10951099
}
10961100

0 commit comments

Comments
 (0)