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 1FC0BA051C for ; Tue, 11 Feb 2020 12:29:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 180CE49E0; Tue, 11 Feb 2020 12:29:31 +0100 (CET) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 69A4749E0 for ; Tue, 11 Feb 2020 12:29:30 +0100 (CET) Received: by mail-wm1-f65.google.com with SMTP id b17so3094407wmb.0 for ; Tue, 11 Feb 2020 03:29:30 -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=ZY+xehiTGhy2w6lQ0WS4NZc2afdIqIxyUe8JF9/T66s=; b=ARXYLBhV6O5Mc8DUCxMzi2Ju//ZYbzHa02coo6V+vJTOgtPY01ipJhe9G51UmoR6MR 3EQ304Hr5/OY2XMg3amAQOY9b9yQBEE0LRH5TKrJ6E0/5aCK0l8jU9XgEbpiBM8y5gQp fWzq97+7NxImGDvqOJYrJkDGV0DnalgEgOXowsal4Ovn6lZCIZ5pv9SkkdTIQPckwSwP 7nAnntKD1ixlMGStfbpkboBa7q8h0xLlo2meP1/vXxZJNwoYQDZfl5TitvVcwPK67GBA AqHSsMn7V0zR5LQalJ88iZaZRGpXcInPqs68mIKCgg7jVGhV4meQRE+yRuq7ULS5rkb9 mfxQ== 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=ZY+xehiTGhy2w6lQ0WS4NZc2afdIqIxyUe8JF9/T66s=; b=FZtZnOhiD/w5TrYOCW5LjDKx6W9xKs3Ol6CsheiPj9F0NXTMgSlLgci0m/m6LmBBR6 ayGvm+DYb3yCDc5uv56D27KfL5raB0ZGov2qGXMJeCjyLKvTtIAdKIkCPeyEA6yg0b6l BSA8r+8jgk0lmS4Qn64L27lmY4gfPGTe/QsU4QhEWgrph5hRMW0mO3nJnlSUG2l0rNY0 HSq1yWPyb0QkpWJY9ucY8sBetHVmHmELSLaVzqa7dMfRcZfWsgtvdI1HPoz/gy5nyfqh dt1YRqRNsPGYhJpPC0IdsDrMZT+wpalI0NfD8mMRhkVMtmkhBhhZtmpjjT2HyQVoUjzT Ov4w== X-Gm-Message-State: APjAAAWqdsePbUum42+hz/qEX56Nvtc2un3EdAn5fNAbaVMnhzol2fwb 3mAeZTtABUD6ZWyY5xEl34Y= X-Google-Smtp-Source: APXvYqyC/LpKnG5A3YefRqGjQnULhlAyvnCSFRJnfRPBOJ7MV8Wy7HrNqFxktb9EKipi62tODVQGvQ== X-Received: by 2002:a05:600c:20c6:: with SMTP id y6mr5179676wmm.95.1581420570128; Tue, 11 Feb 2020 03:29:30 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id a184sm3390875wmf.29.2020.02.11.03.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:29:29 -0800 (PST) From: luca.boccassi@gmail.com To: Viacheslav Ovsiienko Cc: Matan Azrad , dpdk stable Date: Tue, 11 Feb 2020 11:20:47 +0000 Message-Id: <20200211112216.3929-101-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix matcher field usage for metadata entities' 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/13/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 aa2fd4ad6061da72ecfcf20ef1d8a7237c8ef6c9 Mon Sep 17 00:00:00 2001 From: Viacheslav Ovsiienko Date: Fri, 17 Jan 2020 11:16:06 +0000 Subject: [PATCH] net/mlx5: fix matcher field usage for metadata entities [ upstream commit fde4341b665786632c6e4375ac25af65a3a5eebb ] Matcher is flow table related structure providing the flow pattern to be translated directly in hardware controlling data. This structure includes the metadata register c0 field, that might be engaged to support META and MARK related flow items and actions. Also, this register might be used by kernel to specify the source vport index. In this case (if kernel uses the field) the register c0 is split into two 16-bit subfields - one for META/MARK items and another to handle vport. The actual configuration is queried by PMD from kernel in runtime and depending on the mask returned by kernel the PMD can use upper or lower half of register c0 field. This patch adds the missing support for upper half. This missed support caused the non-operational META/MARK items on some kernel configurations. Fixes: e554b672aa05 ("net/mlx5: support flow tag") Signed-off-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 39 +++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 9dd0dbdc0a..c9bb76a8fc 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1088,6 +1088,14 @@ flow_dv_convert_action_mark(struct rte_eth_dev *dev, if (reg < 0) return reg; assert(reg > 0); + if (reg == REG_C_0) { + uint32_t msk_c0 = priv->sh->dv_regc0_mask; + uint32_t shl_c0 = rte_bsf32(msk_c0); + + data = rte_cpu_to_be_32(rte_cpu_to_be_32(data) << shl_c0); + mask = rte_cpu_to_be_32(mask) & msk_c0; + mask = rte_cpu_to_be_32(mask << shl_c0); + } reg_c_x[0].id = reg_to_field[reg]; return flow_dv_convert_modify_action(&item, reg_c_x, NULL, resource, MLX5_MODIFICATION_TYPE_SET, error); @@ -5842,6 +5850,15 @@ flow_dv_translate_item_mark(struct rte_eth_dev *dev, /* Get the metadata register index for the mark. */ reg = mlx5_flow_get_reg_id(dev, MLX5_FLOW_MARK, 0, NULL); assert(reg > 0); + if (reg == REG_C_0) { + struct mlx5_priv *priv = dev->data->dev_private; + uint32_t msk_c0 = priv->sh->dv_regc0_mask; + uint32_t shl_c0 = rte_bsf32(msk_c0); + + mask &= msk_c0; + mask <<= shl_c0; + value <<= shl_c0; + } flow_dv_match_meta_reg(matcher, key, reg, value, mask); } } @@ -5923,6 +5940,8 @@ flow_dv_translate_item_meta_vport(void *matcher, void *key, /** * Add tag item to matcher * + * @param[in] dev + * The devich to configure through. * @param[in, out] matcher * Flow matcher. * @param[in, out] key @@ -5931,15 +5950,27 @@ flow_dv_translate_item_meta_vport(void *matcher, void *key, * Flow pattern to translate. */ static void -flow_dv_translate_mlx5_item_tag(void *matcher, void *key, +flow_dv_translate_mlx5_item_tag(struct rte_eth_dev *dev, + void *matcher, void *key, const struct rte_flow_item *item) { const struct mlx5_rte_flow_item_tag *tag_v = item->spec; const struct mlx5_rte_flow_item_tag *tag_m = item->mask; + uint32_t mask, value; assert(tag_v); - flow_dv_match_meta_reg(matcher, key, tag_v->id, tag_v->data, - tag_m ? tag_m->data : UINT32_MAX); + value = tag_v->data; + mask = tag_m ? tag_m->data : UINT32_MAX; + if (tag_v->id == REG_C_0) { + struct mlx5_priv *priv = dev->data->dev_private; + uint32_t msk_c0 = priv->sh->dv_regc0_mask; + uint32_t shl_c0 = rte_bsf32(msk_c0); + + mask &= msk_c0; + mask <<= shl_c0; + value <<= shl_c0; + } + flow_dv_match_meta_reg(matcher, key, tag_v->id, value, mask); } /** @@ -7237,7 +7268,7 @@ cnt_err: last_item = MLX5_FLOW_ITEM_TAG; break; case MLX5_RTE_FLOW_ITEM_TYPE_TAG: - flow_dv_translate_mlx5_item_tag(match_mask, + flow_dv_translate_mlx5_item_tag(dev, match_mask, match_value, items); last_item = MLX5_FLOW_ITEM_TAG; break; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:42.371368102 +0000 +++ 0101-net-mlx5-fix-matcher-field-usage-for-metadata-entiti.patch 2020-02-11 11:17:38.564004414 +0000 @@ -1,8 +1,10 @@ -From fde4341b665786632c6e4375ac25af65a3a5eebb Mon Sep 17 00:00:00 2001 +From aa2fd4ad6061da72ecfcf20ef1d8a7237c8ef6c9 Mon Sep 17 00:00:00 2001 From: Viacheslav Ovsiienko Date: Fri, 17 Jan 2020 11:16:06 +0000 Subject: [PATCH] net/mlx5: fix matcher field usage for metadata entities +[ upstream commit fde4341b665786632c6e4375ac25af65a3a5eebb ] + Matcher is flow table related structure providing the flow pattern to be translated directly in hardware controlling data. This structure includes the metadata register c0 field, that might be engaged to @@ -19,7 +21,6 @@ META/MARK items on some kernel configurations. Fixes: e554b672aa05 ("net/mlx5: support flow tag") -Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Matan Azrad @@ -28,10 +29,10 @@ 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c -index e1b2534d9f..da988f9dd7 100644 +index 9dd0dbdc0a..c9bb76a8fc 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c -@@ -1090,6 +1090,14 @@ flow_dv_convert_action_mark(struct rte_eth_dev *dev, +@@ -1088,6 +1088,14 @@ flow_dv_convert_action_mark(struct rte_eth_dev *dev, if (reg < 0) return reg; assert(reg > 0); @@ -46,7 +47,7 @@ reg_c_x[0].id = reg_to_field[reg]; return flow_dv_convert_modify_action(&item, reg_c_x, NULL, resource, MLX5_MODIFICATION_TYPE_SET, error); -@@ -6014,6 +6022,15 @@ flow_dv_translate_item_mark(struct rte_eth_dev *dev, +@@ -5842,6 +5850,15 @@ flow_dv_translate_item_mark(struct rte_eth_dev *dev, /* Get the metadata register index for the mark. */ reg = mlx5_flow_get_reg_id(dev, MLX5_FLOW_MARK, 0, NULL); assert(reg > 0); @@ -62,7 +63,7 @@ flow_dv_match_meta_reg(matcher, key, reg, value, mask); } } -@@ -6095,6 +6112,8 @@ flow_dv_translate_item_meta_vport(void *matcher, void *key, +@@ -5923,6 +5940,8 @@ flow_dv_translate_item_meta_vport(void *matcher, void *key, /** * Add tag item to matcher * @@ -71,7 +72,7 @@ * @param[in, out] matcher * Flow matcher. * @param[in, out] key -@@ -6103,15 +6122,27 @@ flow_dv_translate_item_meta_vport(void *matcher, void *key, +@@ -5931,15 +5950,27 @@ flow_dv_translate_item_meta_vport(void *matcher, void *key, * Flow pattern to translate. */ static void @@ -102,7 +103,7 @@ } /** -@@ -7470,7 +7501,7 @@ cnt_err: +@@ -7237,7 +7268,7 @@ cnt_err: last_item = MLX5_FLOW_ITEM_TAG; break; case MLX5_RTE_FLOW_ITEM_TYPE_TAG: