From patchwork Thu Apr 2 10:21:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyu Min X-Patchwork-Id: 67643 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 25D3DA057B; Thu, 2 Apr 2020 12:21:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8B52C2C15; Thu, 2 Apr 2020 12:21:20 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 7E4F72BCE; Thu, 2 Apr 2020 12:21:19 +0200 (CEST) From: Xiaoyu Min To: Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Cc: dev@dpdk.org, stable@dpdk.org, Dekel Peled Date: Thu, 2 Apr 2020 13:21:13 +0300 Message-Id: X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/mlx5: fix push VLAN action wrongly use item info 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" Currently when PMD create push VLAN action it need to provide VID to HW and PMD get VID value from item VLAN in pattern if there is no of_set_vlan_vid action following. When user create rule like [1], which has of_set_vlan_vid action before of_push_vlan, the intention is to modify VID on existing VLAN header and push a new VLAN header with VID _inherit_ from the previous of_set_vlan_vid. Currently the above is not covered by PMD, PMD always fetch the VLAN information from item for of_push_vlan action. Fix it by only fetch VLAN information from item when there is no previous of_set_vlan_vid action. [1]: testpmd> flow create 2 ingress transfer group 1 priority 3 pattern eth / vlan vid is 2731 / ipv4 / end actions of_set_vlan_vid vlan_vid 3209 / of_push_vlan ethertype 0x88A8 / port_id id 1 / end Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header") Cc: stable@dpdk.org Signed-off-by: Xiaoyu Min Reviewed-by: Dekel Peled --- drivers/net/mlx5/mlx5_flow_dv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 6aa6e8383d..c790e6afd4 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -7527,7 +7527,9 @@ __flow_dv_translate(struct rte_eth_dev *dev, action_flags |= MLX5_FLOW_ACTION_OF_POP_VLAN; break; case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: - flow_dev_get_vlan_info_from_items(items, &vlan); + if (!(action_flags & + MLX5_FLOW_ACTION_OF_SET_VLAN_VID)) + flow_dev_get_vlan_info_from_items(items, &vlan); vlan.eth_proto = rte_be_to_cpu_16 ((((const struct rte_flow_action_of_push_vlan *) actions->conf)->ethertype));