From nobody Wed Oct 8 00:25:46 2025 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2086.outbound.protection.outlook.com [40.107.212.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFA242F6FAB; Thu, 3 Jul 2025 18:56:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751568989; cv=fail; b=hyHO4Ft7/XvALG8Xz36ek5EulEhIXOvv5g8EkXWI+TMG4VvQBt41pgCS6lrmX6ph1CreAPAnx+GJTDzETW0oiKK/TXqOchokQeZucSedsWEq2HryllN9qPwvmJmxsxMrl487iU0lMRSwc4kKWMTG31ksg2oOxxALQgDEwslvIIw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751568989; c=relaxed/simple; bh=lbYMLBRbLSAovgaDxSQd7+zUlk9xghYC76dCYG2/t7M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BYBJfX7ZbT4tIOFeJ4Au/azR/KMoez3zsa3D/48M5T2P66w0LzSy8sNOtk1g7ob6Lfzp9AA7osFMJWQq5NWHCgfAZytPBZ4Md+Fj7c5JwtTrxZTR6BWiTNF3zbrh353HBm/HeuY1P1k1lsKIiPoyQgkey8ox6qBrJqFMJ31aOks= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=eU/ACRGQ; arc=fail smtp.client-ip=40.107.212.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="eU/ACRGQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KcFtUjKMAAn0uBu0qBUbvs/dloKUhHTI14ReWGhi4UyduAr8EluUAaEY/roW+Pb/1dmOe3wzFHs6NiaOyHxBF0hW2P4QcyTVYONxBWGmfSAymlyZo4naWhIythZO5OZi6ZBIWdA8v/dbRtsa3nHs+4ZcW+WL51RVmoqFzjlD0bpwSmFMMfQffvl/qwVOO6LOEIWK4MZusktaiGD/xRIB4+BfZ8e8QS8hZJL2HxHE7S3JVz9+VgFlcVJWZggSv8kLtcD0wPMjwOIBTICg6M849cj92nIsL3wWwrVYtXYonrQ1Dtvx+wumRYqeWAZru8WaP3Y3WFfNEQMtdwGiM2zcNw== 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=r3iAq3rK5buI5vjuQnLCZFV1VT3EgnXQhCTGXBSoJUY=; b=A35BNkZRo1pdhQQIu3ie76NEgdELPXnsrS9zOH2lRRkhIInr1D4i/EmVtDQPTNoGxj9M2rXLWI0VNRD8nNwzGY58kB2/rG7d6ubEPBMoNYJqXZDJofc48R2VeWvVqNjxyv9eOOiv0ftA8dW/Ytisxp1Omh6ro4I+OH9nkKwYVObKepHutPdaH5NQn86jBN4n2TGcmPNBYm0JQXgKbRo1PqH7NA68X6VLfhiVg/W7aNNmE3DsMxZivrNRsaswOC1O8RUq3MEOoo/DAJI6WFJNIXV0oVjb5eJPrpMi0v94LVqTKp6F7oSKrrCRRcgno3vrGld4zF2CYCfvkspu1FRb/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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=r3iAq3rK5buI5vjuQnLCZFV1VT3EgnXQhCTGXBSoJUY=; b=eU/ACRGQ6OASwfwKI2evB3uQyJj9wDzZHIeHovPEmIs732BwwJxfw8xWcGNUVpdhIvjUi6b15cx5kNorZWQP/WGLIhIIM3RILZBU5TinH7E9/WDJQ3SHdFU4dh0XvmLK+tz0pVpmh8WL3KhAsrvhXp4OD+Lp2QbaPI3jzYnZ0qkhyhGmRVrkUOntOvjIwdCz9TsU2APpiQHA8BsBL3yBCv5QRlHv1huDPPDQDAw5vI8unAACdMW4nTmXl732jo4zMXha9LuSFx9CMQOmB7mKsDhKHyXZ/HBjf/HXO4qEXCgYjm2R0f6WZF1FFnHDhonp+xzjxsaiesx5xOyeM/ZvJg== Received: from BN9PR03CA0796.namprd03.prod.outlook.com (2603:10b6:408:13f::21) by SA5PPF8BD1FB094.namprd12.prod.outlook.com (2603:10b6:80f:fc04::8d3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.33; Thu, 3 Jul 2025 18:56:22 +0000 Received: from BN1PEPF00004684.namprd03.prod.outlook.com (2603:10b6:408:13f:cafe::13) by BN9PR03CA0796.outlook.office365.com (2603:10b6:408:13f::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.21 via Frontend Transport; Thu, 3 Jul 2025 18:56:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN1PEPF00004684.mail.protection.outlook.com (10.167.243.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:21 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 3 Jul 2025 11:56:05 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Thu, 3 Jul 2025 11:56:04 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:00 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Vlad Dogaru , "Yevgeny Kliteynik" , Mark Bloch Subject: [PATCH net-next v3 01/10] net/mlx5: HWS, remove unused create_dest_array parameter Date: Thu, 3 Jul 2025 21:54:22 +0300 Message-ID: <20250703185431.445571-2-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004684:EE_|SA5PPF8BD1FB094:EE_ X-MS-Office365-Filtering-Correlation-Id: a5753255-dabc-4899-6b91-08ddba634d7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|7416014|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?vq3isJQGS/IFXUyp9txcB8wsX7mQWvdwaEZwkh0kskwBcQ52pYxFD1uh9Ldu?= =?us-ascii?Q?6eMIUYjxk+DsaJs34Sf6oIRDWaNhYaktnx8liad8Y6cFRMvNac14Mj+BvVSi?= =?us-ascii?Q?WxQ6qBGYA43xuvOd5VulwJaIxDa7KFVIZg24HRqMnM2MQz2hy62tmotGx8VO?= =?us-ascii?Q?G+uY+C4rn9UXzMBAj4f8HwGCEJ5aPdESAGANN4Cchsztone/W0s2CCj0qdsv?= =?us-ascii?Q?FAr25llj7Z++hpcKymwk5R9DQYbJqLDj5xYVaBQOV0RPL3aQiL86NgJmg29M?= =?us-ascii?Q?wgzsS2lbEPOCJ0dayHVB8d5nrDLyMpOyU4H4cosNoCc36ed+KTyeqMD/Gk4G?= =?us-ascii?Q?RYQvzJOY1RjrPRJV2gBy33TM4EJN9T5K6Gpw6qHlDuWaOtkZfkfNPaqLGeNy?= =?us-ascii?Q?R4LRS4w6HKIeihXS0DBPzIzKxtm3QT8avwIgr81jtL2PbQjRtp1kfGhyKpGI?= =?us-ascii?Q?WlZAeAo6zNK6P4F1pY3N7jkF7vebkLoWDy84aORI1HH9zGZBEHOVDGRJWj9+?= =?us-ascii?Q?iolqiFem9Qrm0nsAmQGFrOc+UtJ6NcaB85cCY7cikSo8sB9CEvHnTqeIS9zH?= =?us-ascii?Q?atRPBiVw3yfz5aTZtP2dtqrLC753PgxfiZ4mo+G+W/HpqvtRDGy0fnFCic+e?= =?us-ascii?Q?hr0rNMEW80M57Y8Uz2r3jRorgVQ3cpmcjPxkA3mdeB2vVN42f1LExNyOCUap?= =?us-ascii?Q?VK45USNNAYvMvBgEK7akYRdVcZegL0zwNjWlj0uCdaB76fIm3v/mhiKM/UdC?= =?us-ascii?Q?9QE8/kPgJC35u8cqaTS2Iq5nsiqNqOg94mKg3AEi+lzGWtjTOVRDGYYPmO9J?= =?us-ascii?Q?YipTu77fby942TrYOQlvOWi4tChlFQCMAvrTjp63Ivu5VL1Mr4q34pkZvFZp?= =?us-ascii?Q?l9MffVKMcs/Chqpulw38yTyQNHtMBn10KVICORi7EVoKqISnk0DIEE3irjYQ?= =?us-ascii?Q?xjWvmxMc5Gz4oPmmLjF2iDekV9XbNU1RYMfNcYVMjMMkGVwXGwyYAEsj0YfG?= =?us-ascii?Q?fkbngiW09mhZI7x9CQ9kikqBxJ/IUWTHETlKYER7JvWGLeN11l0WeuUIGP36?= =?us-ascii?Q?KhhQ0hcDLJ6fN4togus5/3KFPdkOrsjZvuUQeBRsyDffcQHiMPvmb4Je/gRR?= =?us-ascii?Q?2xpOR+etuqojEfpNO8R5JUT8l9Wd1ALC8YTB9cosw0g86A4GqP9EHyRC8maG?= =?us-ascii?Q?c/8p5FQYbILnC6tp7Z87vLpyshVFgWtaPDj/Ty0/oBXp1QxxQG0+lf0S3sv4?= =?us-ascii?Q?Bcgx/AfY5/wGCeGKaSwddHIAhuBrt1Z+oKM/MGxteNwZaVm5g5QJWVj/PwCE?= =?us-ascii?Q?tjUcT3nX8hD8BSBqLaeQfO4tyKJ/RLS2gRhC1sbEMpQloBa8OoLXkd4tV2a3?= =?us-ascii?Q?4UH5VqKnZWOrOGM5S10VL1LkelsSNDBUXGNoIPgO0KjJskDrUocdj5Ll+uJn?= =?us-ascii?Q?cdCuYzRind20Iws9FXcxKOWvtj8GlbpKoqMB8YbbWmla0OI9tPi5AE9t1QW4?= =?us-ascii?Q?EEOV2w9Ybwnd5dmdAogQVw6tk9+E3GODycoT?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(7416014)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:21.8743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5753255-dabc-4899-6b91-08ddba634d7a 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004684.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA5PPF8BD1FB094 Content-Type: text/plain; charset="utf-8" From: Vlad Dogaru `flow_source` is not used anywhere in mlx5hws_action_create_dest_array. Signed-off-by: Vlad Dogaru Signed-off-by: Yevgeny Kliteynik Reviewed-by: Simon Horman Signed-off-by: Mark Bloch --- .../mellanox/mlx5/core/steering/hws/action.c | 7 ++----- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 15 ++++++--------- .../mellanox/mlx5/core/steering/hws/mlx5hws.h | 8 ++------ 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c = b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c index 447ea3f8722c..396804369b00 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c @@ -1358,12 +1358,9 @@ mlx5hws_action_create_modify_header(struct mlx5hws_c= ontext *ctx, } =20 struct mlx5hws_action * -mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx, - size_t num_dest, +mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx, size_t num_d= est, struct mlx5hws_action_dest_attr *dests, - bool ignore_flow_level, - u32 flow_source, - u32 flags) + bool ignore_flow_level, u32 flags) { struct mlx5hws_cmd_set_fte_dest *dest_list =3D NULL; struct mlx5hws_cmd_ft_create_attr ft_attr =3D {0}; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c = b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c index bf4643d0ce17..57592b92e24b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c @@ -571,14 +571,12 @@ static void mlx5_fs_put_dest_action_sampler(struct ml= x5_fs_hws_context *fs_ctx, static struct mlx5hws_action * mlx5_fs_create_action_dest_array(struct mlx5hws_context *ctx, struct mlx5hws_action_dest_attr *dests, - u32 num_of_dests, bool ignore_flow_level, - u32 flow_source) + u32 num_of_dests, bool ignore_flow_level) { u32 flags =3D MLX5HWS_ACTION_FLAG_HWS_FDB | MLX5HWS_ACTION_FLAG_SHARED; =20 return mlx5hws_action_create_dest_array(ctx, num_of_dests, dests, - ignore_flow_level, - flow_source, flags); + ignore_flow_level, flags); } =20 static struct mlx5hws_action * @@ -1015,7 +1013,6 @@ static int mlx5_fs_fte_get_hws_actions(struct mlx5_fl= ow_root_namespace *ns, } (*ractions)[num_actions++].action =3D dest_actions->dest; } else if (num_dest_actions > 1) { - u32 flow_source =3D fte->act_dests.flow_context.flow_source; bool ignore_flow_level; =20 if (num_actions =3D=3D MLX5_FLOW_CONTEXT_ACTION_MAX || @@ -1025,10 +1022,10 @@ static int mlx5_fs_fte_get_hws_actions(struct mlx5_= flow_root_namespace *ns, } ignore_flow_level =3D !!(fte_action->flags & FLOW_ACT_IGNORE_FLOW_LEVEL); - tmp_action =3D mlx5_fs_create_action_dest_array(ctx, dest_actions, - num_dest_actions, - ignore_flow_level, - flow_source); + tmp_action =3D + mlx5_fs_create_action_dest_array(ctx, dest_actions, + num_dest_actions, + ignore_flow_level); if (!tmp_action) { err =3D -EOPNOTSUPP; goto free_actions; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h= b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h index d8ac6c196211..a1295a311b70 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h @@ -727,18 +727,14 @@ mlx5hws_action_create_push_vlan(struct mlx5hws_contex= t *ctx, u32 flags); * @dests: The destination array. Each contains a destination action and c= an * have additional actions. * @ignore_flow_level: Whether to turn on 'ignore_flow_level' for this des= t. - * @flow_source: Source port of the traffic for this actions. * @flags: Action creation flags (enum mlx5hws_action_flags). * * Return: pointer to mlx5hws_action on success NULL otherwise. */ struct mlx5hws_action * -mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx, - size_t num_dest, +mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx, size_t num_d= est, struct mlx5hws_action_dest_attr *dests, - bool ignore_flow_level, - u32 flow_source, - u32 flags); + bool ignore_flow_level, u32 flags); =20 /** * mlx5hws_action_create_insert_header - Create insert header action. --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2057.outbound.protection.outlook.com [40.107.93.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B39B2FE376; Thu, 3 Jul 2025 18:56:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751568994; cv=fail; b=Uu1+UXxRTFV8AOgIWBPll68byvhFDSlC8AzUZ1XerGYIX1/+aZad8IWBKz39NpHsih1/XltY7JInPX/IKsTmxxA3lqtid5nYQmtx2Rcmbe+KmQOaDOPtt/a+7bUzTQD+Y1cJ/nxJwTohpK4V872+nAiP0sILiQHS+07/yMRONjU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751568994; c=relaxed/simple; bh=9iuCi0voR0wEwXXeaWg4BLb3h+DZlAYiDUhE3KCNZ80=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rXizkvJD35jH9OlZpqckQ4ipHgQySdNZXoQNyalZB0aEEwlvqbnw0J5GppEOIL+BJBUYCqQcK0Xm7TTnS1oT06CsenGdSYDJ4edPNe0s7OwwtK6DXXlRVQERYDWXnf10GWsEkykhn7D1uHlifQmIAWUDuqCDM+SLrBEbNGJsvMo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=kb0s8FpF; arc=fail smtp.client-ip=40.107.93.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="kb0s8FpF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G6K8h9ObrH2DzlcDCKsBHSobSqAo4xZ3yMZGHiyaIPuzN7s2VTUm3QPtupEMsC2a+Gq2uOrwiieN4slv58uePmA65H1UsYvnig6AMGUMCSeSxdDGN8X2q02VrchWPSLiQ4eFOAUPCly40MocwArlCLrl1j8u+EaQL6XIbn5H/Q1KG1/W1FSaFMehRte/ByBPbpAIS1wbMRyU1Zh93nssSPxKJMnRwAL7iBaC8b8uF3YsSbIlP3/erkgq5Og8zjD6yKoll81+6mVrmxHNaKU/AHnD332ULW7fgmWa+Ce7LN2ALpbneZB5PrX1QGZ3mxWwkmdADv1ZMRwnmT5GXRpp9A== 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=jBFKve7QIt8PGhuuhv8eUD/NiFexjhTqd7KTxsuC/Wg=; b=MNmH6lwg52HDyD9lS9GbtSbjkptVFwwF+XY4aGKpY5wN9AYasAI0nhSblfGYd9g/DRkkvH5zoxHfQbdR8/NbcbSczVo7Te+TAjAcFp5M+s0z5n1nZVZsr9NInZWeeXuTRfHxHyw7p6QORGDRCTzf2G7zYqDeFAB9wnO7XG9iV4/etIWsFxI4CwX6dixCy23ffGOGmCz8eNxFje3uLm1O8AGTaPIR1GXEUjA6mU8xmmbKN1xSoW5Fd8QA4vr8Ixsi/l3e1uLJ3fXFgEeKuMvFlid21RqGRGph55lhGIKL/syd8zav2Yq8VL9H0IBf1arX2jB9LwTp7Bsi0IO3azpjkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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=jBFKve7QIt8PGhuuhv8eUD/NiFexjhTqd7KTxsuC/Wg=; b=kb0s8FpFgFrdk9xtY4xCr+7CnLEzqSUkztXTFvpszE2U6V4OAsoPmmgdgA6PBU2zAk9Sn4xkm8CZGkmRtuKRFjvjym9z+93XyTggfsmn7I5YLTh61uFAH0cibA+/r5ZcrO8d3O6H5PNnyhLF1KCL40DG70vcQHc5xeMiijhbIa9PZf6itr6sa0bLctaAUh/PuSKCrM7B4dBQdXwgoyWl6aRxNXjpfcaVD9L95O6LxiHzYICp2Xa6NQii348V79v68mgbkCnagsj+CFMZk2VCliNbeTiJdIetkvUANhjUM6O9SXVe0BKInG83UeeL05s2CT4hVCfWDPitcu7vDHe0Vw== Received: from BN1PR10CA0021.namprd10.prod.outlook.com (2603:10b6:408:e0::26) by MW4PR12MB5644.namprd12.prod.outlook.com (2603:10b6:303:189::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.20; Thu, 3 Jul 2025 18:56:30 +0000 Received: from MN1PEPF0000F0E1.namprd04.prod.outlook.com (2603:10b6:408:e0:cafe::ab) by BN1PR10CA0021.outlook.office365.com (2603:10b6:408:e0::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.20 via Frontend Transport; Thu, 3 Jul 2025 18:56:29 +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 MN1PEPF0000F0E1.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:29 +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; Thu, 3 Jul 2025 11:56:09 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.14; Thu, 3 Jul 2025 11:56:09 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:05 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Yevgeny Kliteynik , "Vlad Dogaru" , Mark Bloch Subject: [PATCH net-next v3 02/10] net/mlx5: HWS, remove incorrect comment Date: Thu, 3 Jul 2025 21:54:23 +0300 Message-ID: <20250703185431.445571-3-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E1:EE_|MW4PR12MB5644:EE_ X-MS-Office365-Filtering-Correlation-Id: acca69b3-7a18-4fca-8f65-08ddba635204 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?bFvR/zOJELLKiGidqWHAKaxjpDjhT2NkBcVOnJ/0v1+Ira6ul0j1Nd7b6Yi2?= =?us-ascii?Q?p5/W6CYwiD5usn+9T2Vcm9niBFRkYRpA4KwHDFOiGVKO+aGlBbEcqkCElHWy?= =?us-ascii?Q?QPI+iC5Q4M22DVWLx/A7rbk5Aeek7IoXB5WX3tMOhyWwd7b5WWLg8gHj24v/?= =?us-ascii?Q?PCDc7t5xGdG6vDb5ToU7eqWGVWfavJ6k5EBsQe7hwdIfZfzhy9Yk8bO6Lp26?= =?us-ascii?Q?jDdojEdBvNrkUC72gp2o83MIbznQZ3rd0BrEsC1Lo/8L4Bco19kTmB7IIe61?= =?us-ascii?Q?5DeF4oIhJO9okD0xKXLmBNnXRSNbG6k2FAEmsy5Vp4jN3u98zkHKlAHlF0YW?= =?us-ascii?Q?/mxjZTt5CiQqd7Ag9yBHZSlC9i5XlMw7ff6rNow7vsmV3X9om1ibYe7hBPmL?= =?us-ascii?Q?U/1AZDPmDfzepVilmdb6CNlcj7CRZ5rW0XpiWJfutRBXcXY4+fJ/zReZ0N7a?= =?us-ascii?Q?4AU/t5wkxDz3qQ5LQE2p/ofBR4+wdSAZRKU2xfLH0kpUWtB7bg8MwQaZ9TGn?= =?us-ascii?Q?EjQnflquYg2/v4R9KNp6e7ZZvNTFvrd8s9f/Xgg6oSSdUBw77Q/VxM39GYid?= =?us-ascii?Q?NI+TIcz9KUmtvnPTz4W9d4A8ls0Vb0OpPPJZ+qeLciMoo1NtNfqM/AQOcXyz?= =?us-ascii?Q?Siq+HkHm5uCneBChKx/mq7IVTtf1+ILi51NUdR3WcglOpF2zsmN9mVafbRcl?= =?us-ascii?Q?ApVOlWTDWHhqPFMhQ13WAgz1JbvklI1IhG45PmbNakCIlcU3ijHsY+4/VFQC?= =?us-ascii?Q?b/sdpqz8HuDdaeMOAUqBCR3VHKl1ZGpTH/EdQOWLl10Ogj/xKO03eXIDuWQj?= =?us-ascii?Q?vdZPP8lCg4TrFgQoyJmk03x0kUPkUwrhssi7M4ikwyvBT7mF0EJUzdLYbDW2?= =?us-ascii?Q?aRLFv0a8HUXNkE89Ek/5+P2Qi+Vsx8aR6DE7MwO/seD/nddYXpodKoR08KFq?= =?us-ascii?Q?O3WIHxNJQqcpNgzo3bnxnfOdAHqEj1Mc6fqI60C/sWa85ZKuD6IqluUAhjbO?= =?us-ascii?Q?B7GP8pa/P3ZC05UsDw1kWvsbhOhtJ2s7/Mr6m4Ysw33hnMeSsYFOTCl4Imn0?= =?us-ascii?Q?UdqMcSnG2LVOQLXxyBv4E5P+NsbyuyAe9C5Em31Qg2be3V4qziTkuTkmEFG9?= =?us-ascii?Q?pNYkWF32V9q7r89R/4nVoJv0yD4nnUchvwTfVrYjdZPjRJ3H2saFjgQbsIAS?= =?us-ascii?Q?VbhFXgY1iquUolwmwkO9SB36wo/VgapCDDgGf/5tBzydGpCIXIfyMGkCmJ1b?= =?us-ascii?Q?19OyeXPzMMn2exDHw3drHtDkY7i4b7xDoJR2eBpb2inhiSVux48VNmx+7tnA?= =?us-ascii?Q?ulCKrN7oMK9E5pZ2Aqs/RezqEfFNKiUGu/keFbLhb3m0Kn7cOszzx4dZD8C9?= =?us-ascii?Q?2KCxSY152XthzQXKHtY3bImjX3dYxmV0SDLxigvxRuI2hNz0yqZ70t+PlW7D?= =?us-ascii?Q?yofWbl4vwbxd5L2YWylH/G1rEzEwYrEFZEcCE/QtT+C+rmsmumpHiFLDOz1/?= =?us-ascii?Q?8DLRdNMhRrD6i3xvQEtiDCEa678rrJBvrLUb?= 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)(7416014)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:29.5084 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: acca69b3-7a18-4fca-8f65-08ddba635204 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: MN1PEPF0000F0E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5644 Content-Type: text/plain; charset="utf-8" From: Yevgeny Kliteynik Removing incorrect comment section that is probably some copy-paste artifact. Signed-off-by: Yevgeny Kliteynik Reviewed-by: Vlad Dogaru Reviewed-by: Simon Horman Signed-off-by: Mark Bloch --- drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c b/d= rivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c index 9e057f808ea5..665e6e285db5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c @@ -876,8 +876,6 @@ int mlx5hws_bwc_rule_create_simple(struct mlx5hws_bwc_r= ule *bwc_rule, =20 /* At this point the rule wasn't added. * It could be because there was collision, or some other problem. - * If we don't dive deeper than API, the only thing we know is that - * the status of completion is RTE_FLOW_OP_ERROR. * Try rehash by size and insert rule again - last chance. */ =20 --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2087.outbound.protection.outlook.com [40.107.236.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 939722F85DA; Thu, 3 Jul 2025 18:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751568999; cv=fail; b=gfmJLNrVyTdPT0giOWXmCaQKHi3afOAQkdfmPY/QA5cGEfBZK/p9e4jQLp6n0A6PWEbtkNgYscSoK9RjIhnVCrTgpGras/TWoeJUrJMvfVtLpDDEx0ueJdikDbG6fQsGmx8viDeT0QpmYGCF4BTmUhcj9zMHzFfYvBP3mN6GoUc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751568999; c=relaxed/simple; bh=gL5Pf1dTVd1vIuuyIlGrHA8y9nrQRF/YQRSVfT8A+CY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ShTOSjAkTcYI2T76YFA3b6Wp/+xqtjPGebwyuIwR1hSbuVAlOUu5VjwPAyWOkexWOTm1BGiropqfr8hXFrHHktEhijWe+QiizXOrffDm7mV5Fq8AWjqWawhs84fxG4VlvEMY/jI80ED8hUuhr6/wcJNcJxgDLNiYWFNl6KotqNM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=VaiU9i2n; arc=fail smtp.client-ip=40.107.236.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="VaiU9i2n" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R53GkJ98TyDdpssT4M3xqRWuOemKhwzOgwAcbmkORdFGDmJur9oNCWbaOuyNBrt7hC+hqnK24xo/hMFynzP1oSYkqtJ9+Qhggrphe9nub5/I/3LfCZ/vPxENyMFNE8JX5tJz8sFYceogQMBf5LRq9nUMcyJuXHxhguV7aLfx5tvmsvUzZnXjipUGgNKfj70bFV8y4SQ95z3bUqBfH4ulxSCvQRPwtVneht1ddNL4e2CwT+wOZur2WOeX+HLktnbzYbK6A8E8w1tZxbB5+s+rudpFd2qzg35fGm/Pu7uV2HTnwxKewdshGQs8jAQWhr9ROP1eOoCC69L399+tR62cbw== 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=mXtWidwZfQPyeFewEhUR4cRCMuE3gpktkztvZT4ni0M=; b=hw96KlY7jk4rOBxKy2hwMhpp1RPn9RSnjNtuPHjc0EHrI3jb++eK6JntGkAhv46Ja/VsdoZ1Ue9Ri+jnR/wzL1rQIVuFb1DCrVSpsDfvVQ0X+5q8333UcV/k7TjU5M9O8OXnDJZAONYki7tHlUgndpbi+DM/WnLv8TiWdLXFfAU/hPZBx9pmQ4Eh4W8aZSyILsJYTgg3A3Ca24qkvjZQlrn1lKlNV0QSds+24wpwjW8Ffu5Di4GL+w3KDv6ITj26gQ2flHIBBmrHrDhLRs0/KwenpZ/JM6/t5r1gl55lASA/AUsz4S+cFpyrKQH7OGlTgTynWYjNckLscn6+UgVU/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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=mXtWidwZfQPyeFewEhUR4cRCMuE3gpktkztvZT4ni0M=; b=VaiU9i2ns+zYoMt5ztTelrO26FqDfdfXYmY5rU3/qDaDOj5YF+pOlvq79vJnZcJ2k9kOkprKe52jv/nqgHTxJp4IaAf4O7OeZVtcrpi1EjiyrGLX/N7LK6eVoVibK2mGR/BS5PiBjx5u+0WyYPmJ8oUt5rvZqGMoa0M3ey8LtT92AHATD/97zV6P+FqZMvsGAy/eFTdfp/pVihk+25tbNk0sRceHD6ySJx7M1Db7+jlAWEVIhJaOLmL07UzGuULeReKwFkE4LQbjaoYFFpqL5KqqE4r+hCPMsWNMHymdkCozpgMhREgd7eg4Jly8RDY7Dlhj7zXH+EyvaTdR4e04vg== Received: from BN0PR04CA0202.namprd04.prod.outlook.com (2603:10b6:408:e9::27) by SA3PR12MB7808.namprd12.prod.outlook.com (2603:10b6:806:31b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8880.24; Thu, 3 Jul 2025 18:56:32 +0000 Received: from BN1PEPF00004680.namprd03.prod.outlook.com (2603:10b6:408:e9:cafe::80) by BN0PR04CA0202.outlook.office365.com (2603:10b6:408:e9::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.20 via Frontend Transport; Thu, 3 Jul 2025 18:56:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN1PEPF00004680.mail.protection.outlook.com (10.167.243.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:32 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 3 Jul 2025 11:56:14 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Thu, 3 Jul 2025 11:56:14 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:09 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Vlad Dogaru , "Yevgeny Kliteynik" , Mark Bloch Subject: [PATCH net-next v3 03/10] net/mlx5: HWS, Export rule skip logic Date: Thu, 3 Jul 2025 21:54:24 +0300 Message-ID: <20250703185431.445571-4-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004680:EE_|SA3PR12MB7808:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cd2d48a-01fa-493d-6da9-08ddba635388 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?k5Cd0xg+NFtuF2Jx9mOos7irYP6mG4oJFXdfiVjY10E62ojjTIhwB7tKJGGn?= =?us-ascii?Q?9xMGs4ISQVFOXRRLMzfp/7kNPMy3MYeAERp8pNm8E283pAGuhYjJGbpUWfkj?= =?us-ascii?Q?PeoQA1qKBibEroocsVYfHiIZ8g/XxM2q4tUKutoyIscPSWTub1ra1sm0Pab2?= =?us-ascii?Q?RD1fAw+8TyH6vLUtEiapOpbTE0RMqOcZ5pDcsaFsPMoqcYMEmIZqGDfoPC+r?= =?us-ascii?Q?yp+9oVdYLTT3GNl5ebyj68j2mu5UVlSZ4i1k8Zo/f7kwHyJawT0TfFUKNeXc?= =?us-ascii?Q?BBhNPRorSuv0/cNDnUR0fQoXK4cP9aRQoUaV6Heof9gVxV5+XJZV7DQxUyK0?= =?us-ascii?Q?O1MS/9+rGX3AKFao1yhBxte9ze030piLgS++nJQM9lTQGMVIhJ99mAathB+O?= =?us-ascii?Q?xcc9F3NhKTC+/HEYJM4RZ7S1/Qw+hNJU39yHowuw8JWLpGxx/bcQaeQfLL41?= =?us-ascii?Q?obtAuzWM8K5SR3lheoj5ShaS6A33/gZmTeFBKfdeiwtJRBOeg6oqmk7OM7tk?= =?us-ascii?Q?THN9YDXyjaHMWI0cqRqJEpWy+aKKfMN/jKG0H2Y3RDcXzl7wWWBHqgWI8Whs?= =?us-ascii?Q?NuDRhJ73oCTPEUEfUeQu+6mW7t+AbByKVNYVeOPplCWVhAIBz1rZiHhocEIN?= =?us-ascii?Q?2uOKl7zgySBP2yZ699z1wbbmI8DO6c73WxhzCGTQTTWDcxmoE82lL5dFDX+t?= =?us-ascii?Q?EH/YO/g+jAGKyGzimUqxxHfhPRyN+Wk2doybu4VLnU9TbP3Sg3xld3G/RHae?= =?us-ascii?Q?QgcKmU5vUsEdswi9yK7wncIobhtM6Gax9DPa/Ymsl9TnXzrRXH0A9h1HfrLl?= =?us-ascii?Q?9bQb+7VKQ1/iCxE1xlZyqP9FuYHeMcePYG/qENe36Euw8Y5FcAiBFXdCXyNc?= =?us-ascii?Q?T2LgWFXM/tFnmvXbPWteXPNVKiodiW0DLjQegDQiXfTmwX2OuO/T0QEGTUN+?= =?us-ascii?Q?Y67Vcya5ucJGEpbkcwyf15L4rEX4ujGJiI7nn7aA6k67DoO1gQUDEl/2C8Qx?= =?us-ascii?Q?dNK4da76zttFDkDpyqbGUueyyx822yIxydzaeEAZJ+Q4JrWlw4zX9zIBnpEQ?= =?us-ascii?Q?gBiIegRuE07UavMqRDbRmQiFyIZtzlqZl15WuvDGsNCVTZlxe1xapxQKvkBk?= =?us-ascii?Q?/2/fIYkFMj5vMrfieY2KtewArahobQThr2enbVD8i6u3uVqI6LUtrfhj/+n9?= =?us-ascii?Q?CnCySg0yinW6JC0u5I15eGrKLNByRncvC8QJ/2+oOC+7Cdlwp0BILbvFjGN0?= =?us-ascii?Q?AxwdCGFCXEnNR4HRiYXmy1Bl+q5hJLSsUDL0ZdRjbGuF78b415kY9G5yVvtq?= =?us-ascii?Q?RrwjTdTw1SpvRmmGRQlhDHYJlzNl5kvYOjbICdSBmN7CodLyVYoksuuAuvfN?= =?us-ascii?Q?TD8gtPGdgr/vIhpWErhn/YEeM5lHa0kFPr/FU7BnZoOoi/f7Bqf2mpzQhO89?= =?us-ascii?Q?pGaG+2hjGe6/0nUKMsihqPo9tRdwwelq+E1NtcbMZehYmtP1LTKTT4n1Z9X8?= =?us-ascii?Q?J6e6ufHVDmcaCdODdP228OZBo08HH5Yp7blY?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:32.0651 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8cd2d48a-01fa-493d-6da9-08ddba635388 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004680.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7808 Content-Type: text/plain; charset="utf-8" From: Vlad Dogaru The bwc layer will use `mlx5hws_rule_skip` to keep track of numbers of RX and TX rules individually, so export this function for future usage. Signed-off-by: Vlad Dogaru Reviewed-by: Yevgeny Kliteynik Signed-off-by: Mark Bloch Reviewed-by: Simon Horman --- .../net/ethernet/mellanox/mlx5/core/steering/hws/rule.c | 9 ++++----- .../net/ethernet/mellanox/mlx5/core/steering/hws/rule.h | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c b/= drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c index 5342a4cc7194..4883e4e1d251 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c @@ -3,10 +3,8 @@ =20 #include "internal.h" =20 -static void hws_rule_skip(struct mlx5hws_matcher *matcher, - struct mlx5hws_match_template *mt, - u32 flow_source, - bool *skip_rx, bool *skip_tx) +void mlx5hws_rule_skip(struct mlx5hws_matcher *matcher, u32 flow_source, + bool *skip_rx, bool *skip_tx) { /* By default FDB rules are added to both RX and TX */ *skip_rx =3D false; @@ -66,7 +64,8 @@ static void hws_rule_init_dep_wqe(struct mlx5hws_send_rin= g_dep_wqe *dep_wqe, attr->rule_idx : 0; =20 if (tbl->type =3D=3D MLX5HWS_TABLE_TYPE_FDB) { - hws_rule_skip(matcher, mt, attr->flow_source, &skip_rx, &skip_tx); + mlx5hws_rule_skip(matcher, attr->flow_source, + &skip_rx, &skip_tx); =20 if (!skip_rx) { dep_wqe->rtc_0 =3D matcher->match_ste.rtc_0_id; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.h b/= drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.h index 1c47a9c11572..d0f082b8dbf5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.h @@ -69,6 +69,9 @@ struct mlx5hws_rule { */ }; =20 +void mlx5hws_rule_skip(struct mlx5hws_matcher *matcher, u32 flow_source, + bool *skip_rx, bool *skip_tx); + void mlx5hws_rule_free_action_ste(struct mlx5hws_action_ste_chunk *action_= ste); =20 int mlx5hws_rule_move_hws_remove(struct mlx5hws_rule *rule, --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2059.outbound.protection.outlook.com [40.107.237.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50FF3298990; Thu, 3 Jul 2025 18:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569001; cv=fail; b=JRMul8KBYi2fXUC00fKwSmfaOKt62bztS7yqxtG0fbeiCF0W8ul3kCZh2US6wZCrP3OLe1JcA45b/Nzc0i1j+oYq10NwWdiKN4xJur7EqQn5lcCZKWfnhUXBznfNXaegGKGN/cUOPNw/vLAf0p3a6hkTREutujCDwicK+aD5Xyk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569001; c=relaxed/simple; bh=964UyC549PnWiz4jeY9q3eKtgnZLPbBIzGGbOrSZXgM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y4B6g6UpWR3xbxHavatmY33k/oB9MwwlZEFw3aJVrTEmYHAEa7PiJpOLQ0XoxYxAmBmEyTl0AzHaBtRd25zoSeMc/13qA9u6DVZOwvP3fAFdJR8mjS6UyWEMwH1xpKPp+n9b+DefIaiy9tVwvLhq7k6de5XKueA2cWkMnYZWEG8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=oM3Oouin; arc=fail smtp.client-ip=40.107.237.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="oM3Oouin" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fAEIrDt/Mwu4ZoDiaJkO9NyotGw0gOyfA/ueZzneJlj7k4G5xXE1+zvzK59vUtFWlV5hcuUFKEBB1qBVZtmiwSUJ0RDqn4cBkMMVQMqmwj6xjDkMQKdMCKXIti89s6DSg6UIT/C4K03fPstYZzEXZWqmQ8Gbbuohgz019LY4+Nm3sM6Sg+a3vndaUeqDo/LuTENgxYYwVYYFjISxddHpazhgoFfBEIfCRrB+rZfVaxYQabX9nBucgDdHdxN/Mq3BzuCo0Svhb+MiP+9Q7nkGzrVJoRyIFBG6RZi2WYF4ip/by2hQeiuGgoG0/Itr063rGOJRyJ7HqgvLkKCEU/722A== 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=dArjK9/F1SDkjODhcyZRnZHpcAWwDSur7M/knRq4SnM=; b=J8dWgeDYcm8bMRKBtzT4zUsgDv3N7m9mnu3zhA+qsHscLanDd6V7mYmZHYfg7QPx3Vobk387SrLw3BrMO9jgPOqWaqiNZXhgPSeLstTFvdGYMhNWwi/aymMiGkXgkTGB897bS6OfCg+5SqQROZeyZvFoXikhFqgDvxCsbiEES9WgnI2noGKNbomAnixNDHK1mV/v7fmrLpwdHJGjpH5UgS/IC0hl71qG/mUyVx6FaCJMPVH+xTfohMGnCD5KUqJlVtLCO6ozWED4x7Qd5YKVTlzyfCGSWclSR38SjC3GZJsuqEiCsQRfyHhYqHBmViZYTnylgGhjMrxJ0ZNvJg4IFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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=dArjK9/F1SDkjODhcyZRnZHpcAWwDSur7M/knRq4SnM=; b=oM3OouinNHDbjHb6jgK6+VeCbAdRvimbHSziRWpVAzH+O6GKbzg+VTwn6fihUgmxh4s9JB1Ba7mInUJTCCs5wm/iP2rbd+m21aCarz5yv+RLSFBV1+r0FYq800acrb9EiaqAZHT9OVL1ZmsO2V2ZMqGxb/DbTg1VRLKqjZ8tah3x8uv55wUrOTJOFJBbrg7DMXSdjYG29Yl83x+Lra5dIHeomxXVFSXo7uEIjAOAhhKc84bIvNO8Lv6UNQwTC1hRC7Icwg6PHAcjj88/4Tvo6jDNQlSe8AGPkFs2ZdTlAUNLu8LlBQxWlc0FUQExgLYEckZLQo8R3p4vTjRiUGEFGg== Received: from BN7PR02CA0025.namprd02.prod.outlook.com (2603:10b6:408:20::38) by PH0PR12MB8007.namprd12.prod.outlook.com (2603:10b6:510:28e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.21; Thu, 3 Jul 2025 18:56:36 +0000 Received: from BN1PEPF00004682.namprd03.prod.outlook.com (2603:10b6:408:20:cafe::79) by BN7PR02CA0025.outlook.office365.com (2603:10b6:408:20::38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.22 via Frontend Transport; Thu, 3 Jul 2025 18:56:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN1PEPF00004682.mail.protection.outlook.com (10.167.243.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:35 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 3 Jul 2025 11:56:19 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.14; Thu, 3 Jul 2025 11:56:18 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:14 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Vlad Dogaru , "Yevgeny Kliteynik" , Mark Bloch Subject: [PATCH net-next v3 04/10] net/mlx5: HWS, Refactor rule skip logic Date: Thu, 3 Jul 2025 21:54:25 +0300 Message-ID: <20250703185431.445571-5-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004682:EE_|PH0PR12MB8007:EE_ X-MS-Office365-Filtering-Correlation-Id: 52287daa-3e52-45a4-99c0-08ddba635586 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?0j95zKozmm4x9ND7/lfbuugIsAV9Gh+Yv04v2rdrWRYw0YbEGFJfM2mmvrrf?= =?us-ascii?Q?S+QlPH69Pc2ZpdOc8WGW88UmK4iD0iy8nsFFRciq/Mu1m1KkX+pE5YmtY0KL?= =?us-ascii?Q?DuasAghfm6Y/ktX+QLuaCAA5RNtAHY8/3Tfr7mFLH4OgB9UZlyiholq/d8wS?= =?us-ascii?Q?m5fNnANDNfz1xDWdT7Q/BWlx5nEfujGcVy/54bc6mDUkON+fZDrTq/bgFcW+?= =?us-ascii?Q?F1atX/IzdBBN7zD1ddFxjFnpFQ+Ckj5Imt8ygVaikhq306u9NftmsA2SVLBh?= =?us-ascii?Q?GHT6RFhKbxEJ76HwcQkn/aI+20xNfh6FuiNVmPChfkLaiKmptMoZ+IMK5mZV?= =?us-ascii?Q?UsB2iX6Fbf/UJ+Is+mmqOZLLPRfWABGK1zqDF4e1zwJsLMKMOIDrcB1FZviG?= =?us-ascii?Q?RgHT9gP8/SU8hHA2j7qCborbzkK9wmKtx8lkABzrB6EXSh9WMZVKg1swa/Yn?= =?us-ascii?Q?sFYSq71B5nENOWtkyWxPFyZt1AQFzkUApQL0b00dBgsiBxL1vk3b9YrwzQpV?= =?us-ascii?Q?IvsQEYK+t9+t9+TRMizUe9xZb4UtiCcRN3ynQdH6ve/ZofeD0QDkhM710ku5?= =?us-ascii?Q?8+GmLkAHrqFmymaIL9aMO8QjccRC3Pb/9mdV9njjskW8qs4Q6wytKNMtX/TE?= =?us-ascii?Q?hnZ3j1oFRyAVtFsp05YR0biVmM50Oa0lNdxaN8qH7F1tGu9jKBC0+28ommjO?= =?us-ascii?Q?56wIt2bUkIHTfX4SWDlvRFLu1s8tJA2LMFYzxaoEhyf+i1Gds98GZhSyt5Tx?= =?us-ascii?Q?uyma5+g905bLD+Rs9UVGt4eBI5MCkEbNg0Xxi/A7Ef6qjMLqDixBcNmTgkZO?= =?us-ascii?Q?A3M+DhSeUo6soxjz9SQFxRur3XEf12zqD2vT6dXiB0bxwnzisz0BDzyjL5zM?= =?us-ascii?Q?vRA0I074EYMglGVJn7HMMww4YAtvc+yWLJjZptTDYzpn55A1mnv6mBq/OVEE?= =?us-ascii?Q?9UeKwbQInjT0tfw0XOn1QzcUWH6s+RlZ+gEfKNV/jAX1kN0riULo+NUHMPRV?= =?us-ascii?Q?ly/xwuRpj5fwYLaoR9PO6yjYcXTk8ptxKqyk9B7lqxsKfpclmxcAuBKU/kcK?= =?us-ascii?Q?BALKlui8BaNhi/H/Yk1NpiLAoZHJnRAnBmAnL3Y0Um7ZmHSer4uyv8BDv2H5?= =?us-ascii?Q?V1aXxa59LMToCCHy2M/7UHTk41OvzLb4wF55pWlIoRyOmUJFRQ8t1+X9trEG?= =?us-ascii?Q?4EuACgVZbQ4ip71gLLxAOWyXc8ny4u2rPBKJ9oL75qfxOz4YMOz68sFmnkad?= =?us-ascii?Q?pnRfXRJGR0wE57M0gn7KDqNH8yY/TVKw5q4isqEvf91b4nT+R2wW8oscMtGR?= =?us-ascii?Q?rtlA7UsAJcPEor2xsT6Y+OQpJL6EzAXnZjnwQcuAtD2sPrdafEiOWr6YsgVE?= =?us-ascii?Q?SUHXo+mlkismS+ODZzVKhcyGiU+O1/leivFEHytX1IZnckyhSw3SCmvZoM0m?= =?us-ascii?Q?3dEOjnIavg87v7CGUjtAFXP5Arfre7JMW3ttlRbrZd0Bf3kahfoIWruAqfGS?= =?us-ascii?Q?3Xd+JPyPlhDqnie2AiGyOgCCCH7lDPmBXwU3?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:35.4076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52287daa-3e52-45a4-99c0-08ddba635586 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004682.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8007 Content-Type: text/plain; charset="utf-8" From: Vlad Dogaru Reduce nesting by adding a couple of early return statements. Signed-off-by: Vlad Dogaru Reviewed-by: Yevgeny Kliteynik Signed-off-by: Mark Bloch Reviewed-by: Simon Horman --- .../mellanox/mlx5/core/steering/hws/rule.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c b/= drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c index 4883e4e1d251..a94f094e72ba 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c @@ -12,20 +12,21 @@ void mlx5hws_rule_skip(struct mlx5hws_matcher *matcher,= u32 flow_source, =20 if (flow_source =3D=3D MLX5_FLOW_CONTEXT_FLOW_SOURCE_LOCAL_VPORT) { *skip_rx =3D true; - } else if (flow_source =3D=3D MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK) { + return; + } + + if (flow_source =3D=3D MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK) { *skip_tx =3D true; - } else { - /* If no flow source was set for current rule, - * check for flow source in matcher attributes. - */ - if (matcher->attr.optimize_flow_src) { - *skip_tx =3D - matcher->attr.optimize_flow_src =3D=3D MLX5HWS_MATCHER_FLOW_SRC_WIRE; - *skip_rx =3D - matcher->attr.optimize_flow_src =3D=3D MLX5HWS_MATCHER_FLOW_SRC_VPORT; - return; - } + return; } + + /* If no flow source was set for current rule, + * check for flow source in matcher attributes. + */ + *skip_tx =3D matcher->attr.optimize_flow_src =3D=3D + MLX5HWS_MATCHER_FLOW_SRC_WIRE; + *skip_rx =3D matcher->attr.optimize_flow_src =3D=3D + MLX5HWS_MATCHER_FLOW_SRC_VPORT; } =20 static void --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 303682FEE15; Thu, 3 Jul 2025 18:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569008; cv=fail; b=tUOj3s0DsD9n5DVZeNYmzqeeCMILsC+ffm/qNqHMM+wwJI0jWLaalBu45Le5MFJkzGrOJfEIPNYwOSsP/0FzaTXLKmByEi5QGVZh8viNwTAzFNYwTMwDViel2XuOHXLEBxb5Mcnp08XHQdVVapCI1RppGcc3DAXI0fF8PkZpotw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569008; c=relaxed/simple; bh=AzluDkSd3zxR3LqKxYTnpT4rC4i3FLLhqD2Qin5R4J8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lQO/GME5YAWxk7U1aqW6BMkRCtHcRUb0TINlFnpbhbc5dwsg5mAb80cPFbf1m218CEHEgyvtvZO4QFoJ/yrvHML6xjovgT/e/vOApcaaEadHgSeICZ6FT7+2wpgHG0nJo+suesHFIR0DCh1JSvV7XYk7BoLrfeMH5e2cUHPu2So= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Rn7Hm8NK; arc=fail smtp.client-ip=40.107.223.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Rn7Hm8NK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mn+smHiaH9L1zZtWHvyKJHvrpPNPyUnR842X8AaQjyuYy50A9DhkmlzUrxbdynAl5zb3nLZgoU1DZgD+5DyFHRCeKp6ICV/3Aq+s2nNsxZvw6yqwH7r+V5pSdEys9X6AjQFSxrvKW9cUjy7hBAm+LTFa5XQuphnVLHelNo+MCwOvAJ933xzIDHawAGqcBVVz+yR9FDSw7gW4nInjtXTjDrFtOgFsPrdIHoG/puJ/twuIixk1TeiQmrcbUYPyEVTqmyE5ra+cllB+zxSaOG6rnKUN8pagKUB8xvK1UBqhUIAJ1swADQ3HJyg33eVM4F5a7gXDFrCN9O+lh0W9FlUjEQ== 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=iBDT1UDGj8b7T3/ErrhFbidtz4CmzbCBftSXpJ/oqWM=; b=QR9ujjKSwOP5NxqSGR4f1EIQlncRxQoJoV0eZaNF8zBmRdGyDaIjnyHat8UXx7ecVkDVZA2kGPTpVOl1RIGkCXG5fT31TYUNiKPBxJSM0io0nF5LxINUhBeVUeNHmFPdp50obOeOGq1x2s1ImVYOa1WmiVS2oFXCdnbk3MvPawk6DqZONHHE5Kx126mzTBL+NG/S36D7CAG212Wudgs0VqMctQ0ld4CzgOevNM+aoSTuZxZab2g8GS8D4R6s3LH7cPkE5AqhNoNLyAn9Aq2PPF58xRkMOQN23jU1IrmZ12RoAYpbT0eD5+++YX2hGgmHlBS/cj6GLa53JDPNtzFANQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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=iBDT1UDGj8b7T3/ErrhFbidtz4CmzbCBftSXpJ/oqWM=; b=Rn7Hm8NKhupNcGcxZUw8JvQPMOXT02eCzaVlXm8oucUwUhH5R6wiq8uIaxPhfpJ3VDw2XVNN0AEZb860GAyLlLT1tHv6bLZUdc3w2ESt7jhVRbkHRDuI/G+Y3uQTBuIVfuir2shDCXbIeEp9CU1aV8SkNQkCjocbG0sbk71E3SskvAqrctoqIF9+SwpD63Z+7wxq7xMJhRnCR4j0cUa5xtpmfyr4MknFCR7xeIIcz3uQaT82SGJSZ41fd5ZwT+WexrABocMU70xRRxBaedwiIMJkjFOIBbuo9wtcFIo1uqWFx9Oih/ZHODjtp7szrk9KoEqEO/QMU4/nx4SxPys+/Q== Received: from BN9PR03CA0802.namprd03.prod.outlook.com (2603:10b6:408:13f::27) by DS7PR12MB5888.namprd12.prod.outlook.com (2603:10b6:8:7b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.24; Thu, 3 Jul 2025 18:56:42 +0000 Received: from MN1PEPF0000F0DE.namprd04.prod.outlook.com (2603:10b6:408:13f:cafe::a3) by BN9PR03CA0802.outlook.office365.com (2603:10b6:408:13f::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.23 via Frontend Transport; Thu, 3 Jul 2025 18:56:42 +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 MN1PEPF0000F0DE.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:41 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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; Thu, 3 Jul 2025 11:56:23 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Thu, 3 Jul 2025 11:56:23 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:19 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Vlad Dogaru , "Yevgeny Kliteynik" , Mark Bloch Subject: [PATCH net-next v3 05/10] net/mlx5: HWS, Create STEs directly from matcher Date: Thu, 3 Jul 2025 21:54:26 +0300 Message-ID: <20250703185431.445571-6-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DE:EE_|DS7PR12MB5888:EE_ X-MS-Office365-Filtering-Correlation-Id: f4e2cd04-c187-4816-0e50-08ddba635922 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|7416014|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Iof/FWmo9F4nKXfFunkLDQSZIcmO+84RLCK/ts7tyMCciMmvA0VkdH+6iT96?= =?us-ascii?Q?wt8oDsdIxRkfJMmh53pFf2Vbx+X7M4O/oACWY400T3OoC7cFVvu/78wlrA0a?= =?us-ascii?Q?mErdp/8Jrkt2ZveGArYpYNTXzaYjJnrUBiwhdWu7VULBh1+39c9p4JpH9REN?= =?us-ascii?Q?hHN49Lr7tRRTj7cOubBPqjZDqUgaAFQ2+Dz/d812aKKcA5yyYV8P56Fios5E?= =?us-ascii?Q?aVkOxzccAvwn7fatWk2PbM1OlV67e270ogDeGZDibZhpHORBtXehi9Dmrv5p?= =?us-ascii?Q?7osaeMlvHYP8js5ouu2NSroracSwrXV1NLzwPLumSkizbToGjXXkbfh3inio?= =?us-ascii?Q?JtM0Ij8usgw+SwUu02qQIH1l11mnSGeLW0NLHdvoKoyZPH6rqIdgHIFYgvoE?= =?us-ascii?Q?7I9LgKrgkajQmQNxA3M3hOK5tYpSrL0oNi6QSO1VScOTlaxAUL1GDlYEirwX?= =?us-ascii?Q?xu0z5VYNzoaAnUkFw9vbKB6G/3AfnIIJuTYqLnYjycif2073VnffDjARsPy5?= =?us-ascii?Q?5ugzIWYR4IRVa/HjGgwmgHxtDtq86whG/tRThveYa96+7SMlq0Kms9+NhoHU?= =?us-ascii?Q?OmuRpn0BC4+8/uGEGTNV3WnUTBWXK1zL/jganCygcSck7TziaKK45Db/kP9K?= =?us-ascii?Q?hkEqJY+X+R1ZQu6TfMFq1YX/v/QGGg8ysUitJUXvjqcsXx1flGpMz0Sxu6ll?= =?us-ascii?Q?UERw346ASG5RymU1677tNZVUNOYK0IQP8fH1kB+qYjjRLOnmFXrYm7hYkApT?= =?us-ascii?Q?9T8ZZnMwM5Sz+xhdbc9tSk2G/2I218SkZ2iy4wQ1WXt3qciRVdiX+mpfr4DG?= =?us-ascii?Q?lJn4XbcLtRo736OZzL9NgVTlMYgg4KXdk1sq2PNF62jCHQh2/TThhKIpXk0k?= =?us-ascii?Q?bRJHZSvstqQH+Vucbwvpszzi52CIzhRAj4G38tHFa0fgk8mRNI26feWkbSep?= =?us-ascii?Q?51G7g/pv7xb95g9/0MoRADAw8dxV6Ypr9UK6odRhiimk/Fm42N2ufhseMLOu?= =?us-ascii?Q?DJb7ZOnhanOYmb9NPCE6gEmF95SVxnThHb8XTEN2v7NQw4I5vxw6gAQfcGmx?= =?us-ascii?Q?yWTtELF4nDjJJn9LZ8Bt5sypB3yWdaobwUFpnCpCTct3F/kP6Xf1ZztA44i3?= =?us-ascii?Q?pkcv+fLbo/vEo/1ReghiQf3gYlTzI/7C63Uva5o5iMuP+FtdGXhwZ5BqWsBy?= =?us-ascii?Q?MwRzEt5cRN3wFkPztPDYKZEeCDplsT7afbM9Xx7Gcn1l1PXMCh+D8XIPf4px?= =?us-ascii?Q?N1a5ih6iaXnG2fTCIY1/elnSIkLJq9wgBEPq/M77h20VwpjXOTaK4/XfF01l?= =?us-ascii?Q?WW311U76NzcHv90M4iGFl6iBDrrVaV6DoBqpcLB4Qv93K1RIK4UAKyddLXzP?= =?us-ascii?Q?9JnsBQOdGp2e5I3BkB655kxiUDAj44g9T9cskvGPn9aVT+4j+gkrbJyUnPDn?= =?us-ascii?Q?+h7BGgHHnTg4PVDrlWfY+FuFahwZc7bfWtwPJ9rqPYoZnN0qNgPaChgplk/3?= =?us-ascii?Q?GAAxZEQpj8alrogQTs7da2uILJy67F1x/9tb?= 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)(82310400026)(1800799024)(7416014)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:41.4942 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4e2cd04-c187-4816-0e50-08ddba635922 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: MN1PEPF0000F0DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5888 Content-Type: text/plain; charset="utf-8" From: Vlad Dogaru Matchers were using the pool abstraction solely as a convenience to allocate two STE ranges. The pool's core functionality, that of allocating individual items from the range, was unused. Matchers rely either on the hardware to hash rules into a table, or on a user-provided index. Remove the STE pool from the matcher and allocate the STE ranges manually instead. Signed-off-by: Vlad Dogaru Reviewed-by: Yevgeny Kliteynik Reviewed-by: Simon Horman Signed-off-by: Mark Bloch --- .../mellanox/mlx5/core/steering/hws/debug.c | 10 +-- .../mellanox/mlx5/core/steering/hws/matcher.c | 71 ++++++++++--------- .../mellanox/mlx5/core/steering/hws/matcher.h | 3 +- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c b= /drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c index 91568d6c1dac..f9b75aefcaa7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c @@ -118,7 +118,6 @@ static int hws_debug_dump_matcher(struct seq_file *f, s= truct mlx5hws_matcher *ma { enum mlx5hws_table_type tbl_type =3D matcher->tbl->type; struct mlx5hws_cmd_ft_query_attr ft_attr =3D {0}; - struct mlx5hws_pool *ste_pool; u64 icm_addr_0 =3D 0; u64 icm_addr_1 =3D 0; u32 ste_0_id =3D -1; @@ -133,12 +132,9 @@ static int hws_debug_dump_matcher(struct seq_file *f, = struct mlx5hws_matcher *ma matcher->end_ft_id, matcher->col_matcher ? HWS_PTR_TO_ID(matcher->col_matcher) : 0); =20 - ste_pool =3D matcher->match_ste.pool; - if (ste_pool) { - ste_0_id =3D mlx5hws_pool_get_base_id(ste_pool); - if (tbl_type =3D=3D MLX5HWS_TABLE_TYPE_FDB) - ste_1_id =3D mlx5hws_pool_get_base_mirror_id(ste_pool); - } + ste_0_id =3D matcher->match_ste.ste_0_base; + if (tbl_type =3D=3D MLX5HWS_TABLE_TYPE_FDB) + ste_1_id =3D matcher->match_ste.ste_1_base; =20 seq_printf(f, ",%d,%d,%d,%d", matcher->match_ste.rtc_0_id, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c= b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c index ce28ee1c0e41..b0fcaf508e06 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c @@ -507,10 +507,8 @@ static int hws_matcher_create_rtc(struct mlx5hws_match= er *matcher) } } =20 - obj_id =3D mlx5hws_pool_get_base_id(matcher->match_ste.pool); - rtc_attr.pd =3D ctx->pd_num; - rtc_attr.ste_base =3D obj_id; + rtc_attr.ste_base =3D matcher->match_ste.ste_0_base; rtc_attr.reparse_mode =3D mlx5hws_context_get_reparse_mode(ctx); rtc_attr.table_type =3D mlx5hws_table_get_res_fw_ft_type(tbl->type, false= ); hws_matcher_set_rtc_attr_sz(matcher, &rtc_attr, false); @@ -527,9 +525,7 @@ static int hws_matcher_create_rtc(struct mlx5hws_matche= r *matcher) } =20 if (tbl->type =3D=3D MLX5HWS_TABLE_TYPE_FDB) { - obj_id =3D mlx5hws_pool_get_base_mirror_id( - matcher->match_ste.pool); - rtc_attr.ste_base =3D obj_id; + rtc_attr.ste_base =3D matcher->match_ste.ste_1_base; rtc_attr.table_type =3D mlx5hws_table_get_res_fw_ft_type(tbl->type, true= ); =20 obj_id =3D mlx5hws_pool_get_base_mirror_id(ctx->stc_pool); @@ -588,21 +584,6 @@ hws_matcher_check_attr_sz(struct mlx5hws_cmd_query_cap= s *caps, return 0; } =20 -static void hws_matcher_set_pool_attr(struct mlx5hws_pool_attr *attr, - struct mlx5hws_matcher *matcher) -{ - switch (matcher->attr.optimize_flow_src) { - case MLX5HWS_MATCHER_FLOW_SRC_VPORT: - attr->opt_type =3D MLX5HWS_POOL_OPTIMIZE_ORIG; - break; - case MLX5HWS_MATCHER_FLOW_SRC_WIRE: - attr->opt_type =3D MLX5HWS_POOL_OPTIMIZE_MIRROR; - break; - default: - break; - } -} - static int hws_matcher_check_and_process_at(struct mlx5hws_matcher *matche= r, struct mlx5hws_action_template *at) { @@ -683,8 +664,8 @@ static void hws_matcher_set_ip_version_match(struct mlx= 5hws_matcher *matcher) =20 static int hws_matcher_bind_mt(struct mlx5hws_matcher *matcher) { + struct mlx5hws_cmd_ste_create_attr ste_attr =3D {}; struct mlx5hws_context *ctx =3D matcher->tbl->ctx; - struct mlx5hws_pool_attr pool_attr =3D {0}; int ret; =20 /* Calculate match, range and hash definers */ @@ -699,22 +680,39 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher= *matcher) =20 hws_matcher_set_ip_version_match(matcher); =20 - /* Create an STE pool per matcher*/ - pool_attr.table_type =3D matcher->tbl->type; - pool_attr.pool_type =3D MLX5HWS_POOL_TYPE_STE; - pool_attr.alloc_log_sz =3D matcher->attr.table.sz_col_log + - matcher->attr.table.sz_row_log; - hws_matcher_set_pool_attr(&pool_attr, matcher); - - matcher->match_ste.pool =3D mlx5hws_pool_create(ctx, &pool_attr); - if (!matcher->match_ste.pool) { - mlx5hws_err(ctx, "Failed to allocate matcher STE pool\n"); - ret =3D -EOPNOTSUPP; + /* Create an STE range each for RX and TX. */ + ste_attr.table_type =3D FS_FT_FDB_RX; + ste_attr.log_obj_range =3D + matcher->attr.optimize_flow_src =3D=3D + MLX5HWS_MATCHER_FLOW_SRC_VPORT ? + 0 : matcher->attr.table.sz_col_log + + matcher->attr.table.sz_row_log; + + ret =3D mlx5hws_cmd_ste_create(ctx->mdev, &ste_attr, + &matcher->match_ste.ste_0_base); + if (ret) { + mlx5hws_err(ctx, "Failed to allocate RX STE range (%d)\n", ret); goto uninit_match_definer; } =20 + ste_attr.table_type =3D FS_FT_FDB_TX; + ste_attr.log_obj_range =3D + matcher->attr.optimize_flow_src =3D=3D + MLX5HWS_MATCHER_FLOW_SRC_WIRE ? + 0 : matcher->attr.table.sz_col_log + + matcher->attr.table.sz_row_log; + + ret =3D mlx5hws_cmd_ste_create(ctx->mdev, &ste_attr, + &matcher->match_ste.ste_1_base); + if (ret) { + mlx5hws_err(ctx, "Failed to allocate TX STE range (%d)\n", ret); + goto destroy_rx_ste_range; + } + return 0; =20 +destroy_rx_ste_range: + mlx5hws_cmd_ste_destroy(ctx->mdev, matcher->match_ste.ste_0_base); uninit_match_definer: if (!(matcher->flags & MLX5HWS_MATCHER_FLAGS_COLLISION)) mlx5hws_definer_mt_uninit(ctx, matcher->mt); @@ -723,9 +721,12 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher = *matcher) =20 static void hws_matcher_unbind_mt(struct mlx5hws_matcher *matcher) { - mlx5hws_pool_destroy(matcher->match_ste.pool); + struct mlx5hws_context *ctx =3D matcher->tbl->ctx; + + mlx5hws_cmd_ste_destroy(ctx->mdev, matcher->match_ste.ste_1_base); + mlx5hws_cmd_ste_destroy(ctx->mdev, matcher->match_ste.ste_0_base); if (!(matcher->flags & MLX5HWS_MATCHER_FLAGS_COLLISION)) - mlx5hws_definer_mt_uninit(matcher->tbl->ctx, matcher->mt); + mlx5hws_definer_mt_uninit(ctx, matcher->mt); } =20 static int diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.h= b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.h index 32e83cddcd60..ae20bcebfdde 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.h @@ -48,7 +48,8 @@ struct mlx5hws_match_template { struct mlx5hws_matcher_match_ste { u32 rtc_0_id; u32 rtc_1_id; - struct mlx5hws_pool *pool; + u32 ste_0_base; + u32 ste_1_base; }; =20 enum { --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2048.outbound.protection.outlook.com [40.107.236.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E4032FEE3D; Thu, 3 Jul 2025 18:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569015; cv=fail; b=WrGOQTgjaQDfCy1OWL4kNVnUuj2U2uAaA5B6UFj7LWwWGB2yZucug9fHUPemAndlYFo88g0ZeqiKuEPyPJn767K0BGnNFl8QMrFwGW8HIQ/xOS/01g+ehdV5MiwOXXZ0tcPWUzStLNrQw3ULE+TZ7jXhlO114m4uNIwqUndQZT8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569015; c=relaxed/simple; bh=0q7GQsVCR/TeGA/R7PcDnTuIdzXH5ZaFtaAn5gmZmoM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gm4Ffk130XDi4l1QbUBuVZq1gxa9qFEYPxUymGv/nBLTP1pv1yYUpu3iekvCQw/1JhY/JDWR4ME9vt5LCeUwyPw4+77dENG1QWSuuE8/9BmY2zoPzyoHo2Pr69PxnELGUCiKHVEVV7sFK+d6dmmLgFo7b7jC7nUQC9+y8eOxegI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=dBc8SekD; arc=fail smtp.client-ip=40.107.236.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="dBc8SekD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KDvB3K7SVdVXyEmkAvv5nSETRaGBY09jtcJYxpD6yCfr++lZhxmhlmG7McXRtYILfODItdrvxVJLOojWFk0LwYds5csZx9Eha/I6FDr7VTLtP3SWd4uA9GhQD1bzMgN8f+N822Cp1g9fOCk/5x9Aw8mSihyw5enT4MKi+T1T83OwrCgMIKD7N13fovFj8e5Ue6UIE7ZkL48PfHT6gjqn9Drw4O/S0QxtX28NHUBCKMFTwVboyNBEif+2EGtz9Vk/GRhz4xlduhmOin5RmxBFYiYLl/Plc01BgpgjhmMxhFGaco46Rco/ywX/HuFaVrLk3N8MZK7tfRgR5D9EMr2c/w== 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=SI8Eu84OAc+/+TRSzabkt01SHe1uXGQBITpgZ9lPZ7I=; b=OMjIFmoUeSurlCt3hYQ+df40+bUChbFpLEcYFNvGA3DbKNvjw9V03yIWsA0rEOIRG6zwan7shCwJ1gyvDdgkZCJF4/C5Sn10LRa/waS6CcSfpEkQpLWkxMlWfOz5wzXLqTZhlPRvhugZWQU5EE7kLmB2/aeL/a5aGSVxBqUyxyOexTj/RFevxXQpGuriKwmjoiwaOP3XJqmhLt5oQYPaBTPPrZhnYlvSOWosObQ046SwzON5MeFAUi5DEAqdvo6SE3fRBKyPP/v5XVb8UKsyfNMZj44pK4Y9xllWVZaayvePxMfbKmxscbMCRTymc70YWCMb7dPbxj2ccjJpAa2ZhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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=SI8Eu84OAc+/+TRSzabkt01SHe1uXGQBITpgZ9lPZ7I=; b=dBc8SekD81swTv0DyOGp48sUlhIPaU0a9XdGU27NUMULKpck0S4x39aNu7Tm+JfWa8cZevzJWqtExrrkgYPWlFFTXUNWXBtlcmoj3UdbSgWcO6HYlJDz3uN/A8Pdqr+Zyyp6HRkfcbmZFA1INPIN0Gb7KEBe9+SyizTEkRGT0X/5xFA3m8nnFJfzWKWIBBENhnK/em1n5pwrsObFHp5FOoXRl3SjdZ63n/i1Xf1bSHgPIVfLYa1d1rDkvtzL7ZnladwVEJkOTHt2EnRHbm3md2m7OGbf+f/gaSz7G7DtpbqfFfqyITxg/WVcaaKJreEGdCgJGeDLrXdB2YDQWfQhEA== Received: from BN9PR03CA0656.namprd03.prod.outlook.com (2603:10b6:408:13b::31) by SJ0PR12MB6784.namprd12.prod.outlook.com (2603:10b6:a03:44f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8880.27; Thu, 3 Jul 2025 18:56:46 +0000 Received: from BN1PEPF0000467F.namprd03.prod.outlook.com (2603:10b6:408:13b:cafe::db) by BN9PR03CA0656.outlook.office365.com (2603:10b6:408:13b::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.21 via Frontend Transport; Thu, 3 Jul 2025 18:56:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN1PEPF0000467F.mail.protection.outlook.com (10.167.243.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:45 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 3 Jul 2025 11:56:28 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Thu, 3 Jul 2025 11:56:28 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:23 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Vlad Dogaru , "Yevgeny Kliteynik" , Mark Bloch Subject: [PATCH net-next v3 06/10] net/mlx5: HWS, Decouple matcher RX and TX sizes Date: Thu, 3 Jul 2025 21:54:27 +0300 Message-ID: <20250703185431.445571-7-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000467F:EE_|SJ0PR12MB6784:EE_ X-MS-Office365-Filtering-Correlation-Id: c426485a-ca37-493e-906d-08ddba635b5e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?puKb0QP4GIAahgftDiXppDwfn3AOPrInCuppHLMVPOMQjYA42B3qkHzUI0PJ?= =?us-ascii?Q?0438+5vOR+lOJaJ5g+1YnwdE7XWejmE3Dh43p2ZPNMY9t7V/WWqAKZskNhzk?= =?us-ascii?Q?RutvFXbGoIRWi2ZPLu16J1Qk8QdPybAD/ND+1lfBsQ9JiVzI6F4fndfs1hl2?= =?us-ascii?Q?aoWvNDCcKYmrvHlxkmjFT9vtluhPPEnNIOFb1G/OcHixC/frzosZ6xfvXDY8?= =?us-ascii?Q?KKSeJQT5CACPufc8b9kJxyvOgdJLraSaCGjFvGihF+g8S2juLnbcA+jj1eZL?= =?us-ascii?Q?T9G3GjoqsQP4oH6JAw+twyY6CFzD0h4JciRsa4+TiFHQYbppQdoIfnuYGWPe?= =?us-ascii?Q?r76/X98piA1iVdKY7qTmwlvCJzbqNy5YkRqrYn+Pyi+Z+tzpx0LXVkbk/e3T?= =?us-ascii?Q?WpEPJ4/Id5bQBx7s/fWbXJw1ete5Rj6CYLA8JZ19yYBhLASMH4OGh63wYjoD?= =?us-ascii?Q?m+RHHOqDe8FK849gEnorj3iVdWz5BcPjEWJm54qtwDl54amOF0ux1MwDurv3?= =?us-ascii?Q?ASyDt/bue9jZukZuy8734EsHUCBTucB7Y1QjJGQffXowAWK+UABpQF3opBW1?= =?us-ascii?Q?47NOTMAPWvmEaspCNnRQ5v70aR8Nl1EWycBRh9jtkHsc0VoLYc0AHqSfdwWk?= =?us-ascii?Q?2CEG38cxVOFI8WaQzEG6c55N1wmybq3Ni2+b0OnhBvE3jPDDSItvfOmigG+o?= =?us-ascii?Q?WQr6EQnKab/f+pgfsy7wNDGbzOcIpss7hQo/Wqi1qXqdUlFxJMvbxnGmtAZf?= =?us-ascii?Q?KA4vWfeZ12hqF5HJCvv1du+yPRRZa/aR3+UfGHitWVlTD0NoseEqw1lHVyEU?= =?us-ascii?Q?OJa2O1ogorG0wDIdeYYm57+P5AdWKc1VT8W5ibUs/fKI88v7269fS0InoaeX?= =?us-ascii?Q?wKIDEVPku05hJKtpFLxjXj1HgelMtpm8fh69inVDSw6WaNDgbbm3gj1vW22b?= =?us-ascii?Q?1fd7c4MH9WT6iQD1JvtiNO/vg6IZf4FkurJU5/NWafATBnzLMExRdD/8TcEC?= =?us-ascii?Q?6m2hGZJ1OsqzX1Yxx7CivBNLbiTwnMDxRzOJ0ccTbXDil35IIwpL89R1vLny?= =?us-ascii?Q?w/7Ndecnm/71nhk5uQbiiS0amsxnVO4WFNkmr+7cMPPJJ92Jh5E2yHcFBg8z?= =?us-ascii?Q?6H1mpXJGABbNi/8cQUnmqdcMJzQu2cDe+qeGd/2HvlEhN9cwvLaU4B2BHrb8?= =?us-ascii?Q?C4816kHdNs6Jdfg8aHUqZW1AcqxAFPcKSleHEid8H7Fx+M1Exm92pvQIt/Fd?= =?us-ascii?Q?NQ2oNORXGQfCipoi1zl7qMjd2fv2/P7lugp5oagmRWBhYd95u1FhxbvSWEUd?= =?us-ascii?Q?OEF7GKQa+8Hk/XN/W/Nw6Cpgp2eAuE0KdD/mAgZ3NHQqP69DlDPnG+9Geejh?= =?us-ascii?Q?7hn1fkE2hQ3RwaxqqdMMqdiW+VWHJJU8Tlt3DKlCKA3UXJUVjoBrcRLR2/50?= =?us-ascii?Q?yyOudIh+GQ1nYeh4f7OYYbfENfg+P8eYTYTm+T6prOFhbI6JmGGKqRojisgi?= =?us-ascii?Q?OLmtYrp22argSKjgTXliUCWPk3/+S45aGdFJ?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:45.2106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c426485a-ca37-493e-906d-08ddba635b5e 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF0000467F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6784 Content-Type: text/plain; charset="utf-8" From: Vlad Dogaru Kernel HWS only uses FDB tables and, as such, creates two lower level containers (RTCs) for each matcher: one for RX and one for TX. Allow these RTCs to differ in size by converting the size part of the matcher attribute to a two element array. Signed-off-by: Vlad Dogaru Reviewed-by: Yevgeny Kliteynik Reviewed-by: Simon Horman Signed-off-by: Mark Bloch --- .../mellanox/mlx5/core/steering/hws/bwc.c | 7 +- .../mellanox/mlx5/core/steering/hws/debug.c | 10 +- .../mellanox/mlx5/core/steering/hws/matcher.c | 107 ++++++++++++------ .../mellanox/mlx5/core/steering/hws/mlx5hws.h | 28 +++-- 4 files changed, 104 insertions(+), 48 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c b/d= rivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c index 665e6e285db5..009641e6c874 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c @@ -48,7 +48,7 @@ static void hws_bwc_unlock_all_queues(struct mlx5hws_cont= ext *ctx) =20 static void hws_bwc_matcher_init_attr(struct mlx5hws_bwc_matcher *bwc_matc= her, u32 priority, - u8 size_log, + u8 size_log_rx, u8 size_log_tx, struct mlx5hws_matcher_attr *attr) { struct mlx5hws_bwc_matcher *first_matcher =3D @@ -62,7 +62,8 @@ static void hws_bwc_matcher_init_attr(struct mlx5hws_bwc_= matcher *bwc_matcher, attr->optimize_flow_src =3D MLX5HWS_MATCHER_FLOW_SRC_ANY; attr->insert_mode =3D MLX5HWS_MATCHER_INSERT_BY_HASH; attr->distribute_mode =3D MLX5HWS_MATCHER_DISTRIBUTE_BY_HASH; - attr->rule.num_log =3D size_log; + attr->size[MLX5HWS_MATCHER_SIZE_TYPE_RX].rule.num_log =3D size_log_rx; + attr->size[MLX5HWS_MATCHER_SIZE_TYPE_TX].rule.num_log =3D size_log_tx; attr->resizable =3D true; attr->max_num_of_at_attach =3D MLX5HWS_BWC_MATCHER_ATTACH_AT_NUM; =20 @@ -93,6 +94,7 @@ int mlx5hws_bwc_matcher_create_simple(struct mlx5hws_bwc_= matcher *bwc_matcher, hws_bwc_matcher_init_attr(bwc_matcher, priority, MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG, + MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG, &attr); =20 bwc_matcher->priority =3D priority; @@ -696,6 +698,7 @@ static int hws_bwc_matcher_move(struct mlx5hws_bwc_matc= her *bwc_matcher) hws_bwc_matcher_init_attr(bwc_matcher, bwc_matcher->priority, bwc_matcher->size_log, + bwc_matcher->size_log, &matcher_attr); =20 old_matcher =3D bwc_matcher->matcher; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c b= /drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c index f9b75aefcaa7..2ec8cb10139a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c @@ -99,17 +99,19 @@ hws_debug_dump_matcher_attr(struct seq_file *f, struct = mlx5hws_matcher *matcher) { struct mlx5hws_matcher_attr *attr =3D &matcher->attr; =20 - seq_printf(f, "%d,0x%llx,%d,%d,%d,%d,%d,%d,%d,%d\n", + seq_printf(f, "%d,0x%llx,%d,%d,%d,%d,%d,%d,%d,%d,-1,-1,%d,%d\n", MLX5HWS_DEBUG_RES_TYPE_MATCHER_ATTR, HWS_PTR_TO_ID(matcher), attr->priority, attr->mode, - attr->table.sz_row_log, - attr->table.sz_col_log, + attr->size[MLX5HWS_MATCHER_SIZE_TYPE_RX].table.sz_row_log, + attr->size[MLX5HWS_MATCHER_SIZE_TYPE_RX].table.sz_col_log, attr->optimize_using_rule_idx, attr->optimize_flow_src, attr->insert_mode, - attr->distribute_mode); + attr->distribute_mode, + attr->size[MLX5HWS_MATCHER_SIZE_TYPE_TX].table.sz_row_log, + attr->size[MLX5HWS_MATCHER_SIZE_TYPE_TX].table.sz_col_log); =20 return 0; } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c= b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c index b0fcaf508e06..f3ea09caba2b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c @@ -468,12 +468,16 @@ static int hws_matcher_create_rtc(struct mlx5hws_matc= her *matcher) struct mlx5hws_cmd_rtc_create_attr rtc_attr =3D {0}; struct mlx5hws_match_template *mt =3D matcher->mt; struct mlx5hws_context *ctx =3D matcher->tbl->ctx; + union mlx5hws_matcher_size *size_rx, *size_tx; struct mlx5hws_table *tbl =3D matcher->tbl; u32 obj_id; int ret; =20 - rtc_attr.log_size =3D attr->table.sz_row_log; - rtc_attr.log_depth =3D attr->table.sz_col_log; + size_rx =3D &attr->size[MLX5HWS_MATCHER_SIZE_TYPE_RX]; + size_tx =3D &attr->size[MLX5HWS_MATCHER_SIZE_TYPE_TX]; + + rtc_attr.log_size =3D size_rx->table.sz_row_log; + rtc_attr.log_depth =3D size_rx->table.sz_col_log; rtc_attr.is_frst_jumbo =3D mlx5hws_matcher_mt_is_jumbo(mt); rtc_attr.is_scnd_range =3D 0; rtc_attr.miss_ft_id =3D matcher->end_ft_id; @@ -525,6 +529,8 @@ static int hws_matcher_create_rtc(struct mlx5hws_matche= r *matcher) } =20 if (tbl->type =3D=3D MLX5HWS_TABLE_TYPE_FDB) { + rtc_attr.log_size =3D size_tx->table.sz_row_log; + rtc_attr.log_depth =3D size_tx->table.sz_col_log; rtc_attr.ste_base =3D matcher->match_ste.ste_1_base; rtc_attr.table_type =3D mlx5hws_table_get_res_fw_ft_type(tbl->type, true= ); =20 @@ -562,23 +568,33 @@ hws_matcher_check_attr_sz(struct mlx5hws_cmd_query_ca= ps *caps, struct mlx5hws_matcher *matcher) { struct mlx5hws_matcher_attr *attr =3D &matcher->attr; + struct mlx5hws_context *ctx =3D matcher->tbl->ctx; + union mlx5hws_matcher_size *size; + int i; =20 - if (attr->table.sz_col_log > caps->rtc_log_depth_max) { - mlx5hws_err(matcher->tbl->ctx, "Matcher depth exceeds limit %d\n", - caps->rtc_log_depth_max); - return -EOPNOTSUPP; - } + for (i =3D 0; i < 2; i++) { + size =3D &attr->size[i]; =20 - if (attr->table.sz_col_log + attr->table.sz_row_log > caps->ste_alloc_log= _max) { - mlx5hws_err(matcher->tbl->ctx, "Total matcher size exceeds limit %d\n", - caps->ste_alloc_log_max); - return -EOPNOTSUPP; - } + if (size->table.sz_col_log > caps->rtc_log_depth_max) { + mlx5hws_err(ctx, "Matcher depth exceeds limit %d\n", + caps->rtc_log_depth_max); + return -EOPNOTSUPP; + } =20 - if (attr->table.sz_col_log + attr->table.sz_row_log < caps->ste_alloc_log= _gran) { - mlx5hws_err(matcher->tbl->ctx, "Total matcher size below limit %d\n", - caps->ste_alloc_log_gran); - return -EOPNOTSUPP; + if (size->table.sz_col_log + size->table.sz_row_log > + caps->ste_alloc_log_max) { + mlx5hws_err(ctx, + "Total matcher size exceeds limit %d\n", + caps->ste_alloc_log_max); + return -EOPNOTSUPP; + } + + if (size->table.sz_col_log + size->table.sz_row_log < + caps->ste_alloc_log_gran) { + mlx5hws_err(ctx, "Total matcher size below limit %d\n", + caps->ste_alloc_log_gran); + return -EOPNOTSUPP; + } } =20 return 0; @@ -666,6 +682,7 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher *= matcher) { struct mlx5hws_cmd_ste_create_attr ste_attr =3D {}; struct mlx5hws_context *ctx =3D matcher->tbl->ctx; + union mlx5hws_matcher_size *size; int ret; =20 /* Calculate match, range and hash definers */ @@ -682,11 +699,11 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher= *matcher) =20 /* Create an STE range each for RX and TX. */ ste_attr.table_type =3D FS_FT_FDB_RX; + size =3D &matcher->attr.size[MLX5HWS_MATCHER_SIZE_TYPE_RX]; ste_attr.log_obj_range =3D matcher->attr.optimize_flow_src =3D=3D - MLX5HWS_MATCHER_FLOW_SRC_VPORT ? - 0 : matcher->attr.table.sz_col_log + - matcher->attr.table.sz_row_log; + MLX5HWS_MATCHER_FLOW_SRC_VPORT ? + 0 : size->table.sz_col_log + size->table.sz_row_log; =20 ret =3D mlx5hws_cmd_ste_create(ctx->mdev, &ste_attr, &matcher->match_ste.ste_0_base); @@ -696,11 +713,11 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher= *matcher) } =20 ste_attr.table_type =3D FS_FT_FDB_TX; + size =3D &matcher->attr.size[MLX5HWS_MATCHER_SIZE_TYPE_TX]; ste_attr.log_obj_range =3D matcher->attr.optimize_flow_src =3D=3D - MLX5HWS_MATCHER_FLOW_SRC_WIRE ? - 0 : matcher->attr.table.sz_col_log + - matcher->attr.table.sz_row_log; + MLX5HWS_MATCHER_FLOW_SRC_WIRE ? + 0 : size->table.sz_col_log + size->table.sz_row_log; =20 ret =3D mlx5hws_cmd_ste_create(ctx->mdev, &ste_attr, &matcher->match_ste.ste_1_base); @@ -735,6 +752,10 @@ hws_matcher_validate_insert_mode(struct mlx5hws_cmd_qu= ery_caps *caps, { struct mlx5hws_matcher_attr *attr =3D &matcher->attr; struct mlx5hws_context *ctx =3D matcher->tbl->ctx; + union mlx5hws_matcher_size *size_rx, *size_tx; + + size_rx =3D &matcher->attr.size[MLX5HWS_MATCHER_SIZE_TYPE_RX]; + size_tx =3D &matcher->attr.size[MLX5HWS_MATCHER_SIZE_TYPE_TX]; =20 switch (attr->insert_mode) { case MLX5HWS_MATCHER_INSERT_BY_HASH: @@ -745,7 +766,7 @@ hws_matcher_validate_insert_mode(struct mlx5hws_cmd_que= ry_caps *caps, break; =20 case MLX5HWS_MATCHER_INSERT_BY_INDEX: - if (attr->table.sz_col_log) { + if (size_rx->table.sz_col_log || size_tx->table.sz_col_log) { mlx5hws_err(ctx, "Matcher with INSERT_BY_INDEX supports only Nx1 table = size\n"); return -EOPNOTSUPP; } @@ -765,7 +786,10 @@ hws_matcher_validate_insert_mode(struct mlx5hws_cmd_qu= ery_caps *caps, return -EOPNOTSUPP; } =20 - if (attr->table.sz_row_log > MLX5_IFC_RTC_LINEAR_LOOKUP_TBL_LOG_MAX) { + if (size_rx->table.sz_row_log > + MLX5_IFC_RTC_LINEAR_LOOKUP_TBL_LOG_MAX || + size_tx->table.sz_row_log > + MLX5_IFC_RTC_LINEAR_LOOKUP_TBL_LOG_MAX) { mlx5hws_err(ctx, "Matcher with linear distribute: rows exceed limit %d= ", MLX5_IFC_RTC_LINEAR_LOOKUP_TBL_LOG_MAX); return -EOPNOTSUPP; @@ -789,6 +813,10 @@ hws_matcher_process_attr(struct mlx5hws_cmd_query_caps= *caps, struct mlx5hws_matcher *matcher) { struct mlx5hws_matcher_attr *attr =3D &matcher->attr; + union mlx5hws_matcher_size *size_rx, *size_tx; + + size_rx =3D &attr->size[MLX5HWS_MATCHER_SIZE_TYPE_RX]; + size_tx =3D &attr->size[MLX5HWS_MATCHER_SIZE_TYPE_TX]; =20 if (hws_matcher_validate_insert_mode(caps, matcher)) return -EOPNOTSUPP; @@ -800,8 +828,12 @@ hws_matcher_process_attr(struct mlx5hws_cmd_query_caps= *caps, =20 /* Convert number of rules to the required depth */ if (attr->mode =3D=3D MLX5HWS_MATCHER_RESOURCE_MODE_RULE && - attr->insert_mode =3D=3D MLX5HWS_MATCHER_INSERT_BY_HASH) - attr->table.sz_col_log =3D hws_matcher_rules_to_tbl_depth(attr->rule.num= _log); + attr->insert_mode =3D=3D MLX5HWS_MATCHER_INSERT_BY_HASH) { + size_rx->table.sz_col_log =3D + hws_matcher_rules_to_tbl_depth(size_rx->rule.num_log); + size_tx->table.sz_col_log =3D + hws_matcher_rules_to_tbl_depth(size_tx->rule.num_log); + } =20 matcher->flags |=3D attr->resizable ? MLX5HWS_MATCHER_FLAGS_RESIZABLE : 0; matcher->flags |=3D attr->isolated_matcher_end_ft_id ? @@ -862,14 +894,19 @@ static int hws_matcher_create_col_matcher(struct mlx5hws_matcher *matcher) { struct mlx5hws_context *ctx =3D matcher->tbl->ctx; + union mlx5hws_matcher_size *size_rx, *size_tx; struct mlx5hws_matcher *col_matcher; - int ret; + int i, ret; + + size_rx =3D &matcher->attr.size[MLX5HWS_MATCHER_SIZE_TYPE_RX]; + size_tx =3D &matcher->attr.size[MLX5HWS_MATCHER_SIZE_TYPE_TX]; =20 if (matcher->attr.mode !=3D MLX5HWS_MATCHER_RESOURCE_MODE_RULE || matcher->attr.insert_mode =3D=3D MLX5HWS_MATCHER_INSERT_BY_INDEX) return 0; =20 - if (!hws_matcher_requires_col_tbl(matcher->attr.rule.num_log)) + if (!hws_matcher_requires_col_tbl(size_rx->rule.num_log) && + !hws_matcher_requires_col_tbl(size_tx->rule.num_log)) return 0; =20 col_matcher =3D kzalloc(sizeof(*matcher), GFP_KERNEL); @@ -886,10 +923,16 @@ hws_matcher_create_col_matcher(struct mlx5hws_matcher= *matcher) col_matcher->flags |=3D MLX5HWS_MATCHER_FLAGS_COLLISION; col_matcher->attr.mode =3D MLX5HWS_MATCHER_RESOURCE_MODE_HTABLE; col_matcher->attr.optimize_flow_src =3D matcher->attr.optimize_flow_src; - col_matcher->attr.table.sz_row_log =3D matcher->attr.rule.num_log; - col_matcher->attr.table.sz_col_log =3D MLX5HWS_MATCHER_ASSURED_COL_TBL_DE= PTH; - if (col_matcher->attr.table.sz_row_log > MLX5HWS_MATCHER_ASSURED_ROW_RATI= O) - col_matcher->attr.table.sz_row_log -=3D MLX5HWS_MATCHER_ASSURED_ROW_RATI= O; + for (i =3D 0; i < 2; i++) { + union mlx5hws_matcher_size *dst =3D &col_matcher->attr.size[i]; + union mlx5hws_matcher_size *src =3D &matcher->attr.size[i]; + + dst->table.sz_row_log =3D src->rule.num_log; + dst->table.sz_col_log =3D MLX5HWS_MATCHER_ASSURED_COL_TBL_DEPTH; + if (dst->table.sz_row_log > MLX5HWS_MATCHER_ASSURED_ROW_RATIO) + dst->table.sz_row_log -=3D + MLX5HWS_MATCHER_ASSURED_ROW_RATIO; + } =20 col_matcher->attr.max_num_of_at_attach =3D matcher->attr.max_num_of_at_at= tach; col_matcher->attr.isolated_matcher_end_ft_id =3D diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h= b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h index a1295a311b70..59c14745ed0c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h @@ -93,6 +93,23 @@ enum mlx5hws_matcher_distribute_mode { MLX5HWS_MATCHER_DISTRIBUTE_BY_LINEAR =3D 0x1, }; =20 +enum mlx5hws_matcher_size_type { + MLX5HWS_MATCHER_SIZE_TYPE_RX, + MLX5HWS_MATCHER_SIZE_TYPE_TX, + MLX5HWS_MATCHER_SIZE_TYPE_MAX, +}; + +union mlx5hws_matcher_size { + struct { + u8 sz_row_log; + u8 sz_col_log; + } table; + + struct { + u8 num_log; + } rule; +}; + struct mlx5hws_matcher_attr { /* Processing priority inside table */ u32 priority; @@ -107,16 +124,7 @@ struct mlx5hws_matcher_attr { enum mlx5hws_matcher_distribute_mode distribute_mode; /* Define whether the created matcher supports resizing into a bigger mat= cher */ bool resizable; - union { - struct { - u8 sz_row_log; - u8 sz_col_log; - } table; - - struct { - u8 num_log; - } rule; - }; + union mlx5hws_matcher_size size[MLX5HWS_MATCHER_SIZE_TYPE_MAX]; /* Optional AT attach configuration - Max number of additional AT */ u8 max_num_of_at_attach; /* Optional end FT (miss FT ID) for match RTC (for isolated matcher) */ --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2083.outbound.protection.outlook.com [40.107.244.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C2AF2FA653; Thu, 3 Jul 2025 18:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569021; cv=fail; b=N7JPwQ2qlZ9ZxTkolwBn9mUUv5ZFgGVkuL3hv6eNIfp5TQgNEI/YWDSx/TKtzVjqrB14iBTRQaA5aoofyRPiQuXcTx1ZiD4IYR+AYKJBYjrMfgzto6NG/Tueah98G+1cWdiXlb3TgSFlSHts48QTtXfySUcKCuamaAWoG0YcBBg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569021; c=relaxed/simple; bh=3XtL9PEMQ2QLlLetwfxQNuI/WqgGNukNRhBMW+TgLgg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nGW5EbsBK4+e+rhoo4cIA41LNZWP20KNYf2I9+NBtTzWz3kbp07O3ecO/jby8SnLSzITc5ldHo4X9NhZutbMhh6Z937wLI4MFdKEeP84y/PidLMhKtTt+KhZdm28j5u1uaNXlWUkpC6/ebuu42TuuRFIWR3eJWgXw06rvqu2ik8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=QWZMHOIU; arc=fail smtp.client-ip=40.107.244.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="QWZMHOIU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kar3J2FQBFTzd1Gl6Ca5dp4+eDhEpQlV4qnhP0Jzi+JYhKF7jVPDDmPEm/KmCTMHNwbNDBD7vwJGkPtgle+WMkfsz09bqgjFH6coom1TpRKTyGCKGP3HVScamgaiDZZsxrhd54Z26Dz7b7WO1oDiqxp7T5IMYfb387SPqTXFDbCIAggKLHCGoeOD9mxvrPrv6TPxEh0AKFxLFH1yIy/Iw9FJk8FhE8eoZrIidlOuSHi84SDfit6gcNBJe05sRYwH9Ud5+Nac7dq9wzt4F4tyRLpyXYxMhHAeHaKFvN8EXcViWm8n9cIwrrlNvbKCq90vmUU/LjkWiW+6utGs6x/OUg== 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=HZcxiea41geubKpbAkjUQmFiNMzR/zC7y97hxibXy88=; b=v8Lpo8u8XIR5l/wFkCySBQmEjM8TARWuztpvxambGFcs32tjutpwzWpfhYUbiXlQmHJAwT0U8xtx66btna/VUjS3LB4ik+7yRdmtwY9FUsSaS12oitn53QWOtIy6tISbh5tczFSzkf6HsT/YKwHqfgKsNgBvnXN7JniWC/zYB3XyuiqrEkg8Q9frWl/z/0zscNK4JzaYvO5PLhLMuCn5bEKW4VTVSdh7uID2xjNbwmpvXmHs3M+KnWGLWdp7iyCBNdM3oupDdOiQKgZUaFYXKtsRm6uwHkU2NJR0LaL8XDdvZA30Yu4cPC799oHdBsQR9LJT6TJOicVpLBWK/WlWYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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=HZcxiea41geubKpbAkjUQmFiNMzR/zC7y97hxibXy88=; b=QWZMHOIUa0XIdHHZy/OkoHi2yiZHLGMRtZec5ylJUFReyYhnLFEd6YXp6VRp6tYJYO6f6CgYpqr8v4vACUAYlgjCtVvmRXrTR3GWhA4Q7DAUu42deVbCSEG9SEccpJW2fuiBfsm+ubsE6pYMaSol/f85h0xzwGUZ/3tFsCdbUWRUPRQEieBpAmrWrz04d5idttmflHvL0UUqn7EWXcEicxd99/VoudgfAsW4z88yzhbXAOJQ5OyG6up0piqjLtSV5oTgm2eOCenKxNOzuOUdJk/YzY9Lm8J0cNwwURL2iBHyAOWThIBghh7JA7FhY/9Wd6i37p1gMC6di9TgwYKnAg== Received: from BN9PR03CA0560.namprd03.prod.outlook.com (2603:10b6:408:138::25) by IA1PR12MB7544.namprd12.prod.outlook.com (2603:10b6:208:42c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8857.37; Thu, 3 Jul 2025 18:56:50 +0000 Received: from MN1PEPF0000F0E5.namprd04.prod.outlook.com (2603:10b6:408:138:cafe::fe) by BN9PR03CA0560.outlook.office365.com (2603:10b6:408:138::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.20 via Frontend Transport; Thu, 3 Jul 2025 18:56:50 +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 MN1PEPF0000F0E5.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:50 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Thu, 3 Jul 2025 11:56:33 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Thu, 3 Jul 2025 11:56:32 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:28 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Vlad Dogaru , "Yevgeny Kliteynik" , Mark Bloch Subject: [PATCH net-next v3 07/10] net/mlx5: HWS, Track matcher sizes individually Date: Thu, 3 Jul 2025 21:54:28 +0300 Message-ID: <20250703185431.445571-8-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E5:EE_|IA1PR12MB7544:EE_ X-MS-Office365-Filtering-Correlation-Id: f3b0f56d-d630-4344-71ca-08ddba635e3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7FSTZ0C8Il4miw8rPPVA43IyTQgKGDQUH++AmrfRJNqIgTcOeHbAoB3HDY7P?= =?us-ascii?Q?aKZzdnNaTXZaX3CMacaLtf4MmWf1BmsFCkc9iNqFQUheXLNY0WdgiBnrBX76?= =?us-ascii?Q?Zc4W3LedG5EvfmYiMBYiNTjTERekqLK3KspYU2++jrnGTd0PNtx7UVpjky6O?= =?us-ascii?Q?tH66PsZ38U8Vdp9j92939TubrH14snn+80Pro9i8Xfq5XCswZdK3E+KifghL?= =?us-ascii?Q?Sn9emYdeZyzl2jMqW1+4Gv7jyARSzf2AxY5qAx/i8MjHjtXilEFq8NArtV2B?= =?us-ascii?Q?MNmax3E6O2WshEsSBxVZpZ01h4NVDEJ/zcOv26Uk6ihbHVodwGgSu8M/BooA?= =?us-ascii?Q?L3psRMLB0EqcYLQojzlR8R/gdUIJ+IBjzsKnvyFQbezs6DsyR9t9xNJGPVi1?= =?us-ascii?Q?M5IhVfazxrLSxmbLXnA+0/BCwbAXDi1gFiTG0WCGcQBaiyhDNC53PCgXuxpi?= =?us-ascii?Q?QbYbLGBroHYa2/cDtLrleWbs1igxLd7UO8L0hHsLFtya+eXOg3xdzHAEVgVx?= =?us-ascii?Q?meVkwVgc0ujHwjJsBrdzP6jll7fPxI8+B1gHDCWkGEwxwLplb+KbWb8aNf/h?= =?us-ascii?Q?wlsQJ2sojM5RSkaaX2ZsS+R6Q82cnkYaVZc/zAvHv24KJ4UB9vGUpEDZgwP2?= =?us-ascii?Q?uzTFuVeY1ZHT5ZznbPlLiFY7/vFLgA9Z0SxUsidxEq+Om5C+5TRiY0qFiklo?= =?us-ascii?Q?MHn9eMLifjsVErOYNlCIXLVDTCTT/XHT+tjCuVDxsWVgKB64GblgeEhSOE5w?= =?us-ascii?Q?BXaD3Eisu4pYhCoQgcj+SOuvjWOwwWseGAOf5zUdOxLRAbzgEdxGOecTLpxo?= =?us-ascii?Q?zE+Sl6txNVEpwflPk4uogGfYiYJc7oXBN54mdBBPTOtDZRiUR5aRmjXiFcTu?= =?us-ascii?Q?0vQ2/JfpHEU929mWCSH6TY2Q+pLpV4xEN6rb2toLVVx9AkI6lMKbGiF4Y7o0?= =?us-ascii?Q?5iaZ3gSbagDnCnSedx7bRgxYABolVwlsRZE5zUWrZAV65xmmuS0VTfumARTD?= =?us-ascii?Q?RgrV3ToIvz94JheFBNoDI0UKCUNGDuSlZL3g7I5m3o3qI2MwhUzmSdFqkAer?= =?us-ascii?Q?PQScfozwybWY7CR0c7foVEtW6eXozgWEA0J9fX+0026pR44nY02C+J3RRj+p?= =?us-ascii?Q?sUnfOFp8f/wr3r4lRpZwdrbdk8YVTT8nqvBuy8Se3BDAueGo000qe5Y7tuk4?= =?us-ascii?Q?vXy0jHMzTWwuiPGAAON5Di+ScyO5iy4PZCOLK9kSFK914iPZr9/i8vnjBD7D?= =?us-ascii?Q?It4d3LuEGVA4doJrG6ZFU1+aqJhnPjBIw653gzUTgRWTxcUixt++VM5OVV6n?= =?us-ascii?Q?LtPxui/ePd3cd8J09bFA82wzUjG/NkbWBTI4kxUVzZybPBznmNKibmSH7D0A?= =?us-ascii?Q?Dybhk8e9BpapcXy6a6toPgLf9XDole8oGQTMIMQMSyBMrPvSFt0X/LjCFOpw?= =?us-ascii?Q?odJgrf2vorC5XwYZpSqqaQwKzo3xAmt5sJDvxABEw7IHV15fzu5GE+MRSJMX?= =?us-ascii?Q?KF5UoGG9xRSYAznYNDKAPutdAOoImuM/XYwg?= 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)(7416014)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:50.0053 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3b0f56d-d630-4344-71ca-08ddba635e3c 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: MN1PEPF0000F0E5.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7544 Content-Type: text/plain; charset="utf-8" From: Vlad Dogaru Track and grow matcher sizes individually for RX and TX RTCs. This allows RX-only or TX-only use cases to effectively halve the device resources they use. For testing we used a simple module that inserts 1M RX-only rules and measured the number of pages the device requests, and memory usage as reported by `free -h`. Pages Memory Before this patch: 300k 1.5GiB After this patch: 160k 900MiB Signed-off-by: Vlad Dogaru Reviewed-by: Yevgeny Kliteynik Signed-off-by: Mark Bloch Reviewed-by: Simon Horman --- .../mellanox/mlx5/core/steering/hws/bwc.c | 217 +++++++++++++----- .../mellanox/mlx5/core/steering/hws/bwc.h | 15 +- 2 files changed, 171 insertions(+), 61 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c b/d= rivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c index 009641e6c874..516634237cb8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c @@ -93,12 +93,11 @@ int mlx5hws_bwc_matcher_create_simple(struct mlx5hws_bw= c_matcher *bwc_matcher, =20 hws_bwc_matcher_init_attr(bwc_matcher, priority, - MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG, - MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG, + bwc_matcher->rx_size.size_log, + bwc_matcher->tx_size.size_log, &attr); =20 bwc_matcher->priority =3D priority; - bwc_matcher->size_log =3D MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG; =20 bwc_matcher->size_of_at_array =3D MLX5HWS_BWC_MATCHER_ATTACH_AT_NUM; bwc_matcher->at =3D kcalloc(bwc_matcher->size_of_at_array, @@ -150,6 +149,20 @@ int mlx5hws_bwc_matcher_create_simple(struct mlx5hws_b= wc_matcher *bwc_matcher, return -EINVAL; } =20 +static void +hws_bwc_matcher_init_size_rxtx(struct mlx5hws_bwc_matcher_size *size) +{ + size->size_log =3D MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG; + atomic_set(&size->num_of_rules, 0); + atomic_set(&size->rehash_required, false); +} + +static void hws_bwc_matcher_init_size(struct mlx5hws_bwc_matcher *bwc_matc= her) +{ + hws_bwc_matcher_init_size_rxtx(&bwc_matcher->rx_size); + hws_bwc_matcher_init_size_rxtx(&bwc_matcher->tx_size); +} + struct mlx5hws_bwc_matcher * mlx5hws_bwc_matcher_create(struct mlx5hws_table *table, u32 priority, @@ -170,8 +183,7 @@ mlx5hws_bwc_matcher_create(struct mlx5hws_table *table, if (!bwc_matcher) return NULL; =20 - atomic_set(&bwc_matcher->num_of_rules, 0); - atomic_set(&bwc_matcher->rehash_required, false); + hws_bwc_matcher_init_size(bwc_matcher); =20 /* Check if the required match params can be all matched * in single STE, otherwise complex matcher is needed. @@ -221,12 +233,13 @@ int mlx5hws_bwc_matcher_destroy_simple(struct mlx5hws= _bwc_matcher *bwc_matcher) =20 int mlx5hws_bwc_matcher_destroy(struct mlx5hws_bwc_matcher *bwc_matcher) { - u32 num_of_rules =3D atomic_read(&bwc_matcher->num_of_rules); + u32 rx_rules =3D atomic_read(&bwc_matcher->rx_size.num_of_rules); + u32 tx_rules =3D atomic_read(&bwc_matcher->tx_size.num_of_rules); =20 - if (num_of_rules) + if (rx_rules || tx_rules) mlx5hws_err(bwc_matcher->matcher->tbl->ctx, - "BWC matcher destroy: matcher still has %d rules\n", - num_of_rules); + "BWC matcher destroy: matcher still has %u RX and %u TX rules\n", + rx_rules, tx_rules); =20 if (bwc_matcher->complex) mlx5hws_bwc_matcher_destroy_complex(bwc_matcher); @@ -386,6 +399,16 @@ hws_bwc_rule_destroy_hws_sync(struct mlx5hws_bwc_rule = *bwc_rule, return 0; } =20 +static void hws_bwc_rule_cnt_dec(struct mlx5hws_bwc_rule *bwc_rule) +{ + struct mlx5hws_bwc_matcher *bwc_matcher =3D bwc_rule->bwc_matcher; + + if (!bwc_rule->skip_rx) + atomic_dec(&bwc_matcher->rx_size.num_of_rules); + if (!bwc_rule->skip_tx) + atomic_dec(&bwc_matcher->tx_size.num_of_rules); +} + int mlx5hws_bwc_rule_destroy_simple(struct mlx5hws_bwc_rule *bwc_rule) { struct mlx5hws_bwc_matcher *bwc_matcher =3D bwc_rule->bwc_matcher; @@ -402,7 +425,7 @@ int mlx5hws_bwc_rule_destroy_simple(struct mlx5hws_bwc_= rule *bwc_rule) mutex_lock(queue_lock); =20 ret =3D hws_bwc_rule_destroy_hws_sync(bwc_rule, &attr); - atomic_dec(&bwc_matcher->num_of_rules); + hws_bwc_rule_cnt_dec(bwc_rule); hws_bwc_rule_list_remove(bwc_rule); =20 mutex_unlock(queue_lock); @@ -489,25 +512,27 @@ hws_bwc_rule_update_sync(struct mlx5hws_bwc_rule *bwc= _rule, } =20 static bool -hws_bwc_matcher_size_maxed_out(struct mlx5hws_bwc_matcher *bwc_matcher) +hws_bwc_matcher_size_maxed_out(struct mlx5hws_bwc_matcher *bwc_matcher, + struct mlx5hws_bwc_matcher_size *size) { struct mlx5hws_cmd_query_caps *caps =3D bwc_matcher->matcher->tbl->ctx->c= aps; =20 /* check the match RTC size */ - return (bwc_matcher->size_log + MLX5HWS_MATCHER_ASSURED_MAIN_TBL_DEPTH + + return (size->size_log + MLX5HWS_MATCHER_ASSURED_MAIN_TBL_DEPTH + MLX5HWS_BWC_MATCHER_SIZE_LOG_STEP) > (caps->ste_alloc_log_max - 1); } =20 static bool hws_bwc_matcher_rehash_size_needed(struct mlx5hws_bwc_matcher *bwc_matcher, + struct mlx5hws_bwc_matcher_size *size, u32 num_of_rules) { - if (unlikely(hws_bwc_matcher_size_maxed_out(bwc_matcher))) + if (unlikely(hws_bwc_matcher_size_maxed_out(bwc_matcher, size))) return false; =20 if (unlikely((num_of_rules * 100 / MLX5HWS_BWC_MATCHER_REHASH_PERCENT_TH)= >=3D - (1UL << bwc_matcher->size_log))) + (1UL << size->size_log))) return true; =20 return false; @@ -564,20 +589,21 @@ hws_bwc_matcher_extend_at(struct mlx5hws_bwc_matcher = *bwc_matcher, } =20 static int -hws_bwc_matcher_extend_size(struct mlx5hws_bwc_matcher *bwc_matcher) +hws_bwc_matcher_extend_size(struct mlx5hws_bwc_matcher *bwc_matcher, + struct mlx5hws_bwc_matcher_size *size) { struct mlx5hws_context *ctx =3D bwc_matcher->matcher->tbl->ctx; struct mlx5hws_cmd_query_caps *caps =3D ctx->caps; =20 - if (unlikely(hws_bwc_matcher_size_maxed_out(bwc_matcher))) { + if (unlikely(hws_bwc_matcher_size_maxed_out(bwc_matcher, size))) { mlx5hws_err(ctx, "Can't resize matcher: depth exceeds limit %d\n", caps->rtc_log_depth_max); return -ENOMEM; } =20 - bwc_matcher->size_log =3D - min(bwc_matcher->size_log + MLX5HWS_BWC_MATCHER_SIZE_LOG_STEP, - caps->ste_alloc_log_max - MLX5HWS_MATCHER_ASSURED_MAIN_TBL_DEPTH); + size->size_log =3D min(size->size_log + MLX5HWS_BWC_MATCHER_SIZE_LOG_STEP, + caps->ste_alloc_log_max - + MLX5HWS_MATCHER_ASSURED_MAIN_TBL_DEPTH); =20 return 0; } @@ -697,8 +723,8 @@ static int hws_bwc_matcher_move(struct mlx5hws_bwc_matc= her *bwc_matcher) =20 hws_bwc_matcher_init_attr(bwc_matcher, bwc_matcher->priority, - bwc_matcher->size_log, - bwc_matcher->size_log, + bwc_matcher->rx_size.size_log, + bwc_matcher->tx_size.size_log, &matcher_attr); =20 old_matcher =3D bwc_matcher->matcher; @@ -736,21 +762,39 @@ static int hws_bwc_matcher_move(struct mlx5hws_bwc_ma= tcher *bwc_matcher) static int hws_bwc_matcher_rehash_size(struct mlx5hws_bwc_matcher *bwc_matcher) { + bool need_rx_rehash, need_tx_rehash; int ret; =20 - /* If the current matcher size is already at its max size, we can't - * do the rehash. Skip it and try adding the rule again - perhaps - * there was some change. + need_rx_rehash =3D atomic_read(&bwc_matcher->rx_size.rehash_required); + need_tx_rehash =3D atomic_read(&bwc_matcher->tx_size.rehash_required); + + /* It is possible that another rule has already performed rehash. + * Need to check again if we really need rehash. */ - if (hws_bwc_matcher_size_maxed_out(bwc_matcher)) + if (!need_rx_rehash && !need_tx_rehash) return 0; =20 - /* It is possible that other rule has already performed rehash. - * Need to check again if we really need rehash. + /* If the current matcher RX/TX size is already at its max size, + * it can't be rehashed. */ - if (!atomic_read(&bwc_matcher->rehash_required) && - !hws_bwc_matcher_rehash_size_needed(bwc_matcher, - atomic_read(&bwc_matcher->num_of_rules))) + if (need_rx_rehash && + hws_bwc_matcher_size_maxed_out(bwc_matcher, + &bwc_matcher->rx_size)) { + atomic_set(&bwc_matcher->rx_size.rehash_required, false); + need_rx_rehash =3D false; + } + if (need_tx_rehash && + hws_bwc_matcher_size_maxed_out(bwc_matcher, + &bwc_matcher->tx_size)) { + atomic_set(&bwc_matcher->tx_size.rehash_required, false); + need_tx_rehash =3D false; + } + + /* If both RX and TX rehash flags are now off, it means that whatever + * we wanted to rehash is now at its max size - no rehash can be done. + * Return and try adding the rule again - perhaps there was some change. + */ + if (!need_rx_rehash && !need_tx_rehash) return 0; =20 /* Now we're done all the checking - do the rehash: @@ -759,12 +803,22 @@ hws_bwc_matcher_rehash_size(struct mlx5hws_bwc_matche= r *bwc_matcher) * - move all the rules to the new matcher * - destroy the old matcher */ + atomic_set(&bwc_matcher->rx_size.rehash_required, false); + atomic_set(&bwc_matcher->tx_size.rehash_required, false); =20 - atomic_set(&bwc_matcher->rehash_required, false); + if (need_rx_rehash) { + ret =3D hws_bwc_matcher_extend_size(bwc_matcher, + &bwc_matcher->rx_size); + if (ret) + return ret; + } =20 - ret =3D hws_bwc_matcher_extend_size(bwc_matcher); - if (ret) - return ret; + if (need_tx_rehash) { + ret =3D hws_bwc_matcher_extend_size(bwc_matcher, + &bwc_matcher->tx_size); + if (ret) + return ret; + } =20 return hws_bwc_matcher_move(bwc_matcher); } @@ -816,6 +870,62 @@ static int hws_bwc_rule_get_at_idx(struct mlx5hws_bwc_= rule *bwc_rule, return at_idx; } =20 +static void hws_bwc_rule_cnt_inc_rxtx(struct mlx5hws_bwc_rule *bwc_rule, + struct mlx5hws_bwc_matcher_size *size) +{ + u32 num_of_rules =3D atomic_inc_return(&size->num_of_rules); + + if (unlikely(hws_bwc_matcher_rehash_size_needed(bwc_rule->bwc_matcher, + size, num_of_rules))) + atomic_set(&size->rehash_required, true); +} + +static void hws_bwc_rule_cnt_inc(struct mlx5hws_bwc_rule *bwc_rule) +{ + struct mlx5hws_bwc_matcher *bwc_matcher =3D bwc_rule->bwc_matcher; + + if (!bwc_rule->skip_rx) + hws_bwc_rule_cnt_inc_rxtx(bwc_rule, &bwc_matcher->rx_size); + if (!bwc_rule->skip_tx) + hws_bwc_rule_cnt_inc_rxtx(bwc_rule, &bwc_matcher->tx_size); +} + +static int hws_bwc_rule_cnt_inc_with_rehash(struct mlx5hws_bwc_rule *bwc_r= ule, + u16 bwc_queue_idx) +{ + struct mlx5hws_bwc_matcher *bwc_matcher =3D bwc_rule->bwc_matcher; + struct mlx5hws_context *ctx =3D bwc_matcher->matcher->tbl->ctx; + struct mutex *queue_lock; /* Protect the queue */ + int ret; + + hws_bwc_rule_cnt_inc(bwc_rule); + + if (!atomic_read(&bwc_matcher->rx_size.rehash_required) && + !atomic_read(&bwc_matcher->tx_size.rehash_required)) + return 0; + + queue_lock =3D hws_bwc_get_queue_lock(ctx, bwc_queue_idx); + mutex_unlock(queue_lock); + + hws_bwc_lock_all_queues(ctx); + ret =3D hws_bwc_matcher_rehash_size(bwc_matcher); + hws_bwc_unlock_all_queues(ctx); + + mutex_lock(queue_lock); + + if (likely(!ret)) + return 0; + + /* Failed to rehash. Print a diagnostic and rollback the counters. */ + mlx5hws_err(ctx, + "BWC rule insertion: rehash to sizes [%d, %d] failed (%d)\n", + bwc_matcher->rx_size.size_log, + bwc_matcher->tx_size.size_log, ret); + hws_bwc_rule_cnt_dec(bwc_rule); + + return ret; +} + int mlx5hws_bwc_rule_create_simple(struct mlx5hws_bwc_rule *bwc_rule, u32 *match_param, struct mlx5hws_rule_action rule_actions[], @@ -826,7 +936,6 @@ int mlx5hws_bwc_rule_create_simple(struct mlx5hws_bwc_r= ule *bwc_rule, struct mlx5hws_context *ctx =3D bwc_matcher->matcher->tbl->ctx; struct mlx5hws_rule_attr rule_attr; struct mutex *queue_lock; /* Protect the queue */ - u32 num_of_rules; int ret =3D 0; int at_idx; =20 @@ -844,26 +953,10 @@ int mlx5hws_bwc_rule_create_simple(struct mlx5hws_bwc= _rule *bwc_rule, return -EINVAL; } =20 - /* check if number of rules require rehash */ - num_of_rules =3D atomic_inc_return(&bwc_matcher->num_of_rules); - - if (unlikely(hws_bwc_matcher_rehash_size_needed(bwc_matcher, num_of_rules= ))) { + ret =3D hws_bwc_rule_cnt_inc_with_rehash(bwc_rule, bwc_queue_idx); + if (unlikely(ret)) { mutex_unlock(queue_lock); - - hws_bwc_lock_all_queues(ctx); - ret =3D hws_bwc_matcher_rehash_size(bwc_matcher); - hws_bwc_unlock_all_queues(ctx); - - if (ret) { - mlx5hws_err(ctx, "BWC rule insertion: rehash size [%d -> %d] failed (%d= )\n", - bwc_matcher->size_log - MLX5HWS_BWC_MATCHER_SIZE_LOG_STEP, - bwc_matcher->size_log, - ret); - atomic_dec(&bwc_matcher->num_of_rules); - return ret; - } - - mutex_lock(queue_lock); + return ret; } =20 ret =3D hws_bwc_rule_create_sync(bwc_rule, @@ -881,8 +974,11 @@ int mlx5hws_bwc_rule_create_simple(struct mlx5hws_bwc_= rule *bwc_rule, * It could be because there was collision, or some other problem. * Try rehash by size and insert rule again - last chance. */ + if (!bwc_rule->skip_rx) + atomic_set(&bwc_matcher->rx_size.rehash_required, true); + if (!bwc_rule->skip_tx) + atomic_set(&bwc_matcher->tx_size.rehash_required, true); =20 - atomic_set(&bwc_matcher->rehash_required, true); mutex_unlock(queue_lock); =20 hws_bwc_lock_all_queues(ctx); @@ -891,7 +987,7 @@ int mlx5hws_bwc_rule_create_simple(struct mlx5hws_bwc_r= ule *bwc_rule, =20 if (ret) { mlx5hws_err(ctx, "BWC rule insertion: rehash failed (%d)\n", ret); - atomic_dec(&bwc_matcher->num_of_rules); + hws_bwc_rule_cnt_dec(bwc_rule); return ret; } =20 @@ -907,7 +1003,7 @@ int mlx5hws_bwc_rule_create_simple(struct mlx5hws_bwc_= rule *bwc_rule, if (unlikely(ret)) { mutex_unlock(queue_lock); mlx5hws_err(ctx, "BWC rule insertion failed (%d)\n", ret); - atomic_dec(&bwc_matcher->num_of_rules); + hws_bwc_rule_cnt_dec(bwc_rule); return ret; } =20 @@ -937,6 +1033,10 @@ mlx5hws_bwc_rule_create(struct mlx5hws_bwc_matcher *b= wc_matcher, if (unlikely(!bwc_rule)) return NULL; =20 + bwc_rule->flow_source =3D flow_source; + mlx5hws_rule_skip(bwc_matcher->matcher, flow_source, + &bwc_rule->skip_rx, &bwc_rule->skip_tx); + bwc_queue_idx =3D hws_bwc_gen_queue_idx(ctx); =20 if (bwc_matcher->complex) @@ -972,7 +1072,8 @@ hws_bwc_rule_action_update(struct mlx5hws_bwc_rule *bw= c_rule, =20 idx =3D bwc_rule->bwc_queue_idx; =20 - mlx5hws_bwc_rule_fill_attr(bwc_matcher, idx, 0, &rule_attr); + mlx5hws_bwc_rule_fill_attr(bwc_matcher, idx, bwc_rule->flow_source, + &rule_attr); queue_lock =3D hws_bwc_get_queue_lock(ctx, idx); =20 mutex_lock(queue_lock); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.h b/d= rivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.h index d21fc247a510..af391d70c14f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.h @@ -19,6 +19,13 @@ #define MLX5HWS_BWC_POLLING_TIMEOUT 60 =20 struct mlx5hws_bwc_matcher_complex_data; + +struct mlx5hws_bwc_matcher_size { + u8 size_log; + atomic_t num_of_rules; + atomic_t rehash_required; +}; + struct mlx5hws_bwc_matcher { struct mlx5hws_matcher *matcher; struct mlx5hws_match_template *mt; @@ -27,10 +34,9 @@ struct mlx5hws_bwc_matcher { struct mlx5hws_bwc_matcher *complex_first_bwc_matcher; u8 num_of_at; u8 size_of_at_array; - u8 size_log; u32 priority; - atomic_t num_of_rules; - atomic_t rehash_required; + struct mlx5hws_bwc_matcher_size rx_size; + struct mlx5hws_bwc_matcher_size tx_size; struct list_head *rules; }; =20 @@ -39,7 +45,10 @@ struct mlx5hws_bwc_rule { struct mlx5hws_rule *rule; struct mlx5hws_bwc_rule *isolated_bwc_rule; struct mlx5hws_bwc_complex_rule_hash_node *complex_hash_node; + u32 flow_source; u16 bwc_queue_idx; + bool skip_rx; + bool skip_tx; struct list_head list_node; }; =20 --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2075.outbound.protection.outlook.com [40.107.244.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7262E2FF497; Thu, 3 Jul 2025 18:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569021; cv=fail; b=P9FndVkX6lVVhrhrNusgaOPmAYIScI3Y5hhV4DT0iZO+siZApAZXTeqYApksIWj/fM43FOSVlZQRF1yZVGIuMuc+aM3BOt51YTLEAm4o4zWpIEzcYWfWItpqA8vqys3WgvBp6ZXZRlAC95ir29swij5U8EIATXIBDBk2a8+h9ZA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569021; c=relaxed/simple; bh=shBTmTTtN4bdSSkK2+UhSSSH9jbTM4DoZqYC2vllB28=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IjjcsWN1J95iNyHJdIIEII1YhdAWsy8LjPUbJgNNtoj1ec0Ctg7vpoxsMSEWfZh2TcbSX3mmaq57zaNeld22HxO4Aq47E78i815Q61J2amzZBmNtjfxl7Vot396dskKOZebmA2M1Xb/1Zz+8gE+kdCOqzTA7NTAI6ACeq63h9kY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=XFoDZdxy; arc=fail smtp.client-ip=40.107.244.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="XFoDZdxy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=j+el+Ceb88P10xjJvxsGLsmjMVhS16aCkmTScvTPx9MMBFYrnaZf/npe3NbWalDkS3tzhlLpG/VO+fau/R3E/miGz6j0nOHM78gs9sHU/I3i0WOZwcniFx6hrQyQFqKeaufl8vMAT6u9DGvnQVnQE2yOTEki3Q4dc9y8a90A7yRE20/Omgd/A1iL0/dr06NZOwP6Tm0Kpvl96w82ti3KMr6OHUP+MT2ncgeJPs8M7jowU4fmy9KMb6pG4h6cSIcuiK3e93kbxp7v0evUNWVr7kCXAmhkpZEFkQrx8G817sS9tFwG1u5gV/klQ3ltjb8DrhMl/pr8Li/9mJPI/I2ZtA== 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=zw2/+3bFtZgApOakUYNhNpV/SV7S7Su/S5VG5hBOcho=; b=WNwBs4HHqbZC1BaUjiu74rRreRAk8VuUc2BreIvIJYtthN+l1iAkZLmiSsJ0wigwlOqm9axKSAFd1YCUsaAKUi+TtCNRxthCUO6f9OioYMfRd+/GXW1Ze1VZBCiP/QmNzG3zXZJj1zBbmp8/lLYBn65ADePJke98EXwoCnobiWdbDGwhanjPS53txOfz03dNlFV+j491hLMb0QupBLateSFC4rgDr4lpXOTCi1bMSEYk7qNz0QyPvWZVBk9FAElRS37V5rBZ+m0flTX+EwV8hnewcWYkYYAh7dm3ICFn8vstqhG97+q+ISgraaOH2x4wiM4DgWtwj6s3GEplC30OHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.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=zw2/+3bFtZgApOakUYNhNpV/SV7S7Su/S5VG5hBOcho=; b=XFoDZdxyfHn4sz6Xi+pmHyrmA0ii7H+eAJIQkB+CYxkZ7rCF0eVLU29HRR7DqM5kxgVqjPQh9U0qy+bRm/J3XOEE/vV9P810D/LOpN1IScB4EdbVNMC+0SX21MmMUEiDmThpQl7icFz294mkK+J28KeVvWrfwxf1fNxb3/u+buyufOCQ8DtPZUG9rROFUYpcs7jhTVByK1SbZJpwNdTBk1xsTSPgQeAE9G7BLFEk3XANtiEVSqGWP2hWNtlvNTTgxhrFtkpItCwqrX0nRMLZR2LvCX4wGTQFPTB3Iy3RziOFroJr/sofS8xBYkFLZyjWtZQzdEvNu3QR0bKubEWhNw== Received: from MN0P222CA0027.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:531::35) by DM6PR12MB4059.namprd12.prod.outlook.com (2603:10b6:5:215::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.22; Thu, 3 Jul 2025 18:56:56 +0000 Received: from MN1PEPF0000F0E0.namprd04.prod.outlook.com (2603:10b6:208:531:cafe::ae) by MN0P222CA0027.outlook.office365.com (2603:10b6:208:531::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.22 via Frontend Transport; Thu, 3 Jul 2025 18:56:55 +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 MN1PEPF0000F0E0.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:55 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Thu, 3 Jul 2025 11:56:37 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Thu, 3 Jul 2025 11:56:37 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:33 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Yevgeny Kliteynik , "Mark Bloch" Subject: [PATCH net-next v3 08/10] net/mlx5: HWS, Rearrange to prevent forward declaration Date: Thu, 3 Jul 2025 21:54:29 +0300 Message-ID: <20250703185431.445571-9-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E0:EE_|DM6PR12MB4059:EE_ X-MS-Office365-Filtering-Correlation-Id: 5cecaa19-9502-4a9d-89f8-08ddba63614c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?8cc3vTP90JrbvW+6HPH3Zlmhd+45Xxzx4CHetk/3AlPrj35GHSi2G66URFpR?= =?us-ascii?Q?ACGtk7B3bS8p4WP6eLIWWM2Gw5M8r3+YIo4YXIu9BYaVLr2EAKqzkO4t41F9?= =?us-ascii?Q?19E1DxMye1k/Kx3jx2Gxq8cgoyepFEr6Jy44/OScRp8aEdoneOFkkBkSVnCd?= =?us-ascii?Q?RPorTUTlSQXzdVru4mfOqqq9WVWtVH6ooKRc1XRxM2jTJzFXEJcVxy9QWtFR?= =?us-ascii?Q?xLRuFtQakKVheudpJvFdVBXRtFqmNddNjNW0boMSrX1VTVKyHaZx9eVh4uLk?= =?us-ascii?Q?lZUE1QgrzI9JjBPFYKClgpmIj6vp8XB5keAralASvvB7b9PymLdENTPHTNxm?= =?us-ascii?Q?edHqLEeHvyDK9tZpoEXXKkssSzugLynHsvLiK7QaFdokkSdQVxx9jxnXVj3i?= =?us-ascii?Q?oV+lDiSeaC81L1zwt4+JxuB8rSN+Q8s3zABhNeDwTX4JAuxvjlMlfXslJ3dR?= =?us-ascii?Q?ld7RxFWBGn+Meeuqg9QBubVjf8pvNGt34OBVatjbvXwPdGRtVvnpufeJbxYK?= =?us-ascii?Q?Qw6k95SdNI4NYGtRhHqijq1M0OybL538u8+R8ERgT/bH1n0MOcyWCKOViDoI?= =?us-ascii?Q?DICd4E3/3TOt9N4O5BVo4cbqr5kyeUInjPFaUTEihpPoNGz2BCWokKLAC9Y6?= =?us-ascii?Q?Ohjp6G+WzQMiLe3kLxDW67KiFVcx6Be+A33u0nBG6cZrIyE0YXYRC1q6LBGU?= =?us-ascii?Q?KZf92GvFgVidAsP6tnjeI/VL29sOCcVpwy8TikxhUItvytRXFZNI76mifWPI?= =?us-ascii?Q?9y43+kOCbLjxLPn2rqpo+BA4aX2YKChb19w2ytQJzn6nk3w51q7KdnyEUL4b?= =?us-ascii?Q?BHYqPiRkFEEYfSCO2OeVBqFfTwypVc433MpR4VvAXXFAc1gxEoiB7UV0HG25?= =?us-ascii?Q?Ouq3AmQ4LvNT3VCOuAGnfkpF5NL5sZOhr4APT5hpHJKhNU1cX644QPq0G6Hi?= =?us-ascii?Q?cCPN+0r8EvaiNBYwuAOWq1H8ziUvYNeHur8znMko45kh0/7uCQlqV870gZJi?= =?us-ascii?Q?seHz63II3Ti1IpShayj5pFM+icrD7KvE6T9KRT5zk6JDCKsL2KhGDIYwlDug?= =?us-ascii?Q?Gq84HbpvyPJHVdGEhRVdj6YPd0v8IcI7074Jv5Irl0jSjLtsgr/NbXJodw8h?= =?us-ascii?Q?bNEbKwpagVxvSzxka7R/Sr0hPgKHTsAoLB+JRVDjI7d0al9/J89dKNfaSgJq?= =?us-ascii?Q?oIi+oIqbm3EcZx7mDO4EMCKWW5Mx9qnOYhKshte+yLkSYK4jpaxlrbXx/rl8?= =?us-ascii?Q?YdHzKcOzrLeb5yk0GePnLK1MSjEDoo6QStiO3Nrge1nmjTku3u+HZC3mhfDw?= =?us-ascii?Q?gabvd+3exNVn781aidA+C5+Irr6A0zkNqQUHIFeQmkJXUNFWTDokD13q0RLk?= =?us-ascii?Q?HFM+mec+HNmJhJUzB/WWobuis3frdSE8u7FHTOHWtm9dkhYs9dcXU+h2d6iE?= =?us-ascii?Q?6yud9PkjeVMQVIEodMEa+rlymDJx0Ymr8rnyGN7QEfXq0Wy1ITzhLHpt1paE?= =?us-ascii?Q?YtBlOV2e25nfYkQPrQJqFB2gto8LJZVwQOPw?= 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)(82310400026)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:55.1545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5cecaa19-9502-4a9d-89f8-08ddba63614c 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: MN1PEPF0000F0E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4059 Content-Type: text/plain; charset="utf-8" From: Yevgeny Kliteynik As a preparation for the following patch that will add support for shrinking empty matchers, rearrange the code to prevent forward declaration of functions. Signed-off-by: Yevgeny Kliteynik Signed-off-by: Mark Bloch Reviewed-by: Simon Horman --- .../mellanox/mlx5/core/steering/hws/bwc.c | 247 +++++++++--------- 1 file changed, 124 insertions(+), 123 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c b/d= rivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c index 516634237cb8..15d817cbcd9d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c @@ -71,6 +71,130 @@ static void hws_bwc_matcher_init_attr(struct mlx5hws_bw= c_matcher *bwc_matcher, first_matcher ? first_matcher->matcher->end_ft_id : 0; } =20 +static int +hws_bwc_matcher_move_all_simple(struct mlx5hws_bwc_matcher *bwc_matcher) +{ + bool move_error =3D false, poll_error =3D false, drain_error =3D false; + struct mlx5hws_context *ctx =3D bwc_matcher->matcher->tbl->ctx; + struct mlx5hws_matcher *matcher =3D bwc_matcher->matcher; + u16 bwc_queues =3D mlx5hws_bwc_queues(ctx); + struct mlx5hws_rule_attr rule_attr; + struct mlx5hws_bwc_rule *bwc_rule; + struct mlx5hws_send_engine *queue; + struct list_head *rules_list; + u32 pending_rules; + int i, ret =3D 0; + + mlx5hws_bwc_rule_fill_attr(bwc_matcher, 0, 0, &rule_attr); + + for (i =3D 0; i < bwc_queues; i++) { + if (list_empty(&bwc_matcher->rules[i])) + continue; + + pending_rules =3D 0; + rule_attr.queue_id =3D mlx5hws_bwc_get_queue_id(ctx, i); + rules_list =3D &bwc_matcher->rules[i]; + + list_for_each_entry(bwc_rule, rules_list, list_node) { + ret =3D mlx5hws_matcher_resize_rule_move(matcher, + bwc_rule->rule, + &rule_attr); + if (unlikely(ret && !move_error)) { + mlx5hws_err(ctx, + "Moving BWC rule: move failed (%d), attempting to move rest of th= e rules\n", + ret); + move_error =3D true; + } + + pending_rules++; + ret =3D mlx5hws_bwc_queue_poll(ctx, + rule_attr.queue_id, + &pending_rules, + false); + if (unlikely(ret && !poll_error)) { + mlx5hws_err(ctx, + "Moving BWC rule: poll failed (%d), attempting to move rest of th= e rules\n", + ret); + poll_error =3D true; + } + } + + if (pending_rules) { + queue =3D &ctx->send_queue[rule_attr.queue_id]; + mlx5hws_send_engine_flush_queue(queue); + ret =3D mlx5hws_bwc_queue_poll(ctx, + rule_attr.queue_id, + &pending_rules, + true); + if (unlikely(ret && !drain_error)) { + mlx5hws_err(ctx, + "Moving BWC rule: drain failed (%d), attempting to move rest of t= he rules\n", + ret); + drain_error =3D true; + } + } + } + + if (move_error || poll_error || drain_error) + ret =3D -EINVAL; + + return ret; +} + +static int hws_bwc_matcher_move_all(struct mlx5hws_bwc_matcher *bwc_matche= r) +{ + if (!bwc_matcher->complex) + return hws_bwc_matcher_move_all_simple(bwc_matcher); + + return mlx5hws_bwc_matcher_move_all_complex(bwc_matcher); +} + +static int hws_bwc_matcher_move(struct mlx5hws_bwc_matcher *bwc_matcher) +{ + struct mlx5hws_context *ctx =3D bwc_matcher->matcher->tbl->ctx; + struct mlx5hws_matcher_attr matcher_attr =3D {0}; + struct mlx5hws_matcher *old_matcher; + struct mlx5hws_matcher *new_matcher; + int ret; + + hws_bwc_matcher_init_attr(bwc_matcher, + bwc_matcher->priority, + bwc_matcher->rx_size.size_log, + bwc_matcher->tx_size.size_log, + &matcher_attr); + + old_matcher =3D bwc_matcher->matcher; + new_matcher =3D mlx5hws_matcher_create(old_matcher->tbl, + &bwc_matcher->mt, 1, + bwc_matcher->at, + bwc_matcher->num_of_at, + &matcher_attr); + if (!new_matcher) { + mlx5hws_err(ctx, "Rehash error: matcher creation failed\n"); + return -ENOMEM; + } + + ret =3D mlx5hws_matcher_resize_set_target(old_matcher, new_matcher); + if (ret) { + mlx5hws_err(ctx, "Rehash error: failed setting resize target\n"); + return ret; + } + + ret =3D hws_bwc_matcher_move_all(bwc_matcher); + if (ret) + mlx5hws_err(ctx, "Rehash error: moving rules failed, attempting to remov= e the old matcher\n"); + + /* Error during rehash can't be rolled back. + * The best option here is to allow the rehash to complete and remove + * the old matcher - can't leave the matcher in the 'in_resize' state. + */ + + bwc_matcher->matcher =3D new_matcher; + mlx5hws_matcher_destroy(old_matcher); + + return ret; +} + int mlx5hws_bwc_matcher_create_simple(struct mlx5hws_bwc_matcher *bwc_matc= her, struct mlx5hws_table *table, u32 priority, @@ -636,129 +760,6 @@ hws_bwc_matcher_find_at(struct mlx5hws_bwc_matcher *b= wc_matcher, return -1; } =20 -static int hws_bwc_matcher_move_all_simple(struct mlx5hws_bwc_matcher *bwc= _matcher) -{ - bool move_error =3D false, poll_error =3D false, drain_error =3D false; - struct mlx5hws_context *ctx =3D bwc_matcher->matcher->tbl->ctx; - struct mlx5hws_matcher *matcher =3D bwc_matcher->matcher; - u16 bwc_queues =3D mlx5hws_bwc_queues(ctx); - struct mlx5hws_rule_attr rule_attr; - struct mlx5hws_bwc_rule *bwc_rule; - struct mlx5hws_send_engine *queue; - struct list_head *rules_list; - u32 pending_rules; - int i, ret =3D 0; - - mlx5hws_bwc_rule_fill_attr(bwc_matcher, 0, 0, &rule_attr); - - for (i =3D 0; i < bwc_queues; i++) { - if (list_empty(&bwc_matcher->rules[i])) - continue; - - pending_rules =3D 0; - rule_attr.queue_id =3D mlx5hws_bwc_get_queue_id(ctx, i); - rules_list =3D &bwc_matcher->rules[i]; - - list_for_each_entry(bwc_rule, rules_list, list_node) { - ret =3D mlx5hws_matcher_resize_rule_move(matcher, - bwc_rule->rule, - &rule_attr); - if (unlikely(ret && !move_error)) { - mlx5hws_err(ctx, - "Moving BWC rule: move failed (%d), attempting to move rest of th= e rules\n", - ret); - move_error =3D true; - } - - pending_rules++; - ret =3D mlx5hws_bwc_queue_poll(ctx, - rule_attr.queue_id, - &pending_rules, - false); - if (unlikely(ret && !poll_error)) { - mlx5hws_err(ctx, - "Moving BWC rule: poll failed (%d), attempting to move rest of th= e rules\n", - ret); - poll_error =3D true; - } - } - - if (pending_rules) { - queue =3D &ctx->send_queue[rule_attr.queue_id]; - mlx5hws_send_engine_flush_queue(queue); - ret =3D mlx5hws_bwc_queue_poll(ctx, - rule_attr.queue_id, - &pending_rules, - true); - if (unlikely(ret && !drain_error)) { - mlx5hws_err(ctx, - "Moving BWC rule: drain failed (%d), attempting to move rest of t= he rules\n", - ret); - drain_error =3D true; - } - } - } - - if (move_error || poll_error || drain_error) - ret =3D -EINVAL; - - return ret; -} - -static int hws_bwc_matcher_move_all(struct mlx5hws_bwc_matcher *bwc_matche= r) -{ - if (!bwc_matcher->complex) - return hws_bwc_matcher_move_all_simple(bwc_matcher); - - return mlx5hws_bwc_matcher_move_all_complex(bwc_matcher); -} - -static int hws_bwc_matcher_move(struct mlx5hws_bwc_matcher *bwc_matcher) -{ - struct mlx5hws_context *ctx =3D bwc_matcher->matcher->tbl->ctx; - struct mlx5hws_matcher_attr matcher_attr =3D {0}; - struct mlx5hws_matcher *old_matcher; - struct mlx5hws_matcher *new_matcher; - int ret; - - hws_bwc_matcher_init_attr(bwc_matcher, - bwc_matcher->priority, - bwc_matcher->rx_size.size_log, - bwc_matcher->tx_size.size_log, - &matcher_attr); - - old_matcher =3D bwc_matcher->matcher; - new_matcher =3D mlx5hws_matcher_create(old_matcher->tbl, - &bwc_matcher->mt, 1, - bwc_matcher->at, - bwc_matcher->num_of_at, - &matcher_attr); - if (!new_matcher) { - mlx5hws_err(ctx, "Rehash error: matcher creation failed\n"); - return -ENOMEM; - } - - ret =3D mlx5hws_matcher_resize_set_target(old_matcher, new_matcher); - if (ret) { - mlx5hws_err(ctx, "Rehash error: failed setting resize target\n"); - return ret; - } - - ret =3D hws_bwc_matcher_move_all(bwc_matcher); - if (ret) - mlx5hws_err(ctx, "Rehash error: moving rules failed, attempting to remov= e the old matcher\n"); - - /* Error during rehash can't be rolled back. - * The best option here is to allow the rehash to complete and remove - * the old matcher - can't leave the matcher in the 'in_resize' state. - */ - - bwc_matcher->matcher =3D new_matcher; - mlx5hws_matcher_destroy(old_matcher); - - return ret; -} - static int hws_bwc_matcher_rehash_size(struct mlx5hws_bwc_matcher *bwc_matcher) { --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD3B32FF488; Thu, 3 Jul 2025 18:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569022; cv=fail; b=KcJotEIWoSgxRXUZGeLr9ZviD9zuQmg8rLK8bjPtdQfULtfEgNf5FX7w2EO9/lT5toUD1SwtCyPxu0X/MR/Uf3YZNOEb5Nx2Temydyli76eSj6pEhP+DYSd3Gp2UnXwCUBEaD281WKe4j71Vl108scfVCU48Wz75fxyTQS6uG5Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569022; c=relaxed/simple; bh=ZFlzzmmDDOlSnB9v0t28jLr+RjkMSOYEWSJCeraDsKw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OHK/PhPEF1tJTiyXzsg9jDku/pu153oXrY3hHk3u5LHP8JbQV1RvcxOeVqOWDef30+alGw8cyeZ5rSOh2WmVu54V7oAkXJARC257JpHQPgGOfVaZ2ZEtRhQXwqJp1tNoIfMHQei5qYwQ7HIHAriQggqM7xaLH5NE+Pfi/LIHQgY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=qq2UEg1Q; arc=fail smtp.client-ip=40.107.93.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="qq2UEg1Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BeWTKyi8ylJNBvMu2Geh7UK8VfFRKJaVq26CtxaqOUr6SZVMHGzsA68QyU9w0IgdpkdAiTqwCqlKVhaQIScatWXM8Dj3ZoTUyL36AVl1g4CbF1j5pQjZITVDWj5xVpTNXVEBPmjhebUZjfX+aBEq3g4CSOaZB1ZB3bIsQnrCNF10DIdXx7rW2mH4vXq4R2x9W4nd0/ehFTVHMwZc+6KTF3NsBqGyc4ou05l5hTz/easUXHfv7qB97bYZwkTZXAEn3gReJZ98KDuzOD8eu5sk+IznhATsW0WwFlog9PDfKQwvO+YxY0XrB0nGs6viJB9SGSlI+ZFHOJh8nyLVv+vYSg== 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=MH3f8wWgul/qYlNJOI+V7eIUYtUSo5h3D959Zpcuutg=; b=HaaI38szDZmkhZzQIfSYFuwSxquM0T7iB/pofIytXVGtmEhl1AfyC3F5U6jtRvtXKbkAPUGdtUZXP156cHjphj8IRc9mC8tKGD00uGURPQkmaX7s/OnDs3/+/cDtidULbrZrDsBtzNals7xxOhzExFTmG4DnuwBEE2VbKFM7mh3z+C5TDyGye7JwWVcAVmwTmK7W+OBtggEwsrGUx71RqOroLwDvrijG8zRYBjbkJCu28QW3GWSdJaeuHq4DGfWXyRjZ0DRPZ4TctZY4y74OLZzO6qsbQBX41fUFxPFOh/iRucNEh6F5qDN1djsJT0dFv0FYsQcrvRMpg86brMxhjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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=MH3f8wWgul/qYlNJOI+V7eIUYtUSo5h3D959Zpcuutg=; b=qq2UEg1QocXeVlZzOucGEfq64EgMVB5dh7QDnzu4jLfiM9o7baqgREPgfjY3JAXfj6KQrprZ7PJsx8KT+JzUIZoK7sjjQqnn1smTsabf2JoXVpkUFA1jhDYD7Hg7JH7cohm1v/o/cLRu3PNSovsBgALsCWegN/p0PsQAkpFWZqdFD0hOHNhQQjPQhwLhqfqpJwVvYg7wvjsmU8H0IwioiZ+m2FNRftymABe5KXPqtgQWVj/tqHmf1ney4Ymd42KmmTCxwiaBnHV63C4SZqx/Uy6WewFzzlwg8e2neumIkw73CVtKVEY5uxS77JGl/sA4LUaMLXyGCExc02Ya/SuPng== Received: from BN7PR02CA0027.namprd02.prod.outlook.com (2603:10b6:408:20::40) by MN2PR12MB4190.namprd12.prod.outlook.com (2603:10b6:208:1dd::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.22; Thu, 3 Jul 2025 18:56:57 +0000 Received: from BN1PEPF00004682.namprd03.prod.outlook.com (2603:10b6:408:20:cafe::10) by BN7PR02CA0027.outlook.office365.com (2603:10b6:408:20::40) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.21 via Frontend Transport; Thu, 3 Jul 2025 18:56:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN1PEPF00004682.mail.protection.outlook.com (10.167.243.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:56:57 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 3 Jul 2025 11:56:42 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.14; Thu, 3 Jul 2025 11:56:41 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:37 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Yevgeny Kliteynik , "Vlad Dogaru" , Mark Bloch Subject: [PATCH net-next v3 09/10] net/mlx5: HWS, Shrink empty matchers Date: Thu, 3 Jul 2025 21:54:30 +0300 Message-ID: <20250703185431.445571-10-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004682:EE_|MN2PR12MB4190:EE_ X-MS-Office365-Filtering-Correlation-Id: 3655c19b-2d8f-4a3a-abcc-08ddba636279 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?UiSY59Pl3e7VM1txPko4ab1QBT/ZD9LXzelO5FyX7bES2XlTx2Q/EgqYAZSS?= =?us-ascii?Q?QxCv78vdDvUK+IWosHmBV/N7nTcKnrfH4VKJ21jrtJNnTApUOUFP2QX+GibS?= =?us-ascii?Q?sejBhiSKSdem5dEt8zeFZRAwlm9A8JHTSIhH/xX6red12eSFCcCDmMeWexrs?= =?us-ascii?Q?okiCYjhkEPhU94OPGjrNLZ+2Fyy8tOMD7fN99GZkc1gKIoSprihCpT2lEXYX?= =?us-ascii?Q?2M4RnaWcu3mzuk1dOExvw1nRvpPSTOOFxcpq+EG0NqCgP4NayPv9E8smcHMR?= =?us-ascii?Q?F/5oKQYyqSrSYAQ2JrwuueKBfVmv0ic9LbNeI+gYmDlBf/Pn/bEUxbvyB4K7?= =?us-ascii?Q?O0jGNg658+tyyWalMxkBLLEnfguGAN6gtk2EqLBZg4A0VOp6WqFSjCKfhsqc?= =?us-ascii?Q?DxCDZDFvluaqwxWUm4w3igIw7Wj9k0F4jQl6slmPXm7o+SL9jZR9WfXaXcnc?= =?us-ascii?Q?BithZ+9+EUsW+e5cnzA4YmN47cmtIJ2u9pggEebRkNQ2En1+ZwXMY3jqLKIY?= =?us-ascii?Q?r7efrMMnzWwJAUfbMqJHRRqOhL885erJiVniEBvn6bCRs2SiE2DmWL750Mz0?= =?us-ascii?Q?3IzsYuTs4G7oWValuhc+devUARhjJXJe+lwZ9yZPPWcOamyqXdvT3YP9TA0/?= =?us-ascii?Q?b4KYIf6DYMcCYlNA+M2oULqmHfrdYwVNTkZhez4Gc3v6jTqWjST9cFI8lCtq?= =?us-ascii?Q?wA/b3c0J64kfOsIONsVfAl+Ext9//GUnOEy51A0fJSux9kWQpZ5DfFIF1qWI?= =?us-ascii?Q?0RX+JODFYykBC0SqKZwiAWHnn3a9atqwhaT8b6C4fkVtnxEWLE9iP8SZtLAT?= =?us-ascii?Q?AGyuyA/3zJNnGTtQ5StoqjU2wmucXCj5zwxj12N/9M64ugscdBnOqU3Z0bmL?= =?us-ascii?Q?mYHAykt9DT45fJqq5/PsfcSpwWJcLroJEA/gtyNwiozOka4+TfJM7rx34qyf?= =?us-ascii?Q?KtIbElp48qaMiAmUjcsf8eydoGDxalOLvagupF2GuDmoOWNJNNO9COyNwz7l?= =?us-ascii?Q?T8YLPPl5nnMgkAYQd5wJqbIq3njBEEWWBjwvZuZKKK1dXbmWPsgNfpI3CAPi?= =?us-ascii?Q?3tTcMoRNpUdGdj1j7Dm8DurpghRi8tdqQDnqBSoSzuHTIV0Aqfg6DH2ZOiHH?= =?us-ascii?Q?KHZnWbLfqF0S8LVwQTLYndHupFibGwLEyRNlE5Tjj8OL06D43clxL6KRmu5A?= =?us-ascii?Q?4EAZ2tlnkWedszn+MQEQ1Ox70RC9pQWRdvoW0CZ4dLDHviPO6WHz/WI+2bjM?= =?us-ascii?Q?KU5Fzo1q2hT8sICGIOLigWcGhqXukgMOonC+XwJEF/cnY35YteXdUWWCx3oo?= =?us-ascii?Q?MQRtiWIWNW8aaaNLw51C91upykJXHzOinO4K1qvDM/emN9QP50NfJy1xHCVb?= =?us-ascii?Q?w2vCeuG65i0g7Cs/xKTf48xHsndjE2PDpH0putGw5Wd07BO+4jwIuNln1iQr?= =?us-ascii?Q?gr6osPbMMEGzFNNJN2/FDlw0HQSyU6zRu0XePUWwaVySqxMqH8n5dWgYcByB?= =?us-ascii?Q?WMVdqXA58R4JNQxApE7vLiskq94f5E8dz6gl?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:56:57.1300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3655c19b-2d8f-4a3a-abcc-08ddba636279 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004682.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4190 Content-Type: text/plain; charset="utf-8" From: Yevgeny Kliteynik Matcher size is dynamic: it starts at initial size, and then it grows through rehash as more and more rules are added to this matcher. When rules are deleted, matcher's size is not decreased. Rehash approach is greedy. The idea is: if the matcher got to a certain size at some point, chances are - it will get to this size again, so it is better to avoid costly rehash operations whenever possible. However, when all the rules of the matcher are deleted, this should be viewed as special case. If the matcher actually got to the point where it has zero rules, it might be an indication that some usecase from the past is no longer happening. This is where some ICM can be freed. This patch handles this case: when a number of rules in a matcher goes down to zero, the matcher's tables are shrunk to the initial size. Signed-off-by: Yevgeny Kliteynik Reviewed-by: Vlad Dogaru Signed-off-by: Mark Bloch Reviewed-by: Simon Horman --- .../mellanox/mlx5/core/steering/hws/bwc.c | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c b/d= rivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c index 15d817cbcd9d..92de4b761a83 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c @@ -533,6 +533,70 @@ static void hws_bwc_rule_cnt_dec(struct mlx5hws_bwc_ru= le *bwc_rule) atomic_dec(&bwc_matcher->tx_size.num_of_rules); } =20 +static int +hws_bwc_matcher_rehash_shrink(struct mlx5hws_bwc_matcher *bwc_matcher) +{ + struct mlx5hws_bwc_matcher_size *rx_size =3D &bwc_matcher->rx_size; + struct mlx5hws_bwc_matcher_size *tx_size =3D &bwc_matcher->tx_size; + + /* It is possible that another thread has added a rule. + * Need to check again if we really need rehash/shrink. + */ + if (atomic_read(&rx_size->num_of_rules) || + atomic_read(&tx_size->num_of_rules)) + return 0; + + /* If the current matcher RX/TX size is already at its initial size. */ + if (rx_size->size_log =3D=3D MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG && + tx_size->size_log =3D=3D MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG) + return 0; + + /* Now we've done all the checking - do the shrinking: + * - reset match RTC size to the initial size + * - create new matcher + * - move the rules, which will not do anything as the matcher is empty + * - destroy the old matcher + */ + + rx_size->size_log =3D MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG; + tx_size->size_log =3D MLX5HWS_BWC_MATCHER_INIT_SIZE_LOG; + + return hws_bwc_matcher_move(bwc_matcher); +} + +static int hws_bwc_rule_cnt_dec_with_shrink(struct mlx5hws_bwc_rule *bwc_r= ule, + u16 bwc_queue_idx) +{ + struct mlx5hws_bwc_matcher *bwc_matcher =3D bwc_rule->bwc_matcher; + struct mlx5hws_context *ctx =3D bwc_matcher->matcher->tbl->ctx; + struct mutex *queue_lock; /* Protect the queue */ + int ret; + + hws_bwc_rule_cnt_dec(bwc_rule); + + if (atomic_read(&bwc_matcher->rx_size.num_of_rules) || + atomic_read(&bwc_matcher->tx_size.num_of_rules)) + return 0; + + /* Matcher has no more rules - shrink it to save ICM. */ + + queue_lock =3D hws_bwc_get_queue_lock(ctx, bwc_queue_idx); + mutex_unlock(queue_lock); + + hws_bwc_lock_all_queues(ctx); + ret =3D hws_bwc_matcher_rehash_shrink(bwc_matcher); + hws_bwc_unlock_all_queues(ctx); + + mutex_lock(queue_lock); + + if (unlikely(ret)) + mlx5hws_err(ctx, + "BWC rule deletion: shrinking empty matcher failed (%d)\n", + ret); + + return ret; +} + int mlx5hws_bwc_rule_destroy_simple(struct mlx5hws_bwc_rule *bwc_rule) { struct mlx5hws_bwc_matcher *bwc_matcher =3D bwc_rule->bwc_matcher; @@ -549,8 +613,8 @@ int mlx5hws_bwc_rule_destroy_simple(struct mlx5hws_bwc_= rule *bwc_rule) mutex_lock(queue_lock); =20 ret =3D hws_bwc_rule_destroy_hws_sync(bwc_rule, &attr); - hws_bwc_rule_cnt_dec(bwc_rule); hws_bwc_rule_list_remove(bwc_rule); + hws_bwc_rule_cnt_dec_with_shrink(bwc_rule, idx); =20 mutex_unlock(queue_lock); =20 --=20 2.34.1 From nobody Wed Oct 8 00:25:46 2025 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2045.outbound.protection.outlook.com [40.107.223.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88E32302CAC; Thu, 3 Jul 2025 18:57:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569029; cv=fail; b=MThNh8YgkJiU1zUvru3L8bBaJvfYrPhoz1L4hPMJuSmRC1K2fFrW0xI89pL0metAATvqYQET3rmWkCE4ys83ZYPd3zEsQUobSd/LT2fyCDGz1U9K3dNOd675wtJqafKUHCkVcidsDqpMxQ0TTCJa2oGSfhLYjPTzJFozkwzHAVQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751569029; c=relaxed/simple; bh=yU9qX4QWkdm0HiJGgvc6bhcrfjQpBUuzUWMC3nmhf30=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qmSlXZxuTKg5y9WP8xHmU61SVllfNfSXwCYnub7YCvNzqY0ht819FsMZDi1D1JRAs5sZ5q5wv7KGZuc6/NXFMmgl/N76zsRkPEYl7IMpTnTNI99CQ+y+oU0+6JPn+TNevhVNV7V0Nq6GJ2nqpkBM9ZgPL57NNaoOzCytqipeip0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=tq7U7PIF; arc=fail smtp.client-ip=40.107.223.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="tq7U7PIF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YOQMYx1d5SNzhBy70Hn7RcTJTMpU+RJb7J4VuFsyq8Wff591C4KybnEDzeQO0zxy+tITaH1zVAB1kK3BGXr7ykIDQ8cuvTN6V8pmsDNQIPmfWWTe2JHbDr/3L0ijRqEp8ANFmxTYKCItyFBTPakQ+8Fzb4fGqerJXBe8cTHicRShGZOPvHEknsHDTa5wxLgubptwAqboAoPT3Lk8vS72k3Bvl7J5snr8X2HgVAajVQkDGA9q0NeQz37O3AfIhycINyCcUPFDiL3CAwprVpRqeGgfsUqBOc8w3RH/PugwwKJ1HUSDVVc10LaZpB/m2Xw2MR8fDna4ZtL/xwFipPaGEg== 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=o7gy8/RtDH03zPU87GIEWJlarXtse1XhrcI/p0mpGOM=; b=Wb8QkQJ3oWA35o9txQ9lU5mSPEYMIulzNSVlIRbkWBeFAoarQ40g9qhW+c+xYgiEgIekdvBwueZrPXAR5ybRCYNNgoDPT72hPg6oSuYvjdJ0c7G/4nVGXWW0LFYXpKpTs/8A+6PXISp+qoj3vFKsDVBFy36pvTNmh9BN96LPLHkVYBWc6abOZMGg4imr4A8i5G8CH92m4G/aDU8w8evuSUR5c8kn3v8wYPc7wv5wpWgtpu1GGWrsVxfJjpNjM/qZmQ1JIRvacAXGa+DHFAIgbHFNUhIP05Fp+FJthSAvn54jhoM53SBoXQakhNwwLUk62z65wSMkGf8m8gVmiI+KPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.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=o7gy8/RtDH03zPU87GIEWJlarXtse1XhrcI/p0mpGOM=; b=tq7U7PIF+D/AMG0QRvCvgKAo9jQ4UDgY7mHa+E+/xI0wzOK8nuNkbvKYp6K2uUHRnMaSmckO+mrRplk+6w4RxjhuCviY093tsH62gaJiKqeoIy4KeMaO04ibCasCJ0pRpPxpWab34i+Mt2a/4GOE4IT8PKf3DH3JnxOPc8BZWHKfjjGRz4GEqRjD0QbsgoLTCMmWzczHIMPJgyyK0sGNY9oLhrM9a8bnzlLsUFYNh21Cmud11Bzawn34b9I/hIdCOsxzTJL6aM5QYnwIJkxiXjv+PQCdGK2HLoiCe9myMtpsN/Ln1d0LKZfDUB+X8U5iWnKrsyBxjYiNqMKjlKYReQ== Received: from BN7PR02CA0025.namprd02.prod.outlook.com (2603:10b6:408:20::38) by PH0PR12MB7906.namprd12.prod.outlook.com (2603:10b6:510:26c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.20; Thu, 3 Jul 2025 18:57:03 +0000 Received: from BN1PEPF00004682.namprd03.prod.outlook.com (2603:10b6:408:20:cafe::64) by BN7PR02CA0025.outlook.office365.com (2603:10b6:408:20::38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.22 via Frontend Transport; Thu, 3 Jul 2025 18:57:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN1PEPF00004682.mail.protection.outlook.com (10.167.243.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.15 via Frontend Transport; Thu, 3 Jul 2025 18:57:02 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 3 Jul 2025 11:56:47 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Thu, 3 Jul 2025 11:56:46 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Thu, 3 Jul 2025 11:56:42 -0700 From: Mark Bloch To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "Andrew Lunn" , Simon Horman CC: , , , , Leon Romanovsky , , , , Moshe Shemesh , "Yevgeny Kliteynik" , Mark Bloch Subject: [PATCH net-next v3 10/10] net/mlx5: Add HWS as secondary steering mode Date: Thu, 3 Jul 2025 21:54:31 +0300 Message-ID: <20250703185431.445571-11-mbloch@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250703185431.445571-1-mbloch@nvidia.com> References: <20250703185431.445571-1-mbloch@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004682:EE_|PH0PR12MB7906:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ab889b0-7b8f-456b-8132-08ddba636578 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?4zgOq8PepRusjnQ1UR+wY1NYdwFudgqi/JXnbOJnnEVhmv1NXw1DloWtCpxn?= =?us-ascii?Q?wB58VGsS39yEQfjvGlXO7YGa2oUlqbA5OR0S4B7kMbYB1ILh4T22EaBnhYYn?= =?us-ascii?Q?ieQX/YvmTPVhPI0PXkYDigMbKQPXmKjXZAdySW70HyeRQJA97T29xpO2Lh8x?= =?us-ascii?Q?RPmCvrovKx72QSg6v7b+CmuhqysurDskeFPsdRCiqt7UdG6QUxtvkdZ/elfN?= =?us-ascii?Q?YnQI6LlO5vK3gGMaGCNb4S0afEkQO/BtytFENGKWdgwdoCTtnlrt1deN3qp3?= =?us-ascii?Q?eqme4lfeZKSbYLAg0ggTQNpQDXe4AOADzimHHHHnEuNLKsyP5mM59xJVUs16?= =?us-ascii?Q?lvi+l6cQrCx5Hft0VoHqPMgHlnnBhpE9PZlNxd00LWFCUeyj8NB/aTkd6jSS?= =?us-ascii?Q?YhYQABcljb1JnpC1pa6dHz1vtGHie6EH9ymyqFydmQQJlU1Ji05OV5X+4L6x?= =?us-ascii?Q?EMcUpfBVwAGW941UtGGZY92CKfSf3wUSoFkC/CkS9WW67few7Xr5V0OsHwkN?= =?us-ascii?Q?/zxGCHR8GN5AGZhgsp9a9oVLpCyPLDOYe5uRpNyW9dudQYoYQGSseq5GDWYc?= =?us-ascii?Q?84OwhzLXxuIRGeC7wbFyxdJtOlMGWrVskGVTTys9xZMvOHDi0xIL32AP1TRz?= =?us-ascii?Q?Siucwv26B+WpOlX6S9wfBzJr88pJAZa8Ew3B1zrfI3ldOX4WPW0b6mINoyww?= =?us-ascii?Q?xEOXlMXAYO3dNccxSo9Fm4qy6WHv8q9wn+WUn0ecwFq3uCkTFuZ0STnc5ZZQ?= =?us-ascii?Q?XuNIKZCSGMj+f7CPh2AAKVflEBI2JEX5EOgtSaMpZTa6/CbzLjOR33z8eZt2?= =?us-ascii?Q?AeYlPSSAEucENfxuH5KjC0AFywHuPWUkOWrb4oeRSTQryR5e6CZLSmf8ms6+?= =?us-ascii?Q?sWq3lLJmxpmO2ttzK1CrjqVuz+c0Nmb81qt18bJEUuY4TwqUDbwFQFxXs1SP?= =?us-ascii?Q?0x5V3fbGD5zWVnskd/4Eqm8eVX4OZpAqM9wKldplLbBohhNAQm79QNaamO0G?= =?us-ascii?Q?q31XgYPPy7c8dTR9dW0mnAY67iQd9CApXJxwhIQiCzRPtZXy+IHt0CNnhQZT?= =?us-ascii?Q?cZziAsyRktqpqp7UEHsXuTYpSgM9efFO4iRyzq1w2QtMMQWZotYuvPi5/GI/?= =?us-ascii?Q?H3GGFlrUTaldRMBTNDrU/oO41b8i1IH9FfnYLWkbNeGna4/9WJDow6EwIH0o?= =?us-ascii?Q?AAxYWzoStG0hJjhSZ+nz+MvQWY/kYC9Ys68SD88pllgq15XYZUEHv7xqPKUW?= =?us-ascii?Q?cMxNvJTvypo0wiRyAxVWFSNZTrOfZse5H5aHuw1QO7QdCDPPu4QJkRTRN4xl?= =?us-ascii?Q?wXcypkuzZrKmAUlgc7jNf+hnMZgC/msXVa+/bPbBlot2SL+jtlxV9U6kRJIk?= =?us-ascii?Q?/k9rt47AR7VHPY86o2D4fOdiLsO8baVXr+nbo8I0bgeSOY6Lues8QKm9vBl/?= =?us-ascii?Q?yD3HxvEzYduKM2LtuDBW2+WNqPyPp26Lk31LPtQJ89qus5Hns3UxVSRBpXa0?= =?us-ascii?Q?C7mczQMPZBFb/8lEl5M+CQ7AtRkKaqgjLeSy?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2025 18:57:02.1555 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ab889b0-7b8f-456b-8132-08ddba636578 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004682.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7906 Content-Type: text/plain; charset="utf-8" From: Moshe Shemesh Add HW Steering (HWS) as a secondary option for device steering mode. If the device does not support SW Steering (SWS), HW Steering will be used as the default, provided it is supported. FW Steering will now be selected as the default only if both HWS and SWS are unavailable. Signed-off-by: Moshe Shemesh Reviewed-by: Yevgeny Kliteynik Signed-off-by: Mark Bloch Reviewed-by: Simon Horman --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/fs_core.c index a8046200d376..f30fc793e1fb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -3919,6 +3919,8 @@ int mlx5_fs_core_alloc(struct mlx5_core_dev *dev) =20 if (mlx5_fs_dr_is_supported(dev)) steering->mode =3D MLX5_FLOW_STEERING_MODE_SMFS; + else if (mlx5_fs_hws_is_supported(dev)) + steering->mode =3D MLX5_FLOW_STEERING_MODE_HMFS; else steering->mode =3D MLX5_FLOW_STEERING_MODE_DMFS; =20 --=20 2.34.1