net/mlx5: E-Switch, Hold mutex when querying drop counter in legacy mode
authorBodong Wang <bodong@mellanox.com>
Fri, 13 Sep 2019 21:24:19 +0000 (16:24 -0500)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 13 Mar 2020 23:26:01 +0000 (16:26 -0700)
commit14c844cbf3503076de6e2e48d575216f1600b19f
tree74888c193fc458bf5309f2bdb15abd1b9f7fc5e5
parent86f9453c5fca845ca592777ef8960ff827fc7cc9
net/mlx5: E-Switch, Hold mutex when querying drop counter in legacy mode

Consider scenario below, CPU 1 is at risk to query already destroyed
drop counters. Need to apply the same state mutex when disabling vport.

+-------------------------------+-------------------------------------+
| CPU 0                         | CPU 1                               |
+-------------------------------+-------------------------------------+
| mlx5_device_disable_sriov     | mlx5e_get_vf_stats                  |
| mlx5_eswitch_disable          | mlx5_eswitch_get_vport_stats        |
| esw_disable_vport             | mlx5_eswitch_query_vport_drop_stats |
| mlx5_fc_destroy(drop_counter) | mlx5_fc_query(drop_counter)         |
+-------------------------------+-------------------------------------+

Fixes: b8a0dbe3a90b ("net/mlx5e: E-switch, Add steering drop counters")
Signed-off-by: Bodong Wang <bodong@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c