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 7E43DA055A for ; Thu, 27 Feb 2020 10:35:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 772171C01; Thu, 27 Feb 2020 10:35:39 +0100 (CET) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 67E8B1BFFD for ; Thu, 27 Feb 2020 10:35:38 +0100 (CET) Received: by mail-wr1-f66.google.com with SMTP id p18so2393695wre.9 for ; Thu, 27 Feb 2020 01:35:38 -0800 (PST) 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=alEjR9BLSCiRhedWbOPuevzXz/1fYFvdQ8F0VYTh2Vc=; b=h9q9EwVktbfR5wv2ioyjwsJ4cNakmIM5YbPc+hON+tENcrsIM7T5bZS81N6a4M8Khf DB/0BzniD0Oo2IEx7Y+x6QWVX1y5tZeCho0w6etcJ/TSZIzgxj0dRQHUUp0tlL2kLXVT aJlAU4Cs8XZBSB9+rO5oRis4GMReBqsKvQJdRuVnC2pDwXFulqRJgPV6rrNq6aNdRf// C7wH7huu47pM3MIRu6nyjoEu/5uix2xv3uv9U0T6ITBrUBMa6TRFLfs19zTo+y/xQqiB HU0gVf6zNwobqFktFdDslA6lebK3o/OgqLzuRmi6SKzh/hJllpKgwRgGBjNVU48c4A0i pZFA== 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=alEjR9BLSCiRhedWbOPuevzXz/1fYFvdQ8F0VYTh2Vc=; b=s25RvOL58gMMPRTYv0rVE4wk9VjWxXOJmhbmAQnr6lpOFS+mhqF+c7PnLLKHJ1I+RE XCMW3VD/iE9ZiyNmFBxgfIsxCpgfToxVPtGjw5AU2762qiUuG38YC2fvgGXR0QVubP9y LY3DTPEj9+8aTuA9zOXa8qnZ1HNnu2nQKWOMjzgXkSwdLm4mU7+cz00V3UElOhvxEDPh QVcGTLK1rhA6NF1xbaGZnlrOesEVuQW1BDddmIV+sMGwcT/LPVNqHtnUDcdk9qq5qqCy Tfn1r35PZ2UlfAf/DBduQpQS+hgz0k/7NLeMAfwHyKtx6hAwXQtF3K8tFCjTHTzSGkRA J7ZQ== X-Gm-Message-State: APjAAAUoL7APCibxL7k+GL6lV2/rq/vhPIdHIWtMx1QmWZ2JtqucHHJG SzPxUW8pGcvM5KTxiYAU8/s= X-Google-Smtp-Source: APXvYqwnIw7fSNvEQ/04trEEBvDjKmLb1ENlgccOnUB4y4eeMqlORabUUjFhBuf+NMTXGIEa0uVa/A== X-Received: by 2002:adf:9cc7:: with SMTP id h7mr595078wre.369.1582796138057; Thu, 27 Feb 2020 01:35:38 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id o27sm7285921wro.27.2020.02.27.01.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 01:35:37 -0800 (PST) From: luca.boccassi@gmail.com To: Matan Azrad Cc: Viacheslav Ovsiienko , dpdk stable Date: Thu, 27 Feb 2020 09:33:55 +0000 Message-Id: <20200227093402.17690-35-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227093402.17690-1-luca.boccassi@gmail.com> References: <20200217174546.25334-54-luca.boccassi@gmail.com> <20200227093402.17690-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix metadata split with encap action' has been queued to stable release 19.11.1 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.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/29/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 f5d5f63d257f68d99fc9ef7482f02aadc04f5975 Mon Sep 17 00:00:00 2001 From: Matan Azrad Date: Thu, 20 Feb 2020 14:43:30 +0000 Subject: [PATCH] net/mlx5: fix metadata split with encap action [ upstream commit 35594a9b6f96ac6e45bbb851d9180c841c35cfff ] In order to move the mbuf metadata from the WQE to the FDB steering domain, the PMD add for each NIC TX flow a new action to copy the metadata register REG_A to REG_C_0. This copy action is considered as modify header action from HW perspective. The HW doesn't support to do modify header action after ant encapsulation action. The split metadata function wrongly added the copy action in the end of the original actions list, hence, NIC egress flow with encapsulation action failed when the PMD worked with dv_xmeta_en mode. Move the copy action to be before and back to back with the encapsulation action for the aforementioned case. Fixes: 71e254bc0294 ("net/mlx5: split Rx flows to provide metadata copy") Signed-off-by: Matan Azrad Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.c | 66 +++++++++++++++++++++++++-------- drivers/net/mlx5/mlx5_flow.h | 3 ++ drivers/net/mlx5/mlx5_flow_dv.c | 2 - 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a7ddc161c8..aae687a948 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2723,7 +2723,7 @@ find_graph_root(const struct rte_flow_item pattern[], uint32_t rss_level) } /** - * Get QUEUE/RSS action from the action list. + * Get metadata split action information. * * @param[in] actions * Pointer to the list of actions. @@ -2732,18 +2732,38 @@ find_graph_root(const struct rte_flow_item pattern[], uint32_t rss_level) * @param[out] qrss_type * Pointer to the action type to return. RTE_FLOW_ACTION_TYPE_END is returned * if no QUEUE/RSS is found. + * @param[out] encap_idx + * Pointer to the index of the encap action if exists, otherwise the last + * action index. * * @return * Total number of actions. */ static int -flow_parse_qrss_action(const struct rte_flow_action actions[], - const struct rte_flow_action **qrss) +flow_parse_metadata_split_actions_info(const struct rte_flow_action actions[], + const struct rte_flow_action **qrss, + int *encap_idx) { + const struct rte_flow_action_raw_encap *raw_encap; int actions_n = 0; + int raw_decap_idx = -1; + *encap_idx = -1; for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { switch (actions->type) { + case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: + case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: + *encap_idx = actions_n; + break; + case RTE_FLOW_ACTION_TYPE_RAW_DECAP: + raw_decap_idx = actions_n; + break; + case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: + raw_encap = actions->conf; + if (raw_encap->size > MLX5_ENCAPSULATION_DECISION_SIZE) + *encap_idx = raw_decap_idx != -1 ? + raw_decap_idx : actions_n; + break; case RTE_FLOW_ACTION_TYPE_QUEUE: case RTE_FLOW_ACTION_TYPE_RSS: *qrss = actions; @@ -2753,6 +2773,8 @@ flow_parse_qrss_action(const struct rte_flow_action actions[], } actions_n++; } + if (*encap_idx == -1) + *encap_idx = actions_n; /* Count RTE_FLOW_ACTION_TYPE_END. */ return actions_n + 1; } @@ -3678,6 +3700,8 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev, * Number of actions in the list. * @param[out] error * Perform verbose error reporting if not NULL. + * @param[in] encap_idx + * The encap action inndex. * * @return * 0 on success, negative value otherwise @@ -3686,7 +3710,8 @@ static int flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, struct rte_flow_action *ext_actions, const struct rte_flow_action *actions, - int actions_n, struct rte_flow_error *error) + int actions_n, struct rte_flow_error *error, + int encap_idx) { struct mlx5_flow_action_copy_mreg *cp_mreg = (struct mlx5_flow_action_copy_mreg *) @@ -3701,15 +3726,24 @@ flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, if (ret < 0) return ret; cp_mreg->src = ret; - memcpy(ext_actions, actions, - sizeof(*ext_actions) * actions_n); - ext_actions[actions_n - 1] = (struct rte_flow_action){ - .type = MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, - .conf = cp_mreg, - }; - ext_actions[actions_n] = (struct rte_flow_action){ - .type = RTE_FLOW_ACTION_TYPE_END, - }; + if (encap_idx != 0) + memcpy(ext_actions, actions, sizeof(*ext_actions) * encap_idx); + if (encap_idx == actions_n - 1) { + ext_actions[actions_n - 1] = (struct rte_flow_action){ + .type = MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, + .conf = cp_mreg, + }; + ext_actions[actions_n] = (struct rte_flow_action){ + .type = RTE_FLOW_ACTION_TYPE_END, + }; + } else { + ext_actions[encap_idx] = (struct rte_flow_action){ + .type = MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, + .conf = cp_mreg, + }; + memcpy(ext_actions + encap_idx + 1, actions + encap_idx, + sizeof(*ext_actions) * (actions_n - encap_idx)); + } return 0; } @@ -3757,6 +3791,7 @@ flow_create_split_metadata(struct rte_eth_dev *dev, int mtr_sfx = 0; size_t act_size; int actions_n; + int encap_idx; int ret; /* Check whether extensive metadata feature is engaged. */ @@ -3765,7 +3800,8 @@ flow_create_split_metadata(struct rte_eth_dev *dev, !mlx5_flow_ext_mreg_supported(dev)) return flow_create_split_inner(dev, flow, NULL, attr, items, actions, external, error); - actions_n = flow_parse_qrss_action(actions, &qrss); + actions_n = flow_parse_metadata_split_actions_info(actions, &qrss, + &encap_idx); if (qrss) { /* Exclude hairpin flows from splitting. */ if (qrss->type == RTE_FLOW_ACTION_TYPE_QUEUE) { @@ -3840,7 +3876,7 @@ flow_create_split_metadata(struct rte_eth_dev *dev, "metadata flow"); /* Create the action list appended with copy register. */ ret = flow_mreg_tx_copy_prep(dev, ext_actions, actions, - actions_n, error); + actions_n, error, encap_idx); if (ret < 0) goto exit; } diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 0da1b5e318..9dcba4c108 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -334,6 +334,9 @@ enum mlx5_feature_name { #define MLX5_GENEVE_OPT_LEN_0 14 #define MLX5_GENEVE_OPT_LEN_1 63 +#define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \ + sizeof(struct rte_flow_item_ipv4)) + enum mlx5_flow_drv_type { MLX5_FLOW_TYPE_MIN, MLX5_FLOW_TYPE_DV, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index e39d3c4299..25848cb4ea 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -51,8 +51,6 @@ #define MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL 1 #endif -#define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \ - sizeof(struct rte_flow_item_ipv4)) /* VLAN header definitions */ #define MLX5DV_FLOW_VLAN_PCP_SHIFT 13 #define MLX5DV_FLOW_VLAN_PCP_MASK (0x7 << MLX5DV_FLOW_VLAN_PCP_SHIFT) -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-27 09:31:56.940977697 +0000 +++ 0035-net-mlx5-fix-metadata-split-with-encap-action.patch 2020-02-27 09:31:55.831946576 +0000 @@ -1,8 +1,10 @@ -From 35594a9b6f96ac6e45bbb851d9180c841c35cfff Mon Sep 17 00:00:00 2001 +From f5d5f63d257f68d99fc9ef7482f02aadc04f5975 Mon Sep 17 00:00:00 2001 From: Matan Azrad Date: Thu, 20 Feb 2020 14:43:30 +0000 Subject: [PATCH] net/mlx5: fix metadata split with encap action +[ upstream commit 35594a9b6f96ac6e45bbb851d9180c841c35cfff ] + In order to move the mbuf metadata from the WQE to the FDB steering domain, the PMD add for each NIC TX flow a new action to copy the metadata register REG_A to REG_C_0. @@ -21,19 +23,20 @@ encapsulation action for the aforementioned case. Fixes: 71e254bc0294 ("net/mlx5: split Rx flows to provide metadata copy") -Cc: stable@dpdk.org Signed-off-by: Matan Azrad Acked-by: Viacheslav Ovsiienko --- - drivers/net/mlx5/mlx5_flow.c | 66 ++++++++++++++++++++++++++++-------- - 1 file changed, 51 insertions(+), 15 deletions(-) + drivers/net/mlx5/mlx5_flow.c | 66 +++++++++++++++++++++++++-------- + drivers/net/mlx5/mlx5_flow.h | 3 ++ + drivers/net/mlx5/mlx5_flow_dv.c | 2 - + 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c -index 49308e9c5d..16c1ef3532 100644 +index a7ddc161c8..aae687a948 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c -@@ -2744,7 +2744,7 @@ flow_get_prefix_layer_flags(struct mlx5_flow *dev_flow) +@@ -2723,7 +2723,7 @@ find_graph_root(const struct rte_flow_item pattern[], uint32_t rss_level) } /** @@ -42,7 +45,7 @@ * * @param[in] actions * Pointer to the list of actions. -@@ -2753,18 +2753,38 @@ flow_get_prefix_layer_flags(struct mlx5_flow *dev_flow) +@@ -2732,18 +2732,38 @@ find_graph_root(const struct rte_flow_item pattern[], uint32_t rss_level) * @param[out] qrss_type * Pointer to the action type to return. RTE_FLOW_ACTION_TYPE_END is returned * if no QUEUE/RSS is found. @@ -83,7 +86,7 @@ case RTE_FLOW_ACTION_TYPE_QUEUE: case RTE_FLOW_ACTION_TYPE_RSS: *qrss = actions; -@@ -2774,6 +2794,8 @@ flow_parse_qrss_action(const struct rte_flow_action actions[], +@@ -2753,6 +2773,8 @@ flow_parse_qrss_action(const struct rte_flow_action actions[], } actions_n++; } @@ -92,7 +95,7 @@ /* Count RTE_FLOW_ACTION_TYPE_END. */ return actions_n + 1; } -@@ -3739,6 +3761,8 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev, +@@ -3678,6 +3700,8 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev, * Number of actions in the list. * @param[out] error * Perform verbose error reporting if not NULL. @@ -101,7 +104,7 @@ * * @return * 0 on success, negative value otherwise -@@ -3747,7 +3771,8 @@ static int +@@ -3686,7 +3710,8 @@ static int flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, struct rte_flow_action *ext_actions, const struct rte_flow_action *actions, @@ -111,7 +114,7 @@ { struct mlx5_flow_action_copy_mreg *cp_mreg = (struct mlx5_flow_action_copy_mreg *) -@@ -3762,15 +3787,24 @@ flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, +@@ -3701,15 +3726,24 @@ flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, if (ret < 0) return ret; cp_mreg->src = ret; @@ -145,7 +148,7 @@ return 0; } -@@ -3821,6 +3855,7 @@ flow_create_split_metadata(struct rte_eth_dev *dev, +@@ -3757,6 +3791,7 @@ flow_create_split_metadata(struct rte_eth_dev *dev, int mtr_sfx = 0; size_t act_size; int actions_n; @@ -153,17 +156,17 @@ int ret; /* Check whether extensive metadata feature is engaged. */ -@@ -3830,7 +3865,8 @@ flow_create_split_metadata(struct rte_eth_dev *dev, - return flow_create_split_inner(dev, flow, NULL, prefix_layers, - attr, items, actions, external, - error); +@@ -3765,7 +3800,8 @@ flow_create_split_metadata(struct rte_eth_dev *dev, + !mlx5_flow_ext_mreg_supported(dev)) + return flow_create_split_inner(dev, flow, NULL, attr, items, + actions, external, error); - actions_n = flow_parse_qrss_action(actions, &qrss); + actions_n = flow_parse_metadata_split_actions_info(actions, &qrss, + &encap_idx); if (qrss) { /* Exclude hairpin flows from splitting. */ if (qrss->type == RTE_FLOW_ACTION_TYPE_QUEUE) { -@@ -3905,7 +3941,7 @@ flow_create_split_metadata(struct rte_eth_dev *dev, +@@ -3840,7 +3876,7 @@ flow_create_split_metadata(struct rte_eth_dev *dev, "metadata flow"); /* Create the action list appended with copy register. */ ret = flow_mreg_tx_copy_prep(dev, ext_actions, actions, @@ -172,6 +175,33 @@ if (ret < 0) goto exit; } +diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h +index 0da1b5e318..9dcba4c108 100644 +--- a/drivers/net/mlx5/mlx5_flow.h ++++ b/drivers/net/mlx5/mlx5_flow.h +@@ -334,6 +334,9 @@ enum mlx5_feature_name { + #define MLX5_GENEVE_OPT_LEN_0 14 + #define MLX5_GENEVE_OPT_LEN_1 63 + ++#define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \ ++ sizeof(struct rte_flow_item_ipv4)) ++ + enum mlx5_flow_drv_type { + MLX5_FLOW_TYPE_MIN, + MLX5_FLOW_TYPE_DV, +diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c +index e39d3c4299..25848cb4ea 100644 +--- a/drivers/net/mlx5/mlx5_flow_dv.c ++++ b/drivers/net/mlx5/mlx5_flow_dv.c +@@ -51,8 +51,6 @@ + #define MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL 1 + #endif + +-#define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \ +- sizeof(struct rte_flow_item_ipv4)) + /* VLAN header definitions */ + #define MLX5DV_FLOW_VLAN_PCP_SHIFT 13 + #define MLX5DV_FLOW_VLAN_PCP_MASK (0x7 << MLX5DV_FLOW_VLAN_PCP_SHIFT) -- 2.20.1