]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit57d60e2b536e1d8f9212bf32b1f81a1ea5a153ab
tree74888c193fc458bf5309f2bdb15abd1b9f7fc5e5
parent302e7217f045e349cf35d5f10447e1ef71361c63
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: 3647de45baa1 ("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