[v2] net/mlx5: port id action must be after VLAN actions

Message ID cff8ee7dc0bb906b2de85229321030751cb6f17a.1572871121.git.jackmin@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series [v2] net/mlx5: port id action must be after VLAN actions |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Xiaoyu Min Nov. 4, 2019, 12:43 p.m. UTC
  Rdma-core needs the dst_vport (port_id) action be after push/pop VLAN
and modify hdr actions otherwise it will reject to create rule.

This pach validates the port_id is after push/pop VLAN and set VLAN
VID/PCP otherwise PMD spits out errors.

Fixes: 5f163d520cff ("net/mlx5: support modify VLAN ID on existing VLAN header")
Cc: motih@mellanox.com

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
v2:
  * rebased

 drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Comments

Raslan Darawsheh Nov. 4, 2019, 3:09 p.m. UTC | #1
Hi,
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xiaoyu Min
> Sent: Monday, November 4, 2019 2:44 PM
> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; Moti Haimovsky <motih@mellanox.com>
> Subject: [dpdk-dev] [PATCH v2] net/mlx5: port id action must be after VLAN
> actions
> 
> Rdma-core needs the dst_vport (port_id) action be after push/pop VLAN
> and modify hdr actions otherwise it will reject to create rule.
> 
> This pach validates the port_id is after push/pop VLAN and set VLAN VID/PCP
> otherwise PMD spits out errors.
> 
> Fixes: 5f163d520cff ("net/mlx5: support modify VLAN ID on existing VLAN
> header")
> Cc: motih@mellanox.com
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
> v2:
>   * rebased
> 

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4be059ded5..b49175e5a4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1000,6 +1000,11 @@  flow_dv_validate_action_pop_vlan(struct rte_eth_dev *dev,
 					  NULL,
 					  "cannot pop vlan without a "
 					  "match on (outer) vlan in the flow");
+	if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, action,
+					  "wrong action order, port_id should "
+					  "be after pop VLAN action");
 	return 0;
 }
 
@@ -1103,6 +1108,11 @@  flow_dv_validate_action_push_vlan(uint64_t action_flags,
 				"push VLAN needs to match on VLAN in order to "
 				"get VLAN VID information because there is "
 				"no followed set VLAN VID action");
+	if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, action,
+					  "wrong action order, port_id should "
+					  "be after push VLAN");
 	(void)attr;
 	return 0;
 }
@@ -1144,6 +1154,11 @@  flow_dv_validate_action_set_vlan_pcp(uint64_t action_flags,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "Multiple VLAN PCP modification are "
 					  "not supported");
+	if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, action,
+					  "wrong action order, port_id should "
+					  "be after set VLAN PCP");
 	return 0;
 }
 
@@ -1202,6 +1217,11 @@  flow_dv_validate_action_set_vlan_vid(uint64_t item_flags,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "match on VLAN is required in order "
 					  "to set VLAN VID");
+	if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, action,
+					  "wrong action order, port_id should "
+					  "be after set VLAN VID");
 	return 0;
 }