Skip to content

Commit

Permalink
net/mlx5e: Rename hw_modify to preactivate
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Maxim Mikityanskiy authored and Saeed Mahameed committed Feb 26, 2020
1 parent c2c9527 commit dca147b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/mellanox/mlx5/core/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
14 changes: 8 additions & 6 deletions drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,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;
Expand All @@ -2956,9 +2956,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);
Expand All @@ -2970,15 +2972,15 @@ 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;

err = mlx5e_open_channels(priv, new_chs);
if (err)
return err;

mlx5e_switch_priv_channels(priv, new_chs, hw_modify);
mlx5e_switch_priv_channels(priv, new_chs, preactivate);
return 0;
}

Expand Down

0 comments on commit dca147b

Please sign in to comment.