DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dekel Peled <dekelp@mellanox.com>
To: matan@mellanox.com, viacheslavo@mellanox.com
Cc: rasland@mellanox.com, orika@mellanox.com, dev@dpdk.org, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 09/11] net/mlx5: fix the set VLAN VID action validation
Date: Wed, 22 Jan 2020 16:27:21 +0200	[thread overview]
Message-ID: <56b43c8675246d3d66ea761b97f6dff8f8417390.1579703134.git.dekelp@mellanox.com> (raw)
In-Reply-To: <cover.1579703134.git.dekelp@mellanox.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index de4b765..4b6a92c 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -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,
-- 
1.8.3.1


  parent reply	other threads:[~2020-01-22 14:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 14:27 [dpdk-dev] [PATCH 00/11] net/mlx5: vlan actions validation fixes Dekel Peled
2020-01-22 14:27 ` [dpdk-dev] [PATCH 01/11] net/mlx5: fix masks of encap and decap actions Dekel Peled
2020-01-23  7:56   ` Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 02/11] net/mlx5: fix invalid check for VLAN actions Dekel Peled
2020-01-23  7:56   ` Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 03/11] net/mlx5: fix bit mask used for push VLAN validate Dekel Peled
2020-01-23  7:56   ` Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 04/11] net/mlx5: fix allow push VLAN without VID value Dekel Peled
2020-01-23  7:57   ` Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 05/11] net/mlx5: unify validation of drop action Dekel Peled
2020-01-23  7:57   ` Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 06/11] net/mlx5: fix block push VLAN action on Rx Dekel Peled
2020-01-23  7:57   ` Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 07/11] net/mlx5: fix block pop VLAN action on Tx Dekel Peled
2020-01-23  7:57   ` Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 08/11] net/mlx5: fix pop VLAN action validation function Dekel Peled
2020-01-23  7:57   ` Slava Ovsiienko
2020-01-22 14:27 ` Dekel Peled [this message]
2020-01-23  7:58   ` [dpdk-dev] [PATCH 09/11] net/mlx5: fix the set VLAN VID action validation Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 10/11] net/mlx5: update description of validation funcs Dekel Peled
2020-01-23  7:58   ` Slava Ovsiienko
2020-01-22 14:27 ` [dpdk-dev] [PATCH 11/11] doc: update MLX5 supported hardware offloads table Dekel Peled
2020-01-23  7:58   ` Slava Ovsiienko
2020-01-26 15:48 ` [dpdk-dev] [PATCH 00/11] net/mlx5: vlan actions validation fixes Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56b43c8675246d3d66ea761b97f6dff8f8417390.1579703134.git.dekelp@mellanox.com \
    --to=dekelp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=orika@mellanox.com \
    --cc=rasland@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).