From patchwork Wed Jan 22 14:27:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dekel Peled X-Patchwork-Id: 65043 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B8083A0530; Wed, 22 Jan 2020 15:31:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 690451BEA9; Wed, 22 Jan 2020 15:30:18 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 582993576 for ; Wed, 22 Jan 2020 15:30:04 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 22 Jan 2020 16:30:02 +0200 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.128.130.87]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00METnL7010555; Wed, 22 Jan 2020 16:30:02 +0200 From: Dekel Peled To: matan@mellanox.com, viacheslavo@mellanox.com Cc: rasland@mellanox.com, orika@mellanox.com, dev@dpdk.org, stable@dpdk.org Date: Wed, 22 Jan 2020 16:27:21 +0200 Message-Id: <56b43c8675246d3d66ea761b97f6dff8f8417390.1579703134.git.dekelp@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: Subject: [dpdk-dev] [PATCH 09/11] net/mlx5: fix the set VLAN VID action validation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Ori Kam Acked-by: Viacheslav Ovsiienko --- 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,