net/mlx5e: Convert mlx5e_flow_steering member of mlx5e_priv to pointer
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_rep.c
index ae90b06d21e2fbfba0a3d43083ef477b6d52e684..b1d65bbebebb9ad678231d8335bbb8cbd5791d73 100644 (file)
@@ -718,6 +718,7 @@ static int mlx5e_init_ul_rep(struct mlx5_core_dev *mdev,
 
 static void mlx5e_cleanup_rep(struct mlx5e_priv *priv)
 {
+       mlx5e_fs_cleanup(priv->fs);
        mlx5e_ipsec_cleanup(priv);
 }
 
@@ -728,8 +729,8 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv)
        struct ttc_params ttc_params = {};
        int err;
 
-       priv->fs.ns = mlx5_get_flow_namespace(priv->mdev,
-                                             MLX5_FLOW_NAMESPACE_KERNEL);
+       priv->fs->ns = mlx5_get_flow_namespace(priv->mdev,
+                                              MLX5_FLOW_NAMESPACE_KERNEL);
 
        /* The inner_ttc in the ttc params is intentionally not set */
        mlx5e_set_ttc_params(priv, &ttc_params, false);
@@ -738,9 +739,9 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv)
                /* To give uplik rep TTC a lower level for chaining from root ft */
                ttc_params.ft_attr.level = MLX5E_TTC_FT_LEVEL + 1;
 
-       priv->fs.ttc = mlx5_create_ttc_table(priv->mdev, &ttc_params);
-       if (IS_ERR(priv->fs.ttc)) {
-               err = PTR_ERR(priv->fs.ttc);
+       priv->fs->ttc = mlx5_create_ttc_table(priv->mdev, &ttc_params);
+       if (IS_ERR(priv->fs->ttc)) {
+               err = PTR_ERR(priv->fs->ttc);
                netdev_err(priv->netdev, "Failed to create rep ttc table, err=%d\n",
                           err);
                return err;
@@ -760,7 +761,7 @@ static int mlx5e_create_rep_root_ft(struct mlx5e_priv *priv)
                /* non uplik reps will skip any bypass tables and go directly to
                 * their own ttc
                 */
-               rpriv->root_ft = mlx5_get_ttc_flow_table(priv->fs.ttc);
+               rpriv->root_ft = mlx5_get_ttc_flow_table(priv->fs->ttc);
                return 0;
        }
 
@@ -835,9 +836,17 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)
        struct mlx5_core_dev *mdev = priv->mdev;
        int err;
 
-       priv->rx_res = mlx5e_rx_res_alloc();
-       if (!priv->rx_res)
+       priv->fs = mlx5e_fs_init(priv->profile);
+       if (!priv->fs) {
+               netdev_err(priv->netdev, "FS allocation failed\n");
                return -ENOMEM;
+       }
+
+       priv->rx_res = mlx5e_rx_res_alloc();
+       if (!priv->rx_res) {
+               err = -ENOMEM;
+               goto err_free_fs;
+       }
 
        mlx5e_init_l2_addr(priv);
 
@@ -873,13 +882,15 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)
 err_destroy_root_ft:
        mlx5e_destroy_rep_root_ft(priv);
 err_destroy_ttc_table:
-       mlx5_destroy_ttc_table(priv->fs.ttc);
+       mlx5_destroy_ttc_table(priv->fs->ttc);
 err_destroy_rx_res:
        mlx5e_rx_res_destroy(priv->rx_res);
 err_close_drop_rq:
        mlx5e_close_drop_rq(&priv->drop_rq);
        mlx5e_rx_res_free(priv->rx_res);
        priv->rx_res = NULL;
+err_free_fs:
+       mlx5e_fs_cleanup(priv->fs);
        return err;
 }
 
@@ -888,7 +899,7 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv)
        mlx5e_ethtool_cleanup_steering(priv);
        rep_vport_rx_rule_destroy(priv);
        mlx5e_destroy_rep_root_ft(priv);
-       mlx5_destroy_ttc_table(priv->fs.ttc);
+       mlx5_destroy_ttc_table(priv->fs->ttc);
        mlx5e_rx_res_destroy(priv->rx_res);
        mlx5e_close_drop_rq(&priv->drop_rq);
        mlx5e_rx_res_free(priv->rx_res);