Commit 19779f28 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5: Pair mutex_destory with mutex_init for rate limit table

Add missing mutex_destroy() to pair with mutex_init().

This should be done only when table is initialized, hence perform
mutex_init() only when table is initialized.
Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 6b30b6d4
...@@ -367,12 +367,13 @@ int mlx5_init_rl_table(struct mlx5_core_dev *dev) ...@@ -367,12 +367,13 @@ int mlx5_init_rl_table(struct mlx5_core_dev *dev)
{ {
struct mlx5_rl_table *table = &dev->priv.rl_table; struct mlx5_rl_table *table = &dev->priv.rl_table;
mutex_init(&table->rl_lock);
if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, packet_pacing)) { if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, packet_pacing)) {
table->max_size = 0; table->max_size = 0;
return 0; return 0;
} }
mutex_init(&table->rl_lock);
/* First entry is reserved for unlimited rate */ /* First entry is reserved for unlimited rate */
table->max_size = MLX5_CAP_QOS(dev, packet_pacing_rate_table_size) - 1; table->max_size = MLX5_CAP_QOS(dev, packet_pacing_rate_table_size) - 1;
table->max_rate = MLX5_CAP_QOS(dev, packet_pacing_max_rate); table->max_rate = MLX5_CAP_QOS(dev, packet_pacing_max_rate);
...@@ -394,4 +395,5 @@ void mlx5_cleanup_rl_table(struct mlx5_core_dev *dev) ...@@ -394,4 +395,5 @@ void mlx5_cleanup_rl_table(struct mlx5_core_dev *dev)
return; return;
mlx5_rl_table_free(dev, table); mlx5_rl_table_free(dev, table);
mutex_destroy(&table->rl_lock);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment