Skip to contentSkip to conversation

net/mlx5: vlan actions validation fixes

PATCH In review Dekel Peled 3 participants 24 messages Jan 22, 2020 – Jan 26, 2020 Network drivers

lore
Share & tools
lore
#1 lore raw

PATCH 1/11 net/mlx5: fix masks of encap and decap actions

In reply to Dekel Peled

PUSH_VLAN and POP_VLAN actions flags were added to ENCAP_ACTIONS and DECAP_ACTIONS bit masks, respectively.
This is incorrect, because VLAN actions are considered as 'modify header' actions, not as 'packet reformat' actions.

This patch removes the PUSH_VLAN and POP_VLAN actions flags from ENCAP_ACTIONS and DECAP_ACTIONS bit masks.

Fixes 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Fixes b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
---
 drivers/net/mlx5/mlx5_flow.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/mlx5/mlx5_flow.h +2 -4
index 9832542..f771cac 100644
@@ -212,13 +212,11 @@ enum mlx5_feature_name {
 
 #define MLX5_FLOW_ENCAP_ACTIONS	(MLX5_FLOW_ACTION_VXLAN_ENCAP | \
 				 MLX5_FLOW_ACTION_NVGRE_ENCAP | \
-				 MLX5_FLOW_ACTION_RAW_ENCAP | \
-				 MLX5_FLOW_ACTION_OF_PUSH_VLAN)
+				 MLX5_FLOW_ACTION_RAW_ENCAP)
 
 #define MLX5_FLOW_DECAP_ACTIONS	(MLX5_FLOW_ACTION_VXLAN_DECAP | \
 				 MLX5_FLOW_ACTION_NVGRE_DECAP | \
-				 MLX5_FLOW_ACTION_RAW_DECAP | \
-				 MLX5_FLOW_ACTION_OF_POP_VLAN)
+				 MLX5_FLOW_ACTION_RAW_DECAP)
 
 #define MLX5_FLOW_MODIFY_HDR_ACTIONS (MLX5_FLOW_ACTION_SET_IPV4_SRC | \
 				      MLX5_FLOW_ACTION_SET_IPV4_DST | \
Signature · 1 line
1.8.3.1
#0 lore raw

cover net/mlx5: vlan actions validation fixes

This series includes several patches, fixing different faults in validation functions of VLAN actions.

Dekel Peled (11):
net/mlx5: fix masks of encap and decap actions net/mlx5: fix invalid check for VLAN actions net/mlx5: fix bit mask used for push VLAN validate net/mlx5: fix allow push VLAN without VID value net/mlx5: unify validation of drop action net/mlx5: fix block push VLAN action on Rx net/mlx5: fix block pop VLAN action on Tx net/mlx5: fix pop VLAN action validation function net/mlx5: fix the set VLAN VID action validation net/mlx5: update description of validation funcs
doc: update MLX5 supported hardware offloads table

 doc/guides/nics/mlx5.rst           |   8 +--
 drivers/net/mlx5/mlx5_flow.c       |  25 +------
 drivers/net/mlx5/mlx5_flow.h       |   6 +-
 drivers/net/mlx5/mlx5_flow_dv.c    | 139 +++++++++++++------------------------
 drivers/net/mlx5/mlx5_flow_verbs.c |  12 ++++
 5 files changed, 65 insertions(+), 125 deletions(-)
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 3/11 net/mlx5: fix bit mask used for push VLAN validate

Validation function of 'push VLAN' action uses (POP_VLAN or PUSH_VLAN) actions flags, instead of using a mask of both flags.

This patch replaces it to use existing VLAN_ACTIONS mask.

Fixes 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +1 -2
index afa3d0e..d7176c8 100644
@@ -1746,8 +1746,7 @@ struct field_modify_info modify_tcp[] = {
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "invalid vlan ethertype");
-	if (action_flags &
-		(MLX5_FLOW_ACTION_OF_POP_VLAN | MLX5_FLOW_ACTION_OF_PUSH_VLAN))
+	if (action_flags & MLX5_FLOW_VLAN_ACTIONS)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "no support for multiple VLAN "
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 2/11 net/mlx5: fix invalid check for VLAN actions

In reply to Dekel Peled

Flow validation function includes, after all items and actions are validated discretely, a check for VLAN and VXLAN actions. This check is incorrect and redundant.

This patch removes the invalid check from validation function. Check is incorrect, action_flags bit map is checked against items mask MLX5_FLOW_LAYER_TUNNEL.
Check is also redundant, because VLAN push/pop actions can be used together with packet reformat actions.

Fixes b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +0 -7
index 5a1b426..afa3d0e 100644
@@ -5060,13 +5060,6 @@ struct field_modify_info modify_tcp[] = {
 						  "action not supported");
 		}
 	}
-	if ((action_flags & MLX5_FLOW_LAYER_TUNNEL) &&
-	    (action_flags & MLX5_FLOW_VLAN_ACTIONS))
-		return rte_flow_error_set(error, ENOTSUP,
-					  RTE_FLOW_ERROR_TYPE_ACTION,
-					  actions,
-					  "can't have vxlan and vlan"
-					  " actions in the same rule");
 	/* Eswitch has few restrictions on using items and actions */
 	if (attr->transfer) {
 		if (!mlx5_flow_ext_mreg_supported(dev) &&
Signature · 1 line
1.8.3.1
#9 lore raw

PATCH 5/11 net/mlx5: unify validation of drop action

In reply to Dekel Peled

According to PRM: "Drop action is mutually-exclusive with any other action, except for Count action".
In current code this limitaion is checked separately in validation function of each action.

This patch removes the discrete checks, and adds a single check common for all actions.

---
 drivers/net/mlx5/mlx5_flow.c       | 25 +------------------------
 drivers/net/mlx5/mlx5_flow_dv.c    | 36 ++++++++++++------------------------
 drivers/net/mlx5/mlx5_flow_verbs.c | 12 ++++++++++++
 3 files changed, 25 insertions(+), 48 deletions(-)
drivers/net/mlx5/mlx5_flow.c +1 -24
index 970123b..7738cb2 100644
@@ -905,11 +905,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 			       const struct rte_flow_attr *attr,
 			       struct rte_flow_error *error)
 {
-
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and flag in same flow");
 	if (action_flags & MLX5_FLOW_ACTION_MARK)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -961,10 +956,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 					  &mark->id,
 					  "mark id must in 0 <= id < "
 					  RTE_STR(MLX5_FLOW_MARK_MAX));
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and mark in same flow");
 	if (action_flags & MLX5_FLOW_ACTION_FLAG)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -996,24 +987,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-mlx5_flow_validate_action_drop(uint64_t action_flags,
+mlx5_flow_validate_action_drop(uint64_t action_flags __rte_unused,
 			       const struct rte_flow_attr *attr,
 			       struct rte_flow_error *error)
 {
-	if (action_flags & MLX5_FLOW_ACTION_FLAG)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and flag in same flow");
-	if (action_flags & MLX5_FLOW_ACTION_MARK)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and mark in same flow");
-	if (action_flags & (MLX5_FLOW_FATE_ACTIONS |
-			    MLX5_FLOW_FATE_ESWITCH_ACTIONS))
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't have 2 fate actions in"
-					  " same flow");
 	if (attr->egress)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL,
drivers/net/mlx5/mlx5_flow_dv.c +12 -24
index 59ece01..b0d5688 100644
@@ -1912,10 +1912,6 @@ struct field_modify_info modify_tcp[] = {
 	if (ret < 0)
 		return ret;
 	assert(ret > 0);
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and flag in same flow");
 	if (action_flags & MLX5_FLOW_ACTION_MARK)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -1985,10 +1981,6 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
 					  &mark->id,
 					  "mark id exceeds the limit");
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and mark in same flow");
 	if (action_flags & MLX5_FLOW_ACTION_FLAG)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -2173,10 +2165,6 @@ struct field_modify_info modify_tcp[] = {
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "configuration cannot be null");
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and encap in same flow");
 	if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS | MLX5_FLOW_DECAP_ACTIONS))
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -2209,10 +2197,6 @@ struct field_modify_info modify_tcp[] = {
 				 const struct rte_flow_attr *attr,
 				 struct rte_flow_error *error)
 {
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and decap in same flow");
 	if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS | MLX5_FLOW_DECAP_ACTIONS))
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -2259,10 +2243,6 @@ struct field_modify_info modify_tcp[] = {
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "configuration cannot be null");
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and encap in same flow");
 	if (action_flags & MLX5_FLOW_ENCAP_ACTIONS)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -2306,10 +2286,6 @@ struct field_modify_info modify_tcp[] = {
 {
 	const struct rte_flow_action_raw_decap *decap	= action->conf;
 
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "can't drop and decap in same flow");
 	if (action_flags & MLX5_FLOW_ENCAP_ACTIONS)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -5051,6 +5027,18 @@ struct field_modify_info modify_tcp[] = {
 						  "action not supported");
 		}
 	}
+	/*
+	 * Validate the drop action mutual exclusion with other actions.
+	 * Drop action is mutually-exclusive with any other action, except for
+	 * Count action.
+	 */
+	if ((action_flags & MLX5_FLOW_ACTION_DROP) &&
+	    (action_flags & ~(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_COUNT)))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+					  "Drop action is mutually-exclusive "
+					  "with any other action, except for "
+					  "Count action");
 	/* Eswitch has few restrictions on using items and actions */
 	if (attr->transfer) {
 		if (!mlx5_flow_ext_mreg_supported(dev) &&
drivers/net/mlx5/mlx5_flow_verbs.c +12 -0
index c787c98..72fb1e4 100644
@@ -1255,6 +1255,18 @@
 						  "action not supported");
 		}
 	}
+	/*
+	 * Validate the drop action mutual exclusion with other actions.
+	 * Drop action is mutually-exclusive with any other action, except for
+	 * Count action.
+	 */
+	if ((action_flags & MLX5_FLOW_ACTION_DROP) &&
+	    (action_flags & ~(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_COUNT)))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+					  "Drop action is mutually-exclusive "
+					  "with any other action, except for "
+					  "Count action");
 	if (!(action_flags & MLX5_FLOW_FATE_ACTIONS))
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, actions,
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH 4/11 net/mlx5: fix allow push VLAN without VID value

In reply to Dekel Peled

Currently the push VLAN action requires a VID value, either from existing VLAN item, or from following 'set VLAN vid' action.

This patch removes this limitation, allowing a push VLAN action with vid value 0.

Fixes b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +1 -9
index d7176c8..59ece01 100644
@@ -1734,7 +1734,7 @@ struct field_modify_info modify_tcp[] = {
  */
 static int
 flow_dv_validate_action_push_vlan(uint64_t action_flags,
-				  uint64_t item_flags,
+				  uint64_t item_flags __rte_unused,
 				  const struct rte_flow_action *action,
 				  const struct rte_flow_attr *attr,
 				  struct rte_flow_error *error)
@@ -1751,14 +1751,6 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "no support for multiple VLAN "
 					  "actions");
-	if (!mlx5_flow_find_action
-			(action + 1, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID) &&
-	    !(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
-		return rte_flow_error_set(error, ENOTSUP,
-				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"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,
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH 6/11 net/mlx5: fix block push VLAN action on Rx

In reply to Dekel Peled

Add missing check in validation function of 'push VLAN' action. Action is not allowed for ingress flow rules.

Fixes 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/mlx5/mlx5_flow_dv.c +6 -0
index b0d5688..1ed677f 100644
@@ -1741,6 +1741,12 @@ struct field_modify_info modify_tcp[] = {
 {
 	const struct rte_flow_action_of_push_vlan *push_vlan = action->conf;
 
+	if (attr->ingress)
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
+					  NULL,
+					  "push VLAN action not supported for "
+					  "ingress");
 	if (push_vlan->ethertype != RTE_BE16(RTE_ETHER_TYPE_VLAN) &&
 	    push_vlan->ethertype != RTE_BE16(RTE_ETHER_TYPE_QINQ))
 		return rte_flow_error_set(error, EINVAL,
Signature · 1 line
1.8.3.1
#15 lore raw

PATCH 8/11 net/mlx5: fix pop VLAN action validation function

In reply to Dekel Peled

Validation function of 'POP VLAN' action includes check for other 'POP VLAN' actions present in flow.
It doesn't check for 'PUSH VLAN' actions present in flow.

This patch adds check for 'PUSH VLAN' actions present in flow.

Fixes b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +3 -10
index 9dc08ce..de4b765 100644
@@ -1640,17 +1640,10 @@ struct field_modify_info modify_tcp[] = {
 					  NULL,
 					  "pop vlan action not supported for "
 					  "egress");
-	/*
-	 * Check for inconsistencies:
-	 *  fail strip_vlan in a flow that matches packets without VLAN tags.
-	 *  fail strip_vlan in a flow that matches packets without explicitly a
-	 *  matching on VLAN tag ?
-	 */
-	if (action_flags & MLX5_FLOW_ACTION_OF_POP_VLAN)
+	if (action_flags & MLX5_FLOW_VLAN_ACTIONS)
 		return rte_flow_error_set(error, ENOTSUP,
-					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-					  NULL,
-					  "no support for multiple vlan pop "
+					  RTE_FLOW_ERROR_TYPE_ACTION, action,
+					  "no support for multiple VLAN "
 					  "actions");
 	if (!(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
 		return rte_flow_error_set(error, ENOTSUP,
Signature · 1 line
1.8.3.1
#13 lore raw

PATCH 7/11 net/mlx5: fix block pop VLAN action on Tx

In reply to Dekel Peled

Add missing check in validation function of 'pop VLAN' action. Action is not allowed for egress flow rules.

Fixes b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/mlx5/mlx5_flow_dv.c +6 -0
index 1ed677f..9dc08ce 100644
@@ -1634,6 +1634,12 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 					  NULL,
 					  "pop vlan action is not supported");
+	if (attr->egress)
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
+					  NULL,
+					  "pop vlan action not supported for "
+					  "egress");
 	/*
 	 * Check for inconsistencies:
 	 *  fail strip_vlan in a flow that matches packets without VLAN tags.
Signature · 1 line
1.8.3.1
#17 lore raw

PATCH 9/11 net/mlx5: fix the set VLAN VID action validation

In reply to Dekel Peled

Validation function of 'set VLAN VID' action checks twice for existing same action in flow rule.

This patch updates the validation function logic, to check the same restrictions more efficiently.

Fixes 5f163d520cff ("net/mlx5: support modify VLAN ID on existing VLAN header")
Fixes b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +8 -24
index de4b765..4b6a92c 100644
@@ -1815,10 +1815,10 @@ struct field_modify_info modify_tcp[] = {
  *
  * @param[in] item_flags
  *   Holds the items detected in this rule.
+ * @param[in] action_flags
+ *   Holds the actions detected until now.
  * @param[in] actions
  *   Pointer to the list of actions remaining in the flow rule.
- * @param[in] attr
- *   Pointer to flow attributes
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1838,33 +1838,17 @@ struct field_modify_info modify_tcp[] = {
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "VLAN VID value is too big");
-	/* there is an of_push_vlan action before us */
-	if (action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) {
-		if (mlx5_flow_find_action(actions + 1,
-					  RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID))
-			return rte_flow_error_set(error, ENOTSUP,
-					RTE_FLOW_ERROR_TYPE_ACTION, action,
-					"Multiple VLAN VID modifications are "
-					"not supported");
-		else
-			return 0;
-	}
-
-	/*
-	 * Action is on an existing VLAN header:
-	 *    Need to verify this is a single modify CID action.
-	 *   Rule mast include a match on outer VLAN.
-	 */
+	if (!(action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) &&
+	    !(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ACTION, action,
+					  "set VLAN VID action must follow push"
+					  " VLAN action or match on VLAN item");
 	if (action_flags & MLX5_FLOW_ACTION_OF_SET_VLAN_VID)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "Multiple VLAN VID modifications are "
 					  "not supported");
-	if (!(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
-		return rte_flow_error_set(error, EINVAL,
-					  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,
Signature · 1 line
1.8.3.1
#21 lore raw

PATCH 11/11 doc: update MLX5 supported hardware offloads table

In reply to Dekel Peled

Function of_set_vlan_vid is wrongly listed twice in table "Supported hardware offloads".

This patch removes the listing of of_set_vlan_vid under "Header rewrite", and leaves the listing of of_set_vlan_vid under "VLAN".

---
 doc/guides/nics/mlx5.rst | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
doc/guides/nics/mlx5.rst +2 -6
index 66997f1..2411fb3 100644
@@ -1165,10 +1165,6 @@ Supported hardware offloads
    | | set_ttl /           | |               | |               |
    | | set_mac_src /       | |               | |               |
    | | set_mac_dst)        | |               | |               |
-   | |                     | |               | |               |
-   | | (of_set_vlan_vid)   | | DPDK 19.11    | | DPDK 19.11    |
-   |                       | | OFED 4.7-1    | | OFED 4.7-1    |
-   |                       | | ConnectX-5    | | ConnectX-5    |
    +-----------------------+-----------------+-----------------+
    | Jump                  | | DPDK 19.05    | | DPDK 19.02    |
    |                       | | OFED 4.7-1    | | OFED 4.7-1    |
@@ -1188,8 +1184,8 @@ Supported hardware offloads
    | | VLAN                | | DPDK 19.11    | | DPDK 19.11    |
    | | (of_pop_vlan /      | | OFED 4.7-1    | | OFED 4.7-1    |
    | | of_push_vlan /      | | ConnectX-5    | | ConnectX-5    |
-   | | of_set_vlan_pcp /   |                 |                 |
-   | | of_set_vlan_vid)    |                 |                 |
+   | | of_set_vlan_pcp /   | |               | |               |
+   | | of_set_vlan_vid)    | |               | |               |
    +-----------------------+-----------------+-----------------+
    | Hairpin               | |               | | DPDK 19.11    |
    |                       | |     N/A       | | OFED 4.7-3    |
Signature · 1 line
1.8.3.1
#19 lore raw

PATCH 10/11 net/mlx5: update description of validation funcs

In reply to Dekel Peled

Description of several functions is not accurate. This patch updates the description, parameter names etc.

---
 drivers/net/mlx5/mlx5_flow_dv.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +12 -16
index 4b6a92c..059d03f 100644
@@ -1662,14 +1662,10 @@ struct field_modify_info modify_tcp[] = {
 /**
  * Get VLAN default info from vlan match info.
  *
- * @param[in] dev
- *   Pointer to the rte_eth_dev structure.
- * @param[in] item
+ * @param[in] items
  *   the list of item specifications.
  * @param[out] vlan
  *   pointer VLAN info to fill to.
- * @param[out] error
- *   Pointer to error structure.
  *
  * @return
  *   0 on success, a negative errno value otherwise and rte_errno is set.
@@ -1721,8 +1717,10 @@ struct field_modify_info modify_tcp[] = {
  *
  * @param[in] action_flags
  *   Holds the actions detected until now.
+ * @param[in] item_flags
+ *   The items found in this flow rule.
  * @param[in] action
- *   Pointer to the encap action.
+ *   Pointer to the action structure.
  * @param[in] attr
  *   Pointer to flow attributes
  * @param[out] error
@@ -1772,8 +1770,6 @@ struct field_modify_info modify_tcp[] = {
  *   Holds the actions detected until now.
  * @param[in] actions
  *   Pointer to the list of actions remaining in the flow rule.
- * @param[in] attr
- *   Pointer to flow attributes
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1988,7 +1984,7 @@ struct field_modify_info modify_tcp[] = {
  * @param[in] dev
  *   Pointer to the rte_eth_dev structure.
  * @param[in] action
- *   Pointer to the encap action.
+ *   Pointer to the action structure.
  * @param[in] action_flags
  *   Holds the actions detected until now.
  * @param[in] attr
@@ -2049,7 +2045,7 @@ struct field_modify_info modify_tcp[] = {
  * @param[in] dev
  *   Pointer to the rte_eth_dev structure.
  * @param[in] action
- *   Pointer to the encap action.
+ *   Pointer to the action structure.
  * @param[in] action_flags
  *   Holds the actions detected until now.
  * @param[in] attr
@@ -2103,7 +2099,7 @@ struct field_modify_info modify_tcp[] = {
  * Validate count action.
  *
  * @param[in] dev
- *   device otr.
+ *   Pointer to rte_eth_dev structure.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -2135,7 +2131,7 @@ struct field_modify_info modify_tcp[] = {
  * @param[in] action_flags
  *   Holds the actions detected until now.
  * @param[in] action
- *   Pointer to the encap action.
+ *   Pointer to the action structure.
  * @param[in] attr
  *   Pointer to flow attributes
  * @param[out] error
@@ -2995,12 +2991,12 @@ struct field_modify_info modify_tcp[] = {
  *
  * @param[in] dev
  *   Pointer to rte_eth_dev structure.
- * @param[in] vlan_tag
- *   the vlan tag to push to the Ethernet header.
- * @param[in, out] dev_flow
- *   Pointer to the mlx5_flow.
  * @param[in] attr
  *   Pointer to the flow attributes.
+ * @param[in] vlan
+ *   Pointer to the vlan to push to the Ethernet header.
+ * @param[in, out] dev_flow
+ *   Pointer to the mlx5_flow.
  * @param[out] error
  *   Pointer to the error structure.
  *
Signature · 1 line
1.8.3.1
Acked-by on v1 1/11
#2 lore raw

Re: [dpdk-dev] [PATCH 01/11] net/mlx5: fix masks of encap and decap actions

In reply to Dekel Peled
Quoted 17 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 01/11] net/mlx5: fix masks of encap and decap actions

PUSH_VLAN and POP_VLAN actions flags were added to ENCAP_ACTIONS and DECAP_ACTIONS bit masks, respectively.
This is incorrect, because VLAN actions are considered as 'modify header' actions, not as 'packet reformat' actions.

This patch removes the PUSH_VLAN and POP_VLAN actions flags from ENCAP_ACTIONS and DECAP_ACTIONS bit masks.

Quoted 6 lines
Fixes 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Fixes b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
Quoted 29 lines
---
 drivers/net/mlx5/mlx5_flow.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/mlx5/mlx5_flow.h +2 -4
index 9832542..f771cac 100644
@@ -212,13 +212,11 @@ enum mlx5_feature_name {
 
 #define MLX5_FLOW_ENCAP_ACTIONS	(MLX5_FLOW_ACTION_VXLAN_ENCAP
 | \
 				 MLX5_FLOW_ACTION_NVGRE_ENCAP | \
-				 MLX5_FLOW_ACTION_RAW_ENCAP | \
-				 MLX5_FLOW_ACTION_OF_PUSH_VLAN)
+				 MLX5_FLOW_ACTION_RAW_ENCAP)
 
 #define MLX5_FLOW_DECAP_ACTIONS	(MLX5_FLOW_ACTION_VXLAN_DECAP
 | \
 				 MLX5_FLOW_ACTION_NVGRE_DECAP | \
-				 MLX5_FLOW_ACTION_RAW_DECAP | \
-				 MLX5_FLOW_ACTION_OF_POP_VLAN)
+				 MLX5_FLOW_ACTION_RAW_DECAP)
 

#define MLX5_FLOW_MODIFY_HDR_ACTIONS
(MLX5_FLOW_ACTION_SET_IPV4_SRC | \
MLX5_FLOW_ACTION_SET_IPV4_DST | \
--
1.8.3.1

Acked-by on v1 2/11
#4 lore raw

Re: [dpdk-dev] [PATCH 02/11] net/mlx5: fix invalid check for VLAN actions

In reply to Dekel Peled
Quoted 19 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 02/11] net/mlx5: fix invalid check for VLAN actions

Flow validation function includes, after all items and actions are validated discretely, a check for VLAN and VXLAN actions.
This check is incorrect and redundant.

This patch removes the invalid check from validation function. Check is incorrect, action_flags bit map is checked against items mask MLX5_FLOW_LAYER_TUNNEL.
Check is also redundant, because VLAN push/pop actions can be used together with packet reformat actions.

Quoted 5 lines
Fixes b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
Quoted 24 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 7 -------
 1 file changed, 7 deletions(-)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index 5a1b426..afa3d0e 100644

drivers/net/mlx5/mlx5_flow_dv.c +0 -8
@@ -5060,13 +5060,6 @@ struct field_modify_info modify_tcp[] = {
 						  "action not supported");
 		}
 	}
-	if ((action_flags & MLX5_FLOW_LAYER_TUNNEL) &&
-	    (action_flags & MLX5_FLOW_VLAN_ACTIONS))
-		return rte_flow_error_set(error, ENOTSUP,
-					  RTE_FLOW_ERROR_TYPE_ACTION,
-					  actions,
-					  "can't have vxlan and vlan"
-					  " actions in the same rule");
 	/* Eswitch has few restrictions on using items and actions */
 	if (attr->transfer) {
 		if (!mlx5_flow_ext_mreg_supported(dev) &&
--

1.8.3.1

Acked-by on v1 3/11
#6 lore raw

Re: [dpdk-dev] [PATCH 03/11] net/mlx5: fix bit mask used for push VLAN validate

In reply to Dekel Peled
Quoted 12 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 03/11] net/mlx5: fix bit mask used for push VLAN validate

Validation function of 'push VLAN' action uses (POP_VLAN or PUSH_VLAN) actions flags, instead of using a mask of both flags.

Quoted 7 lines

This patch replaces it to use existing VLAN_ACTIONS mask.

Fixes 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Quoted 23 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index afa3d0e..d7176c8 100644

drivers/net/mlx5/mlx5_flow_dv.c +1 -2
@@ -1746,8 +1746,7 @@ struct field_modify_info modify_tcp[] = {
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,
 action,
 					  "invalid vlan ethertype");
-	if (action_flags &
-		(MLX5_FLOW_ACTION_OF_POP_VLAN |
 MLX5_FLOW_ACTION_OF_PUSH_VLAN))
+	if (action_flags & MLX5_FLOW_VLAN_ACTIONS)
 		return rte_flow_error_set(error, ENOTSUP,

RTE_FLOW_ERROR_TYPE_ACTION,
action,
"no support for multiple VLAN "
--
1.8.3.1

Acked-by on v1 4/11
#8 lore raw

Re: [dpdk-dev] [PATCH 04/11] net/mlx5: fix allow push VLAN without VID value

In reply to Dekel Peled
Quoted 12 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 04/11] net/mlx5: fix allow push VLAN without VID value

Currently the push VLAN action requires a VID value, either from existing VLAN item, or from following 'set VLAN vid' action.

Quoted 8 lines

This patch removes this limitation, allowing a push VLAN action with vid value 0.

Fixes b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
Quoted 38 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index d7176c8..59ece01 100644

drivers/net/mlx5/mlx5_flow_dv.c +1 -3
@@ -1734,7 +1734,7 @@ struct field_modify_info modify_tcp[] = {
  */
 static int
 flow_dv_validate_action_push_vlan(uint64_t action_flags,
-				  uint64_t item_flags,
+				  uint64_t item_flags __rte_unused,
 				  const struct rte_flow_action *action,
 				  const struct rte_flow_attr *attr,
 				  struct rte_flow_error *error)
@@ -1751,14 +1751,6 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ACTION,
 action,
 					  "no support for multiple VLAN "
 					  "actions");
-	if (!mlx5_flow_find_action
-			(action + 1,

RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID) &&

drivers/net/mlx5/mlx5_flow_dv.c +0 -4
-	    !(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
-		return rte_flow_error_set(error, ENOTSUP,
-				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"push VLAN needs to match on VLAN in order

to "

drivers/net/mlx5/mlx5_flow_dv.c +0 -2
-				"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,
--
1.8.3.1

Acked-by on v1 5/11
#10 lore raw

Re: [dpdk-dev] [PATCH 05/11] net/mlx5: unify validation of drop action

In reply to Dekel Peled
Quoted 14 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]
Subject: [PATCH 05/11] net/mlx5: unify validation of drop action

According to PRM: "Drop action is mutually-exclusive with any other action, except for Count action".
In current code this limitaion is checked separately in validation function of each action.

Quoted 5 lines

This patch removes the discrete checks, and adds a single check common for all actions.

Quoted 200 lines
---
 drivers/net/mlx5/mlx5_flow.c       | 25 +------------------------
 drivers/net/mlx5/mlx5_flow_dv.c    | 36 ++++++++++++------------------------
 drivers/net/mlx5/mlx5_flow_verbs.c | 12 ++++++++++++
 3 files changed, 25 insertions(+), 48 deletions(-)
drivers/net/mlx5/mlx5_flow.c +0 -5
index 970123b..7738cb2 100644
@@ -905,11 +905,6 @@ uint32_t mlx5_flow_adjust_priority(struct
 rte_eth_dev *dev, int32_t priority,
 			       const struct rte_flow_attr *attr,
 			       struct rte_flow_error *error)  {
-
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,
 NULL,
-					  "can't drop and flag in same flow");
 	if (action_flags & MLX5_FLOW_ACTION_MARK)
 		return rte_flow_error_set(error, EINVAL,

RTE_FLOW_ERROR_TYPE_ACTION,
NULL, @@ -961,10 +956,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,

drivers/net/mlx5/mlx5_flow.c +0 -3
 					  &mark->id,
 					  "mark id must in 0 <= id < "
 					  RTE_STR(MLX5_FLOW_MARK_MAX));
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow.c +0 -1
-					  "can't drop and mark in same flow");
 	if (action_flags & MLX5_FLOW_ACTION_FLAG)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL, @@ -996,24 +987,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
int

drivers/net/mlx5/mlx5_flow.c +1 -4
-mlx5_flow_validate_action_drop(uint64_t action_flags,
+mlx5_flow_validate_action_drop(uint64_t action_flags __rte_unused,
 			       const struct rte_flow_attr *attr,
 			       struct rte_flow_error *error)  {
-	if (action_flags & MLX5_FLOW_ACTION_FLAG)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow.c +0 -4
-					  "can't drop and flag in same flow");
-	if (action_flags & MLX5_FLOW_ACTION_MARK)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow.c +0 -5
-					  "can't drop and mark in same flow");
-	if (action_flags & (MLX5_FLOW_FATE_ACTIONS |
-			    MLX5_FLOW_FATE_ESWITCH_ACTIONS))
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow.c +0 -2
-					  "can't have 2 fate actions in"
-					  " same flow");
 	if (attr->egress)
 		return rte_flow_error_set(error, ENOTSUP,

RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 59ece01..b0d5688 100644

drivers/net/mlx5/mlx5_flow_dv.c +0 -4
@@ -1912,10 +1912,6 @@ struct field_modify_info modify_tcp[] = {
 	if (ret < 0)
 		return ret;
 	assert(ret > 0);
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,
 NULL,
-					  "can't drop and flag in same flow");
 	if (action_flags & MLX5_FLOW_ACTION_MARK)
 		return rte_flow_error_set(error, EINVAL,

RTE_FLOW_ERROR_TYPE_ACTION,
NULL, @@ -1985,10 +1981,6 @@ struct field_modify_info modify_tcp[] = {

RTE_FLOW_ERROR_TYPE_ACTION_CONF,

drivers/net/mlx5/mlx5_flow_dv.c +0 -3
 					  &mark->id,
 					  "mark id exceeds the limit");
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow_dv.c +0 -1
-					  "can't drop and mark in same flow");
 	if (action_flags & MLX5_FLOW_ACTION_FLAG)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL, @@ -2173,10 +2165,6 @@ struct field_modify_info modify_tcp[] = {

drivers/net/mlx5/mlx5_flow_dv.c +0 -0
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

action,

drivers/net/mlx5/mlx5_flow_dv.c +0 -3
 					  "configuration cannot be null");
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow_dv.c +0 -1
-					  "can't drop and encap in same

flow");
if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS |
MLX5_FLOW_DECAP_ACTIONS))

drivers/net/mlx5/mlx5_flow_dv.c +0 -0
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL, @@ -2209,10 +2197,6 @@ struct field_modify_info modify_tcp[] = {

drivers/net/mlx5/mlx5_flow_dv.c +0 -3
 				 const struct rte_flow_attr *attr,
 				 struct rte_flow_error *error)
 {
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow_dv.c +0 -1
-					  "can't drop and decap in same

flow");
if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS |
MLX5_FLOW_DECAP_ACTIONS))

drivers/net/mlx5/mlx5_flow_dv.c +0 -0
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL, @@ -2259,10 +2243,6 @@ struct field_modify_info modify_tcp[] = {

drivers/net/mlx5/mlx5_flow_dv.c +0 -0
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

action,

drivers/net/mlx5/mlx5_flow_dv.c +0 -3
 					  "configuration cannot be null");
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow_dv.c +0 -1
-					  "can't drop and encap in same

flow");

drivers/net/mlx5/mlx5_flow_dv.c +0 -0
 	if (action_flags & MLX5_FLOW_ENCAP_ACTIONS)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL, @@ -2306,10 +2286,6 @@ struct field_modify_info modify_tcp[] = { {
const struct rte_flow_action_raw_decap *decap = action-

Quoted 1 line

conf;

drivers/net/mlx5/mlx5_flow_dv.c +0 -3
-	if (action_flags & MLX5_FLOW_ACTION_DROP)
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow_dv.c +0 -1
-					  "can't drop and decap in same

flow");

drivers/net/mlx5/mlx5_flow_dv.c +0 -0
 	if (action_flags & MLX5_FLOW_ENCAP_ACTIONS)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL, @@ -5051,6 +5027,18 @@ struct field_modify_info modify_tcp[] = {

drivers/net/mlx5/mlx5_flow_dv.c +7 -0
 						  "action not supported");
 		}
 	}
+	/*
+	 * Validate the drop action mutual exclusion with other actions.
+	 * Drop action is mutually-exclusive with any other action, except for
+	 * Count action.
+	 */
+	if ((action_flags & MLX5_FLOW_ACTION_DROP) &&
+	    (action_flags & ~(MLX5_FLOW_ACTION_DROP |

MLX5_FLOW_ACTION_COUNT)))

drivers/net/mlx5/mlx5_flow_dv.c +2 -0
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION,

NULL,

drivers/net/mlx5/mlx5_flow_dv.c +3 -0
+					  "Drop action is mutually-exclusive "
+					  "with any other action, except for "
+					  "Count action");
 	/* Eswitch has few restrictions on using items and actions */
 	if (attr->transfer) {
 		if (!mlx5_flow_ext_mreg_supported(dev) && diff --git

a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index c787c98..72fb1e4 100644

drivers/net/mlx5/mlx5_flow_verbs.c +12 -0
@@ -1255,6 +1255,18 @@
 						  "action not supported");
 		}
 	}
+	/*
+	 * Validate the drop action mutual exclusion with other actions.
+	 * Drop action is mutually-exclusive with any other action, except for
+	 * Count action.
+	 */
+	if ((action_flags & MLX5_FLOW_ACTION_DROP) &&
+	    (action_flags & ~(MLX5_FLOW_ACTION_DROP |
 MLX5_FLOW_ACTION_COUNT)))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION,
 NULL,
+					  "Drop action is mutually-exclusive "
+					  "with any other action, except for "
+					  "Count action");
 	if (!(action_flags & MLX5_FLOW_FATE_ACTIONS))
drivers/net/mlx5/mlx5_flow_verbs.c +0 -0
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

actions,
--
1.8.3.1

Acked-by on v1 6/11
#12 lore raw

Re: [dpdk-dev] [PATCH 06/11] net/mlx5: fix block push VLAN action on Rx

In reply to Dekel Peled
Quoted 9 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 06/11] net/mlx5: fix block push VLAN action on Rx

Quoted 8 lines

Add missing check in validation function of 'push VLAN' action. Action is not allowed for ingress flow rules.

Fixes 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Quoted 24 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index b0d5688..1ed677f 100644

drivers/net/mlx5/mlx5_flow_dv.c +5 -0
@@ -1741,6 +1741,12 @@ struct field_modify_info modify_tcp[] = {  {
 	const struct rte_flow_action_of_push_vlan *push_vlan = action->conf;
 
+	if (attr->ingress)
+		return rte_flow_error_set(error, ENOTSUP,
+
 RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
+					  NULL,
+					  "push VLAN action not supported for

"

drivers/net/mlx5/mlx5_flow_dv.c +1 -1
+					  "ingress");
 	if (push_vlan->ethertype != RTE_BE16(RTE_ETHER_TYPE_VLAN) &&
 	    push_vlan->ethertype != RTE_BE16(RTE_ETHER_TYPE_QINQ))
 		return rte_flow_error_set(error, EINVAL,
--

1.8.3.1

Acked-by on v1 7/11
#14 lore raw

Re: [dpdk-dev] [PATCH 07/11] net/mlx5: fix block pop VLAN action on Tx

In reply to Dekel Peled
Quoted 9 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 07/11] net/mlx5: fix block pop VLAN action on Tx

Quoted 8 lines

Add missing check in validation function of 'pop VLAN' action. Action is not allowed for egress flow rules.

Fixes b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
Quoted 25 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index 1ed677f..9dc08ce 100644

drivers/net/mlx5/mlx5_flow_dv.c +6 -0
@@ -1634,6 +1634,12 @@ struct field_modify_info modify_tcp[] = {
 
 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 					  NULL,
 					  "pop vlan action is not supported");
+	if (attr->egress)
+		return rte_flow_error_set(error, ENOTSUP,
+
 RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
+					  NULL,
+					  "pop vlan action not supported for "
+					  "egress");
 	/*
drivers/net/mlx5/mlx5_flow_dv.c +0 -1
 	 * Check for inconsistencies:
 	 *  fail strip_vlan in a flow that matches packets without VLAN tags.
--

1.8.3.1

Acked-by on v1 8/11
#16 lore raw

Re: [dpdk-dev] [PATCH 08/11] net/mlx5: fix pop VLAN action validation function

In reply to Dekel Peled
Quoted 13 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 08/11] net/mlx5: fix pop VLAN action validation function

Validation function of 'POP VLAN' action includes check for other 'POP VLAN' actions present in flow.
It doesn't check for 'PUSH VLAN' actions present in flow.

Quoted 7 lines

This patch adds check for 'PUSH VLAN' actions present in flow.

Fixes b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
Quoted 33 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index 9dc08ce..de4b765 100644

drivers/net/mlx5/mlx5_flow_dv.c +3 -10
@@ -1640,17 +1640,10 @@ struct field_modify_info modify_tcp[] = {
 					  NULL,
 					  "pop vlan action not supported for "
 					  "egress");
-	/*
-	 * Check for inconsistencies:
-	 *  fail strip_vlan in a flow that matches packets without VLAN tags.
-	 *  fail strip_vlan in a flow that matches packets without explicitly a
-	 *  matching on VLAN tag ?
-	 */
-	if (action_flags & MLX5_FLOW_ACTION_OF_POP_VLAN)
+	if (action_flags & MLX5_FLOW_VLAN_ACTIONS)
 		return rte_flow_error_set(error, ENOTSUP,
-
 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-					  NULL,
-					  "no support for multiple vlan pop "
+					  RTE_FLOW_ERROR_TYPE_ACTION,
 action,
+					  "no support for multiple VLAN "
 					  "actions");
drivers/net/mlx5/mlx5_flow_dv.c +0 -1
 	if (!(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
 		return rte_flow_error_set(error, ENOTSUP,
--

1.8.3.1

Acked-by on v1 9/11
#18 lore raw

Re: [dpdk-dev] [PATCH 09/11] net/mlx5: fix the set VLAN VID action validation

In reply to Dekel Peled
Quoted 15 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 09/11] net/mlx5: fix the set VLAN VID action validation

Validation function of 'set VLAN VID' action checks twice for existing same action in flow rule.

This patch updates the validation function logic, to check the same restrictions more efficiently.

Quoted 7 lines
Fixes 5f163d520cff ("net/mlx5: support modify VLAN ID on existing VLAN

header")

Fixes b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
Quoted 75 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index de4b765..4b6a92c 100644

drivers/net/mlx5/mlx5_flow_dv.c +2 -9
@@ -1815,10 +1815,10 @@ struct field_modify_info modify_tcp[] = {
  *
  * @param[in] item_flags
  *   Holds the items detected in this rule.
+ * @param[in] action_flags
+ *   Holds the actions detected until now.
  * @param[in] actions
  *   Pointer to the list of actions remaining in the flow rule.
- * @param[in] attr
- *   Pointer to flow attributes
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1838,33 +1838,17 @@ struct field_modify_info modify_tcp[] = {
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION,
 action,
 					  "VLAN VID value is too big");
-	/* there is an of_push_vlan action before us */
-	if (action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) {
-		if (mlx5_flow_find_action(actions + 1,
-
 RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID))
-			return rte_flow_error_set(error, ENOTSUP,
-					RTE_FLOW_ERROR_TYPE_ACTION,
 action,
-					"Multiple VLAN VID modifications are

"

drivers/net/mlx5/mlx5_flow_dv.c +4 -10
-					"not supported");
-		else
-			return 0;
-	}
-
-	/*
-	 * Action is on an existing VLAN header:
-	 *    Need to verify this is a single modify CID action.
-	 *   Rule mast include a match on outer VLAN.
-	 */
+	if (!(action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) &&
+	    !(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ACTION,

action,

drivers/net/mlx5/mlx5_flow_dv.c +1 -0
+					  "set VLAN VID action must follow

push"

drivers/net/mlx5/mlx5_flow_dv.c +1 -0
+					  " VLAN action or match on VLAN

item");

drivers/net/mlx5/mlx5_flow_dv.c +0 -0
 	if (action_flags & MLX5_FLOW_ACTION_OF_SET_VLAN_VID)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION,

action,
"Multiple VLAN VID modifications
are "

drivers/net/mlx5/mlx5_flow_dv.c +0 -3
 					  "not supported");
-	if (!(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION,

action,

drivers/net/mlx5/mlx5_flow_dv.c +0 -1
-					  "match on VLAN is required in order

"

drivers/net/mlx5/mlx5_flow_dv.c +0 -1
-					  "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,
--
1.8.3.1

Acked-by on v1 10/11
#20 lore raw

Re: [dpdk-dev] [PATCH 10/11] net/mlx5: update description of validation funcs

In reply to Dekel Peled
Quoted 9 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]
Subject: [PATCH 10/11] net/mlx5: update description of validation funcs

Quoted 5 lines

Description of several functions is not accurate. This patch updates the description, parameter names etc.

Quoted 100 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index 4b6a92c..059d03f 100644

drivers/net/mlx5/mlx5_flow_dv.c +12 -17
@@ -1662,14 +1662,10 @@ struct field_modify_info modify_tcp[] = {
 /**
  * Get VLAN default info from vlan match info.
  *
- * @param[in] dev
- *   Pointer to the rte_eth_dev structure.
- * @param[in] item
+ * @param[in] items
  *   the list of item specifications.
  * @param[out] vlan
  *   pointer VLAN info to fill to.
- * @param[out] error
- *   Pointer to error structure.
  *
  * @return
  *   0 on success, a negative errno value otherwise and rte_errno is set.
@@ -1721,8 +1717,10 @@ struct field_modify_info modify_tcp[] = {
  *
  * @param[in] action_flags
  *   Holds the actions detected until now.
+ * @param[in] item_flags
+ *   The items found in this flow rule.
  * @param[in] action
- *   Pointer to the encap action.
+ *   Pointer to the action structure.
  * @param[in] attr
  *   Pointer to flow attributes
  * @param[out] error
@@ -1772,8 +1770,6 @@ struct field_modify_info modify_tcp[] = {
  *   Holds the actions detected until now.
  * @param[in] actions
  *   Pointer to the list of actions remaining in the flow rule.
- * @param[in] attr
- *   Pointer to flow attributes
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1988,7 +1984,7 @@ struct field_modify_info modify_tcp[] = {
  * @param[in] dev
  *   Pointer to the rte_eth_dev structure.
  * @param[in] action
- *   Pointer to the encap action.
+ *   Pointer to the action structure.
  * @param[in] action_flags
  *   Holds the actions detected until now.
  * @param[in] attr
@@ -2049,7 +2045,7 @@ struct field_modify_info modify_tcp[] = {
  * @param[in] dev
  *   Pointer to the rte_eth_dev structure.
  * @param[in] action
- *   Pointer to the encap action.
+ *   Pointer to the action structure.
  * @param[in] action_flags
  *   Holds the actions detected until now.
  * @param[in] attr
@@ -2103,7 +2099,7 @@ struct field_modify_info modify_tcp[] = {
  * Validate count action.
  *
  * @param[in] dev
- *   device otr.
+ *   Pointer to rte_eth_dev structure.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -2135,7 +2131,7 @@ struct field_modify_info modify_tcp[] = {
  * @param[in] action_flags
  *   Holds the actions detected until now.
  * @param[in] action
- *   Pointer to the encap action.
+ *   Pointer to the action structure.
  * @param[in] attr
  *   Pointer to flow attributes
  * @param[out] error
@@ -2995,12 +2991,12 @@ struct field_modify_info modify_tcp[] = {
  *
  * @param[in] dev
  *   Pointer to rte_eth_dev structure.
- * @param[in] vlan_tag
- *   the vlan tag to push to the Ethernet header.
- * @param[in, out] dev_flow
- *   Pointer to the mlx5_flow.
  * @param[in] attr
  *   Pointer to the flow attributes.
+ * @param[in] vlan
+ *   Pointer to the vlan to push to the Ethernet header.
+ * @param[in, out] dev_flow
+ *   Pointer to the mlx5_flow.
  * @param[out] error
  *   Pointer to the error structure.
  *
--

1.8.3.1

Acked-by on v1 11/11
#22 lore raw

Re: [dpdk-dev] [PATCH 11/11] doc: update MLX5 supported hardware offloads table

In reply to Dekel Peled
Quoted 9 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 16:27
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]
Subject: [PATCH 11/11] doc: update MLX5 supported hardware offloads table

Quoted 8 lines

Function of_set_vlan_vid is wrongly listed twice in table "Supported hardware offloads".

This patch removes the listing of of_set_vlan_vid under "Header rewrite", and leaves the listing of of_set_vlan_vid under "VLAN".

Quoted 32 lines
---
 doc/guides/nics/mlx5.rst | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
doc/guides/nics/mlx5.rst index renamed from doc/guides/nics/mlx5.rst +0 -0

66997f1..2411fb3 100644

doc/guides/nics/mlx5.rst +2 -7
@@ -1165,10 +1165,6 @@ Supported hardware offloads
    | | set_ttl /           | |               | |               |
    | | set_mac_src /       | |               | |               |
    | | set_mac_dst)        | |               | |               |
-   | |                     | |               | |               |
-   | | (of_set_vlan_vid)   | | DPDK 19.11    | | DPDK 19.11    |
-   |                       | | OFED 4.7-1    | | OFED 4.7-1    |
-   |                       | | ConnectX-5    | | ConnectX-5    |
    +-----------------------+-----------------+-----------------+
    | Jump                  | | DPDK 19.05    | | DPDK 19.02    |
    |                       | | OFED 4.7-1    | | OFED 4.7-1    |
@@ -1188,8 +1184,8 @@ Supported hardware offloads
    | | VLAN                | | DPDK 19.11    | | DPDK 19.11    |
    | | (of_pop_vlan /      | | OFED 4.7-1    | | OFED 4.7-1    |
    | | of_push_vlan /      | | ConnectX-5    | | ConnectX-5    |
-   | | of_set_vlan_pcp /   |                 |                 |
-   | | of_set_vlan_vid)    |                 |                 |
+   | | of_set_vlan_pcp /   | |               | |               |
+   | | of_set_vlan_vid)    | |               | |               |
    +-----------------------+-----------------+-----------------+
    | Hairpin               | |               | | DPDK 19.11    |
    |                       | |     N/A       | | OFED 4.7-3    |
--

1.8.3.1

#23 lore raw
In reply to Dekel Peled

Hi,

Quoted 35 lines

-----Original Message-----
From: Dekel Peled <[email protected]>
Sent: Wednesday, January 22, 2020 4:27 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; [email protected]
Subject: [PATCH 00/11] net/mlx5: vlan actions validation fixes

This series includes several patches, fixing different faults in validation functions of VLAN actions.

Dekel Peled (11):
net/mlx5: fix masks of encap and decap actions net/mlx5: fix invalid check for VLAN actions net/mlx5: fix bit mask used for push VLAN validate net/mlx5: fix allow push VLAN without VID value net/mlx5: unify validation of drop action net/mlx5: fix block push VLAN action on Rx net/mlx5: fix block pop VLAN action on Tx net/mlx5: fix pop VLAN action validation function net/mlx5: fix the set VLAN VID action validation net/mlx5: update description of validation funcs
doc: update MLX5 supported hardware offloads table

 doc/guides/nics/mlx5.rst           |   8 +--
 drivers/net/mlx5/mlx5_flow.c       |  25 +------
 drivers/net/mlx5/mlx5_flow.h       |   6 +-
 drivers/net/mlx5/mlx5_flow_dv.c    | 139 +++++++++++++----------------------
--
 drivers/net/mlx5/mlx5_flow_verbs.c |  12 ++++
 5 files changed, 65 insertions(+), 125 deletions(-)
Quoted 2 lines

--
1.8.3.1

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh