dev_ioctl: split out ndo_eth_ioctl
[linux-2.6-block.git] / drivers / net / ethernet / mellanox / mlx5 / core / ipoib / ipoib.c
index 7d7ed025db0da7c72369346a7c422b6e5c9c6b38..a126cbc6f0d6a200859de059852a3410583d8a1a 100644 (file)
@@ -50,7 +50,7 @@ static const struct net_device_ops mlx5i_netdev_ops = {
        .ndo_init                = mlx5i_dev_init,
        .ndo_uninit              = mlx5i_dev_cleanup,
        .ndo_change_mtu          = mlx5i_change_mtu,
-       .ndo_do_ioctl            = mlx5i_ioctl,
+       .ndo_eth_ioctl            = mlx5i_ioctl,
 };
 
 /* IPoIB mlx5 netdev profile */
@@ -331,32 +331,19 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
        }
 
        mlx5e_set_ttc_basic_params(priv, &ttc_params);
-       mlx5e_set_inner_ttc_ft_params(&ttc_params);
-       for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
-               ttc_params.indir_tirn[tt] = priv->inner_indir_tir[tt].tirn;
-
-       err = mlx5e_create_inner_ttc_table(priv, &ttc_params, &priv->fs.inner_ttc);
-       if (err) {
-               netdev_err(priv->netdev, "Failed to create inner ttc table, err=%d\n",
-                          err);
-               goto err_destroy_arfs_tables;
-       }
-
        mlx5e_set_ttc_ft_params(&ttc_params);
        for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
-               ttc_params.indir_tirn[tt] = priv->indir_tir[tt].tirn;
+               ttc_params.indir_tirn[tt] = priv->rx_res->rss[tt].indir_tir.tirn;
 
        err = mlx5e_create_ttc_table(priv, &ttc_params, &priv->fs.ttc);
        if (err) {
                netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n",
                           err);
-               goto err_destroy_inner_ttc_table;
+               goto err_destroy_arfs_tables;
        }
 
        return 0;
 
-err_destroy_inner_ttc_table:
-       mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc);
 err_destroy_arfs_tables:
        mlx5e_arfs_destroy_tables(priv);
 
@@ -366,16 +353,20 @@ err_destroy_arfs_tables:
 static void mlx5i_destroy_flow_steering(struct mlx5e_priv *priv)
 {
        mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
-       mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc);
        mlx5e_arfs_destroy_tables(priv);
 }
 
 static int mlx5i_init_rx(struct mlx5e_priv *priv)
 {
        struct mlx5_core_dev *mdev = priv->mdev;
-       u16 max_nch = priv->max_nch;
        int err;
 
+       priv->rx_res = kvzalloc(sizeof(*priv->rx_res), GFP_KERNEL);
+       if (!priv->rx_res)
+               return -ENOMEM;
+
+       mlx5e_build_rss_params(&priv->rx_res->rss_params, priv->channels.params.num_channels);
+
        mlx5e_create_q_counters(priv);
 
        err = mlx5e_open_drop_rq(priv, &priv->drop_rq);
@@ -388,15 +379,15 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)
        if (err)
                goto err_close_drop_rq;
 
-       err = mlx5e_create_direct_rqts(priv, priv->direct_tir, max_nch);
+       err = mlx5e_create_direct_rqts(priv);
        if (err)
                goto err_destroy_indirect_rqts;
 
-       err = mlx5e_create_indirect_tirs(priv, true);
+       err = mlx5e_create_indirect_tirs(priv, false);
        if (err)
                goto err_destroy_direct_rqts;
 
-       err = mlx5e_create_direct_tirs(priv, priv->direct_tir, max_nch);
+       err = mlx5e_create_direct_tirs(priv);
        if (err)
                goto err_destroy_indirect_tirs;
 
@@ -407,31 +398,33 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)
        return 0;
 
 err_destroy_direct_tirs:
-       mlx5e_destroy_direct_tirs(priv, priv->direct_tir, max_nch);
+       mlx5e_destroy_direct_tirs(priv);
 err_destroy_indirect_tirs:
        mlx5e_destroy_indirect_tirs(priv);
 err_destroy_direct_rqts:
-       mlx5e_destroy_direct_rqts(priv, priv->direct_tir, max_nch);
+       mlx5e_destroy_direct_rqts(priv);
 err_destroy_indirect_rqts:
-       mlx5e_destroy_rqt(priv, &priv->indir_rqt);
+       mlx5e_rqt_destroy(&priv->rx_res->indir_rqt);
 err_close_drop_rq:
        mlx5e_close_drop_rq(&priv->drop_rq);
 err_destroy_q_counters:
        mlx5e_destroy_q_counters(priv);
+       kvfree(priv->rx_res);
+       priv->rx_res = NULL;
        return err;
 }
 
 static void mlx5i_cleanup_rx(struct mlx5e_priv *priv)
 {
-       u16 max_nch = priv->max_nch;
-
        mlx5i_destroy_flow_steering(priv);
-       mlx5e_destroy_direct_tirs(priv, priv->direct_tir, max_nch);
+       mlx5e_destroy_direct_tirs(priv);
        mlx5e_destroy_indirect_tirs(priv);
-       mlx5e_destroy_direct_rqts(priv, priv->direct_tir, max_nch);
-       mlx5e_destroy_rqt(priv, &priv->indir_rqt);
+       mlx5e_destroy_direct_rqts(priv);
+       mlx5e_rqt_destroy(&priv->rx_res->indir_rqt);
        mlx5e_close_drop_rq(&priv->drop_rq);
        mlx5e_destroy_q_counters(priv);
+       kvfree(priv->rx_res);
+       priv->rx_res = NULL;
 }
 
 /* The stats groups order is opposite to the update_stats() order calls */