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 887D345D5D for ; Thu, 21 Nov 2024 00:43:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8037C40296; Thu, 21 Nov 2024 00:43:27 +0100 (CET) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mails.dpdk.org (Postfix) with ESMTP id 5BB7C43272 for ; Thu, 21 Nov 2024 00:43:25 +0100 (CET) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so2179765e9.1 for ; Wed, 20 Nov 2024 15:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732146205; x=1732751005; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D9HzzvcLaChVsFom/YMsmkwKIJ0/Yu1mDuqWKf2KV8k=; b=ZSkv+79KJZzkGblfj7LPlileWkzPeFsfEOFV1El2W/OQTKsCLx+vFTG3n48mb3ucRF wDTwSjBmiUAxUu31fQ3Nzw0rX4/XpYPA/NqkND2Urtwv/3HlFqQZcZwUljPhqkjE4ew+ ddk/CrqOdTaBwLhjjs/+z3zS/La/ehe/n4zGzJkcVPctlatEOtoiP4b+dQMUL0nslmi3 KC5AczfCp8Tg0FVW9EuigZ093TWYGiNckydvtTE4Otz1PFsxdC18uYHqjdBGPsD1ck88 WM9So39YinHO3zrTsQlflEY1Q93bKv0ijhtLf8ylgUNHIC4B8Q73hLfHEf4mDQAPBGP6 tVjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732146205; x=1732751005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D9HzzvcLaChVsFom/YMsmkwKIJ0/Yu1mDuqWKf2KV8k=; b=Gcv0XUEqToPfKn0rJxC+GXJsx40shLxieRDZeMkCR75b8lLRfE9pYVqInB2MBt4omN TLpy+33x5wDyxMUUf89wtGy0DDQQx3XEOK6t0I0S+xsDx6RI2BTMVIKypdfnE6oYttyN xbUDVEA8K57DN0LAMcsjQv8WUlLDuXYmSLcxQ3C9VHNF3Ki6408OWp3RXBBvhWFhX0LW qvca96zz6HjA5rk1vfYMbNEAr9BSovsYcDl0Q7c8OTw0BGJh8d91t0hQs9Al6mvq57o/ S/7ACwzKApzRUl4To5jymJ2LWSZdzy5tqbUp4Ewis6VIz7DSiQfCfDx9QOHGdfsuwiyd 3IJA== X-Forwarded-Encrypted: i=1; AJvYcCU/wxDrRo2sD+bpVygKmEGAbNBnR84zlazc3J9DuAOfBHVfn0rTT/3vlONxNf9CtUufeCKmN0o=@dpdk.org X-Gm-Message-State: AOJu0Yxz7Qs3loexkFoZUjHnYswCsIvecFl09wwBu1aAB91sfHcRiUL1 QKOFb6BCuyJlNUDVEA7P2/puYzBi9GAcRindhDNYAw/tZ8yoZtva X-Gm-Gg: ASbGnctzrkCrn2endGHuP1pJOI3rqwSdvtIinU1Ftu+h5baw6T9BBu85eB4PefMRoZM QktzygYxLAyalfmIwevkej6huCX5ksTVnzknpTGA+rRYya78tUqBsgmA7utysVHipTTn/gBVIJZ 3C3aHoBvfOWmWxV9zvbLIY3aLBs6uFTPkLlqLJ6I9FGtGUuBLcHlgVwWrzIwg8TYCNLDIOHM457 rN8c+wZKSjVcSyNaShw0VcT2Yhikp9h3+WKRDLpvGWwE0fN8NxuxqrW X-Google-Smtp-Source: AGHT+IGtKdh8K2Yf7bz4gD9E7uFHPDevs5psXA8Nao7CjqcyTsg+WBWhdc+WQ9L1CrxeEzmYuRgIUw== X-Received: by 2002:a05:600c:19d0:b0:431:4b88:d408 with SMTP id 5b1f17b1804b1-4334898148amr39355355e9.5.1732146204929; Wed, 20 Nov 2024 15:43:24 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:21cd:def0:a01d:d2aa]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433b45f5c33sm34743295e9.10.2024.11.20.15.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 15:43:24 -0800 (PST) From: luca.boccassi@gmail.com To: Erez Shitrit Cc: Bing Zhao , Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5/hws: fix allocation of STCs' has been queued to stable release 22.11.7 Date: Wed, 20 Nov 2024 23:41:42 +0000 Message-ID: <20241120234215.233355-17-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241120234215.233355-1-luca.boccassi@gmail.com> References: <20241112220754.666489-40-luca.boccassi@gmail.com> <20241120234215.233355-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 22.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/22/24. 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/08bdeeee6b35210eba4ade0fc3e34369d85f6708 Thanks. Luca Boccassi --- >From 08bdeeee6b35210eba4ade0fc3e34369d85f6708 Mon Sep 17 00:00:00 2001 From: Erez Shitrit Date: Tue, 29 Oct 2024 15:24:03 +0200 Subject: [PATCH] net/mlx5/hws: fix allocation of STCs [ upstream commit 691326d15da263d068de71c468c74c225c4f75c3 ] STC is a limited resource of the HW, and might get consumed till no more contexts can be opened. So, let the user to define the size of how many STCs to allocate per context. In case the user has many representors, no need to allocate per each of them the default value of STCs, otherwise after a certain numbers of representors no more STC's will remain in the system. Fixes: b0290e56dd08 ("net/mlx5/hws: add context object") Signed-off-by: Erez Shitrit Signed-off-by: Bing Zhao Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/hws/mlx5dr.h | 4 +++- drivers/net/mlx5/hws/mlx5dr_context.c | 9 ++++++--- drivers/net/mlx5/mlx5_flow.h | 3 +++ drivers/net/mlx5/mlx5_flow_hw.c | 3 +++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index d570810e95..d5a5299a23 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -95,8 +95,10 @@ struct mlx5dr_context_attr { uint16_t queues; uint16_t queue_size; size_t initial_log_ste_memory; /* Currently not in use */ - /* Optional PD used for allocating res ources */ + /* Optional PD used for allocating resources */ struct ibv_pd *pd; + /* Optional the STC array size for that context */ + size_t initial_log_stc_memory; }; struct mlx5dr_table_attr { diff --git a/drivers/net/mlx5/hws/mlx5dr_context.c b/drivers/net/mlx5/hws/mlx5dr_context.c index d1923a8e93..21047b8384 100644 --- a/drivers/net/mlx5/hws/mlx5dr_context.c +++ b/drivers/net/mlx5/hws/mlx5dr_context.c @@ -4,7 +4,8 @@ #include "mlx5dr_internal.h" -static int mlx5dr_context_pools_init(struct mlx5dr_context *ctx) +static int mlx5dr_context_pools_init(struct mlx5dr_context *ctx, + struct mlx5dr_context_attr *attr) { struct mlx5dr_pool_attr pool_attr = {0}; uint8_t max_log_sz; @@ -16,7 +17,9 @@ static int mlx5dr_context_pools_init(struct mlx5dr_context *ctx) /* Create an STC pool per FT type */ pool_attr.pool_type = MLX5DR_POOL_TYPE_STC; pool_attr.flags = MLX5DR_POOL_FLAGS_FOR_STC_POOL; - max_log_sz = RTE_MIN(MLX5DR_POOL_STC_LOG_SZ, ctx->caps->stc_alloc_log_max); + if (!attr->initial_log_stc_memory) + attr->initial_log_stc_memory = MLX5DR_POOL_STC_LOG_SZ; + max_log_sz = RTE_MIN(attr->initial_log_stc_memory, ctx->caps->stc_alloc_log_max); pool_attr.alloc_log_sz = RTE_MAX(max_log_sz, ctx->caps->stc_alloc_log_gran); for (i = 0; i < MLX5DR_TABLE_TYPE_MAX; i++) { @@ -151,7 +154,7 @@ static int mlx5dr_context_init_hws(struct mlx5dr_context *ctx, if (ret) return ret; - ret = mlx5dr_context_pools_init(ctx); + ret = mlx5dr_context_pools_init(ctx, attr); if (ret) goto uninit_pd; diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 1aff287616..d523cff739 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -2647,4 +2647,7 @@ int mlx5_flow_item_field_width(struct rte_eth_dev *dev, enum rte_flow_field_id field, int inherit, const struct rte_flow_attr *attr, struct rte_flow_error *error); + +#define MLX5_REPR_STC_MEMORY_LOG 11 + #endif /* RTE_PMD_MLX5_FLOW_H_ */ diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index aa315c054d..bff95133cf 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -7295,6 +7295,9 @@ flow_hw_configure(struct rte_eth_dev *dev, } dr_ctx_attr.pd = priv->sh->cdev->pd; dr_ctx_attr.queues = nb_q_updated; + /* Assign initial value of STC numbers for representors. */ + if (priv->representor) + dr_ctx_attr.initial_log_stc_memory = MLX5_REPR_STC_MEMORY_LOG; /* Queue size should all be the same. Take the first one. */ dr_ctx_attr.queue_size = _queue_attr[0]->size; dr_ctx = mlx5dr_context_open(priv->sh->cdev->ctx, &dr_ctx_attr); -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-20 23:41:23.303391148 +0000 +++ 0017-net-mlx5-hws-fix-allocation-of-STCs.patch 2024-11-20 23:41:22.724195467 +0000 @@ -1 +1 @@ -From 691326d15da263d068de71c468c74c225c4f75c3 Mon Sep 17 00:00:00 2001 +From 08bdeeee6b35210eba4ade0fc3e34369d85f6708 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 691326d15da263d068de71c468c74c225c4f75c3 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index 1b58eeb2c7..3668ab9fcf 100644 +index d570810e95..d5a5299a23 100644 @@ -31 +32 @@ -@@ -103,8 +103,10 @@ struct mlx5dr_context_attr { +@@ -95,8 +95,10 @@ struct mlx5dr_context_attr { @@ -40,3 +41,3 @@ - /* Optional other ctx for resources allocation, all objects will be created on it */ - struct ibv_context *shared_ibv_ctx; - bool bwc; /* add support for backward compatible API*/ + }; + + struct mlx5dr_table_attr { @@ -44 +45 @@ -index db5e72927a..24741afe58 100644 +index d1923a8e93..21047b8384 100644 @@ -47,3 +48,3 @@ -@@ -19,7 +19,8 @@ uint8_t mlx5dr_context_get_reparse_mode(struct mlx5dr_context *ctx) - return MLX5_IFC_RTC_REPARSE_ALWAYS; - } +@@ -4,7 +4,8 @@ + + #include "mlx5dr_internal.h" @@ -57 +58 @@ -@@ -34,7 +35,9 @@ static int mlx5dr_context_pools_init(struct mlx5dr_context *ctx) +@@ -16,7 +17,9 @@ static int mlx5dr_context_pools_init(struct mlx5dr_context *ctx) @@ -68 +69 @@ -@@ -172,7 +175,7 @@ static int mlx5dr_context_init_hws(struct mlx5dr_context *ctx, +@@ -151,7 +154,7 @@ static int mlx5dr_context_init_hws(struct mlx5dr_context *ctx, @@ -78 +79 @@ -index 693e07218d..d871b62854 100644 +index 1aff287616..d523cff739 100644 @@ -81,4 +82,4 @@ -@@ -3652,6 +3652,9 @@ flow_hw_get_ipv6_route_ext_mod_id_from_ctx(void *dr_ctx, uint8_t idx) - void - mlx5_indirect_list_handles_release(struct rte_eth_dev *dev); - #ifdef HAVE_MLX5_HWS_SUPPORT +@@ -2647,4 +2647,7 @@ int mlx5_flow_item_field_width(struct rte_eth_dev *dev, + enum rte_flow_field_id field, int inherit, + const struct rte_flow_attr *attr, + struct rte_flow_error *error); @@ -88,3 +89 @@ - struct mlx5_mirror; - void - mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror); + #endif /* RTE_PMD_MLX5_FLOW_H_ */ @@ -92 +91 @@ -index 2a9ef71cd8..c43520ed51 100644 +index aa315c054d..bff95133cf 100644 @@ -95 +94 @@ -@@ -11825,6 +11825,9 @@ __flow_hw_configure(struct rte_eth_dev *dev, +@@ -7295,6 +7295,9 @@ flow_hw_configure(struct rte_eth_dev *dev, @@ -104 +103 @@ - if (port_attr->flags & RTE_FLOW_PORT_FLAG_SHARE_INDIRECT) { + dr_ctx = mlx5dr_context_open(priv->sh->cdev->ctx, &dr_ctx_attr);