|
@@ -460,8 +460,7 @@ static void del_flow_group(struct fs_node *node)
|
|
|
fg->id, ft->id);
|
|
|
}
|
|
|
|
|
|
-static struct fs_fte *alloc_fte(u8 action,
|
|
|
- u32 flow_tag,
|
|
|
+static struct fs_fte *alloc_fte(struct mlx5_flow_act *flow_act,
|
|
|
u32 *match_value,
|
|
|
unsigned int index)
|
|
|
{
|
|
@@ -473,9 +472,10 @@ static struct fs_fte *alloc_fte(u8 action,
|
|
|
|
|
|
memcpy(fte->val, match_value, sizeof(fte->val));
|
|
|
fte->node.type = FS_TYPE_FLOW_ENTRY;
|
|
|
- fte->flow_tag = flow_tag;
|
|
|
+ fte->flow_tag = flow_act->flow_tag;
|
|
|
fte->index = index;
|
|
|
- fte->action = action;
|
|
|
+ fte->action = flow_act->action;
|
|
|
+ fte->encap_id = flow_act->encap_id;
|
|
|
|
|
|
return fte;
|
|
|
}
|
|
@@ -1117,15 +1117,14 @@ static unsigned int get_free_fte_index(struct mlx5_flow_group *fg,
|
|
|
/* prev is output, prev->next = new_fte */
|
|
|
static struct fs_fte *create_fte(struct mlx5_flow_group *fg,
|
|
|
u32 *match_value,
|
|
|
- u8 action,
|
|
|
- u32 flow_tag,
|
|
|
+ struct mlx5_flow_act *flow_act,
|
|
|
struct list_head **prev)
|
|
|
{
|
|
|
struct fs_fte *fte;
|
|
|
int index;
|
|
|
|
|
|
index = get_free_fte_index(fg, prev);
|
|
|
- fte = alloc_fte(action, flow_tag, match_value, index);
|
|
|
+ fte = alloc_fte(flow_act, match_value, index);
|
|
|
if (IS_ERR(fte))
|
|
|
return fte;
|
|
|
|
|
@@ -1219,8 +1218,7 @@ static struct mlx5_flow_rule *find_flow_rule(struct fs_fte *fte,
|
|
|
|
|
|
static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
|
|
|
u32 *match_value,
|
|
|
- u8 action,
|
|
|
- u32 flow_tag,
|
|
|
+ struct mlx5_flow_act *flow_act,
|
|
|
struct mlx5_flow_destination *dest,
|
|
|
int dest_num)
|
|
|
{
|
|
@@ -1234,12 +1232,13 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
|
|
|
fs_for_each_fte(fte, fg) {
|
|
|
nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD);
|
|
|
if (compare_match_value(&fg->mask, match_value, &fte->val) &&
|
|
|
- (action & fte->action) && flow_tag == fte->flow_tag) {
|
|
|
+ (flow_act->action & fte->action) &&
|
|
|
+ flow_act->flow_tag == fte->flow_tag) {
|
|
|
int old_action = fte->action;
|
|
|
|
|
|
- fte->action |= action;
|
|
|
+ fte->action |= flow_act->action;
|
|
|
handle = add_rule_fte(fte, fg, dest, dest_num,
|
|
|
- old_action != action);
|
|
|
+ old_action != flow_act->action);
|
|
|
if (IS_ERR(handle)) {
|
|
|
fte->action = old_action;
|
|
|
goto unlock_fte;
|
|
@@ -1255,7 +1254,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
|
|
|
goto unlock_fg;
|
|
|
}
|
|
|
|
|
|
- fte = create_fte(fg, match_value, action, flow_tag, &prev);
|
|
|
+ fte = create_fte(fg, match_value, flow_act, &prev);
|
|
|
if (IS_ERR(fte)) {
|
|
|
handle = (void *)fte;
|
|
|
goto unlock_fg;
|
|
@@ -1332,17 +1331,17 @@ static bool dest_is_valid(struct mlx5_flow_destination *dest,
|
|
|
static struct mlx5_flow_handle *
|
|
|
_mlx5_add_flow_rules(struct mlx5_flow_table *ft,
|
|
|
struct mlx5_flow_spec *spec,
|
|
|
- u32 action,
|
|
|
- u32 flow_tag,
|
|
|
+ struct mlx5_flow_act *flow_act,
|
|
|
struct mlx5_flow_destination *dest,
|
|
|
int dest_num)
|
|
|
+
|
|
|
{
|
|
|
struct mlx5_flow_group *g;
|
|
|
struct mlx5_flow_handle *rule;
|
|
|
int i;
|
|
|
|
|
|
for (i = 0; i < dest_num; i++) {
|
|
|
- if (!dest_is_valid(&dest[i], action, ft))
|
|
|
+ if (!dest_is_valid(&dest[i], flow_act->action, ft))
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
}
|
|
|
|
|
@@ -1353,7 +1352,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
|
|
|
g->mask.match_criteria,
|
|
|
spec->match_criteria)) {
|
|
|
rule = add_rule_fg(g, spec->match_value,
|
|
|
- action, flow_tag, dest, dest_num);
|
|
|
+ flow_act, dest, dest_num);
|
|
|
if (!IS_ERR(rule) || PTR_ERR(rule) != -ENOSPC)
|
|
|
goto unlock;
|
|
|
}
|
|
@@ -1365,8 +1364,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
|
|
|
goto unlock;
|
|
|
}
|
|
|
|
|
|
- rule = add_rule_fg(g, spec->match_value,
|
|
|
- action, flow_tag, dest, dest_num);
|
|
|
+ rule = add_rule_fg(g, spec->match_value, flow_act, dest, dest_num);
|
|
|
if (IS_ERR(rule)) {
|
|
|
/* Remove assumes refcount > 0 and autogroup creates a group
|
|
|
* with a refcount = 0.
|
|
@@ -1390,8 +1388,7 @@ static bool fwd_next_prio_supported(struct mlx5_flow_table *ft)
|
|
|
struct mlx5_flow_handle *
|
|
|
mlx5_add_flow_rules(struct mlx5_flow_table *ft,
|
|
|
struct mlx5_flow_spec *spec,
|
|
|
- u32 action,
|
|
|
- u32 flow_tag,
|
|
|
+ struct mlx5_flow_act *flow_act,
|
|
|
struct mlx5_flow_destination *dest,
|
|
|
int dest_num)
|
|
|
{
|
|
@@ -1399,11 +1396,11 @@ mlx5_add_flow_rules(struct mlx5_flow_table *ft,
|
|
|
struct mlx5_flow_destination gen_dest;
|
|
|
struct mlx5_flow_table *next_ft = NULL;
|
|
|
struct mlx5_flow_handle *handle = NULL;
|
|
|
- u32 sw_action = action;
|
|
|
+ u32 sw_action = flow_act->action;
|
|
|
struct fs_prio *prio;
|
|
|
|
|
|
fs_get_obj(prio, ft->node.parent);
|
|
|
- if (action == MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO) {
|
|
|
+ if (flow_act->action == MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO) {
|
|
|
if (!fwd_next_prio_supported(ft))
|
|
|
return ERR_PTR(-EOPNOTSUPP);
|
|
|
if (dest)
|
|
@@ -1415,15 +1412,14 @@ mlx5_add_flow_rules(struct mlx5_flow_table *ft,
|
|
|
gen_dest.ft = next_ft;
|
|
|
dest = &gen_dest;
|
|
|
dest_num = 1;
|
|
|
- action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
|
|
|
+ flow_act->action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
|
|
|
} else {
|
|
|
mutex_unlock(&root->chain_lock);
|
|
|
return ERR_PTR(-EOPNOTSUPP);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- handle = _mlx5_add_flow_rules(ft, spec, action, flow_tag, dest,
|
|
|
- dest_num);
|
|
|
+ handle = _mlx5_add_flow_rules(ft, spec, flow_act, dest, dest_num);
|
|
|
|
|
|
if (sw_action == MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO) {
|
|
|
if (!IS_ERR_OR_NULL(handle) &&
|