patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix push VLAN action validation
@ 2022-03-09  9:39 Dariusz Sosnowski
  2022-03-10  9:20 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Dariusz Sosnowski @ 2022-03-09  9:39 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko, Dong Zhou
  Cc: dev, Raslan Darawsheh, stable

Flow domain and direction was validated when OF_PUSH_VLAN action
appears in flow actions. Flow was rejected whenever this action:

- was used in NIC domain, in ingress direction;
- was used in FDB domain, in ingress direction, on ConnectX-5.

This validation logic rejected a valid case when the OF_PUSH_VLAN
action was used when directing traffic to the hairpin queue,
configured in TX implicit mode.

This patch moves code responsible for OF_PUSH_VLAN validation of
domain and direction from flow_dv_validate_push_vlan() to
flow_dv_validate(). Domain and direction are now validated when either
non-hairpin queue is used or hairpin queue is configured in Tx explicit
mode.

Fixes: 96f85ec489db ("net/mlx5: check VLAN push/pop support")
Cc: dongzhou@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 46 ++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 29751e7eda..1746ef37bd 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -2873,8 +2873,6 @@ 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;
-	struct mlx5_dev_ctx_shared *sh = priv->sh;
-	bool direction_error = false;
 
 	if (push_vlan->ethertype != RTE_BE16(RTE_ETHER_TYPE_VLAN) &&
 	    push_vlan->ethertype != RTE_BE16(RTE_ETHER_TYPE_QINQ))
@@ -2886,22 +2884,6 @@ flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "wrong action order, port_id should "
 					  "be after push VLAN");
-	/* Push VLAN is not supported in ingress except for CX6 FDB mode. */
-	if (attr->transfer) {
-		bool fdb_tx = priv->representor_id != UINT16_MAX;
-		bool is_cx5 = sh->steering_format_version ==
-		    MLX5_STEERING_LOGIC_FORMAT_CONNECTX_5;
-
-		if (!fdb_tx && is_cx5)
-			direction_error = true;
-	} else if (attr->ingress) {
-		direction_error = true;
-	}
-	if (direction_error)
-		return rte_flow_error_set(error, ENOTSUP,
-					  RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
-					  NULL,
-					  "push vlan action not supported for ingress");
 	if (!attr->transfer && priv->representor)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
@@ -7996,6 +7978,28 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 						  RTE_FLOW_ERROR_TYPE_ACTION,
 						  NULL, "encap and decap "
 						  "combination aren't supported");
+		/* Push VLAN is not supported in ingress except for NICs newer than CX5. */
+		if (action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) {
+			struct mlx5_dev_ctx_shared *sh = priv->sh;
+			bool direction_error = false;
+
+			if (attr->transfer) {
+				bool fdb_tx = priv->representor_id != UINT16_MAX;
+				bool is_cx5 = sh->steering_format_version ==
+				    MLX5_STEERING_LOGIC_FORMAT_CONNECTX_5;
+
+				if (!fdb_tx && is_cx5)
+					direction_error = true;
+			} else if (attr->ingress) {
+				direction_error = true;
+			}
+			if (direction_error)
+				return rte_flow_error_set(error, ENOTSUP,
+							  RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
+							  NULL,
+							  "push VLAN action not supported "
+							  "for ingress");
+		}
 		if (!attr->transfer && attr->ingress) {
 			if (action_flags & MLX5_FLOW_ACTION_ENCAP)
 				return rte_flow_error_set
@@ -8003,12 +8007,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 						 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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-10  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  9:39 [PATCH] net/mlx5: fix push VLAN action validation Dariusz Sosnowski
2022-03-10  9:20 ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).