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 77365A0524 for ; Fri, 5 Feb 2021 12:39:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70894188A5C; Fri, 5 Feb 2021 12:39:04 +0100 (CET) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mails.dpdk.org (Postfix) with ESMTP id 0541A4067B for ; Fri, 5 Feb 2021 12:39:03 +0100 (CET) Received: by mail-wr1-f46.google.com with SMTP id v15so7340222wrx.4 for ; Fri, 05 Feb 2021 03:39:03 -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=4HvIZCDb3hAGgh0GvVOgv5fPxed+bTZ5qH+v3XFo6Rw=; b=ry5ag7p45r2lID2IKrJkIx2jtR5Uaw6163LYR5h08i8mBqZAUm6gWASzS6C5T45ZcX ll81mlIDHKYCnldgW7yf6BF8MbM9/0D7KpOaICpyIUBWl8Bl+B9U+QJ7ZvPNP1aApLCN fpeeZ7Mwsk3ioMuBvDXz+WSe+IvBUd785m1JatOZXOSwzqx6gjRISLpDGBSxHVRtZWOH Z+oBugkxo01iQBf+uKFm8k9fBbg1Ttc/Q5G/RZ/igMSedH2tSFJWy1dNtYI7Zw6jFOCx QlOpG7qlOf4tOm7iVYnlDdTgaqCjsAXA/HumlnpgMGtXTcnVdQfuQAg+xQOBZhr48OH+ 5ZOQ== 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=4HvIZCDb3hAGgh0GvVOgv5fPxed+bTZ5qH+v3XFo6Rw=; b=ALuA2lG32v0AYPqrf6UonWpc1WZ7tKy8XccrELL0zLK06e3YLxgFWtC+En0hd9mi9R SyC6nLgSgJwWkDxqVZox/Sg2lRHuYfka89rllFFRKmNViFMx0Ihyo0aRiqw20FFMf181 HcwfINQya+GClC3e/mpOejqkA7VTf062qX3lh8EL8HLho2MH2hTakW39WAFUGgPI+i/g yCpmHJ+xQ96MNovW2d5jr7ZZFzzJLpEmg3pkWfceq+roTp1e5dKL82xX5VRYlGNu6Msi vaLo+6cnEub6yoUGNFsUdIWf7xv0M16W8bXREueV3M3v6vqz+Eb67u5DT9v7kLOolpCe BMhA== X-Gm-Message-State: AOAM531c5xCwt3BHG7rT4pkTTy12wq9WHykRNeE1RFkRkZ8Si370k1m1 qpz1crD1OKTP/iZgYHhftJTFNEd7EAmwUGBc X-Google-Smtp-Source: ABdhPJwP7iVZk7Gf7OZ7lLmuA/t9n9oekD1Jlxw11XVdmjgCyXZ4rQS4sz1Z/gMrrwonw0sJrVqyQw== X-Received: by 2002:a05:6000:254:: with SMTP id m20mr4608730wrz.300.1612525142774; Fri, 05 Feb 2021 03:39:02 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id z18sm12258665wro.91.2021.02.05.03.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:39:02 -0800 (PST) From: luca.boccassi@gmail.com To: Jiawei Wang Cc: Viacheslav Ovsiienko , dpdk stable Date: Fri, 5 Feb 2021 11:19:05 +0000 Message-Id: <20210205111920.1272063-259-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix count actions query in sample flow' 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/07/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/bcf89725d0c2ddd210783fb3aaf85f9f6c30d59f Thanks. Luca Boccassi --- >From bcf89725d0c2ddd210783fb3aaf85f9f6c30d59f Mon Sep 17 00:00:00 2001 From: Jiawei Wang Date: Tue, 26 Jan 2021 17:37:56 +0200 Subject: [PATCH] net/mlx5: fix count actions query in sample flow [ upstream commit 84382dfadf2e5de23db750c6bf61bde725b1dc8d ] If the count action was presented in sample actions list, MLX5 PMD created the counter resource and saved the index of counter in the sample resource only, the counter index of flow was not updated. This patch removes the counter index in the sampler resource and saves it into the flow, and adds the checking to make sure only one count be created once per flow, it's used for all sample sub flows. Fixes: 0756228b2704 ("net/mlx5: update translate function for sample action") Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 1 - drivers/net/mlx5/mlx5_flow_dv.c | 62 ++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index a249c292e3..e0211fb2dd 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -552,7 +552,6 @@ struct mlx5_flow_sub_actions_list { struct mlx5_flow_sub_actions_idx { uint32_t rix_hrxq; /**< Hash Rx queue object index. */ uint32_t rix_tag; /**< Index to the tag action. */ - uint32_t cnt; uint32_t rix_port_id_action; /**< Index to port ID action resource. */ uint32_t rix_encap_decap; /**< Index to encap/decap resource. */ }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 0841279f14..4dca11ad5b 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_flags + * Holds the actions detected until now. * @param[out] error * Pointer to error structure. * @@ -2550,10 +2552,15 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, */ static int flow_dv_validate_action_count(struct rte_eth_dev *dev, + uint64_t action_flags, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; + 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; #ifdef HAVE_IBV_FLOW_DEVX_COUNTERS @@ -4342,7 +4349,7 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, /** * Validate the sample action. * - * @param[in] action_flags + * @param[in, out] action_flags * Holds the actions detected until now. * @param[in] action * Pointer to the sample action. @@ -4359,7 +4366,7 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -flow_dv_validate_action_sample(uint64_t action_flags, +flow_dv_validate_action_sample(uint64_t *action_flags, const struct rte_flow_action *action, struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -4389,17 +4396,17 @@ flow_dv_validate_action_sample(uint64_t action_flags, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "sample action not supported"); - if (action_flags & MLX5_FLOW_ACTION_SAMPLE) + if (*action_flags & MLX5_FLOW_ACTION_SAMPLE) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "Multiple sample actions not " "supported"); - if (action_flags & MLX5_FLOW_ACTION_METER) + if (*action_flags & MLX5_FLOW_ACTION_METER) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, action, "wrong action order, meter should " "be after sample action"); - if (action_flags & MLX5_FLOW_ACTION_JUMP) + if (*action_flags & MLX5_FLOW_ACTION_JUMP) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, action, "wrong action order, jump should " @@ -4437,10 +4444,18 @@ flow_dv_validate_action_sample(uint64_t action_flags, ++actions_n; break; case RTE_FLOW_ACTION_TYPE_COUNT: - ret = flow_dv_validate_action_count(dev, error); + 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); if (ret < 0) return ret; sub_action_flags |= MLX5_FLOW_ACTION_COUNT; + *action_flags |= MLX5_FLOW_ACTION_COUNT; ++actions_n; break; case RTE_FLOW_ACTION_TYPE_PORT_ID: @@ -5731,7 +5746,8 @@ 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, error); + ret = flow_dv_validate_action_count(dev, action_flags, + error); if (ret < 0) return ret; action_flags |= MLX5_FLOW_ACTION_COUNT; @@ -6031,7 +6047,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, rw_act_num += MLX5_ACT_NUM_SET_DSCP; break; case RTE_FLOW_ACTION_TYPE_SAMPLE: - ret = flow_dv_validate_action_sample(action_flags, + ret = flow_dv_validate_action_sample(&action_flags, actions, dev, attr, item_flags, error); @@ -8685,10 +8701,6 @@ flow_dv_sample_sub_actions_release(struct rte_eth_dev *dev, flow_dv_tag_release(dev, act_res->rix_tag); act_res->rix_tag = 0; } - if (act_res->cnt) { - flow_dv_counter_free(dev, act_res->cnt); - act_res->cnt = 0; - } } int @@ -9067,6 +9079,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev, struct mlx5_flow_sub_actions_list *sample_act; struct mlx5_flow_sub_actions_idx *sample_idx; struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace(); + struct rte_flow *flow = dev_flow->flow; struct mlx5_flow_rss_desc *rss_desc; uint64_t action_flags = 0; @@ -9138,21 +9151,22 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev, } case RTE_FLOW_ACTION_TYPE_COUNT: { - uint32_t counter; - - counter = flow_dv_translate_create_counter(dev, - dev_flow, sub_actions->conf, 0); - if (!counter) - return rte_flow_error_set + if (!flow->counter) { + flow->counter = + flow_dv_translate_create_counter(dev, + dev_flow, sub_actions->conf, + 0); + if (!flow->counter) + return rte_flow_error_set (error, rte_errno, - RTE_FLOW_ERROR_TYPE_ACTION, - NULL, - "cannot create counter" - " object."); - sample_idx->cnt = counter; + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, + "cannot create counter" + " object."); + } sample_act->dr_cnt_action = (flow_dv_counter_get_by_idx(dev, - counter, NULL))->action; + flow->counter, NULL))->action; sample_actions[sample_act->actions_num++] = sample_act->dr_cnt_action; action_flags |= MLX5_FLOW_ACTION_COUNT; -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:40.581240715 +0000 +++ 0259-net-mlx5-fix-count-actions-query-in-sample-flow.patch 2021-02-05 11:18:29.286700251 +0000 @@ -1 +1 @@ -From 84382dfadf2e5de23db750c6bf61bde725b1dc8d Mon Sep 17 00:00:00 2001 +From bcf89725d0c2ddd210783fb3aaf85f9f6c30d59f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 84382dfadf2e5de23db750c6bf61bde725b1dc8d ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index e9e33972ef..0b949f4a3a 100644 +index a249c292e3..e0211fb2dd 100644 @@ -28 +29 @@ -@@ -578,7 +578,6 @@ struct mlx5_flow_sub_actions_list { +@@ -552,7 +552,6 @@ struct mlx5_flow_sub_actions_list { @@ -35 +36 @@ - uint32_t rix_jump; /**< Index to the jump action resource. */ + }; @@ -37 +38 @@ -index 78cae46080..8ece56ba5a 100644 +index 0841279f14..4dca11ad5b 100644 @@ -40 +41 @@ -@@ -2612,6 +2612,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, @@ -49 +50 @@ -@@ -2620,10 +2622,15 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, +@@ -2550,10 +2552,15 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, @@ -65 +66 @@ -@@ -4395,7 +4402,7 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, +@@ -4342,7 +4349,7 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, @@ -74 +75 @@ -@@ -4416,7 +4423,7 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, +@@ -4359,7 +4366,7 @@ flow_dv_modify_create_cb(struct mlx5_hlist *list, uint64_t key __rte_unused, @@ -83 +84 @@ -@@ -4447,17 +4454,17 @@ flow_dv_validate_action_sample(uint64_t action_flags, +@@ -4389,17 +4396,17 @@ flow_dv_validate_action_sample(uint64_t action_flags, @@ -104 +105 @@ -@@ -4517,10 +4524,18 @@ flow_dv_validate_action_sample(uint64_t action_flags, +@@ -4437,10 +4444,18 @@ flow_dv_validate_action_sample(uint64_t action_flags, @@ -124 +125 @@ -@@ -5848,7 +5863,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -5731,7 +5746,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -134 +135 @@ -@@ -6148,7 +6164,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -6031,7 +6047,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -142,2 +143,2 @@ - rss, &sample_rss, -@@ -9064,10 +9080,6 @@ flow_dv_sample_sub_actions_release(struct rte_eth_dev *dev, + error); +@@ -8685,10 +8701,6 @@ flow_dv_sample_sub_actions_release(struct rte_eth_dev *dev, @@ -151,4 +152,4 @@ - if (act_res->rix_jump) { - flow_dv_jump_tbl_resource_release(dev, act_res->rix_jump); - act_res->rix_jump = 0; -@@ -9460,6 +9472,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev, + } + + int +@@ -9067,6 +9079,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev, @@ -162 +163 @@ -@@ -9570,21 +9583,22 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev, +@@ -9138,21 +9151,22 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev,