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 1A2E3A0547 for ; Tue, 9 Feb 2021 11:35:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12AB2160705; Tue, 9 Feb 2021 11:35:36 +0100 (CET) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mails.dpdk.org (Postfix) with ESMTP id 9AC42160706 for ; Tue, 9 Feb 2021 11:35:34 +0100 (CET) Received: by mail-wm1-f48.google.com with SMTP id w4so2597845wmi.4 for ; Tue, 09 Feb 2021 02:35:34 -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=QgCnIn5cqgMB3XhyPP1mnI0dVxDIrFmO5fJrEYUq7Fw=; b=szvuJARDYL2oKC9g0ptmsVt0DNAkxitGrHFTyYXd/0Y5/ERCRCVvxiZeKrSnsavF76 /hUVJM28RgABpA7TKFGf1eZ33OYAxipHMBxOrNtzPz7xfHBPeGdWhV7KK+Pnbzr1pmEX dfmqX07MnPfMCmN5Y7+oNJ7iWR1kK21Apm2q21nTgKeEjKF2XZZVsTrLwCWnGLXa/LBZ xdB5dERDDCKDOEh28L9tEeF31iuPsbFpehPB5raw/G5WXKw9OWP101Ev5Ll53mNROoCA lbZ52a6dnDH290/8BgShYOe2Jxaun3Y9jYQn5yDQKwZ9iSX7vE6SYNBSgH5EQkXCawlp R8gQ== 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=QgCnIn5cqgMB3XhyPP1mnI0dVxDIrFmO5fJrEYUq7Fw=; b=evy8acKQIIh5CcGILRXfZWxw9jkN9xFAg7XWXT/7nVgbO1ek/7Iz0nTHseq1VXk2ut t6h75ZVxHSi7jhGCrBi9WNSIAv/rhtikkTNwyyT9mOF3ZbRj6Ni8ZCn4sULCN7YafNEk rj7CgV82g5cLjoNf6gW/mB2H6nWrJh2ZgtvZkyy2ZKIBOHckGuC4CYLfOpMXAjWsUpYf KrPW1kXiSzNZUotVI3G0tVfEvaIE6HoEm7VyXzbEKvCutPKNqaNC3wcFwcRV29yBafFk wQllL3j1ff71uItmvNfHVn46mwz2+GIoX76n9VcceiLbYGk0d/dd91TE7K2x/NNnjz+a 688w== X-Gm-Message-State: AOAM531zQf1FIrPwSAMnFjJQkhf8jX1s8Cax+w+bQDuyT3k3l8+qG5sS OtCAwvsyZ+5+I+m3mAiVtVM= X-Google-Smtp-Source: ABdhPJy9BdxMsHCJspeSuC292NnUPR/sk11/ALbZDeGsyXOrlvckdbmnl7NtjKgiFwv3hU5sIXY+yA== X-Received: by 2002:a1c:ba44:: with SMTP id k65mr2688674wmf.25.1612866934338; Tue, 09 Feb 2021 02:35:34 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id 35sm40092010wrn.42.2021.02.09.02.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 02:35:33 -0800 (PST) From: luca.boccassi@gmail.com To: Dekel Peled Cc: Matan Azrad , dpdk stable Date: Tue, 9 Feb 2021 10:35:00 +0000 Message-Id: <20210209103529.466775-2-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 shared RSS translation and cleanup' 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/1fe06255a79e669f4cfcdb3633cc81aac56e2c2d Thanks. Luca Boccassi --- >From 1fe06255a79e669f4cfcdb3633cc81aac56e2c2d Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Mon, 1 Feb 2021 11:28:57 +0200 Subject: [PATCH] net/mlx5: fix shared RSS translation and cleanup [ upstream commit c83456cdd7953e0659d13dcf0affc39bf76ef460 ] This patch includes several updates of the shared RSS action: (1) The shared RSS action, introduced recently, uses existing definitions of the regular RSS action. The new defined value MLX5_RSS_HASH_IPV4_TCP uses existing definition IBV_RX_HASH_SRC_PORT_TCP twice, instead of using IBV_RX_HASH_SRC_PORT_TCP and IBV_RX_HASH_DST_PORT_TCP. --- --- The same is true for IPv4-UDP, IPv6-TCP, IPv6-UDP. As result, a shared RSS action with L4 type is specified as src-only. Flow rule using such shared action, while specifying L4 item in flow pattern, will fail to create. This patch updates the new definitions, to use the existing values correctly. (2) On shared RSS action destroy, in function __flow_dv_action_rss_release, the indirection table shared_rss->ind_tbl was released before shared_rss->refcnt was checked. This order is incorrect, since the indirection table should be released only when the shared RSS action is destroyed. This patch puts release function calls in correct order. (3) Variables declared of type "struct mlx5_shared_action_rss" are named "shared_rss", "action", and "shared_action". To improve code readability, this patch renames all to "shared_rss". Fixes: d7cfcddded61 ("net/mlx5: translate shared action for RSS action") Fixes: d2046c09aa64 ("net/mlx5: support shared action for RSS") Signed-off-by: Dekel Peled Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 4 +- drivers/net/mlx5/mlx5_flow.h | 8 ++-- drivers/net/mlx5/mlx5_flow_dv.c | 80 ++++++++++++++++----------------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index ba9a90210f..cda3ca557c 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -7177,12 +7177,12 @@ mlx5_shared_action_flush(struct rte_eth_dev *dev) { struct rte_flow_error error; struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_shared_action_rss *action; + struct mlx5_shared_action_rss *shared_rss; int ret = 0; uint32_t idx; ILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], - priv->rss_shared_actions, idx, action, next) { + priv->rss_shared_actions, idx, shared_rss, next) { ret |= mlx5_shared_action_destroy(dev, (struct rte_flow_shared_action *)(uintptr_t)idx, &error); } diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index e0211fb2dd..91f48923c0 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1048,17 +1048,17 @@ struct rte_flow { #define MLX5_RSS_HASH_IPV4 (IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_DST_IPV4) #define MLX5_RSS_HASH_IPV4_TCP \ (MLX5_RSS_HASH_IPV4 | \ - IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_SRC_PORT_TCP) + IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_DST_PORT_TCP) #define MLX5_RSS_HASH_IPV4_UDP \ (MLX5_RSS_HASH_IPV4 | \ - IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_SRC_PORT_UDP) + IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_DST_PORT_UDP) #define MLX5_RSS_HASH_IPV6 (IBV_RX_HASH_SRC_IPV6 | IBV_RX_HASH_DST_IPV6) #define MLX5_RSS_HASH_IPV6_TCP \ (MLX5_RSS_HASH_IPV6 | \ - IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_SRC_PORT_TCP) + IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_DST_PORT_TCP) #define MLX5_RSS_HASH_IPV6_UDP \ (MLX5_RSS_HASH_IPV6 | \ - IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_SRC_PORT_UDP) + IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_DST_PORT_UDP) #define MLX5_RSS_HASH_NONE 0ULL /* array of valid combinations of RX Hash fields for RSS */ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 32065efa41..7a1de50efa 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -11371,10 +11371,10 @@ __flow_dv_hrxqs_release(struct rte_eth_dev *dev, */ static int __flow_dv_action_rss_hrxqs_release(struct rte_eth_dev *dev, - struct mlx5_shared_action_rss *action) + struct mlx5_shared_action_rss *shared_rss) { - return __flow_dv_hrxqs_release(dev, &action->hrxq) + - __flow_dv_hrxqs_release(dev, &action->hrxq_tunnel); + return __flow_dv_hrxqs_release(dev, &shared_rss->hrxq) + + __flow_dv_hrxqs_release(dev, &shared_rss->hrxq_tunnel); } /** @@ -11398,25 +11398,25 @@ __flow_dv_action_rss_hrxqs_release(struct rte_eth_dev *dev, static int __flow_dv_action_rss_setup(struct rte_eth_dev *dev, uint32_t action_idx, - struct mlx5_shared_action_rss *action, + struct mlx5_shared_action_rss *shared_rss, struct rte_flow_error *error) { struct mlx5_flow_rss_desc rss_desc = { 0 }; size_t i; int err; - if (mlx5_ind_table_obj_setup(dev, action->ind_tbl)) { + if (mlx5_ind_table_obj_setup(dev, shared_rss->ind_tbl)) { return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "cannot setup indirection table"); } - memcpy(rss_desc.key, action->origin.key, MLX5_RSS_HASH_KEY_LEN); + memcpy(rss_desc.key, shared_rss->origin.key, MLX5_RSS_HASH_KEY_LEN); rss_desc.key_len = MLX5_RSS_HASH_KEY_LEN; - rss_desc.const_q = action->origin.queue; - rss_desc.queue_num = action->origin.queue_num; + rss_desc.const_q = shared_rss->origin.queue; + rss_desc.queue_num = shared_rss->origin.queue_num; /* Set non-zero value to indicate a shared RSS. */ rss_desc.shared_rss = action_idx; - rss_desc.ind_tbl = action->ind_tbl; + rss_desc.ind_tbl = shared_rss->ind_tbl; for (i = 0; i < MLX5_RSS_HASH_FIELDS_LEN; i++) { uint32_t hrxq_idx; uint64_t hash_fields = mlx5_rss_hash_fields[i]; @@ -11434,16 +11434,16 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev, goto error_hrxq_new; } err = __flow_dv_action_rss_hrxq_set - (action, hash_fields, tunnel, hrxq_idx); + (shared_rss, hash_fields, tunnel, hrxq_idx); MLX5_ASSERT(!err); } } return 0; error_hrxq_new: err = rte_errno; - __flow_dv_action_rss_hrxqs_release(dev, action); - if (!mlx5_ind_table_obj_release(dev, action->ind_tbl, true)) - action->ind_tbl = NULL; + __flow_dv_action_rss_hrxqs_release(dev, shared_rss); + if (!mlx5_ind_table_obj_release(dev, shared_rss->ind_tbl, true)) + shared_rss->ind_tbl = NULL; rte_errno = err; return -rte_errno; } @@ -11472,7 +11472,7 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_shared_action_rss *shared_action = NULL; + struct mlx5_shared_action_rss *shared_rss = NULL; void *queue = NULL; struct rte_flow_action_rss *origin; const uint8_t *rss_key; @@ -11482,9 +11482,9 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, RTE_SET_USED(conf); queue = mlx5_malloc(0, RTE_ALIGN_CEIL(queue_size, sizeof(void *)), 0, SOCKET_ID_ANY); - shared_action = mlx5_ipool_zmalloc + shared_rss = mlx5_ipool_zmalloc (priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], &idx); - if (!shared_action || !queue) { + if (!shared_rss || !queue) { rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "cannot allocate resource memory"); @@ -11496,43 +11496,43 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, "rss action number out of range"); goto error_rss_init; } - shared_action->ind_tbl = mlx5_malloc(MLX5_MEM_ZERO, - sizeof(*shared_action->ind_tbl), - 0, SOCKET_ID_ANY); - if (!shared_action->ind_tbl) { + shared_rss->ind_tbl = mlx5_malloc(MLX5_MEM_ZERO, + sizeof(*shared_rss->ind_tbl), + 0, SOCKET_ID_ANY); + if (!shared_rss->ind_tbl) { rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "cannot allocate resource memory"); goto error_rss_init; } memcpy(queue, rss->queue, queue_size); - shared_action->ind_tbl->queues = queue; - shared_action->ind_tbl->queues_n = rss->queue_num; - origin = &shared_action->origin; + shared_rss->ind_tbl->queues = queue; + shared_rss->ind_tbl->queues_n = rss->queue_num; + origin = &shared_rss->origin; origin->func = rss->func; origin->level = rss->level; /* RSS type 0 indicates default RSS type (ETH_RSS_IP). */ origin->types = !rss->types ? ETH_RSS_IP : rss->types; /* NULL RSS key indicates default RSS key. */ rss_key = !rss->key ? rss_hash_default_key : rss->key; - memcpy(shared_action->key, rss_key, MLX5_RSS_HASH_KEY_LEN); - origin->key = &shared_action->key[0]; + memcpy(shared_rss->key, rss_key, MLX5_RSS_HASH_KEY_LEN); + origin->key = &shared_rss->key[0]; origin->key_len = MLX5_RSS_HASH_KEY_LEN; origin->queue = queue; origin->queue_num = rss->queue_num; - if (__flow_dv_action_rss_setup(dev, idx, shared_action, error)) + if (__flow_dv_action_rss_setup(dev, idx, shared_rss, error)) goto error_rss_init; - rte_spinlock_init(&shared_action->action_rss_sl); - __atomic_add_fetch(&shared_action->refcnt, 1, __ATOMIC_RELAXED); + rte_spinlock_init(&shared_rss->action_rss_sl); + __atomic_add_fetch(&shared_rss->refcnt, 1, __ATOMIC_RELAXED); rte_spinlock_lock(&priv->shared_act_sl); ILIST_INSERT(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], - &priv->rss_shared_actions, idx, shared_action, next); + &priv->rss_shared_actions, idx, shared_rss, next); rte_spinlock_unlock(&priv->shared_act_sl); return idx; error_rss_init: - if (shared_action) { - if (shared_action->ind_tbl) - mlx5_free(shared_action->ind_tbl); + if (shared_rss) { + if (shared_rss->ind_tbl) + mlx5_free(shared_rss->ind_tbl); mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], idx); } @@ -11577,14 +11577,6 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "shared rss hrxq has references"); - queue = shared_rss->ind_tbl->queues; - remaining = mlx5_ind_table_obj_release(dev, shared_rss->ind_tbl, true); - if (remaining) - return rte_flow_error_set(error, EBUSY, - RTE_FLOW_ERROR_TYPE_ACTION, - NULL, - "shared rss indirection table has" - " references"); if (!__atomic_compare_exchange_n(&shared_rss->refcnt, &old_refcnt, 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) @@ -11592,6 +11584,14 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "shared rss has references"); + queue = shared_rss->ind_tbl->queues; + remaining = mlx5_ind_table_obj_release(dev, shared_rss->ind_tbl, true); + if (remaining) + return rte_flow_error_set(error, EBUSY, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, + "shared rss indirection table has" + " references"); mlx5_free(queue); rte_spinlock_lock(&priv->shared_act_sl); ILIST_REMOVE(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-09 10:34:58.009720643 +0000 +++ 0002-net-mlx5-fix-shared-RSS-translation-and-cleanup.patch 2021-02-09 10:34:57.846582764 +0000 @@ -1 +1 @@ -From c83456cdd7953e0659d13dcf0affc39bf76ef460 Mon Sep 17 00:00:00 2001 +From 1fe06255a79e669f4cfcdb3633cc81aac56e2c2d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c83456cdd7953e0659d13dcf0affc39bf76ef460 ] + @@ -37 +38,0 @@ -Cc: stable@dpdk.org @@ -48 +49 @@ -index 0197a07209..632f46dfde 100644 +index ba9a90210f..cda3ca557c 100644 @@ -51 +52 @@ -@@ -7452,12 +7452,12 @@ mlx5_shared_action_flush(struct rte_eth_dev *dev) +@@ -7177,12 +7177,12 @@ mlx5_shared_action_flush(struct rte_eth_dev *dev) @@ -67 +68 @@ -index a3a3c7f54f..8324e188e1 100644 +index e0211fb2dd..91f48923c0 100644 @@ -70 +71 @@ -@@ -1095,17 +1095,17 @@ struct rte_flow { +@@ -1048,17 +1048,17 @@ struct rte_flow { @@ -93 +94 @@ -index 8c11ac306f..e0874e3f5f 100644 +index 32065efa41..7a1de50efa 100644 @@ -96 +97 @@ -@@ -12552,10 +12552,10 @@ __flow_dv_hrxqs_release(struct rte_eth_dev *dev, +@@ -11371,10 +11371,10 @@ __flow_dv_hrxqs_release(struct rte_eth_dev *dev, @@ -110 +111 @@ -@@ -12579,25 +12579,25 @@ __flow_dv_action_rss_hrxqs_release(struct rte_eth_dev *dev, +@@ -11398,25 +11398,25 @@ __flow_dv_action_rss_hrxqs_release(struct rte_eth_dev *dev, @@ -142 +143 @@ -@@ -12615,16 +12615,16 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev, +@@ -11434,16 +11434,16 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev, @@ -163 +164 @@ -@@ -12653,7 +12653,7 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, +@@ -11472,7 +11472,7 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, @@ -172 +173 @@ -@@ -12663,9 +12663,9 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, +@@ -11482,9 +11482,9 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, @@ -184 +185 @@ -@@ -12677,43 +12677,43 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, +@@ -11496,43 +11496,43 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev, @@ -244 +245 @@ -@@ -12758,14 +12758,6 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx, +@@ -11577,14 +11577,6 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx, @@ -259 +260 @@ -@@ -12773,6 +12765,14 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx, +@@ -11592,6 +11584,14 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,