struct mlx5_flow_namespace *ns;
struct mlx5_flow_namespace *egress_ns;
#ifdef CONFIG_MLX5_EN_RXNFC
- struct mlx5e_ethtool_steering ethtool;
+ struct mlx5e_ethtool_steering *ethtool;
#endif
struct mlx5e_tc_table *tc;
struct mlx5e_promisc_table promisc;
return fs->tc;
}
+#ifdef CONFIG_MLX5_EN_RXNFC
+static int mlx5e_fs_ethtool_alloc(struct mlx5e_flow_steering *fs)
+{
+ fs->ethtool = kvzalloc(sizeof(*fs->ethtool), GFP_KERNEL);
+
+ if (!fs->ethtool)
+ return -ENOMEM;
+ return 0;
+}
+
+static void mlx5e_fs_ethtool_free(struct mlx5e_flow_steering *fs)
+{
+ kvfree(fs->ethtool);
+}
+
+struct mlx5e_ethtool_steering *mlx5e_fs_get_ethtool(struct mlx5e_flow_steering *fs)
+{
+ return fs->ethtool;
+}
+#else
+static int mlx5e_fs_ethtool_alloc(struct mlx5e_flow_steering *fs)
+{ return 0; }
+static void mlx5e_fs_ethtool_free(struct mlx5e_flow_steering *fs) { }
+#endif
+
struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile,
struct mlx5_core_dev *mdev,
bool state_destroy)
goto err_free_vlan;
}
+ err = mlx5e_fs_ethtool_alloc(fs);
+ if (err)
+ goto err_free_tc;
+
return fs;
+err_free_tc:
+ mlx5e_fs_tc_free(fs);
err_free_fs:
kvfree(fs);
err_free_vlan:
void mlx5e_fs_cleanup(struct mlx5e_flow_steering *fs)
{
+ mlx5e_fs_ethtool_free(fs);
mlx5e_fs_tc_free(fs);
mlx5e_fs_vlan_free(fs);
kvfree(fs);
fs->egress_ns = ns;
}
-#ifdef CONFIG_MLX5_EN_RXNFC
-struct mlx5e_ethtool_steering *mlx5e_fs_get_ethtool(struct mlx5e_flow_steering *fs)
-{
- return &fs->ethtool;
-}
-#endif
-
struct mlx5_ttc_table *mlx5e_fs_get_ttc(struct mlx5e_flow_steering *fs, bool inner)
{
return inner ? fs->inner_ttc : fs->ttc;