net/mlx5: fix VLAN push/pop and decap actions with mirror

Due to hardware limitations the VLAN push/pop and decap actions following
the sample action are supported in the FDB Tx steering domain only, the
flows with incorrect action order for other domains are rejected by
rdma-core.

To provide the action order requested in flow API this patch checks for
the VLAN or decap precedence to the sample action and moves the VLAN or
decap actions into the next flow in the new table and adds the jump
action in the prefix sample flow.

This patch also adds the validation for these combination actions.

Fixes: 255b8f86eb ("net/mlx5: fix E-Switch egress mirror flow validation")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
This commit is contained in:
Jiawei Wang 2021-04-09 15:36:42 +03:00 committed by Raslan Darawsheh
parent bd0a931543
commit cafd87f62a
2 changed files with 23 additions and 0 deletions

View File

@ -4743,6 +4743,14 @@ flow_check_match_action(const struct rte_flow_action actions[],
case RTE_FLOW_ACTION_TYPE_MARK: case RTE_FLOW_ACTION_TYPE_MARK:
case RTE_FLOW_ACTION_TYPE_SET_META: case RTE_FLOW_ACTION_TYPE_SET_META:
case RTE_FLOW_ACTION_TYPE_SET_TAG: case RTE_FLOW_ACTION_TYPE_SET_TAG:
case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:
case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID:
case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP:
case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
if (fdb_mirror) if (fdb_mirror)
*modify_after_mirror = 1; *modify_after_mirror = 1;
break; break;

View File

@ -6597,6 +6597,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
item_flags, attr, item_flags, attr,
error)) error))
return -rte_errno; return -rte_errno;
if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
modify_after_mirror = 1;
action_flags |= MLX5_FLOW_ACTION_OF_POP_VLAN; action_flags |= MLX5_FLOW_ACTION_OF_POP_VLAN;
++actions_n; ++actions_n;
break; break;
@ -6608,6 +6610,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
error); error);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
modify_after_mirror = 1;
action_flags |= MLX5_FLOW_ACTION_OF_PUSH_VLAN; action_flags |= MLX5_FLOW_ACTION_OF_PUSH_VLAN;
++actions_n; ++actions_n;
break; break;
@ -6616,6 +6620,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
(action_flags, actions, error); (action_flags, actions, error);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
modify_after_mirror = 1;
/* Count PCP with push_vlan command. */ /* Count PCP with push_vlan command. */
action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_PCP; action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_PCP;
break; break;
@ -6625,6 +6631,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
actions, error); actions, error);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
modify_after_mirror = 1;
/* Count VID with push_vlan command. */ /* Count VID with push_vlan command. */
action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_VID; action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_VID;
rw_act_num += MLX5_ACT_NUM_MDF_VID; rw_act_num += MLX5_ACT_NUM_MDF_VID;
@ -6647,6 +6655,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
attr, error); attr, error);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
modify_after_mirror = 1;
action_flags |= MLX5_FLOW_ACTION_DECAP; action_flags |= MLX5_FLOW_ACTION_DECAP;
++actions_n; ++actions_n;
break; break;
@ -6674,6 +6684,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
actions, item_flags, error); actions, item_flags, error);
if (ret < 0) if (ret < 0)
return ret; return ret;
if ((action_flags & MLX5_FLOW_ACTION_SAMPLE) &&
(action_flags & MLX5_FLOW_ACTION_DECAP))
modify_after_mirror = 1;
break; break;
case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC: case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC:
case RTE_FLOW_ACTION_TYPE_SET_MAC_DST: case RTE_FLOW_ACTION_TYPE_SET_MAC_DST:
@ -6957,6 +6970,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
error); error);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (action_flags & MLX5_FLOW_ACTION_SAMPLE)
modify_after_mirror = 1;
/* Count all modify-header actions as one action. */ /* Count all modify-header actions as one action. */
if (!(action_flags & MLX5_FLOW_ACTION_MODIFY_FIELD)) if (!(action_flags & MLX5_FLOW_ACTION_MODIFY_FIELD))
++actions_n; ++actions_n;