Commit 16e74672 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5: Do not hold mutex while reading table constants

Table max_size, min and max rate are constants initialized while table
is created. Reading it doesn't need to hold a table mutex. Hence, read
them without holding table mutex.
Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 4c4c0a89
...@@ -180,16 +180,18 @@ int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid, ...@@ -180,16 +180,18 @@ int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid,
int err = 0; int err = 0;
u32 rate; u32 rate;
rate = MLX5_GET(set_pp_rate_limit_context, rl_in, rate_limit); if (!table->max_size)
mutex_lock(&table->rl_lock); return -EOPNOTSUPP;
rate = MLX5_GET(set_pp_rate_limit_context, rl_in, rate_limit);
if (!rate || !mlx5_rl_is_in_range(dev, rate)) { if (!rate || !mlx5_rl_is_in_range(dev, rate)) {
mlx5_core_err(dev, "Invalid rate: %u, should be %u to %u\n", mlx5_core_err(dev, "Invalid rate: %u, should be %u to %u\n",
rate, table->min_rate, table->max_rate); rate, table->min_rate, table->max_rate);
err = -EINVAL; return -EINVAL;
goto out;
} }
mutex_lock(&table->rl_lock);
entry = find_rl_entry(table, rl_in, uid, dedicated_entry); entry = find_rl_entry(table, rl_in, uid, dedicated_entry);
if (!entry) { if (!entry) {
mlx5_core_err(dev, "Max number of %u rates reached\n", mlx5_core_err(dev, "Max number of %u rates reached\n",
......
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