[dpdk-stable] patch 'net/mlx5: fix VLAN push action on hairpin queue' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 14:00:12 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/26/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 6e3b631758528c2125e78c4c03e028d6966d6456 Mon Sep 17 00:00:00 2001
From: Dekel Peled <dekelp at mellanox.com>
Date: Wed, 15 Jul 2020 10:31:01 +0300
Subject: [PATCH] net/mlx5: fix VLAN push action on hairpin queue

[ upstream commit 210008309b45316288869377be574c22f670b825 ]

Push VLAN action is allowed on Tx only, same as encap action.
Flow rules for hairpin queue are created on Rx, and split
by PMD to Rx and Tx rules, according to the above limitation.
In current implementation the encap action is split to Tx rule.
This patch adds the same handling for push-vlan action, as well as
its complementing actions set-vlan-vid and set-vlan-pcp.

Fixes: d85c7b5ea59f ("net/mlx5: split hairpin flows")

Signed-off-by: Dekel Peled <dekelp at mellanox.com>
Acked-by: Matan Azrad <matan at mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c    | 23 +++++++++++------
 drivers/net/mlx5/mlx5_flow_dv.c | 46 +++++++++++++++++++--------------
 2 files changed, 41 insertions(+), 28 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 400273f25..be45091f4 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2799,10 +2799,10 @@ flow_check_meter_action(const struct rte_flow_action actions[], uint32_t *mtr)
 }
 
 /**
- * Check if the flow should be splited due to hairpin.
+ * Check if the flow should be split due to hairpin.
  * The reason for the split is that in current HW we can't
- * support encap on Rx, so if a flow have encap we move it
- * to Tx.
+ * support encap and push-vlan on Rx, so if a flow contains
+ * these actions we move it to Tx.
  *
  * @param dev
  *   Pointer to Ethernet device.
@@ -2822,7 +2822,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
 {
 	int queue_action = 0;
 	int action_n = 0;
-	int encap = 0;
+	int split = 0;
 	const struct rte_flow_action_queue *queue;
 	const struct rte_flow_action_rss *rss;
 	const struct rte_flow_action_raw_encap *raw_encap;
@@ -2853,7 +2853,10 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
 			break;
 		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
 		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
-			encap = 1;
+		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:
+			split++;
 			action_n++;
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
@@ -2861,7 +2864,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
 			if (raw_encap->size >
 			    (sizeof(struct rte_flow_item_eth) +
 			     sizeof(struct rte_flow_item_ipv4)))
-				encap = 1;
+				split++;
 			action_n++;
 			break;
 		default:
@@ -2869,7 +2872,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
 			break;
 		}
 	}
-	if (encap == 1 && queue_action)
+	if (split && queue_action)
 		return action_n;
 	return 0;
 }
@@ -3276,7 +3279,8 @@ flow_mreg_update_copy_table(struct rte_eth_dev *dev,
 
 /**
  * Split the hairpin flow.
- * Since HW can't support encap on Rx we move the encap to Tx.
+ * Since HW can't support encap and push-vlan on Rx, we move these
+ * actions to Tx.
  * If the count action is after the encap then we also
  * move the count action. in this case the count will also measure
  * the outer bytes.
@@ -3320,6 +3324,9 @@ flow_hairpin_split(struct rte_eth_dev *dev,
 		switch (actions->type) {
 		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
 		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
+		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:
 			rte_memcpy(actions_tx, actions,
 			       sizeof(struct rte_flow_action));
 			actions_tx++;
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 2407f8723..bfb27a602 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1801,22 +1801,11 @@ flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev,
 	const struct rte_flow_action_of_push_vlan *push_vlan = action->conf;
 	const struct mlx5_priv *priv = dev->data->dev_private;
 
-	if (!attr->transfer && 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,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "invalid vlan ethertype");
-	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 "
-					  "actions");
 	if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
@@ -5148,21 +5137,38 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 						  actions,
 						  "no fate action is found");
 	}
-	/* Continue validation for Xcap actions.*/
-	if ((action_flags & MLX5_FLOW_XCAP_ACTIONS) && (queue_index == 0xFFFF ||
-	    mlx5_rxq_get_type(dev, queue_index) != MLX5_RXQ_TYPE_HAIRPIN)) {
+	/* Continue validation for Xcap and VLAN actions.*/
+	if ((action_flags & (MLX5_FLOW_XCAP_ACTIONS |
+			     MLX5_FLOW_VLAN_ACTIONS)) &&
+	    (queue_index == 0xFFFF ||
+	     mlx5_rxq_get_type(dev, queue_index) != MLX5_RXQ_TYPE_HAIRPIN)) {
 		if ((action_flags & MLX5_FLOW_XCAP_ACTIONS) ==
 		    MLX5_FLOW_XCAP_ACTIONS)
 			return rte_flow_error_set(error, ENOTSUP,
 						  RTE_FLOW_ERROR_TYPE_ACTION,
 						  NULL, "encap and decap "
 						  "combination aren't supported");
-		if (!attr->transfer && attr->ingress && (action_flags &
-							MLX5_FLOW_ACTION_ENCAP))
-			return rte_flow_error_set(error, ENOTSUP,
-						  RTE_FLOW_ERROR_TYPE_ACTION,
-						  NULL, "encap is not supported"
-						  " for ingress traffic");
+		if (!attr->transfer && attr->ingress) {
+			if (action_flags & MLX5_FLOW_ACTION_ENCAP)
+				return rte_flow_error_set
+						(error, ENOTSUP,
+						 RTE_FLOW_ERROR_TYPE_ACTION,
+						 NULL, "encap is not supported"
+						 " for ingress traffic");
+			else if (action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN)
+				return rte_flow_error_set
+						(error, ENOTSUP,
+						 RTE_FLOW_ERROR_TYPE_ACTION,
+						 NULL, "push VLAN action not "
+						 "supported for ingress");
+			else if ((action_flags & MLX5_FLOW_VLAN_ACTIONS) ==
+					MLX5_FLOW_VLAN_ACTIONS)
+				return rte_flow_error_set
+						(error, ENOTSUP,
+						 RTE_FLOW_ERROR_TYPE_ACTION,
+						 NULL, "no support for "
+						 "multiple VLAN actions");
+		}
 	}
 	/* Hairpin flow will add one more TAG action. */
 	if (hairpin > 0)
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-07-24 12:53:55.265961237 +0100
+++ 0174-net-mlx5-fix-VLAN-push-action-on-hairpin-queue.patch	2020-07-24 12:53:48.595012198 +0100
@@ -1,8 +1,10 @@
-From 210008309b45316288869377be574c22f670b825 Mon Sep 17 00:00:00 2001
+From 6e3b631758528c2125e78c4c03e028d6966d6456 Mon Sep 17 00:00:00 2001
 From: Dekel Peled <dekelp at mellanox.com>
 Date: Wed, 15 Jul 2020 10:31:01 +0300
 Subject: [PATCH] net/mlx5: fix VLAN push action on hairpin queue
 
+[ upstream commit 210008309b45316288869377be574c22f670b825 ]
+
 Push VLAN action is allowed on Tx only, same as encap action.
 Flow rules for hairpin queue are created on Rx, and split
 by PMD to Rx and Tx rules, according to the above limitation.
@@ -11,7 +13,6 @@
 its complementing actions set-vlan-vid and set-vlan-pcp.
 
 Fixes: d85c7b5ea59f ("net/mlx5: split hairpin flows")
-Cc: stable at dpdk.org
 
 Signed-off-by: Dekel Peled <dekelp at mellanox.com>
 Acked-by: Matan Azrad <matan at mellanox.com>
@@ -21,10 +22,10 @@
  2 files changed, 41 insertions(+), 28 deletions(-)
 
 diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
-index e83cf8311..b56bee43b 100644
+index 400273f25..be45091f4 100644
 --- a/drivers/net/mlx5/mlx5_flow.c
 +++ b/drivers/net/mlx5/mlx5_flow.c
-@@ -2876,10 +2876,10 @@ flow_check_meter_action(const struct rte_flow_action actions[], uint32_t *mtr)
+@@ -2799,10 +2799,10 @@ flow_check_meter_action(const struct rte_flow_action actions[], uint32_t *mtr)
  }
  
  /**
@@ -38,7 +39,7 @@
   *
   * @param dev
   *   Pointer to Ethernet device.
-@@ -2899,7 +2899,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
+@@ -2822,7 +2822,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
  {
  	int queue_action = 0;
  	int action_n = 0;
@@ -47,7 +48,7 @@
  	const struct rte_flow_action_queue *queue;
  	const struct rte_flow_action_rss *rss;
  	const struct rte_flow_action_raw_encap *raw_encap;
-@@ -2930,7 +2930,10 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
+@@ -2853,7 +2853,10 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
  			break;
  		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
  		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
@@ -59,7 +60,7 @@
  			action_n++;
  			break;
  		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
-@@ -2938,7 +2941,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
+@@ -2861,7 +2864,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
  			if (raw_encap->size >
  			    (sizeof(struct rte_flow_item_eth) +
  			     sizeof(struct rte_flow_item_ipv4)))
@@ -68,7 +69,7 @@
  			action_n++;
  			break;
  		default:
-@@ -2946,7 +2949,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
+@@ -2869,7 +2872,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
  			break;
  		}
  	}
@@ -77,7 +78,7 @@
  		return action_n;
  	return 0;
  }
-@@ -3388,7 +3391,8 @@ flow_mreg_update_copy_table(struct rte_eth_dev *dev,
+@@ -3276,7 +3279,8 @@ flow_mreg_update_copy_table(struct rte_eth_dev *dev,
  
  /**
   * Split the hairpin flow.
@@ -87,7 +88,7 @@
   * If the count action is after the encap then we also
   * move the count action. in this case the count will also measure
   * the outer bytes.
-@@ -3432,6 +3436,9 @@ flow_hairpin_split(struct rte_eth_dev *dev,
+@@ -3320,6 +3324,9 @@ flow_hairpin_split(struct rte_eth_dev *dev,
  		switch (actions->type) {
  		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
  		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
@@ -98,10 +99,10 @@
  			       sizeof(struct rte_flow_action));
  			actions_tx++;
 diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
-index 5ba788a33..12c7db79d 100644
+index 2407f8723..bfb27a602 100644
 --- a/drivers/net/mlx5/mlx5_flow_dv.c
 +++ b/drivers/net/mlx5/mlx5_flow_dv.c
-@@ -1951,22 +1951,11 @@ flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev,
+@@ -1801,22 +1801,11 @@ flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev,
  	const struct rte_flow_action_of_push_vlan *push_vlan = action->conf;
  	const struct mlx5_priv *priv = dev->data->dev_private;
  
@@ -124,7 +125,7 @@
  	if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
  		return rte_flow_error_set(error, EINVAL,
  					  RTE_FLOW_ERROR_TYPE_ACTION, action,
-@@ -5691,21 +5680,38 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
+@@ -5148,21 +5137,38 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
  						  actions,
  						  "no fate action is found");
  	}


More information about the stable mailing list