| From 87259a02eb80545d8f8f6c1d8dc2cea0d4b1f6f2 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Thu, 31 Oct 2019 09:39:34 +0200 |
| Subject: net/mlx5e: Rename hw_modify to preactivate |
| |
| From: Maxim Mikityanskiy <maximmi@mellanox.com> |
| |
| [ Upstream commit dca147b3dce5abb5284ff747211960fd2db5ec2e ] |
| |
| mlx5e_safe_switch_channels accepts a callback to be called before |
| activating new channels. It is intended to configure some hardware |
| parameters in cases where channels are recreated because some |
| configuration has changed. |
| |
| Recently, this callback has started being used to update the driver's |
| internal MLX5E_STATE_XDP_OPEN flag, and the following patches also |
| intend to use this callback for software preparations. This patch |
| renames the hw_modify callback to preactivate, so that the name fits |
| better. |
| |
| Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com> |
| Reviewed-by: Tariq Toukan <tariqt@mellanox.com> |
| Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 +++--- |
| drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 14 ++++++++------ |
| 2 files changed, 11 insertions(+), 9 deletions(-) |
| |
| diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
| index 55ceabf077b29..3cb5b4321bf93 100644 |
| --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h |
| +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
| @@ -1035,14 +1035,14 @@ int mlx5e_open_channels(struct mlx5e_priv *priv, |
| struct mlx5e_channels *chs); |
| void mlx5e_close_channels(struct mlx5e_channels *chs); |
| |
| -/* Function pointer to be used to modify WH settings while |
| +/* Function pointer to be used to modify HW or kernel settings while |
| * switching channels |
| */ |
| -typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv); |
| +typedef int (*mlx5e_fp_preactivate)(struct mlx5e_priv *priv); |
| int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv); |
| int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, |
| struct mlx5e_channels *new_chs, |
| - mlx5e_fp_hw_modify hw_modify); |
| + mlx5e_fp_preactivate preactivate); |
| void mlx5e_activate_priv_channels(struct mlx5e_priv *priv); |
| void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv); |
| |
| diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| index dc456a222c48d..c58f02258ddfa 100644 |
| --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| @@ -2965,7 +2965,7 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv) |
| |
| static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv, |
| struct mlx5e_channels *new_chs, |
| - mlx5e_fp_hw_modify hw_modify) |
| + mlx5e_fp_preactivate preactivate) |
| { |
| struct net_device *netdev = priv->netdev; |
| int new_num_txqs; |
| @@ -2984,9 +2984,11 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv, |
| |
| priv->channels = *new_chs; |
| |
| - /* New channels are ready to roll, modify HW settings if needed */ |
| - if (hw_modify) |
| - hw_modify(priv); |
| + /* New channels are ready to roll, call the preactivate hook if needed |
| + * to modify HW settings or update kernel parameters. |
| + */ |
| + if (preactivate) |
| + preactivate(priv); |
| |
| priv->profile->update_rx(priv); |
| mlx5e_activate_priv_channels(priv); |
| @@ -2998,7 +3000,7 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv, |
| |
| int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, |
| struct mlx5e_channels *new_chs, |
| - mlx5e_fp_hw_modify hw_modify) |
| + mlx5e_fp_preactivate preactivate) |
| { |
| int err; |
| |
| @@ -3006,7 +3008,7 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, |
| if (err) |
| return err; |
| |
| - mlx5e_switch_priv_channels(priv, new_chs, hw_modify); |
| + mlx5e_switch_priv_channels(priv, new_chs, preactivate); |
| return 0; |
| } |
| |
| -- |
| 2.20.1 |
| |