From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D780CA0547 for ; Tue, 9 Feb 2021 11:36:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E3FC40147; Tue, 9 Feb 2021 11:36:13 +0100 (CET) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mails.dpdk.org (Postfix) with ESMTP id 5764C40147 for ; Tue, 9 Feb 2021 11:36:10 +0100 (CET) Received: by mail-wr1-f49.google.com with SMTP id v15so20968423wrx.4 for ; Tue, 09 Feb 2021 02:36:10 -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=M8/StSJPiui9QEOk9sA8ISkT1KR7sOd0OUr4Zi0QrxE=; b=QP3i8hwdpTfcdpwXxRnt2hLa8QPHenDgTzQfWdrkcUpXdWFP0dTH8hkn7Z6eXRMwQy zgpFZ4MSvbRlBC8NycLT5MWuRSON5IpXiJztEUPe3+C+yPgYtt+UHxWgWvsjm++JN7io Vx5o8qD7FUOkx/aLEPRpenblTQjUUuClYm3FCL/zMAcuNwFyztfi25jLvw4sttCMs8O7 hJTk4ePP0L7BR5xwQUftGq8psUrn0bwHztfFAgA2jVQnMRiuaxRCUJgRruJh05tVf4du sUUoxxDZRd2KgUAEvfdIE8F/e6M0+VyuiV35OKMkE5rkbSfLJsIXyywUReTA3KeJ4vgr XjOQ== 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=M8/StSJPiui9QEOk9sA8ISkT1KR7sOd0OUr4Zi0QrxE=; b=nP4wG9B5D1Eyz4hVBzplH9vF3H1OAAq9yIquLoXP7Ya0odp+6SqA8daZvvFjmBx6GU gPNlpExSWVp66m0INjoEkuFPLnKg7Uqwd+EuUgVxhAHlV/+s1qm5OlXLr4+buPU5sPY0 eOrlWpz6oFWd12csINpTHENv6lpa+dS/4E08D6ZIAarnVMuGQPgLIcg4nvoSUs1Lynh5 /jeMk/1IpF+rU72DWkAqjdgBTwj9Pvd/yRwi2bZMXBmN/zwwpKt0Mlc96jX0BJBhLrNk 2MIdM7PCjbDSNKMKXdBCJyA0N1It+v1GtdSovRJM2OkVFAhMwzIQ4ZuoxfmBpmnBsNT+ 9jZQ== X-Gm-Message-State: AOAM530SpX66IwA0CWQdlHVeIgBXE5JsxGF4bE8sjHvFz1CB3/PmcEuU qRDUH5i57+SZqiEqW6nnkj0= X-Google-Smtp-Source: ABdhPJydFfofBKRTrKioYXKI4eAtTDpIjF8Ddv/Uyhi0EX9enzJUbdoHnNGfbR375fwaOtNKDSIMcQ== X-Received: by 2002:a5d:6883:: with SMTP id h3mr1287501wru.90.1612866970162; Tue, 09 Feb 2021 02:36:10 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id c9sm3914202wmb.33.2021.02.09.02.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 02:36:09 -0800 (PST) From: luca.boccassi@gmail.com To: Jiawei Wang Cc: Matan Azrad , dpdk stable Date: Tue, 9 Feb 2021 10:35:11 +0000 Message-Id: <20210209103529.466775-13-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210209103529.466775-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> <20210209103529.466775-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix counter and age flow action validation' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 20.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/11/21. 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. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/21fd2b8e2d44805d95843d07b954e9a378cf3c6e Thanks. Luca Boccassi --- >From 21fd2b8e2d44805d95843d07b954e9a378cf3c6e Mon Sep 17 00:00:00 2001 From: Jiawei Wang Date: Tue, 2 Feb 2021 18:42:49 +0200 Subject: [PATCH] net/mlx5: fix counter and age flow action validation [ upstream commit 5fe95d736471452cdf9f26d8b01fd0b8d6de90e0 ] Currently old age action was implemented by flow counter and only one counter index was maintained in each flow. While there was old age action and share count action in one flow, and the same share count action in the another flow, the counter was updated if second flow was hit, so it may cause the first flow didn't aged out since the counter was updated by second flow. This patch updates the validation function for count and old age action: - Old age and shared count action combination is not supported. - Old age and count(not shared) action could work in the same sub flow. Fixes: e7138997e07d ("net/mlx5: make shared counters thread safe") Signed-off-by: Jiawei Wang Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 55 ++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 7a1de50efa..481a3a7498 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2542,6 +2542,8 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, * * @param[in] dev * Pointer to rte_eth_dev structure. + * @param[in] action + * Pointer to the action structure. * @param[in] action_flags * Holds the actions detected until now. * @param[out] error @@ -2552,17 +2554,25 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, */ static int flow_dv_validate_action_count(struct rte_eth_dev *dev, + const struct rte_flow_action *action, uint64_t action_flags, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; + const struct rte_flow_action_count *count; + if (!priv->config.devx) + goto notsup_err; if (action_flags & MLX5_FLOW_ACTION_COUNT) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "duplicate count actions set"); - if (!priv->config.devx) - goto notsup_err; + count = (const struct rte_flow_action_count *)action->conf; + if (count && count->shared && (action_flags & MLX5_FLOW_ACTION_AGE) && + !priv->sh->flow_hit_aso_en) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "old age and shared count combination is not supported"); #ifdef HAVE_IBV_FLOW_DEVX_COUNTERS return 0; #endif @@ -4359,6 +4369,8 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, * Attributes of flow that includes this action. * @param[in] item_flags * Holds the items detected. + * @param[out] count + * Pointer to the COUNT action in sample action list. * @param[out] error * Pointer to error structure. * @@ -4371,6 +4383,7 @@ flow_dv_validate_action_sample(uint64_t *action_flags, struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const uint64_t item_flags, + const struct rte_flow_action_count **count, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; @@ -4444,16 +4457,13 @@ flow_dv_validate_action_sample(uint64_t *action_flags, ++actions_n; break; case RTE_FLOW_ACTION_TYPE_COUNT: - if (*action_flags & MLX5_FLOW_ACTION_COUNT) - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - action, - "duplicate count action set"); - ret = flow_dv_validate_action_count(dev, - sub_action_flags, - error); + ret = flow_dv_validate_action_count + (dev, act, + *action_flags | sub_action_flags, + error); if (ret < 0) return ret; + *count = act->conf; sub_action_flags |= MLX5_FLOW_ACTION_COUNT; *action_flags |= MLX5_FLOW_ACTION_COUNT; ++actions_n; @@ -5263,6 +5273,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const struct rte_flow_action_raw_decap *decap; const struct rte_flow_action_raw_encap *encap; const struct rte_flow_action_rss *rss; + const struct rte_flow_action_count *count = NULL; + const struct rte_flow_action_count *sample_count = NULL; const struct rte_flow_item_tcp nic_tcp_mask = { .hdr = { .tcp_flags = 0xFF, @@ -5746,10 +5758,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, ++actions_n; break; case RTE_FLOW_ACTION_TYPE_COUNT: - ret = flow_dv_validate_action_count(dev, action_flags, + ret = flow_dv_validate_action_count(dev, actions, + action_flags, error); if (ret < 0) return ret; + count = actions->conf; action_flags |= MLX5_FLOW_ACTION_COUNT; ++actions_n; break; @@ -6015,6 +6029,24 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; + /* + * Validate the regular AGE action (using counter) + * mutual exclusion with share counter actions. + */ + if (!priv->sh->flow_hit_aso_en) { + if (count && count->shared) + return rte_flow_error_set + (error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, + "old age and shared count combination is not supported"); + if (sample_count) + return rte_flow_error_set + (error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, + "old age action and count must be in the same sub flow"); + } action_flags |= MLX5_FLOW_ACTION_AGE; ++actions_n; break; @@ -6050,6 +6082,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, ret = flow_dv_validate_action_sample(&action_flags, actions, dev, attr, item_flags, + &sample_count, error); if (ret < 0) return ret; -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-09 10:34:58.437638764 +0000 +++ 0013-net-mlx5-fix-counter-and-age-flow-action-validation.patch 2021-02-09 10:34:57.886583539 +0000 @@ -1 +1 @@ -From 5fe95d736471452cdf9f26d8b01fd0b8d6de90e0 Mon Sep 17 00:00:00 2001 +From 21fd2b8e2d44805d95843d07b954e9a378cf3c6e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5fe95d736471452cdf9f26d8b01fd0b8d6de90e0 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index e0874e3f5f..4410c518f7 100644 +index 7a1de50efa..481a3a7498 100644 @@ -31 +32 @@ -@@ -3118,6 +3118,8 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, +@@ -2542,6 +2542,8 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, @@ -40 +41 @@ -@@ -3128,17 +3130,25 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, +@@ -2552,17 +2554,25 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, @@ -68,4 +69,4 @@ -@@ -5081,6 +5091,8 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, - * Pointer to the RSS action. - * @param[out] sample_rss - * Pointer to the RSS action in sample action list. +@@ -4359,6 +4369,8 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, + * Attributes of flow that includes this action. + * @param[in] item_flags + * Holds the items detected. @@ -77,4 +78,4 @@ -@@ -5095,6 +5107,7 @@ flow_dv_validate_action_sample(uint64_t *action_flags, - uint64_t item_flags, - const struct rte_flow_action_rss *rss, - const struct rte_flow_action_rss **sample_rss, +@@ -4371,6 +4383,7 @@ flow_dv_validate_action_sample(uint64_t *action_flags, + struct rte_eth_dev *dev, + const struct rte_flow_attr *attr, + const uint64_t item_flags, @@ -85 +86 @@ -@@ -5189,16 +5202,13 @@ flow_dv_validate_action_sample(uint64_t *action_flags, +@@ -4444,16 +4457,13 @@ flow_dv_validate_action_sample(uint64_t *action_flags, @@ -107 +108,2 @@ -@@ -6017,6 +6027,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -5263,6 +5273,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, + const struct rte_flow_action_raw_decap *decap; @@ -109,2 +111 @@ - const struct rte_flow_action_rss *rss = NULL; - const struct rte_flow_action_rss *sample_rss = NULL; + const struct rte_flow_action_rss *rss; @@ -116 +117 @@ -@@ -6528,10 +6540,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -5746,10 +5758,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -130 +131 @@ -@@ -6797,6 +6811,24 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -6015,6 +6029,24 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -155 +156,2 @@ -@@ -6833,6 +6865,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -6050,6 +6082,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, + ret = flow_dv_validate_action_sample(&action_flags, @@ -158 +159,0 @@ - rss, &sample_rss,