net/mlx5e: Directly get flow_steering struct as input when init/cleanup ethtool steering
authorLama Kayal <lkayal@nvidia.com>
Sun, 13 Feb 2022 11:50:35 +0000 (13:50 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 23 Aug 2022 05:44:22 +0000 (22:44 -0700)
Let both mlx5e_ethtool_init_steering and mlx5e_ethtool_cleanup_steering
get ethtool steering struct as input instead of priv, as passing priv is
obsolete.
Also modify other function through the flow similarly.

Signed-off-by: Lama Kayal <lkayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c

index ee999d79f6c8c69dfb8881cfa77b86f5e3595521..20ca670fc2266525c9a3a1f5cff1041b9574949e 100644 (file)
@@ -109,14 +109,14 @@ struct mlx5e_ethtool_steering {
        int                             tot_num_rules;
 };
 
-void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv);
-void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv);
+void mlx5e_ethtool_init_steering(struct mlx5e_flow_steering *fs);
+void mlx5e_ethtool_cleanup_steering(struct mlx5e_flow_steering *fs);
 int mlx5e_ethtool_set_rxnfc(struct mlx5e_priv *priv, struct ethtool_rxnfc *cmd);
 int mlx5e_ethtool_get_rxnfc(struct mlx5e_priv *priv,
                            struct ethtool_rxnfc *info, u32 *rule_locs);
 #else
-static inline void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv)    { }
-static inline void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv) { }
+static inline void mlx5e_ethtool_init_steering(struct mlx5e_flow_steering *fs) { }
+static inline void mlx5e_ethtool_cleanup_steering(struct mlx5e_flow_steering *fs) { }
 static inline int mlx5e_ethtool_set_rxnfc(struct mlx5e_priv *priv, struct ethtool_rxnfc *cmd)
 { return -EOPNOTSUPP; }
 static inline int mlx5e_ethtool_get_rxnfc(struct mlx5e_priv *priv,
index eef674cf0f1d9cc0036081bc30d412366f6690ea..dc73c0cfca6a8662f140711ad55ac0cbd9cc9dfd 100644 (file)
@@ -1342,7 +1342,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
        if (err)
                goto err_destory_vlan_table;
 
-       mlx5e_ethtool_init_steering(priv);
+       mlx5e_ethtool_init_steering(priv->fs);
 
        return 0;
 
@@ -1368,7 +1368,7 @@ void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv)
        mlx5e_destroy_ttc_table(priv);
        mlx5e_destroy_inner_ttc_table(priv);
        mlx5e_arfs_destroy_tables(priv);
-       mlx5e_ethtool_cleanup_steering(priv);
+       mlx5e_ethtool_cleanup_steering(priv->fs);
 }
 
 static int mlx5e_fs_vlan_alloc(struct mlx5e_flow_steering *fs)
index 82c8262341bf84c7da525a3ce7b637d4f8e7c4c9..3abd3db72e07011704f2f09a256092ed3a5bb767 100644 (file)
@@ -501,10 +501,10 @@ free:
        return err ? ERR_PTR(err) : rule;
 }
 
-static void del_ethtool_rule(struct mlx5e_priv *priv,
+static void del_ethtool_rule(struct mlx5e_flow_steering *fs,
                             struct mlx5e_ethtool_rule *eth_rule)
 {
-       struct mlx5e_ethtool_steering *ethtool = mlx5e_fs_get_ethtool(priv->fs);
+       struct mlx5e_ethtool_steering *ethtool = mlx5e_fs_get_ethtool(fs);
        if (eth_rule->rule)
                mlx5_del_flow_rules(eth_rule->rule);
        if (eth_rule->rss)
@@ -535,7 +535,7 @@ static struct mlx5e_ethtool_rule *get_ethtool_rule(struct mlx5e_priv *priv,
 
        eth_rule = find_ethtool_rule(priv, location);
        if (eth_rule)
-               del_ethtool_rule(priv, eth_rule);
+               del_ethtool_rule(priv->fs, eth_rule);
 
        eth_rule = kzalloc(sizeof(*eth_rule), GFP_KERNEL);
        if (!eth_rule)
@@ -758,7 +758,7 @@ mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv,
        return 0;
 
 del_ethtool_rule:
-       del_ethtool_rule(priv, eth_rule);
+       del_ethtool_rule(priv->fs, eth_rule);
 
        return err;
 }
@@ -778,7 +778,7 @@ mlx5e_ethtool_flow_remove(struct mlx5e_priv *priv, int location)
                goto out;
        }
 
-       del_ethtool_rule(priv, eth_rule);
+       del_ethtool_rule(priv->fs, eth_rule);
 out:
        return err;
 }
@@ -831,19 +831,19 @@ mlx5e_ethtool_get_all_flows(struct mlx5e_priv *priv,
        return err;
 }
 
-void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv)
+void mlx5e_ethtool_cleanup_steering(struct mlx5e_flow_steering *fs)
 {
-       struct mlx5e_ethtool_steering *ethtool = mlx5e_fs_get_ethtool(priv->fs);
+       struct mlx5e_ethtool_steering *ethtool = mlx5e_fs_get_ethtool(fs);
        struct mlx5e_ethtool_rule *iter;
        struct mlx5e_ethtool_rule *temp;
 
        list_for_each_entry_safe(iter, temp, &ethtool->rules, list)
-               del_ethtool_rule(priv, iter);
+               del_ethtool_rule(fs, iter);
 }
 
-void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv)
+void mlx5e_ethtool_init_steering(struct mlx5e_flow_steering *fs)
 {
-       struct mlx5e_ethtool_steering *ethtool = mlx5e_fs_get_ethtool(priv->fs);
+       struct mlx5e_ethtool_steering *ethtool = mlx5e_fs_get_ethtool(fs);
 
        INIT_LIST_HEAD(&ethtool->rules);
 }
index 8ef4ad0a6ce9025bc5375f55978b97624cb7a57e..a6b54adb377ab1f9ade1c5b4bbb09ce55f69e34e 100644 (file)
@@ -886,7 +886,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)
        if (err)
                goto err_destroy_root_ft;
 
-       mlx5e_ethtool_init_steering(priv);
+       mlx5e_ethtool_init_steering(priv->fs);
 
        return 0;
 
@@ -907,7 +907,7 @@ err_free_fs:
 
 static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv)
 {
-       mlx5e_ethtool_cleanup_steering(priv);
+       mlx5e_ethtool_cleanup_steering(priv->fs);
        rep_vport_rx_rule_destroy(priv);
        mlx5e_destroy_rep_root_ft(priv);
        mlx5_destroy_ttc_table(mlx5e_fs_get_ttc(priv->fs, false));
index 039a7be1eb0bd525ee8a8b69d2a6efaa3654dbc1..1ce5ab9270f2ed8b096501760c30784714db8291 100644 (file)
@@ -344,7 +344,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
                goto err_destroy_arfs_tables;
        }
 
-       mlx5e_ethtool_init_steering(priv);
+       mlx5e_ethtool_init_steering(priv->fs);
 
        return 0;
 
@@ -358,7 +358,7 @@ static void mlx5i_destroy_flow_steering(struct mlx5e_priv *priv)
 {
        mlx5e_destroy_ttc_table(priv);
        mlx5e_arfs_destroy_tables(priv);
-       mlx5e_ethtool_cleanup_steering(priv);
+       mlx5e_ethtool_cleanup_steering(priv->fs);
 }
 
 static int mlx5i_init_rx(struct mlx5e_priv *priv)