From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8ED60A0093 for ; Tue, 19 May 2020 15:10:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 84DBD1D6A4; Tue, 19 May 2020 15:10:46 +0200 (CEST) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 618BA1D6A4 for ; Tue, 19 May 2020 15:10:45 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id s8so15842259wrt.9 for ; Tue, 19 May 2020 06:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XS1unBS5NQYX3I7aRqrJAYHskjqkEqE3YQo9FpvRYTw=; b=QIxCjgbtuRq8/+D8B5c8T1kh0S03aCUvX4+9/1islIKY5/bp+JKHMW04zdHMyu+hcO c0/6qZfB3610KmfdYs0JR0zZvf0ySEY6pEuABm6ndkrJJkTIigvfALtdQV8MTh/vfpt1 ZCcbwcad0uG/mhXeUWavp0v3yJEwcFOU35W4HgAql71SBqqkT+iQ9xjFZWdV7s3J7J04 s+7IClSzKeECmo371mLwCd0e+uo+MA21p15UbEsE9sT8ljGoS+u3yXmbySUA6AuZb2kN JKdtgltFd0gtS9aOykThqEw+tW0n91ZFIeurdR1fmzLdM6cvBdijGSdksnxpk+nXHIXT Gnuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XS1unBS5NQYX3I7aRqrJAYHskjqkEqE3YQo9FpvRYTw=; b=i8NS0LtCKk4eARBuufT7lcrH4xDWylJW3T1sTVoM60rU0a9iKYkJ2bahQoOMGycc2+ CAwyy+gYQGR9CklESNEWBhDdz1SPeqi7blvcfSdwsQ0qL4vC1UtGfHuJYzy/J9AcN9r8 3fmvkj8Ec9i2h0r1tIUsKRF0MFGVRvVoRmvOi8vDt0vwbPZVS2rEUU5ckbWF+JOHgToP hD3ErLsL/IyJ2ntLt0oA9zxTtWO2I+W9KOGcoi305vEuo0FoPtohDtGxQNQWtxifl5GV 2HrDDm/+wLIp59tK29X7CGo+nyyqDnBmARqx8WEDRe3eijcEy+hayXBLeaW8OPuDal9a TTDQ== X-Gm-Message-State: AOAM530hi2jOhUAbaL0q29nJkrFrJFTsQ2KSwXpwEx237I0n46func0B JLD3jp5OD++Q++PTwqXxYb3XxhhdSEodklFm X-Google-Smtp-Source: ABdhPJyaekFy+0o2CTmrPoq3sYmHd9AhKMTOsxqBlpwTje6ahqbYl/KTqN1/93n2qQ3KSDFjI/46nQ== X-Received: by 2002:adf:a1cb:: with SMTP id v11mr27882157wrv.39.1589893845107; Tue, 19 May 2020 06:10:45 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id n9sm20821412wrv.43.2020.05.19.06.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:10:44 -0700 (PDT) From: luca.boccassi@gmail.com To: Xiaoyu Min Cc: Dekel Peled , Viacheslav Ovsiienko , dpdk stable Date: Tue, 19 May 2020 14:03:47 +0100 Message-Id: <20200519130549.112823-92-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> <20200519130549.112823-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix validation of push VLAN without full mask' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/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 ab9701159da2a8eb298ba906aa8a7fc6c8ca086f Mon Sep 17 00:00:00 2001 From: Xiaoyu Min Date: Mon, 13 Apr 2020 06:32:56 +0300 Subject: [PATCH] net/mlx5: fix validation of push VLAN without full mask [ upstream commit 889cf609e555ab6b8263cb96d06ae4c7ddfb9a24 ] Due the limitation of HW, when PMD create push VLAN action it needs to know what exactly the value of VID/PCP. PMD try to figure out them via: - of_set_vlan_vid/pcp actions - VLAN item in pattern If none of above is provided, default value - zero is used. However user will write rule like [1] which match on a range of VID and without of_set_vlan_vid action and expect the VID will inherit from original packet. This is not supported by HW currently. PMD will set VID to default value - zero because it cannot figure out the exact value of VID from VLAN item. This is sort of misleading for some users. In order to avoid this, PMD will spit out error for rule like [1] to force user to provide explicit VID/PCP for new pushed VLAN headers. [1]: testpmd> flow create 2 ingress transfer group 0 priority 3 pattern eth / vlan vid spec 2859 vid prefix 4 / ipv4 / end actcions of_push_vlan ethertype 0x88A8 / of_set_vlan_pcp vlan_pcp 6 / port_id id 0 / end Fixes: 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header") Signed-off-by: Xiaoyu Min Reviewed-by: Dekel Peled Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 34 +++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 8c3748f13c..3574b94f4a 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1700,7 +1700,7 @@ flow_dev_get_vlan_info_from_items(const struct rte_flow_item *items, static int flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev, uint64_t action_flags, - uint64_t item_flags __rte_unused, + const struct rte_flow_item_vlan *vlan_m, const struct rte_flow_action *action, const struct rte_flow_attr *attr, struct rte_flow_error *error) @@ -1734,6 +1734,32 @@ flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "push vlan action for VF representor " "not supported on NIC table"); + if (vlan_m && + (vlan_m->tci & MLX5DV_FLOW_VLAN_PCP_MASK_BE) && + (vlan_m->tci & MLX5DV_FLOW_VLAN_PCP_MASK_BE) != + MLX5DV_FLOW_VLAN_PCP_MASK_BE && + !(action_flags & MLX5_FLOW_ACTION_OF_SET_VLAN_PCP) && + !(mlx5_flow_find_action + (action + 1, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP))) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "not full match mask on VLAN PCP and " + "there is no of_set_vlan_pcp action, " + "push VLAN action cannot figure out " + "PCP value"); + if (vlan_m && + (vlan_m->tci & MLX5DV_FLOW_VLAN_VID_MASK_BE) && + (vlan_m->tci & MLX5DV_FLOW_VLAN_VID_MASK_BE) != + MLX5DV_FLOW_VLAN_VID_MASK_BE && + !(action_flags & MLX5_FLOW_ACTION_OF_SET_VLAN_VID) && + !(mlx5_flow_find_action + (action + 1, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID))) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "not full match mask on VLAN VID and " + "there is no of_set_vlan_vid action, " + "push VLAN action cannot figure out " + "VID value"); (void)attr; return 0; } @@ -4364,6 +4390,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_dev_config *dev_conf = &priv->config; uint16_t queue_index = 0xFFFF; + const struct rte_flow_item_vlan *vlan_m = NULL; if (items == NULL) return -1; @@ -4421,6 +4448,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, } else { ether_type = 0; } + /* Store outer VLAN mask for of_push_vlan action. */ + if (!tunnel) + vlan_m = items->mask; break; case RTE_FLOW_ITEM_TYPE_IPV4: mlx5_flow_tunnel_ip_check(items, next_protocol, @@ -4727,7 +4757,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: ret = flow_dv_validate_action_push_vlan(dev, action_flags, - item_flags, + vlan_m, actions, attr, error); if (ret < 0) -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 14:04:48.223946154 +0100 +++ 0092-net-mlx5-fix-validation-of-push-VLAN-without-full-ma.patch 2020-05-19 14:04:44.300649895 +0100 @@ -1,8 +1,10 @@ -From 889cf609e555ab6b8263cb96d06ae4c7ddfb9a24 Mon Sep 17 00:00:00 2001 +From ab9701159da2a8eb298ba906aa8a7fc6c8ca086f Mon Sep 17 00:00:00 2001 From: Xiaoyu Min Date: Mon, 13 Apr 2020 06:32:56 +0300 Subject: [PATCH] net/mlx5: fix validation of push VLAN without full mask +[ upstream commit 889cf609e555ab6b8263cb96d06ae4c7ddfb9a24 ] + Due the limitation of HW, when PMD create push VLAN action it needs to know what exactly the value of VID/PCP. @@ -28,7 +30,6 @@ of_set_vlan_pcp vlan_pcp 6 / port_id id 0 / end Fixes: 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header") -Cc: stable@dpdk.org Signed-off-by: Xiaoyu Min Reviewed-by: Dekel Peled @@ -38,10 +39,10 @@ 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c -index 5f093bedd3..ae00ca431e 100644 +index 8c3748f13c..3574b94f4a 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c -@@ -1833,7 +1833,7 @@ flow_dev_get_vlan_info_from_items(const struct rte_flow_item *items, +@@ -1700,7 +1700,7 @@ flow_dev_get_vlan_info_from_items(const struct rte_flow_item *items, static int flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev, uint64_t action_flags, @@ -50,7 +51,7 @@ const struct rte_flow_action *action, const struct rte_flow_attr *attr, struct rte_flow_error *error) -@@ -1867,6 +1867,32 @@ flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev, +@@ -1734,6 +1734,32 @@ flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "push vlan action for VF representor " "not supported on NIC table"); @@ -83,7 +84,7 @@ (void)attr; return 0; } -@@ -4569,6 +4595,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -4364,6 +4390,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_dev_config *dev_conf = &priv->config; uint16_t queue_index = 0xFFFF; @@ -91,7 +92,7 @@ if (items == NULL) return -1; -@@ -4626,6 +4653,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -4421,6 +4448,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, } else { ether_type = 0; } @@ -101,7 +102,7 @@ break; case RTE_FLOW_ITEM_TYPE_IPV4: mlx5_flow_tunnel_ip_check(items, next_protocol, -@@ -4941,7 +4971,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -4727,7 +4757,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: ret = flow_dv_validate_action_push_vlan(dev, action_flags,