Commit 7ca42c80 authored by Erez Shitrit's avatar Erez Shitrit Committed by Saeed Mahameed

net/mlx5e: Add new profile function update_carrier

Updating the carrier involves specific HW setting, each profile should
use its own function for that.

Both IPoIB and VF representor don't need carrier update function, since
VF representor has only a logical link to VF and IPoIB manages its own
link via ib_core upper layer.
Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 076b0936
...@@ -782,6 +782,7 @@ struct mlx5e_profile { ...@@ -782,6 +782,7 @@ struct mlx5e_profile {
void (*enable)(struct mlx5e_priv *priv); void (*enable)(struct mlx5e_priv *priv);
void (*disable)(struct mlx5e_priv *priv); void (*disable)(struct mlx5e_priv *priv);
void (*update_stats)(struct mlx5e_priv *priv); void (*update_stats)(struct mlx5e_priv *priv);
void (*update_carrier)(struct mlx5e_priv *priv);
int (*max_nch)(struct mlx5_core_dev *mdev); int (*max_nch)(struct mlx5_core_dev *mdev);
struct { struct {
mlx5e_fp_handle_rx_cqe handle_rx_cqe; mlx5e_fp_handle_rx_cqe handle_rx_cqe;
......
...@@ -143,7 +143,8 @@ static void mlx5e_update_carrier_work(struct work_struct *work) ...@@ -143,7 +143,8 @@ static void mlx5e_update_carrier_work(struct work_struct *work)
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
if (test_bit(MLX5E_STATE_OPENED, &priv->state)) if (test_bit(MLX5E_STATE_OPENED, &priv->state))
mlx5e_update_carrier(priv); if (priv->profile->update_carrier)
priv->profile->update_carrier(priv);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
} }
...@@ -2598,9 +2599,10 @@ void mlx5e_switch_priv_channels(struct mlx5e_priv *priv, ...@@ -2598,9 +2599,10 @@ void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
{ {
struct net_device *netdev = priv->netdev; struct net_device *netdev = priv->netdev;
int new_num_txqs; int new_num_txqs;
int carrier_ok;
new_num_txqs = new_chs->num * new_chs->params.num_tc; new_num_txqs = new_chs->num * new_chs->params.num_tc;
carrier_ok = netif_carrier_ok(netdev);
netif_carrier_off(netdev); netif_carrier_off(netdev);
if (new_num_txqs < netdev->real_num_tx_queues) if (new_num_txqs < netdev->real_num_tx_queues)
...@@ -2618,7 +2620,9 @@ void mlx5e_switch_priv_channels(struct mlx5e_priv *priv, ...@@ -2618,7 +2620,9 @@ void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
mlx5e_refresh_tirs(priv, false); mlx5e_refresh_tirs(priv, false);
mlx5e_activate_priv_channels(priv); mlx5e_activate_priv_channels(priv);
mlx5e_update_carrier(priv); /* return carrier back if needed */
if (carrier_ok)
netif_carrier_on(netdev);
} }
int mlx5e_open_locked(struct net_device *netdev) int mlx5e_open_locked(struct net_device *netdev)
...@@ -2634,7 +2638,8 @@ int mlx5e_open_locked(struct net_device *netdev) ...@@ -2634,7 +2638,8 @@ int mlx5e_open_locked(struct net_device *netdev)
mlx5e_refresh_tirs(priv, false); mlx5e_refresh_tirs(priv, false);
mlx5e_activate_priv_channels(priv); mlx5e_activate_priv_channels(priv);
mlx5e_update_carrier(priv); if (priv->profile->update_carrier)
priv->profile->update_carrier(priv);
mlx5e_timestamp_init(priv); mlx5e_timestamp_init(priv);
if (priv->profile->update_stats) if (priv->profile->update_stats)
...@@ -4215,6 +4220,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = { ...@@ -4215,6 +4220,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = {
.disable = mlx5e_nic_disable, .disable = mlx5e_nic_disable,
.update_stats = mlx5e_update_ndo_stats, .update_stats = mlx5e_update_ndo_stats,
.max_nch = mlx5e_get_max_num_channels, .max_nch = mlx5e_get_max_num_channels,
.update_carrier = mlx5e_update_carrier,
.rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe, .rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe,
.rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq, .rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq,
.max_tc = MLX5E_MAX_NUM_TC, .max_tc = MLX5E_MAX_NUM_TC,
......
...@@ -916,6 +916,7 @@ static struct mlx5e_profile mlx5e_rep_profile = { ...@@ -916,6 +916,7 @@ static struct mlx5e_profile mlx5e_rep_profile = {
.cleanup_tx = mlx5e_cleanup_nic_tx, .cleanup_tx = mlx5e_cleanup_nic_tx,
.update_stats = mlx5e_rep_update_stats, .update_stats = mlx5e_rep_update_stats,
.max_nch = mlx5e_get_rep_max_num_channels, .max_nch = mlx5e_get_rep_max_num_channels,
.update_carrier = NULL,
.rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe_rep, .rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe_rep,
.rx_handlers.handle_rx_cqe_mpwqe = NULL /* Not supported */, .rx_handlers.handle_rx_cqe_mpwqe = NULL /* Not supported */,
.max_tc = 1, .max_tc = 1,
......
...@@ -291,6 +291,7 @@ static const struct mlx5e_profile mlx5i_nic_profile = { ...@@ -291,6 +291,7 @@ static const struct mlx5e_profile mlx5i_nic_profile = {
.disable = NULL, /* mlx5i_disable */ .disable = NULL, /* mlx5i_disable */
.update_stats = NULL, /* mlx5i_update_stats */ .update_stats = NULL, /* mlx5i_update_stats */
.max_nch = mlx5e_get_max_num_channels, .max_nch = mlx5e_get_max_num_channels,
.update_carrier = NULL, /* no HW update in IB link */
.rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe, .rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe,
.rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */ .rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */
.max_tc = MLX5I_MAX_NUM_TC, .max_tc = MLX5I_MAX_NUM_TC,
...@@ -337,6 +338,7 @@ static int mlx5i_open(struct net_device *netdev) ...@@ -337,6 +338,7 @@ static int mlx5i_open(struct net_device *netdev)
mlx5e_refresh_tirs(priv, false); mlx5e_refresh_tirs(priv, false);
mlx5e_activate_priv_channels(priv); mlx5e_activate_priv_channels(priv);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return 0; return 0;
......
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