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 E363D45C0C for ; Tue, 29 Oct 2024 14:24:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CEE0D42E60; Tue, 29 Oct 2024 14:24:35 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2078.outbound.protection.outlook.com [40.107.244.78]) by mails.dpdk.org (Postfix) with ESMTP id 19D3140144; Tue, 29 Oct 2024 14:24:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qMAqi+lx0quFwDYu+BlLd8Er+ebjT1EGULtbUkUL8M+iunGx08uOpxnzbMSSOsvDDnMXiueBk0M3hCpZbA7ItoSeHZEEY0sVtfBv36oI6TaWQu/6S02n0HyrGnav59LPsfONK+poGvkabDYtdRMYxwqmc96qvzCd3qiRduiuG9FjoQBtX9+nh80/yh5HC7m+AV83Vp1TFK2bOxlHwceHa6n01HqzMioEAAoWgKUZOprG70v6pwCe99gSNnSmcaFpB6hT6sYsgelKUMNqw4of3z2UmZXQXxjtKQK9MA05DAETcvpkmFEruWTSSbvOS2fcSoiq/919Z45z7VbAouAUMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ReWXSOMp9Uwn/N/KFRJRAdgGJLgNyoybLnRzF/+UPbM=; b=ywi4LJYrppw9EbWYgCo2Ikom87NWJjQ/VBl+LHKrDEca9U/qWbGpVjxHYP4yeZSE+7Bvfr5wo2if3VtA3bIq2ZTa44QDnPbPHIkRmuKXUF1biHMMLmr5b4U/RWCJoT+QubLxpp0rjPZ0FHzFTyEhkJbo0SX/CS4eYtNFK73vRu4Nl6wJQbryG0C+OiQmn3I+6EjIUNMNTUvlFwwpnUnpn4yEIM+bA/h172mcOBj7UkGmoe9IdQ9uLt9f+ng2bh8sZnLkhpJwVh8dN/lBG05VCGG05b0OdA0e5vmVxAZFSx77cPSWFoVEbk/BvzyGLJdVhxantse3sYCn3aazmYBc0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ReWXSOMp9Uwn/N/KFRJRAdgGJLgNyoybLnRzF/+UPbM=; b=nIUer1LGeJsDsFQPJq2OoRMkqNVutAVxEAk11qOjmbpnOCqRWc7/i+L3TZ8U2CdPV5TaOoqq0ni0W+O+3CElmoKFbxPDUylEodFcA7dsY3rFY6pLCNNfXPoYKLPAfbRcvww3EJhEnWsuDJ6rg5O/zE98U/ctvUcHSP0CeYVlVmSPn5A1Klt4re6eWkpkueEALFp+ba5GjgRsajpoO85jEsTqtrlErsMIfkPmUAHr9OGDFstL6zv+3H1wsmIPnoPWutuXwk8CJAI7jurBsnwGKICPZeiSAAaTjvO7H/qRqfFBViI+aJSvMrhxvuzJubooiSC+9ghz20NZm36i8JeMUA== Received: from MN2PR12CA0032.namprd12.prod.outlook.com (2603:10b6:208:a8::45) by CY8PR12MB7219.namprd12.prod.outlook.com (2603:10b6:930:59::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Tue, 29 Oct 2024 13:24:27 +0000 Received: from BL6PEPF00020E66.namprd04.prod.outlook.com (2603:10b6:208:a8:cafe::9b) by MN2PR12CA0032.outlook.office365.com (2603:10b6:208:a8::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.17 via Frontend Transport; Tue, 29 Oct 2024 13:24:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E66.mail.protection.outlook.com (10.167.249.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Tue, 29 Oct 2024 13:24:26 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 29 Oct 2024 06:24:10 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 29 Oct 2024 06:24:09 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 29 Oct 2024 06:24:06 -0700 From: Itamar Gozlan To: , , , , , Dariusz Sosnowski , Viacheslav Ovsiienko , "Ori Kam" , Matan Azrad , Alex Vesker CC: , Subject: [PATCH] net/mlx5/hws: fix allocation of STCs Date: Tue, 29 Oct 2024 15:24:03 +0200 Message-ID: <20241029132403.232302-1-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E66:EE_|CY8PR12MB7219:EE_ X-MS-Office365-Filtering-Correlation-Id: 90ac953d-ebe4-4e9d-e65e-08dcf81d02ca X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ubLHjcFvQ+S+khh+9nipz+2nT7eqnH8lHJORglv0ZKWvq740ZBBvDDBhwjHO?= =?us-ascii?Q?ij4+/3Vkl77TIxK7fHpWdOEuPCEgjvy5G4FjZVa8pqfKYxkpyY0fGVlc4AFw?= =?us-ascii?Q?D44ZJAjYA4+D8qrqxXw5bsZfxvpSIbJ3NGuYAE7KG/pW5d8Ag3OrVoCXFrob?= =?us-ascii?Q?hm+Q76JsQnYGFEncA/OMP9skABusvuU6q8ACub+SDttsKiYJMYXLT7v/3O3D?= =?us-ascii?Q?D35H8fN5ixCgYbLJo7Xwt/eZUwA11UoHqUiV0gN4700PLHveL8zulX7fXR0w?= =?us-ascii?Q?WKPG+Y7vOmmFjgH0WZNGZZ+YndwliflZkGx7kj0HaFeHMkftliI2yKI+S42G?= =?us-ascii?Q?4rmR1kt0tiXLv/t8yRblQVjopvWeeQRy4zzHvT94S4+sUj25M6LkK5M9jTo5?= =?us-ascii?Q?sWTQy7QcKgRnRcgGKVpQL29ZYy/3VbUxxUbGzeFBADfT60OodDJHRINHI56p?= =?us-ascii?Q?2hdeOd9s/2sfi4XftVcx+QWgMI9Rgt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ii?Q?q2I3lX/MRrGqWzaEtBbxdz8EaN6NETKMIAhF15Wfk+axlUFR139zrEqhX9a/?= =?us-ascii?Q?B5mqyUVti5c=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 13:24:26.2328 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90ac953d-ebe4-4e9d-e65e-08dcf81d02ca X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E66.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7219 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 From: Erez Shitrit 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") Cc: stable@dpdk.org 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 0fe39e9c76..8ea653bede 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -102,8 +102,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; /* 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*/ diff --git a/drivers/net/mlx5/hws/mlx5dr_context.c b/drivers/net/mlx5/hws/mlx5dr_context.c index db5e72927a..24741afe58 100644 --- a/drivers/net/mlx5/hws/mlx5dr_context.c +++ b/drivers/net/mlx5/hws/mlx5dr_context.c @@ -19,7 +19,8 @@ uint8_t mlx5dr_context_get_reparse_mode(struct mlx5dr_context *ctx) return MLX5_IFC_RTC_REPARSE_ALWAYS; } -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; @@ -34,7 +35,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++) { @@ -172,7 +175,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 86a1476879..2055129519 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -3609,6 +3609,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 + +#define MLX5_REPR_STC_MEMORY_LOG 11 + struct mlx5_mirror; void mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror); diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 0084f81980..0e01453b50 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -11769,6 +11769,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; if (port_attr->flags & RTE_FLOW_PORT_FLAG_SHARE_INDIRECT) { -- 2.39.3