@@ -934,4 +934,5 @@ int mlx5e_get_offload_stats(int attr_id, const struct net_device *dev,
bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv);
bool mlx5e_is_vf_vport_rep(struct mlx5e_priv *priv);
+bool mlx5e_is_eswitch_vport_mngr(struct mlx5_core_dev *mdev);
#endif /* __MLX5_EN_H__ */
@@ -2269,7 +2269,9 @@ int mlx5e_open_locked(struct mlx5e_priv *priv)
}
mlx5e_redirect_rqts(priv);
- mlx5e_update_carrier(priv);
+ /* only for the RFC, will use channels api when available */
+ if (MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH)
+ mlx5e_update_carrier(priv);
mlx5e_timestamp_init(priv);
#ifdef CONFIG_RFS_ACCEL
priv->netdev->rx_cpu_rmap = priv->mdev->rmap;
@@ -2277,7 +2279,7 @@ int mlx5e_open_locked(struct mlx5e_priv *priv)
if (priv->profile->update_stats)
queue_delayed_work(priv->wq, &priv->update_stats_work, 0);
- if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
+ if (mlx5e_is_eswitch_vport_mngr(mdev)) {
err = mlx5e_add_sqs_fwd_rules(priv);
if (err)
goto err_close_channels;
@@ -3900,6 +3902,7 @@ static void mlx5i_nic_init(struct mlx5_core_dev *mdev,
struct mlx5e_priv *priv = netdev_priv(netdev) + base_size;
mlx5n_build_nic_netdev_priv_common(mdev, netdev, priv, profile, ppriv);
+ priv->ppriv = NULL;
}
static int mlx5i_init_nic_rx(struct mlx5e_priv *priv)
@@ -4026,6 +4029,22 @@ void mlx5i_detach(struct mlx5_core_dev *mdev, void *vpriv)
}
EXPORT_SYMBOL(mlx5i_detach);
+int mlx5i_open(void *vpriv)
+{
+ struct mlx5e_priv *priv = vpriv;
+
+ return mlx5e_open_locked(priv);
+}
+EXPORT_SYMBOL(mlx5i_open);
+
+int mlx5i_close(void *vpriv)
+{
+ struct mlx5e_priv *priv = vpriv;
+
+ return mlx5e_close_locked(priv);
+}
+EXPORT_SYMBOL(mlx5i_close);
+
static const struct mlx5e_profile mlx5e_nic_profile = {
.init = mlx5e_nic_init,
.cleanup = mlx5e_nic_cleanup,
@@ -219,7 +219,12 @@ int mlx5e_nic_rep_load(struct mlx5_eswitch *esw, struct mlx5_eswitch_rep *rep)
void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv)
{
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
- struct mlx5_eswitch_rep *rep = priv->ppriv;
+ struct mlx5_eswitch_rep *rep;
+
+ if (!priv->ppriv)
+ return;
+
+ rep = priv->ppriv;
mlx5_eswitch_sqs2vport_stop(esw, rep);
}
@@ -323,6 +328,12 @@ bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv)
return false;
}
+bool mlx5e_is_eswitch_vport_mngr(struct mlx5_core_dev *mdev)
+{
+ return (MLX5_CAP_GEN(mdev, vport_group_manager) &&
+ MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH);
+}
+
bool mlx5e_is_vf_vport_rep(struct mlx5e_priv *priv)
{
struct mlx5_eswitch_rep *rep = (struct mlx5_eswitch_rep *)priv->ppriv;
@@ -1138,4 +1138,7 @@ struct net_device *mlx5i_create_netdev(struct mlx5_core_dev *mdev,
struct mlx5i_create_ext_param *param);
int mlx5i_attach(struct mlx5_core_dev *mdev, void *vpriv);
void mlx5i_detach(struct mlx5_core_dev *mdev, void *vpriv);
+int mlx5i_close(void *vpriv);
+int mlx5i_open(void *vpriv);
+
#endif /* MLX5_DRIVER_H */
Now IB device is able to call open or close for its net device. TBD: There is one change that is waiting for the new channels api, till then used an "if" in the code. Signed-off-by: Erez Shitrit <erezsh@mellanox.com> --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 23 +++++++++++++++++++++-- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 13 ++++++++++++- include/linux/mlx5/driver.h | 3 +++ 4 files changed, 37 insertions(+), 3 deletions(-)