summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
diff options
context:
space:
mode:
authorMaxim Mikityanskiy <maximmi@mellanox.com>2021-02-04 13:21:16 +0300
committerSaeed Mahameed <saeedm@nvidia.com>2021-04-16 21:48:17 +0300
commitb3b886cf965d5f8d8e51f9481ce60ee8f9548580 (patch)
tree5df96f6389c55ee4dfec891d390b7204d3606fc0 /drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
parent69cc4185dcbaaedc52d5d8d13b4aac2a3836a874 (diff)
downloadlinux-b3b886cf965d5f8d8e51f9481ce60ee8f9548580.tar.xz
net/mlx5e: Refactor on-the-fly configuration changes
This commit extends mlx5e_safe_switch_channels() to support on-the-fly configuration changes, when the channels are open, but don't need to be recreated. Such flows exist when a parameter being changed doesn't affect how the queues are created, or when the queues can be modified while remaining active. Before this commit, such flows were handled as special cases on the caller site. This commit adds this functionality to mlx5e_safe_switch_channels(), allowing the caller to pass a boolean indicating whether it's required to recreate the channels or it's allowed to skip it. The logic of switching channel parameters is now completely encapsulated into mlx5e_safe_switch_channels(). Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index 9d4d83159603..0b0273fac6e3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -1150,7 +1150,8 @@ static int mlx5e_update_trust_state_hw(struct mlx5e_priv *priv, void *context)
static int mlx5e_set_trust_state(struct mlx5e_priv *priv, u8 trust_state)
{
struct mlx5e_channels new_channels = {};
- int err = 0;
+ bool reset = true;
+ int err;
mutex_lock(&priv->state_lock);
@@ -1160,16 +1161,13 @@ static int mlx5e_set_trust_state(struct mlx5e_priv *priv, u8 trust_state)
/* Skip if tx_min_inline is the same */
if (new_channels.params.tx_min_inline_mode ==
- priv->channels.params.tx_min_inline_mode) {
- err = mlx5e_update_trust_state_hw(priv, &trust_state);
- goto out;
- }
+ priv->channels.params.tx_min_inline_mode)
+ reset = false;
err = mlx5e_safe_switch_channels(priv, &new_channels,
mlx5e_update_trust_state_hw,
- &trust_state);
+ &trust_state, reset);
-out:
mutex_unlock(&priv->state_lock);
return err;