err = mlx5_cmd_destroy_flow_table(dev, ft);
if (err)
mlx5_core_warn(dev, "flow steering can't destroy ft\n");
- ida_destroy(&ft->fte_allocator);
rhltable_destroy(&ft->fgs_hash);
fs_get_obj(prio, ft->node.parent);
prio->num_ft--;
WARN_ON(ret);
fte->status = 0;
fs_get_obj(ft, fg->node.parent);
- ida_simple_remove(&ft->fte_allocator, fte->index);
+ ida_simple_remove(&fg->fte_allocator, fte->index - fg->start_index);
}
static void del_fte(struct fs_node *node)
ft->autogroup.num_groups--;
rhashtable_destroy(&fg->ftes_hash);
+ ida_destroy(&fg->fte_allocator);
err = rhltable_remove(&ft->fgs_hash,
&fg->hash,
rhash_fg);
kfree(fg);
return ERR_PTR(ret);
}
+ ida_init(&fg->fte_allocator);
fg->mask.match_criteria_enable = match_criteria_enable;
memcpy(&fg->mask.match_criteria, match_criteria,
sizeof(fg->mask.match_criteria));
ft->flags = flags;
INIT_LIST_HEAD(&ft->fwd_rules);
mutex_init(&ft->lock);
- ida_init(&ft->fte_allocator);
return ft;
}
destroy_ft:
mlx5_cmd_destroy_flow_table(root->dev, ft);
free_ft:
- ida_destroy(&ft->fte_allocator);
kfree(ft);
unlock_root:
mutex_unlock(&root->chain_lock);
rhash_fg));
err_free_fg:
rhashtable_destroy(&fg->ftes_hash);
+ ida_destroy(&fg->fte_allocator);
kfree(fg);
return ERR_PTR(err);
u32 *match_value,
struct mlx5_flow_act *flow_act)
{
- struct mlx5_flow_table *ft;
struct fs_fte *fte;
int index;
int ret;
- fs_get_obj(ft, fg->node.parent);
- index = ida_simple_get(&ft->fte_allocator, fg->start_index,
- fg->start_index + fg->max_ftes,
+ index = ida_simple_get(&fg->fte_allocator, 0,
+ fg->max_ftes,
GFP_KERNEL);
if (index < 0)
return ERR_PTR(index);
+ index += fg->start_index;
+
fte = alloc_fte(flow_act, match_value, index);
if (IS_ERR(fte)) {
ret = PTR_ERR(fte);
err_hash:
kfree(fte);
err_alloc:
- ida_simple_remove(&ft->fte_allocator, index);
+ ida_simple_remove(&fg->fte_allocator, index - fg->start_index);
return ERR_PTR(ret);
}