|
@@ -778,18 +778,16 @@ static void list_add_flow_table(struct mlx5_flow_table *ft,
|
|
}
|
|
}
|
|
|
|
|
|
static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
|
|
static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
|
|
|
|
+ struct mlx5_flow_table_attr *ft_attr,
|
|
enum fs_flow_table_op_mod op_mod,
|
|
enum fs_flow_table_op_mod op_mod,
|
|
- u16 vport, int prio,
|
|
|
|
- int max_fte, u32 level,
|
|
|
|
- u32 flags)
|
|
|
|
|
|
+ u16 vport)
|
|
{
|
|
{
|
|
|
|
+ struct mlx5_flow_root_namespace *root = find_root(&ns->node);
|
|
struct mlx5_flow_table *next_ft = NULL;
|
|
struct mlx5_flow_table *next_ft = NULL;
|
|
|
|
+ struct fs_prio *fs_prio = NULL;
|
|
struct mlx5_flow_table *ft;
|
|
struct mlx5_flow_table *ft;
|
|
- int err;
|
|
|
|
int log_table_sz;
|
|
int log_table_sz;
|
|
- struct mlx5_flow_root_namespace *root =
|
|
|
|
- find_root(&ns->node);
|
|
|
|
- struct fs_prio *fs_prio = NULL;
|
|
|
|
|
|
+ int err;
|
|
|
|
|
|
if (!root) {
|
|
if (!root) {
|
|
pr_err("mlx5: flow steering failed to find root of namespace\n");
|
|
pr_err("mlx5: flow steering failed to find root of namespace\n");
|
|
@@ -797,29 +795,31 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa
|
|
}
|
|
}
|
|
|
|
|
|
mutex_lock(&root->chain_lock);
|
|
mutex_lock(&root->chain_lock);
|
|
- fs_prio = find_prio(ns, prio);
|
|
|
|
|
|
+ fs_prio = find_prio(ns, ft_attr->prio);
|
|
if (!fs_prio) {
|
|
if (!fs_prio) {
|
|
err = -EINVAL;
|
|
err = -EINVAL;
|
|
goto unlock_root;
|
|
goto unlock_root;
|
|
}
|
|
}
|
|
- if (level >= fs_prio->num_levels) {
|
|
|
|
|
|
+ if (ft_attr->level >= fs_prio->num_levels) {
|
|
err = -ENOSPC;
|
|
err = -ENOSPC;
|
|
goto unlock_root;
|
|
goto unlock_root;
|
|
}
|
|
}
|
|
/* The level is related to the
|
|
/* The level is related to the
|
|
* priority level range.
|
|
* priority level range.
|
|
*/
|
|
*/
|
|
- level += fs_prio->start_level;
|
|
|
|
- ft = alloc_flow_table(level,
|
|
|
|
|
|
+ ft_attr->level += fs_prio->start_level;
|
|
|
|
+ ft = alloc_flow_table(ft_attr->level,
|
|
vport,
|
|
vport,
|
|
- max_fte ? roundup_pow_of_two(max_fte) : 0,
|
|
|
|
|
|
+ ft_attr->max_fte ? roundup_pow_of_two(ft_attr->max_fte) : 0,
|
|
root->table_type,
|
|
root->table_type,
|
|
- op_mod, flags);
|
|
|
|
|
|
+ op_mod, ft_attr->flags);
|
|
if (!ft) {
|
|
if (!ft) {
|
|
err = -ENOMEM;
|
|
err = -ENOMEM;
|
|
goto unlock_root;
|
|
goto unlock_root;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ft->underlay_qpn = ft_attr->underlay_qpn;
|
|
|
|
+
|
|
tree_init_node(&ft->node, 1, del_flow_table);
|
|
tree_init_node(&ft->node, 1, del_flow_table);
|
|
log_table_sz = ft->max_fte ? ilog2(ft->max_fte) : 0;
|
|
log_table_sz = ft->max_fte ? ilog2(ft->max_fte) : 0;
|
|
next_ft = find_next_chained_ft(fs_prio);
|
|
next_ft = find_next_chained_ft(fs_prio);
|
|
@@ -849,44 +849,56 @@ unlock_root:
|
|
}
|
|
}
|
|
|
|
|
|
struct mlx5_flow_table *mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
|
|
struct mlx5_flow_table *mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
|
|
- int prio, int max_fte,
|
|
|
|
- u32 level,
|
|
|
|
- u32 flags)
|
|
|
|
|
|
+ struct mlx5_flow_table_attr *ft_attr)
|
|
{
|
|
{
|
|
- return __mlx5_create_flow_table(ns, FS_FT_OP_MOD_NORMAL, 0, prio,
|
|
|
|
- max_fte, level, flags);
|
|
|
|
|
|
+ return __mlx5_create_flow_table(ns, ft_attr, FS_FT_OP_MOD_NORMAL, 0);
|
|
}
|
|
}
|
|
|
|
|
|
struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
|
|
struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
|
|
int prio, int max_fte,
|
|
int prio, int max_fte,
|
|
u32 level, u16 vport)
|
|
u32 level, u16 vport)
|
|
{
|
|
{
|
|
- return __mlx5_create_flow_table(ns, FS_FT_OP_MOD_NORMAL, vport, prio,
|
|
|
|
- max_fte, level, 0);
|
|
|
|
|
|
+ struct mlx5_flow_table_attr ft_attr = {};
|
|
|
|
+
|
|
|
|
+ ft_attr.max_fte = max_fte;
|
|
|
|
+ ft_attr.level = level;
|
|
|
|
+ ft_attr.prio = prio;
|
|
|
|
+
|
|
|
|
+ return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, 0);
|
|
}
|
|
}
|
|
|
|
|
|
-struct mlx5_flow_table *mlx5_create_lag_demux_flow_table(
|
|
|
|
- struct mlx5_flow_namespace *ns,
|
|
|
|
- int prio, u32 level)
|
|
|
|
|
|
+struct mlx5_flow_table*
|
|
|
|
+mlx5_create_lag_demux_flow_table(struct mlx5_flow_namespace *ns,
|
|
|
|
+ int prio, u32 level)
|
|
{
|
|
{
|
|
- return __mlx5_create_flow_table(ns, FS_FT_OP_MOD_LAG_DEMUX, 0, prio, 0,
|
|
|
|
- level, 0);
|
|
|
|
|
|
+ struct mlx5_flow_table_attr ft_attr = {};
|
|
|
|
+
|
|
|
|
+ ft_attr.level = level;
|
|
|
|
+ ft_attr.prio = prio;
|
|
|
|
+ return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_LAG_DEMUX, 0);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(mlx5_create_lag_demux_flow_table);
|
|
EXPORT_SYMBOL(mlx5_create_lag_demux_flow_table);
|
|
|
|
|
|
-struct mlx5_flow_table *mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
|
|
|
|
- int prio,
|
|
|
|
- int num_flow_table_entries,
|
|
|
|
- int max_num_groups,
|
|
|
|
- u32 level,
|
|
|
|
- u32 flags)
|
|
|
|
|
|
+struct mlx5_flow_table*
|
|
|
|
+mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
|
|
|
|
+ int prio,
|
|
|
|
+ int num_flow_table_entries,
|
|
|
|
+ int max_num_groups,
|
|
|
|
+ u32 level,
|
|
|
|
+ u32 flags)
|
|
{
|
|
{
|
|
|
|
+ struct mlx5_flow_table_attr ft_attr = {};
|
|
struct mlx5_flow_table *ft;
|
|
struct mlx5_flow_table *ft;
|
|
|
|
|
|
if (max_num_groups > num_flow_table_entries)
|
|
if (max_num_groups > num_flow_table_entries)
|
|
return ERR_PTR(-EINVAL);
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
- ft = mlx5_create_flow_table(ns, prio, num_flow_table_entries, level, flags);
|
|
|
|
|
|
+ ft_attr.max_fte = num_flow_table_entries;
|
|
|
|
+ ft_attr.prio = prio;
|
|
|
|
+ ft_attr.level = level;
|
|
|
|
+ ft_attr.flags = flags;
|
|
|
|
+
|
|
|
|
+ ft = mlx5_create_flow_table(ns, &ft_attr);
|
|
if (IS_ERR(ft))
|
|
if (IS_ERR(ft))
|
|
return ft;
|
|
return ft;
|
|
|
|
|
|
@@ -1828,12 +1840,18 @@ static void set_prio_attrs(struct mlx5_flow_root_namespace *root_ns)
|
|
static int create_anchor_flow_table(struct mlx5_flow_steering *steering)
|
|
static int create_anchor_flow_table(struct mlx5_flow_steering *steering)
|
|
{
|
|
{
|
|
struct mlx5_flow_namespace *ns = NULL;
|
|
struct mlx5_flow_namespace *ns = NULL;
|
|
|
|
+ struct mlx5_flow_table_attr ft_attr = {};
|
|
struct mlx5_flow_table *ft;
|
|
struct mlx5_flow_table *ft;
|
|
|
|
|
|
ns = mlx5_get_flow_namespace(steering->dev, MLX5_FLOW_NAMESPACE_ANCHOR);
|
|
ns = mlx5_get_flow_namespace(steering->dev, MLX5_FLOW_NAMESPACE_ANCHOR);
|
|
if (WARN_ON(!ns))
|
|
if (WARN_ON(!ns))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
- ft = mlx5_create_flow_table(ns, ANCHOR_PRIO, ANCHOR_SIZE, ANCHOR_LEVEL, 0);
|
|
|
|
|
|
+
|
|
|
|
+ ft_attr.max_fte = ANCHOR_SIZE;
|
|
|
|
+ ft_attr.level = ANCHOR_LEVEL;
|
|
|
|
+ ft_attr.prio = ANCHOR_PRIO;
|
|
|
|
+
|
|
|
|
+ ft = mlx5_create_flow_table(ns, &ft_attr);
|
|
if (IS_ERR(ft)) {
|
|
if (IS_ERR(ft)) {
|
|
mlx5_core_err(steering->dev, "Failed to create last anchor flow table");
|
|
mlx5_core_err(steering->dev, "Failed to create last anchor flow table");
|
|
return PTR_ERR(ft);
|
|
return PTR_ERR(ft);
|