Commit c9fd1e33 authored by Roi Dayan's avatar Roi Dayan Committed by Saeed Mahameed

net/mlx5e: Refactor mlx5e_netdev_init/cleanup to mlx5e_priv_init/cleanup

We actually initialize priv and not netdev. The only call to
set netdev carrier will be moved in the following commit.
Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent c4d7eb57
...@@ -1160,10 +1160,10 @@ mlx5e_calc_max_nch(struct mlx5e_priv *priv, const struct mlx5e_profile *profile) ...@@ -1160,10 +1160,10 @@ mlx5e_calc_max_nch(struct mlx5e_priv *priv, const struct mlx5e_profile *profile)
return priv->netdev->num_rx_queues / max_t(u8, profile->rq_groups, 1); return priv->netdev->num_rx_queues / max_t(u8, profile->rq_groups, 1);
} }
int mlx5e_netdev_init(struct net_device *netdev, int mlx5e_priv_init(struct mlx5e_priv *priv,
struct mlx5e_priv *priv, struct net_device *netdev,
struct mlx5_core_dev *mdev); struct mlx5_core_dev *mdev);
void mlx5e_netdev_cleanup(struct net_device *netdev, struct mlx5e_priv *priv); void mlx5e_priv_cleanup(struct mlx5e_priv *priv);
struct net_device * struct net_device *
mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int rxqs); mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int rxqs);
int mlx5e_attach_netdev(struct mlx5e_priv *priv); int mlx5e_attach_netdev(struct mlx5e_priv *priv);
......
...@@ -5457,9 +5457,9 @@ static const struct mlx5e_profile mlx5e_nic_profile = { ...@@ -5457,9 +5457,9 @@ static const struct mlx5e_profile mlx5e_nic_profile = {
}; };
/* mlx5e generic netdev management API (move to en_common.c) */ /* mlx5e generic netdev management API (move to en_common.c) */
int mlx5e_netdev_init(struct net_device *netdev, int mlx5e_priv_init(struct mlx5e_priv *priv,
struct mlx5e_priv *priv, struct net_device *netdev,
struct mlx5_core_dev *mdev) struct mlx5_core_dev *mdev)
{ {
memset(priv, 0, sizeof(*priv)); memset(priv, 0, sizeof(*priv));
...@@ -5494,7 +5494,7 @@ int mlx5e_netdev_init(struct net_device *netdev, ...@@ -5494,7 +5494,7 @@ int mlx5e_netdev_init(struct net_device *netdev,
return -ENOMEM; return -ENOMEM;
} }
void mlx5e_netdev_cleanup(struct net_device *netdev, struct mlx5e_priv *priv) void mlx5e_priv_cleanup(struct mlx5e_priv *priv)
{ {
int i; int i;
...@@ -5518,9 +5518,9 @@ mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int ...@@ -5518,9 +5518,9 @@ mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int
return NULL; return NULL;
} }
err = mlx5e_netdev_init(netdev, netdev_priv(netdev), mdev); err = mlx5e_priv_init(netdev_priv(netdev), netdev, mdev);
if (err) { if (err) {
mlx5_core_err(mdev, "mlx5e_netdev_init failed, err=%d\n", err); mlx5_core_err(mdev, "mlx5e_priv_init failed, err=%d\n", err);
goto err_free_netdev; goto err_free_netdev;
} }
dev_net_set(netdev, mlx5_core_net(mdev)); dev_net_set(netdev, mlx5_core_net(mdev));
...@@ -5625,9 +5625,9 @@ mlx5e_netdev_attach_profile(struct mlx5e_priv *priv, ...@@ -5625,9 +5625,9 @@ mlx5e_netdev_attach_profile(struct mlx5e_priv *priv,
struct mlx5_core_dev *mdev = priv->mdev; struct mlx5_core_dev *mdev = priv->mdev;
int err; int err;
err = mlx5e_netdev_init(netdev, priv, mdev); err = mlx5e_priv_init(priv, netdev, mdev);
if (err) { if (err) {
mlx5_core_err(mdev, "mlx5e_netdev_init failed, err=%d\n", err); mlx5_core_err(mdev, "mlx5e_priv_init failed, err=%d\n", err);
return err; return err;
} }
priv->profile = new_profile; priv->profile = new_profile;
...@@ -5660,7 +5660,7 @@ int mlx5e_netdev_change_profile(struct mlx5e_priv *priv, ...@@ -5660,7 +5660,7 @@ int mlx5e_netdev_change_profile(struct mlx5e_priv *priv,
/* cleanup old profile */ /* cleanup old profile */
mlx5e_detach_netdev(priv); mlx5e_detach_netdev(priv);
priv->profile->cleanup(priv); priv->profile->cleanup(priv);
mlx5e_netdev_cleanup(priv->netdev, priv); mlx5e_priv_cleanup(priv);
err = mlx5e_netdev_attach_profile(priv, new_profile, new_ppriv); err = mlx5e_netdev_attach_profile(priv, new_profile, new_ppriv);
if (err) { /* roll back to original profile */ if (err) { /* roll back to original profile */
...@@ -5685,7 +5685,7 @@ void mlx5e_destroy_netdev(struct mlx5e_priv *priv) ...@@ -5685,7 +5685,7 @@ void mlx5e_destroy_netdev(struct mlx5e_priv *priv)
{ {
struct net_device *netdev = priv->netdev; struct net_device *netdev = priv->netdev;
mlx5e_netdev_cleanup(netdev, priv); mlx5e_priv_cleanup(priv);
free_netdev(netdev); free_netdev(netdev);
} }
......
...@@ -103,7 +103,7 @@ int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev) ...@@ -103,7 +103,7 @@ int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev)
/* Called directly before IPoIB netdevice is destroyed to cleanup SW structs */ /* Called directly before IPoIB netdevice is destroyed to cleanup SW structs */
void mlx5i_cleanup(struct mlx5e_priv *priv) void mlx5i_cleanup(struct mlx5e_priv *priv)
{ {
mlx5e_netdev_cleanup(priv->netdev, priv); mlx5e_priv_cleanup(priv);
} }
static void mlx5i_grp_sw_update_stats(struct mlx5e_priv *priv) static void mlx5i_grp_sw_update_stats(struct mlx5e_priv *priv)
...@@ -744,7 +744,7 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num, ...@@ -744,7 +744,7 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
goto destroy_ht; goto destroy_ht;
} }
err = mlx5e_netdev_init(netdev, epriv, mdev); err = mlx5e_priv_init(epriv, netdev, mdev);
if (err) if (err)
goto destroy_mdev_resources; goto destroy_mdev_resources;
......
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