From patchwork Mon Jun 24 07:29:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13709110 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2053.outbound.protection.outlook.com [40.107.95.53]) (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 42E213EA83 for ; Mon, 24 Jun 2024 07:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214288; cv=fail; b=hFGWnXDEZmrr8r827ceTHnxCqHO4kHpWlNA3K8oTnfMOH3XzGOsb75pP+4b1nxN/aYA0bh5k6D1NCxMpY9IB7AmW1OoNnDJhhCQ1fHPiNISWSXHwBfLAq9FunKyiHSt7Mn18x7Tmu/qbRscuAaq0qD5LAnGmuZ9hA9GuAO0yKhs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214288; c=relaxed/simple; bh=izgBM7UrxIUFUTIjn3r66tKFZKZ25ckV7wt+xeTT5Cw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tl6j1pqyS3A+Xcz53U1Iak/c46ZaAvLEQiIw5HJncZWGIOCVXBgarAvxYpcWrAmv0zwzKBedCShWtxlcQtYUpq6XxWux46ocpo6w0EnuDm66w/WIdGqpgEPvnAdGtkh8iatQg3eVHX/LfbwwXzF9OH6c48NSXaRwSA5ZOqI/U0g= 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=TzurgOSd; arc=fail smtp.client-ip=40.107.95.53 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="TzurgOSd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nj7eE8uk56Hn1dMKb2Az86LBQpRgwTxbOLiwe1uKJ0RZ9uuw1KzmHod84cJ0xu+DzJqiiItJVvx9+OpaSR7/Ew9FOYqfwK4t5eM7cd9j0w/urwg2gFP4EE8tbkBxUWvX4YS1u6jSJ/cfc7qfKTOGICCtbFhojc/VvKDA0lqzZILuoIsKlZu3dICwwmKQJZk3oC2PXtjcTAGl7Pb9dOs1z/t3+kRPqWmGa9CLhsA7fCzAWETtFEGFlWHH5/G0XiYZaPo5I4snU1UP0ds1Jf/aoUgnGElpdUOiUoz3C4u08DI+l2snRMUcJF8gogNrtix9uhZXSzQVA9RAs2AfYEevZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=UO7PjPpw07uz0p2M9ZXfLFgYMzDlHf75tvNXyyuDoSQ=; b=ErCqSPt6andbrOTWkyn1ZOAFXHkxlUC+rz3w9tLD2g7pUX+gLGzma3fHHZWQjh3Ih46dfb7CmZ5vPc59EMI/rUSM3XpZiQSTTPJhTCf44BPuavAAO0Q48tLulLtvHfriaKVSEo9xzG6F1fpYqEwvy8gIM62kX86Sqan73qH5fRSyppK3ClqVCnZE9PL7tF8uEd3FU4lydaFGR1IJkTUnDw1nRvoEVsqw1XZRBcFJiNe5kCpOWji9zWxPLAL6Tr98pLuzMbViXVCt1EElDY8CbFmp04XzjHgk/nwhJAybH/fKcYgYWn5YKJh9GLhBcrg2Kq1nVoTHok0HbrpPkWTPLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=UO7PjPpw07uz0p2M9ZXfLFgYMzDlHf75tvNXyyuDoSQ=; b=TzurgOSdGWQyPAKeUa/9blYQc6UesqrncfDOC5ce7QZZTEw6sJ1iajKgv5v9iPqjOFbVI8DBsP7K2Gm/cbQl7D9DAEx7id5g/AvTLfjljerKTUaF8TheIyiC1J2UYEzz+KVjZo22Xyzk6RJcA6SM8Z4z4/i/oV/T4sxBlIin9J+m4Wo3OtFn1O4cvM8luUGmyoemymj/9xAiKxfCtXB1GZU58l9KB8lK+Tbf4/OHXdJ1ww2ClgXaYUC+mGhxHaFgVibau1MH74+1EZ3blMfYpjJLuGlGGN2buzyWxfXxTGtLXH9XkpZ1ccLl87U0Z+UEfjHnLVNTHJ7cCsRBCgh2WA== Received: from MW4PR03CA0229.namprd03.prod.outlook.com (2603:10b6:303:b9::24) by DM4PR12MB5985.namprd12.prod.outlook.com (2603:10b6:8:68::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.27; Mon, 24 Jun 2024 07:31:24 +0000 Received: from MWH0EPF000971E6.namprd02.prod.outlook.com (2603:10b6:303:b9:cafe::f) by MW4PR03CA0229.outlook.office365.com (2603:10b6:303:b9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:31:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by MWH0EPF000971E6.mail.protection.outlook.com (10.167.243.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:31:23 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:14 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:08 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 24 Jun 2024 00:31:06 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , Daniel Jurgens , Parav Pandit , William Tu , Tariq Toukan Subject: [PATCH net 1/7] net/mlx5: IFC updates for changing max EQs Date: Mon, 24 Jun 2024 10:29:55 +0300 Message-ID: <20240624073001.1204974-2-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240624073001.1204974-1-tariqt@nvidia.com> References: <20240624073001.1204974-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E6:EE_|DM4PR12MB5985:EE_ X-MS-Office365-Filtering-Correlation-Id: 82fbb8bd-af90-4fe8-cb48-08dc941fa6aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: Z5Wz656WGyoBFAzajnmaDB1Vh/oBKeARTXx7OdGlE1eDNZbu/QGU14gyCHIPDj6j0yq6EMgJKaLjxu3UP5jJkpAv0rmauHnengDVQAC2hBCWpYEIowDeURmwUhq5Ro/JzcPTV2924db+C6jHceaptfYGwoWCv4vx7z4h876d/T9gpErvQ67cwgMnVDtAClPPp98/udpTnBbPNfYFgsLFS3xFHWEdfqc3FrQl8cJkhsjJfXTfapU1io0BDo/sb6z+9Tlex4jXuJYkPDXmHzXorlqxQNsI1NmnIqREwVdkfyxlczKDHTQvH3ZQfAU6qj8FcTPvGsg4fhKvqRtS/Xcukh16AFg9RqttVW38mRlEQo1l+JGUWHUohfv5MqNKVg3pmr/oUOA4l2ERVJr1NVPs5eizUGZOiRHfShISyHHlJOtv/PEJUp3G8y929aUW+GeOW6SuGu0cFYwKvaVcU0h8bZ3GhpSEnGWVniBcpFbS5xrrH6Ei81LhK5Y/uF+AC8v7JnGT1/ee8/Ly/KjhiDDJYIlCJSVgNB4afp5bIOEdvc2TOzAYhHtotKR5+Z7U7HK/W/zdLHZS/1gud3LDlK8E0rbguoACVqLl4DWfTaRwlLqLaTCNEU0VXGK+ZerQfbqvzc4lZYBu9mfrosRHtfn3FFWnJ7fOWOwUMwywoc0jc65QVMnAs7qjPjU39/w+AqhjwL9e94NE6YrdjWQbiNOmhkn65rBXn5TqrRWdCIBeYqDfPXn2ig9AYRz3kThZjKanDSyC2PN6+r0kgdBli2yWnhHSOppvWisCJxPeiwFLdNx3bEFPySOrZnyXJXMtU2OVCEBGvefSDz7mqyYzxlbFsERKTtsSVJYNaQ98Jq+MyTupQU2Y9o2A19npIekOSiZpW8ywRraRmGOM0f81VL1Aqcpm4QmEUan5YNh2a9kCcvAlwyd8K6Vc2XsDbDRn3BV4AE5N4Jj/GEKgxgEJYOFU/mEZYiRNKuvji/Lly8vf61lQlynrvm9VW/j/ujsa9WbC1T0xCXfTKN1E+epO+G4HcXFfPeXGRg0VrtYZZ7RPLd6OJQ8zsxywOZTBNFL+Vv5o9G7QyjS6jS5tjXphl1FinaEOA4QlYOMgz5yRcRM+6lEq3xuxa3UGf5E2E54yQgfJMS7RmYv3JWdbYz2ZXyLGuv8PH62Hd6vuqgogvkgxEm6KYWUeZj44lkhlG7eS0+uFvUHNmkIxyn/EHlsV+j1r747E7C3ip2kAU1ZRdnS4d21txVb1ER2+O/R4wY9t9rAj03I26JxDCPHDYiJpSWYaIT12pw+nO7aWbDM8sOaesQ5VSTO3cVTTBC9xqgVv5863Dn9JFfV6UvGe0GIRz5vfJDgXtc8Ep0fPLAqLjLiYdTAOBDMHT4Xw2ItD15Lorq+XaJi+h1vq8a4Y1CCEV61EzQ== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(376011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:31:23.9938 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82fbb8bd-af90-4fe8-cb48-08dc941fa6aa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5985 X-Patchwork-Delegate: kuba@kernel.org From: Daniel Jurgens Expose new capability to support changing the number of EQs available to other functions. Fixes: 93197c7c509d ("mlx5/core: Support max_io_eqs for a function") Signed-off-by: Daniel Jurgens Reviewed-by: Parav Pandit Reviewed-by: William Tu Signed-off-by: Tariq Toukan --- include/linux/mlx5/mlx5_ifc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 5df52e15f7d6..d45bfb7cf81d 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -2029,7 +2029,11 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { u8 pcc_ifa2[0x1]; u8 reserved_at_3f1[0xf]; - u8 reserved_at_400[0x400]; + u8 reserved_at_400[0x40]; + + u8 reserved_at_440[0x8]; + u8 max_num_eqs_24b[0x18]; + u8 reserved_at_460[0x3a0]; }; enum mlx5_ifc_flow_destination_type { From patchwork Mon Jun 24 07:29:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13709111 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) (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 1983944C7E for ; Mon, 24 Jun 2024 07:31:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214291; cv=fail; b=tpcQtOz9ARQpHBmPvoj1J4x1AKTI9SybTctQo2OsTv1DJMULSdMd44xmJNXyFZf/cs18Jd3Qz34ikCPQ2SR4agnn9r8hyaUEawvXp1WnSug/BMGg09uqaeO7GESYk4ovpu9zY7bTmEsv7rWTfM/tS0mMhpALFJ9Mgna1gZ+lP6w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214291; c=relaxed/simple; bh=kmT7ytZO+/KgbmmtdA/VbzVojfVaE3Fk0xK5Xy+kPP4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jGkTLaaI/6YHOVNkkyxLfXbYSg4CDodEEmz/8S5rcExIK1eEAZKWNcVwuV1XEfYZz/ROzm5IBPsqcwlPcYokVj/C5v1TQrYg2fC53jBmDPpYSdklqo9Yupi052VGelsOO2Gzh+PsnpeWxVgH1J8jO1SWpdSju6j/sL9FmNqOUXE= 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=euTPm3wD; arc=fail smtp.client-ip=40.107.237.62 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="euTPm3wD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KBgsratX2CQ4v41u+Bg1Afe4nKTEux2Q/gtcOQHvJ7N4E23Cn/NsWzLZdljrlziS0Mf0dvNQgwwHx2nMStvntyLePSXELzOzMznFdCGYvLTaZhgymwQlWVtkSONN0bpXzW9RzOAWdsUbaopl75A4IBXoa6mPq6mVOETWxjawRg121q/cZ9DX84VdSu62Y63AqT2nDBPFh9AGjvBfoaxPDcizhPGS4ItAoBr4wwLWFfLnM9bsb06J5bwG6b0sIyqat6tw3f+iAX6yXZ4daRAzWPfA5v4IWVbvrs8TIJ18HxcrzpsWzQjrPI8fJEdSTozs2dzKPzOV/zdPJsAtFTjd+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Ws6SU4j2kUTyyd0n2Empvl9Lqh4uwAzAcWENXzTg070=; b=fUIXsYdaxovps/DqTckowVsMp+vVG5xQISeahr1J5EtEJuS5ZeTG+IXsWKawXwdFmHySj0Wc7KeGSE9Kf5TuTiRnOB5SkaNvFUjdOXU8obkMd8XSEzjjXrawxQu2aS9OC2bGXc1AfjkfG0vpye8c18lgLS6br7R0e4qCcCffaXwkSojltbQhwz8Iad27x6wG58wHy6Dg6yJTDrUf8qA59q4RPJzPibscOVxVUfbR2dUjuKrOCpvj5/o3Q6RZB23cM1gwdY2dVB3BNA7TO9d6SgI/kXiajUW0ona+wo7NAuhXPJR8lZj/J+FjF2lh1VeHyPFUbWhK7jJI52LJq7Xp8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=Ws6SU4j2kUTyyd0n2Empvl9Lqh4uwAzAcWENXzTg070=; b=euTPm3wDl73roa1DAQe0AACwkoVVk+giMfHj+dgTOHWUvlJfdhJaz9HMa+X42zoNga6vEi6qBArzIGQtGaaeSf5L2J2hkqoE2Ac24U6JLrhSoeusnXP8Ap6j4fRTkNUkNHQWWWUMRcva067o17bgHyzGVX6RF2kISkgVNhaHqln3j3ScwrDHnXuVf+D/SIGgRQ5bVCzznA0oEUdAcOcnUR1gSRallUETqZuXda230fHMfSHVbuEHCIEsUmWYyjxYAFAstwb/QqGfAqHCyPBtIQwXpPkbtfUTi73k2eTb5YG6zVfllh3pE6o2TS6DrUjEdMXp3+T4WxI4EHR+jJt6Vw== Received: from BYAPR05CA0094.namprd05.prod.outlook.com (2603:10b6:a03:e0::35) by DS7PR12MB5742.namprd12.prod.outlook.com (2603:10b6:8:71::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.26; Mon, 24 Jun 2024 07:31:27 +0000 Received: from MWH0EPF000971E5.namprd02.prod.outlook.com (2603:10b6:a03:e0:cafe::27) by BYAPR05CA0094.outlook.office365.com (2603:10b6:a03:e0::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.19 via Frontend Transport; Mon, 24 Jun 2024 07:31:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by MWH0EPF000971E5.mail.protection.outlook.com (10.167.243.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:31:26 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:17 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:16 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 24 Jun 2024 00:31:14 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , Daniel Jurgens , Parav Pandit , William Tu , Tariq Toukan Subject: [PATCH net 2/7] net/mlx5: Use max_num_eqs_24b capability if set Date: Mon, 24 Jun 2024 10:29:56 +0300 Message-ID: <20240624073001.1204974-3-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240624073001.1204974-1-tariqt@nvidia.com> References: <20240624073001.1204974-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E5:EE_|DS7PR12MB5742:EE_ X-MS-Office365-Filtering-Correlation-Id: a5df0691-71aa-40a5-990d-08dc941fa858 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: 72Zr9i4pjeAd8M9TI8jy0wps6g4EiCIV5SySNBAjyUGOWWjqQS4nrhmdbyYGODyPUCRHsHg2NJtp5V78gzVn+4Jlr+F8AOSEaiaqUssaDMzfWCoJLkWE7ZdBTveDvSroRqDMKdeqKVmtiwSmybOsOCjv1qc4HTNIQ/mj0hpA7Q96TkYAJMxuqcKDYpuhZP2G1lLgcJPqADy4W+n2UHOVwtz7UCPPlOQBafJf1hvRbe5UQT1rxSVEwmyAkv81TuM9BlbrJ5EAZmcCqLZjZbJUBn2uZUqTBSDoFPmQZKy5EtiaRx+NBZv9NuuGghwrI8b8hd2EDRmUCiik8XuFTYK0Mv33uWTrOZwQVW+NLlVkJUhlw5RgM+8LTgcc0Q5ECpW7G9qkXU7q1NBen7+skxMXWbzX0Od8Sd3WIa7U9ga/5qZDK7cEmr0ULUcxVoavPD8OL46hfwxlHXFq6wmX5RosfrDQRKOccfXKwQ95FlBvT0Ev3aA0C2FJnEtvBBNKo6PyyTbSz7KRQ/IYez9hFvs/JS6ESg74wC17AXmvzh0j0mOoyWLdPp6/6x2TH6EvAwXwTRcguvGuT/UWYzreO7VEeRhqjIRJdar7xFDweYSSgfR3uC0/og6S4aGf1l9W2mpOqw/Jjj+T1CPzHwBF2/Ey8JUoXpIHlu6sn82cZcBywBnQiNptzOBGf2RA4d/mRVZBvohSp4rpYLtqxQJvRnS/rgByUSJq1euwaYlp0724NdfcsuOlA6Wk91UwBqk6dwTe6t+hIUlp5hFdJXtaT69u2U4ZNAc2mVPYIrQoNmowkWv5m/qlmj/MiG2R7S7xkSG7wpoXTUyydCLb/S4StM90q0+sDukI6R+hWn4uT0YJkZkbxrash7gdGphNGIHRODiT/NT9OpQ2ud8DzkpXHIj4jTLfTyOdfzJpObtBrK6QPqiA5rav+nypqhcJqRwhq2A8nIxF/2VhF30y79RwN5orvtP6aW6/2ZVmMSWScuDMtiPms04OdM1lE4YJ9V3m903ftzo67glYhrIOUAmNAF1K+PjLaqD5wfGyyULTOLDmNKPTm4tEciLm6tlVVtJxB8nmEPMYOH0USyI2o67rIWjbIe4j0gHO3ngQWlyQAoiB4n1mqABZNrve6NM8Y/rDQedCVZtZTpLrL3Z2q+Uy0aUjSd0YIjZHH7MNESFNZmdr8Mum9ZKsiFIXWqz2thaIKJKNQfBVUpLgaSbZfHIWiIg1oBo+BDzLavb/X7rBvxItzqJiBaob8HvGiTogXXNeiB9AAVXZrP4xiwlpKC+6Lf1wOIResPBm/OKK8ouWn0BQ+llv8rLGyDNlSmNceveBVswBmPXzo+bs15iJK0ezCfE1bKsnAqOjPOcFCm6d74hoGpD12nrq2KZc2lLxCVIlzXBo4H94xecf1mh7gX8XhSleoQ== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:31:26.8262 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5df0691-71aa-40a5-990d-08dc941fa858 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5742 X-Patchwork-Delegate: kuba@kernel.org From: Daniel Jurgens A new capability with more bits is added. If it's set use that value as the maximum number of EQs available. This cap is also writable by the vhca_resource_manager to allow limiting the number of EQs available to SFs and VFs. Fixes: 93197c7c509d ("mlx5/core: Support max_io_eqs for a function") Signed-off-by: Daniel Jurgens Reviewed-by: Parav Pandit Reviewed-by: William Tu Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 4 +--- drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | 10 ++++++++++ drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 4 +--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index 5693986ae656..ac1565c0c8af 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -1197,9 +1197,7 @@ static int get_num_eqs(struct mlx5_core_dev *dev) if (!mlx5_core_is_eth_enabled(dev) && mlx5_eth_supported(dev)) return 1; - max_dev_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? - MLX5_CAP_GEN(dev, max_num_eqs) : - 1 << MLX5_CAP_GEN(dev, log_max_eq); + max_dev_eqs = mlx5_max_eq_cap_get(dev); num_eqs = min_t(int, mlx5_irq_table_get_num_comp(eq_table->irq_table), max_dev_eqs - MLX5_MAX_ASYNC_EQS); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index c38342b9f320..a7fd18888b6e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h @@ -383,4 +383,14 @@ static inline int mlx5_vport_to_func_id(const struct mlx5_core_dev *dev, u16 vpo : vport; } +static inline int mlx5_max_eq_cap_get(const struct mlx5_core_dev *dev) +{ + if (MLX5_CAP_GEN_2(dev, max_num_eqs_24b)) + return MLX5_CAP_GEN_2(dev, max_num_eqs_24b); + + if (MLX5_CAP_GEN(dev, max_num_eqs)) + return MLX5_CAP_GEN(dev, max_num_eqs); + + return 1 << MLX5_CAP_GEN(dev, log_max_eq); +} #endif /* __MLX5_CORE_H__ */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c index fb8787e30d3f..401d39069680 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c @@ -711,9 +711,7 @@ int mlx5_irq_table_get_num_comp(struct mlx5_irq_table *table) int mlx5_irq_table_create(struct mlx5_core_dev *dev) { - int num_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? - MLX5_CAP_GEN(dev, max_num_eqs) : - 1 << MLX5_CAP_GEN(dev, log_max_eq); + int num_eqs = mlx5_max_eq_cap_get(dev); int total_vec; int pcif_vec; int req_vec; From patchwork Mon Jun 24 07:29:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13709112 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2067.outbound.protection.outlook.com [40.107.244.67]) (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 182903EA90 for ; Mon, 24 Jun 2024 07:31:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214292; cv=fail; b=aYCWoLu3m/U9rPtSDSJ9RN4uia+MxxE+ZEEQhtSXdg9mp1WOupnq9bWt1JQYI9XRBuqDfoIGrTqrprWpXpP134Tc7v/NG9tNkL6EhgOgMqutQFakvUDkAj3s1HOfWszeUK/wXUt5e6WwwpkeQJ4EnOp0bZRpkH04GXh50nFCeE4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214292; c=relaxed/simple; bh=LStAbE9vpO/sIAT/4See3RWQmxNTtiVg9lDExW0cLOQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jGtD24SrzKojpKoorksCXwQ9pADjyaUjz5oVRZgwe619eMHBt8FhgaSjL3cpR7qQimP/w9JLRE5vGU1mzKhm54FM/oF7yd/0dTCmH0RaKXiy8gC+FpPgz+asO9eO6tzfOxmFvXm+MZT44EEHOI0Vp0p/fhmggcfi4R2QkV/OTTY= 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=f9YNMKLh; arc=fail smtp.client-ip=40.107.244.67 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="f9YNMKLh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mDz1xrE/B/+NrJKe7OY/UMrviKMdSD5cW5d/RfFKHeiJ1I7KkV7aAYk/27DqJDdd4dNEdhYBkjLG+1zT/tqO95LyVDr4IuYWCt5AeQocj6esX/jPT4NMIh19yktOKkLndQHiQCri9rkLDPgmZxyQxBbxton7/dWwP/B6eHEljqBWx8tC+n9AXTG7uoFP6jvytu5TMN1S2Kh3ND61sO7e9vLAG41BxUxonjEijTBPVB6wZjkxRumMKqwrmlGOTKhPNVFBUJ2seeFn2IY5UNTlC9nXb4wIJ1HTk6ekkl2d/0rS8pZJ9pW31NOCMfgObDAkh2lRvw3XrhkUVahV2MuOIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=s3PKK+BN3vPx9Db4iy/hS26Whh5E64+zPiV3w2Wl4vA=; b=d+CFODT7btHXy+VQphZ8DFtix13RzXM5+Rr7iSb0vamlFWx8oWg1OUkuBYLP+HTel/0WV5lPGG58IuH69hxkc6FpKJ2Z0Kt7PDwfGBCskZl5oObnt8KS9HTQ1l0Vi46gQPFEbP0dk08sSngfuB7A7daa7I0EcMYJUnNRM8I9dpIgC3dhGDa/+lMLufylK0cNwfplmOoJwL90TM2YgJvKkj2I7HDLRjEwJcAqoosTmd8Or007yI3EFKqLoa1wP0LjkJXxgV20Yw+dFJu2OUSHbSbbRW1VbndHnNdMFtfVIDXl/uILflJ1q/sS7/fmLzSAXoRHipS+j9Vm97+Uworo7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=s3PKK+BN3vPx9Db4iy/hS26Whh5E64+zPiV3w2Wl4vA=; b=f9YNMKLh6t9TRAJq7RPlOIUFeD4azK7gvCY1lGb0440AmvRMWUunhyK0k6OrY4965LoPssflxY+t4sy5F9XjL5gmYs/LbtdEfG8hm/Zu0s6cerdFOpp08mV2dw/ZjLk0F17YVmEh5GUZJ0kuRdtG4gRUPKdOKCr3deQnh4VZQ6zz4IPncJmhUydCprF+31FJ/nMG8lhk1eJHzVwa6p6TzYP7oVWvbCHkBgsez7Gd4cNUyxVNijNngKcm6BM8IOy0OVdlnPQoQK6pE6FiztHf+x0wFqx8QMCx+6jvrSlhYQ9igNi3nKY7wLrIFFVO+H7Cj1gwEm8kt6LpQxOB0k/fmA== Received: from BYAPR05CA0074.namprd05.prod.outlook.com (2603:10b6:a03:e0::15) by SJ2PR12MB9241.namprd12.prod.outlook.com (2603:10b6:a03:57b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.29; Mon, 24 Jun 2024 07:31:28 +0000 Received: from MWH0EPF000971E5.namprd02.prod.outlook.com (2603:10b6:a03:e0:cafe::8d) by BYAPR05CA0074.outlook.office365.com (2603:10b6:a03:e0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.19 via Frontend Transport; Mon, 24 Jun 2024 07:31:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by MWH0EPF000971E5.mail.protection.outlook.com (10.167.243.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:31:28 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:20 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:20 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 24 Jun 2024 00:31:17 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , Daniel Jurgens , Parav Pandit , Tariq Toukan Subject: [PATCH net 3/7] net/mlx5: Use max_num_eqs_24b when setting max_io_eqs Date: Mon, 24 Jun 2024 10:29:57 +0300 Message-ID: <20240624073001.1204974-4-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240624073001.1204974-1-tariqt@nvidia.com> References: <20240624073001.1204974-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E5:EE_|SJ2PR12MB9241:EE_ X-MS-Office365-Filtering-Correlation-Id: 001a3588-afe3-4683-1859-08dc941fa93b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: 7DmITXeEAcH8HY1KYu9/l3jl02D8SSzHzeFrWhMQeFzTwIlGEgszzP4L9IzATPGwdizKjYFFJihazi0XdltG/r+4KZW2XKTZF76UVwbAU94vKnTiN2GIJ8BVblM3SxI21o0274iLRHmP4uLiSqCXTsXAn0ZJ2qS5JX9MdGPCpeWguyG1LAW0ywa5Wmosv1DXXpDJmWuykfTQn7+ODg81J4Sv6WI5R7Azh8HAp3MoECUwEYxDxeDp5vLm8bk3NYJ21Tr4C1BzZSjBQFtRGeTT1YUh4PS9fCWEu29IoFPEF8IElRgIxp0HADkOqC/wMaTmUUERyMrtZiTBRN6JUUWDiVDjPJf5vmzgVdDliUHg7y7ua5P/bR6sV5tGOBl4KEFs7GMuDrrJP1MGpKKAc9GcNCMCr/KDPFABKLdD41LlYnropHhdFMXgtn0IU70YjcLNiq2qIHVEa1tUdyPF0G+ZxSaVzaypfByie8AA8EXzY+CwYYs9Fh5MHnhy4Veq9R6xkBOA+X3JRwGUvKLyItnuV3fdTt2nXORTPFwI1KsW24FMeb8jcfWvVITxAgF+LdWHxHe5huJ2lGEZpX0KS89oVPf10Zm5Gsq8KH2EOMGbYa9Eylbp4F1wXASHQrrmHWYINhv7tSLVDed8FTr0gOELImoFiycHTab69vxBvvEFcszecHMbDO0X4veMi8/BCoQthcGDsb56Kxnongmb/FNfw+CBgsmoDZYNvSEJhNPNUdzCBw6wosg/ZC0FUk1Jb+lEp89xLMFcdX4PHC2eEnVDluwTflPVVIwygmjsJtAeAWeOIPz3NLmGgd3e4LPypDP1TJKKfNWegw+YZdnglTZ2k7W/filgCkB+UoMb4NcWynQ/6GFtA/zdD0gmvOX/VrFy2zr4lvx7Wsc11GhH/apOQtsp/+Zy0GG7uq2H3XvI8sYSectzrbo9kDLKeRsm1vOeBINOYSJKbbK4y7y1cq7o3PWYovy/rII+gNPrJq+X3bmK9H1aNYkh7cfAy4t3CqC0P/cHg47n5pvORF/fd4HMstIFSP2CAkARs2lNFbAXT4Rzl6Bd+FDrD6xeRt6yYj/BfEhZcfntdDJNnrTbXkzvV9LzWnzbx4yE8bERQ98EgAa993NfMXhw9gLt/2jktrfDpYe3s9qOJVE+Tv/IG9QrIQpUzkS5uEsCac+F45bAMvQV3PS6W4vI2uuleARYyJLccqvIhFiFyacdRxbVYi96DK15FUDN1OkZ02HVwEV/NNc09zSRTAN66ufvtfD9+fefBSv7ZF+hAkyoT9uS+IxsXfU0LeRHffQLBg04FXdPsXj58pq/hNl4pl1mTyh8gUI1eBtPMXkAiDfPUr8WKjt4HU04ZOIpS3gcmXPFYHS0+orH1CwDJ1qHTdNDklSViMB2/rGuUrdxR2t/fMfAHH3mTA== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:31:28.2949 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 001a3588-afe3-4683-1859-08dc941fa93b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9241 X-Patchwork-Delegate: kuba@kernel.org From: Daniel Jurgens Due a bug in the device max_num_eqs doesn't always reflect a written value. As a result, setting max_io_eqs may not work but appear successful. Instead write max_num_eqs_24b, which reflects correct value. Fixes: 93197c7c509d ("mlx5/core: Support max_io_eqs for a function") Signed-off-by: Daniel Jurgens Reviewed-by: Parav Pandit Signed-off-by: Tariq Toukan --- .../mellanox/mlx5/core/eswitch_offloads.c | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 592143d5e1da..72949cb85244 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -4600,20 +4600,26 @@ mlx5_devlink_port_fn_max_io_eqs_get(struct devlink_port *port, u32 *max_io_eqs, return -EOPNOTSUPP; } + if (!MLX5_CAP_GEN_2(esw->dev, max_num_eqs_24b)) { + NL_SET_ERR_MSG_MOD(extack, + "Device doesn't support getting the max number of EQs"); + return -EOPNOTSUPP; + } + query_ctx = kzalloc(query_out_sz, GFP_KERNEL); if (!query_ctx) return -ENOMEM; mutex_lock(&esw->state_lock); err = mlx5_vport_get_other_func_cap(esw->dev, vport_num, query_ctx, - MLX5_CAP_GENERAL); + MLX5_CAP_GENERAL_2); if (err) { NL_SET_ERR_MSG_MOD(extack, "Failed getting HCA caps"); goto out; } hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); - max_eqs = MLX5_GET(cmd_hca_cap, hca_caps, max_num_eqs); + max_eqs = MLX5_GET(cmd_hca_cap_2, hca_caps, max_num_eqs_24b); if (max_eqs < MLX5_ESW_MAX_CTRL_EQS) *max_io_eqs = 0; else @@ -4644,6 +4650,12 @@ mlx5_devlink_port_fn_max_io_eqs_set(struct devlink_port *port, u32 max_io_eqs, return -EOPNOTSUPP; } + if (!MLX5_CAP_GEN_2(esw->dev, max_num_eqs_24b)) { + NL_SET_ERR_MSG_MOD(extack, + "Device doesn't support changing the max number of EQs"); + return -EOPNOTSUPP; + } + if (check_add_overflow(max_io_eqs, MLX5_ESW_MAX_CTRL_EQS, &max_eqs)) { NL_SET_ERR_MSG_MOD(extack, "Supplied value out of range"); return -EINVAL; @@ -4655,17 +4667,17 @@ mlx5_devlink_port_fn_max_io_eqs_set(struct devlink_port *port, u32 max_io_eqs, mutex_lock(&esw->state_lock); err = mlx5_vport_get_other_func_cap(esw->dev, vport_num, query_ctx, - MLX5_CAP_GENERAL); + MLX5_CAP_GENERAL_2); if (err) { NL_SET_ERR_MSG_MOD(extack, "Failed getting HCA caps"); goto out; } hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); - MLX5_SET(cmd_hca_cap, hca_caps, max_num_eqs, max_eqs); + MLX5_SET(cmd_hca_cap_2, hca_caps, max_num_eqs_24b, max_eqs); err = mlx5_vport_set_other_func_cap(esw->dev, hca_caps, vport_num, - MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE); + MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE2); if (err) NL_SET_ERR_MSG_MOD(extack, "Failed setting HCA caps"); From patchwork Mon Jun 24 07:29:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13709113 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2044.outbound.protection.outlook.com [40.107.220.44]) (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 E706C45BE3 for ; Mon, 24 Jun 2024 07:31:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214296; cv=fail; b=RD81ZiZGiLYrKdV/emzLtJ1p5EnsWVTbFrLcoRNkZC0pO9lXS+WFCS9LzW2XFP9B8zGm2Mx3lWFspJUo+2AeL3CQ4xsl/Nomp+x+2j6/z79dwHn4Cer3yiscfxHw+rJUz0riG74OrXYVImLw8kJNx0FgzfwE9OmtIXv0jQyNyoc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214296; c=relaxed/simple; bh=bbUCNyhKq1US3nBNaav+KH2oGEng3LGKP7axh2rI8dU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QWxOsCX0ak7WEajbUZKTDdTlxzym5xHuP9FUQ4lbpCo6iI0aZ+bqS+0S5osH4ez/3B6W5Gi0GayJo8XTChJPgkt03AWgZBI/Xhwxv6KXvPr7h///7Tc0LdzEHw3Fl3xvcGG89wFguDB7ysQ+dZstEiFpfdxfYRyqJseAy4Txkh8= 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=gDXiECtj; arc=fail smtp.client-ip=40.107.220.44 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="gDXiECtj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cCWkFXKVydmD2eMNxXeB7X3TkwWMNX7plAYWJbP5cZasHbuEDsP2I+PFf8W32z3smAHIFkT0OJpXilDOZOhCdhw7n0zEy/c7ExeLQUVXKI9E6OMuFHqsZUmGUKnbg19NyG4AtsvQvymDpgIJQr5nrjHyZZFsofg7ytZLb3dHx5MlxBQaFSbc8aJCrdn5Rf3IzKIijH8lb2u+YzwwUO5zMLCDOR+BnFXENI9mUYA+uRLcD7mRf6kFULCMtLNr8/IAjEAujo+Ia1lELcWB1kIOITqIL2lcsoDDpEE0nvSRDK7jMdmFWB9TB7rMei5gY2361qp7FF0avFH2zw2lgTzFRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=PFDSqEMIPZuVmW1lYWdYlECURavG8XQ62yyZiPqaOMU=; b=oST2Sarhq7q/nxEV198KAy3mQ4w4z2F4oo6yGh4JmvNaagIrf++TGUbwaYyAZGItaHJ/DyuPXnGbgD7GTQm9ICa4t78CwK82oju4iccKzrHkgc5vtjznQtH5AOYzlWYeq+sgtn320r6/kRvn/SW24gkdgsjWPyM4itTb0p1aNsNzY9/zWu0enFNTjImRVQDbbddRfw8laoDYrXDJ/FDAyb1zo7xSp8kyhGlfZynUbFiAC28VqQPE9Aq2NXSv/zX63Wqd+kr72IDGFdttUc54s6LmTHE3Vp6WjlykM6OVGK38fs3YoG2RsOTGObO9fy90/nJRxlnlaNwkFiZSmj7UdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=PFDSqEMIPZuVmW1lYWdYlECURavG8XQ62yyZiPqaOMU=; b=gDXiECtjO4itriDWIFabbFwb+QyEgC9PSFDwpdIrqdX5Ay/Y+Hd+ut4/pO0z83hQBNtfW28PUMXSfjIG3pnQvlFCmFAumwM5njkmX7upfbPvNPFVuIaoUAmjrfoAZs+2mlaEwplwcGQD/5K1o9pRDwqLO0l948vDMEtszdqFlRWDNS72TaWBiatfKIXemCZZSVY6XfGub50i6iRpr87ytMw6YOK49XW1FvhMrombi7jWCN1y5uZO4DXUQhZOy7A/qBabxyd7WScJ2V4YWensr/JkwY6CNA6PDugbGU0llf6/t5jY28X054b1mjBlrmwlWVEum/Ff73gI/kpSF4keyA== Received: from BYAPR05CA0079.namprd05.prod.outlook.com (2603:10b6:a03:e0::20) by CH3PR12MB9196.namprd12.prod.outlook.com (2603:10b6:610:197::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.26; Mon, 24 Jun 2024 07:31:31 +0000 Received: from MWH0EPF000971E5.namprd02.prod.outlook.com (2603:10b6:a03:e0:cafe::10) by BYAPR05CA0079.outlook.office365.com (2603:10b6:a03:e0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.17 via Frontend Transport; Mon, 24 Jun 2024 07:31:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by MWH0EPF000971E5.mail.protection.outlook.com (10.167.243.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:31:30 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:23 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:23 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 24 Jun 2024 00:31:20 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , Chris Mi , Tariq Toukan Subject: [PATCH net 4/7] net/mlx5: E-switch, Create ingress ACL when needed Date: Mon, 24 Jun 2024 10:29:58 +0300 Message-ID: <20240624073001.1204974-5-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240624073001.1204974-1-tariqt@nvidia.com> References: <20240624073001.1204974-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E5:EE_|CH3PR12MB9196:EE_ X-MS-Office365-Filtering-Correlation-Id: 786f9a90-d020-418b-4208-08dc941faaaa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|1800799021|36860700010|82310400023; X-Microsoft-Antispam-Message-Info: PtgmCxOcD1m2ECMRFTyZMoH3IWqdmF5yzwwnQ2iY2ylVUHBWX0/CBVoIiNITPsY0kXnFPOaY+OkAHDPO2206Rj5XOBJRyPPRaWSQkAnN3439seHQR+BdAk7l1GJcOaf8UiS8cfZ8Glp1yog7Pwj9E1+BA427pZ8wOypmFO5UTQzbQOVbsBX/Mfc20KTXRT41i33NXFW0pMxeiesfOIahAPf7t8xQXimpanljKhxgbpTfTR3GYTTXQCNt6cvqH7s+eGdYFBafixFnqdf6W/hTy8Lch53ZGC+eNDxl3/DiUeivGpjgfQQXuTxgWR2DDaIDWroOH53tL6H2Rhf0KJnxf3TPs8+8ylf8pbslG8uq7W82XS3kQHH3q8x5hBhBdI4VW0oBXq6DxQ9GVveRCTfT4XIp0sGzoUKIN+5GFVGAyBJmXvk/HacPPPgRFYXFUsFSVnESK3EhTTCjt/oTAAHYy1G0mMVHnpKNeh7eze0iPphaQKxw8UModLyZpEEvIUSoAxEYkCdOwYsUSCKdK6uvfrvtvjMixhvO+bsI52GUS0vBAzH/Px49xgD6bRbvBWy6tUI+epM1MkVC+30+KtZVrhGqsFMoIxu5ifVdC457PNRBoV38uI/MKMKmFqjLpwFA6Mab1AMHRz0au3J8hX5oOVedB/+ZxLNkkKdzXWSalAmL6HwacI54F6+6MiIQPGfbt3eTyOF4+Ii+VxW6Sa2VJ/VcneL0XrTAJgpN48Tizh0R0Yt5W8DFiF960GBxX6VmqVTtvbgz+dBvDqMfkCig3hLqEILP7j33luHWaPmR0AWBuS0EXDTzDRaL/5VG2ZZEvbILEm8uT1zY0N9IN+z8grS1yIcW2F5HvOarAS0Jvjx182VRfgh1FKuL6T0nhsGAa26fdA8ull3/UhDyLmn13qBt2aFAp8YfLkh62hfw66gberpoPH/73UMGuOkgjd25x94Qmj23fi41Jah2Ch1skjKlkoIv0yrnYHTVopr4JxeqOIYBRWm1TZ37S2MV018R0eFddKFMk2TF5GjVILBKTi1Cxh/uJMMdsCotiv3FMoMLD8dSiiEQwfGQ+3tHYxdEyzGznItsvzkI3JEZnq/jPn2cmo3Lgvp7VD7lY4c2W5VfaiDz3uk5F7TADCCqlN4tzQs5qGQUYecIETgv7cngUrK/CxYFGLmEsaDyyYz+0D2kBnJyGHrWrx3yK9dOt8uh1uCjDsYvyq832G0OhjRy1tjPFvgzoCk2Ztdf5MbawGK7H7CHQ1Tq8GkV3/ekg52yngQxr1wkhsRygw1PoKfvOwNfyjYqwLQ5zLjcUz5BmgJbgO2Cj/UNoTTUfB+rJipxpbckL3q/LRSgyCiCda488i1M0UJfwzYNLHXl1seUXtQHz6gInekiHeggQ4IJGhW6wDv5gDNoc6fHKTQOyzywzw== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(376011)(1800799021)(36860700010)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:31:30.7637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 786f9a90-d020-418b-4208-08dc941faaaa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9196 X-Patchwork-Delegate: kuba@kernel.org From: Chris Mi Currently, ingress acl is used for three features. It is created only when vport metadata match and prio tag are enabled. But active-backup lag mode also uses it. It is independent of vport metadata match and prio tag. And vport metadata match can be disabled using the following devlink command: # devlink dev param set pci/0000:08:00.0 name esw_port_metadata \ value false cmode runtime If ingress acl is not created, will hit panic when creating drop rule for active-backup lag mode. If always create it, there will be about 5% performance degradation. Fix it by creating ingress acl when needed. If esw_port_metadata is true, ingress acl exists, then create drop rule using existing ingress acl. If esw_port_metadata is false, create ingress acl and then create drop rule. Fixes: 1749c4c51c16 ("net/mlx5: E-switch, add drop rule support to ingress ACL") Signed-off-by: Chris Mi Signed-off-by: Tariq Toukan --- .../mellanox/mlx5/core/esw/acl/ingress_ofld.c | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c index 50d2ea323979..a436ce895e45 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c @@ -6,6 +6,9 @@ #include "helper.h" #include "ofld.h" +static int +acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport); + static bool esw_acl_ingress_prio_tag_enabled(struct mlx5_eswitch *esw, const struct mlx5_vport *vport) @@ -123,18 +126,31 @@ static int esw_acl_ingress_src_port_drop_create(struct mlx5_eswitch *esw, { struct mlx5_flow_act flow_act = {}; struct mlx5_flow_handle *flow_rule; + bool created = false; int err = 0; + if (!vport->ingress.acl) { + err = acl_ingress_ofld_setup(esw, vport); + if (err) + return err; + created = true; + } + flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP; flow_act.fg = vport->ingress.offloads.drop_grp; flow_rule = mlx5_add_flow_rules(vport->ingress.acl, NULL, &flow_act, NULL, 0); if (IS_ERR(flow_rule)) { err = PTR_ERR(flow_rule); - goto out; + goto err_out; } vport->ingress.offloads.drop_rule = flow_rule; -out: + + return 0; +err_out: + /* Only destroy ingress acl created in this function. */ + if (created) + esw_acl_ingress_ofld_cleanup(esw, vport); return err; } @@ -299,16 +315,12 @@ static void esw_acl_ingress_ofld_groups_destroy(struct mlx5_vport *vport) } } -int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, - struct mlx5_vport *vport) +static int +acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) { int num_ftes = 0; int err; - if (!mlx5_eswitch_vport_match_metadata_enabled(esw) && - !esw_acl_ingress_prio_tag_enabled(esw, vport)) - return 0; - esw_acl_ingress_allow_rule_destroy(vport); if (mlx5_eswitch_vport_match_metadata_enabled(esw)) @@ -347,6 +359,15 @@ int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, return err; } +int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) +{ + if (!mlx5_eswitch_vport_match_metadata_enabled(esw) && + !esw_acl_ingress_prio_tag_enabled(esw, vport)) + return 0; + + return acl_ingress_ofld_setup(esw, vport); +} + void esw_acl_ingress_ofld_cleanup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) { From patchwork Mon Jun 24 07:29:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13709114 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2080.outbound.protection.outlook.com [40.107.220.80]) (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 7D3DD45BE3 for ; Mon, 24 Jun 2024 07:31:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214300; cv=fail; b=nGss6geI1NedvhF5dRNhyI/+OX1ohSUtouqyMYYmV0a+dP9HbFVIUf7pq+f2k1TDAJ7ZPhi857gwl1H8FVR8ol/Uf+2q7lqVgPIvmv++j0N1sw8naBdWF8ZVfdLOfzPy2LFOj3kS2XBkZwY/xo/hKSiAvogNRSBiPe8EC9pdj64= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214300; c=relaxed/simple; bh=ktNUg8sBL1IQRMOYkdZYmH7PptDXUxImEn2vACZ+Xp8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YcJ7j4C2wiYHyzZKescTh102j7F8IrYsvESDz8ODJi/6GaxFIxCwzfKm0+yL1EtDZaxSpAbLVShcS7gOFPkvSPtRapkA7oh8QtddYDdq/3vPizdBjh3+nRsvHTNWneo4gQr1AOQ1RS45OC+P3he0DdomtKuit122zQfmAjtz4CE= 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=kIVj68De; arc=fail smtp.client-ip=40.107.220.80 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="kIVj68De" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+isnIJOPmlRVprPjAe3Aybeqw22KsWNIcT4Wz40NNOC1SQtxcYS5bVJ4H0ozPkHfzKVpqrN9ltaWfylwYrvdbui5JbpBvacZX9l20QGPjKbFar9RHcQzWGJR9z/9bC3S7rI8GwR4M8/CyOdRyhd0Efot+fkT/DSVtbo6ZV8ODs/f8KuB5TT8Y67a0HBfDTlUg3MqJxgxECY+FQZ/Jal2EA9jRCNhMrjAZCZaUExO6y58x9QT6+8RVWeHiGOBIsIuJ3bP+RNguLwYhyExeG8EVKSU06K3jywawjAImw/fhwHE7EQwjiIZDV9eWGM2/h7YjF8xZAm9ZvwzkKplQufbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Pi91PzOyihEku1JhtFU+H65pLIgENBcLD0FuZZr99QA=; b=QMxxqtq46x+uZ2z2xFAORhz50JybTRUWpNxyQDleIdwYUfDP9bkyE9BwuRVkF2aqHVkhbHU2TkGh/dfMS/BsZ3iXhwayCv1ymOkXgjVKA68mvZUwWJG08yJ/GHe4Ng7Eq/94zEVS0GvmiBdMMBCMx3wCkgG2Smi0L5ZHeTFje0T982K6LoF0eLIkBZzCI3HKRVoc3b6nWfhcFtsJnhmRZEZPy84ctTWoDuQMoRQEJJ0DZG+oCtuQjlGWhi+wzExtFpBEuMISjEYx29RcZJ7DIpAuy8KZoUZYrkCJnx8IEHQdDH2P0HK9WUy0054kaK9gx6ZmyfF8WPYuN6AeNOLaxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=Pi91PzOyihEku1JhtFU+H65pLIgENBcLD0FuZZr99QA=; b=kIVj68DeFN68VoTKaY10OSRQLIyC9nEw/dJV78jMkLe3V12Zt/cvqnjWnNLhfL79YDxB32jR0nJdHK6yvndTJ80gcO8u5ZbOZSGBcoM0ZRW/eMDdD2ATXc68KbAo6CAYSK6BwetshqJw/C7UlSX9LbkWjJuok60gtvsMdoHTtcq5mfCNp4xIE4NK0f9gikHxYnuWDemgOeU1csG/4BGxYv+rK+Z35C5tbnxkLihRoncrdVbbYLNaAz3Y4MktsyGw5d9NsV4F6X/NrZddRMBp4RIFAqIfdxRhIs1J5+jL6L2+hymebJy96Pr2YIrp54X4YEHruRS1AKIsiZPTuzA/Ug== Received: from CH2PR02CA0025.namprd02.prod.outlook.com (2603:10b6:610:4e::35) by LV3PR12MB9215.namprd12.prod.outlook.com (2603:10b6:408:1a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.28; Mon, 24 Jun 2024 07:31:37 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:610:4e:cafe::d9) by CH2PR02CA0025.outlook.office365.com (2603:10b6:610:4e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:31:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:31:36 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:26 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:26 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 24 Jun 2024 00:31:23 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , Jianbo Liu , Dragos Tatulea , Tariq Toukan Subject: [PATCH net 5/7] net/mlx5e: Add mqprio_rl cleanup and free in mlx5e_priv_cleanup() Date: Mon, 24 Jun 2024 10:29:59 +0300 Message-ID: <20240624073001.1204974-6-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240624073001.1204974-1-tariqt@nvidia.com> References: <20240624073001.1204974-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|LV3PR12MB9215:EE_ X-MS-Office365-Filtering-Correlation-Id: 17517edd-3ad0-47f6-207a-08dc941fae4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: 4XY9deu1LDsqzA8CmGOByzYFLFfvGMKlDLOO5INWwfXzrdIijQjOpKgM1l0nIsCtqS9+EEc4+LnMCWjQHqtzXBRXW049APkYJLJrDvU/iye4dOI+kEQSCAGa9T1NXY0bzK0uRGxf1L53k/FPbJkTyMYTdDIfsQvy3lJWj3NB2sb+1KskKUgo2FDl8N2daF2hariLFK9Mx6IYebMZTJnDN3nYSC3T0G4dai/7THPyqTAmOVZRuvpUDDRmoGHN5j2yAlMmqmSbpWRo/e+dNp3iF4Y4dQZeg/I7n0LfldBESGnaAhexNgx4WXxtHRumiQRREjr7jJy6T9vKWSE3wE7k9vsYlgNKP4l/FIEe3rHxQjOK4pwuc/ZQ1IL1HkCH1TilzwhR4dy5SXkG7qNToqAbzQfYbB+yvbnpLMO1O3jPasnqEjwVcnF2OeungsJRYXWSh5gXJV4sDYhxif2PiaRi7vItce2ZZ401k5ZscVtkK1/buuMKS75PjjR5u28m3NizxzwZJ1r9LG4tkJBrObvQP3qOJ27u3+ev/A50PsU6fRAwyP9rEW2qpKmdNioLs+b1e25Cx6ArKpabYZJ4O8cb0OfRLpXo1r4sOFQetTi/VyJpqrzZdt7+daFAPCA3jg5PQ0JFyXxUp1veM0/ymprrkia0EDTt/i2l4SwFsAIBV8AVlaDaErL8udtKAXMHLgkYys/3jWOfRMwlcKEzMb6zd5Blr3MaKUs9y7xi3/5Sx9b4uyo9W4aWZFhlEPUiqV76108B08efuAwa1rKBCcV2lfv6joPETmUzXAxPNSjQhNe8Vc+D9uGnBU33093rVwb4gvOZLQtXr9abEdrhxIOw4LXU89whRFK6ovwnLUfgcpHPD5+owspRIfZgDvVd2P+49bI4PHs6V4Re6YwTwOeaf6osDexK+Cv/3xsANDjg9sOZusjkgZwMF+ttG05r1HtgzZ9f0JLSLZd/UmEcpwgapzgVRX5Doc/URKnap6NEt2iAUI3eHyw9eR+mEVf/W4RMNVPQcUsPSQLDZ2f+CThX4NxVoxC9/hhItQF5ZWF2bPqU8Sa7j6iiEF8bM1HgcLe7ZZYTBY/E9r0q3W2l5SQaezkMcz/wcN23y4ramLxrEAXigIh7MwUQgVck07c3kK1eaHFoh75SqmB8HnysASwwTQtZERTMxWvchVWJ5zcYdecHwOjiRRgEWh1nBSh/9pH7ShNP6cMMeGbO8vp7Q1SrJERioZcMNRWNiUQqcweU/KK0gq/yE3vmjYsT5Lv5C/O3gH9oa4cIl2iSq6diXQNdYVldBkn9vO9BgynwQ3nOq+DSTXIkHzzfGDMo6YadkJUolXKF/9gwctK3d3j6isdNGi/s9LkTNcVODsf1BV45vIERQ3p7+Kvuq4ySXmeqiJSrnegJdL+CnczdQW8FVx2ohw== X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(376011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:31:36.7458 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17517edd-3ad0-47f6-207a-08dc941fae4e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9215 X-Patchwork-Delegate: kuba@kernel.org From: Jianbo Liu In the cited commit, mqprio_rl cleanup and free are mistakenly removed in mlx5e_priv_cleanup(), and it causes the leakage of host memory and firmware SCHEDULING_ELEMENT objects while changing eswitch mode. So, add them back. Fixes: 0bb7228f7096 ("net/mlx5e: Fix mqprio_rl handling on devlink reload") Signed-off-by: Jianbo Liu Reviewed-by: Dragos Tatulea Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index a605eae56685..eedbcba22689 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5868,6 +5868,11 @@ void mlx5e_priv_cleanup(struct mlx5e_priv *priv) kfree(priv->htb_qos_sq_stats[i]); kvfree(priv->htb_qos_sq_stats); + if (priv->mqprio_rl) { + mlx5e_mqprio_rl_cleanup(priv->mqprio_rl); + mlx5e_mqprio_rl_free(priv->mqprio_rl); + } + memset(priv, 0, sizeof(*priv)); } From patchwork Mon Jun 24 07:30:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13709115 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2087.outbound.protection.outlook.com [40.107.94.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 791DE3EA71 for ; Mon, 24 Jun 2024 07:31:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214307; cv=fail; b=dttgKX0uoWIE0h2DT9hqpgS6ROWfBpiR6SO/Y24EYu87thkXz0w20GUWWNZ82WHML24O5vvVWlsIb5tgKsC8eBiVF8+dDnQUegjkeQP/DQY7VcPkGReb8Pnz5lRJb+i6uEDVZCpuawCol/F9rbej2KbcSEHD2jzJRSzEil+eRyg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214307; c=relaxed/simple; bh=uXiXgBWavQfx5rFULz7Zix4z+xfMh+jTb0lcYEWa+fE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mZw+J0XtlSoHkEOpnr74ZeQECDnk+p4E7wsAIwFhtP4BZ2/sB9aWl2yJvuIi03IQJlZlqhR8KFWKOEVb1Iy3OWIqn2+4VotRjtFtMQ0JJhdey4BULe7MRvbMsd08FI1hFvB9cjknZF+zh+5wEwK8UrCHV8g8uTPokrzL33b5I9s= 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=jeU7yswF; arc=fail smtp.client-ip=40.107.94.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="jeU7yswF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OFH5JvaqAGvxMMPWC2xK3/DGESTtRN11H4NR3Dfq9x0rWhbS1mxnwBY72hjasxemlTs9/7JoQhUJWQiGtLN76ansShze+4Xvy9eBLZAUrmLt42oIEXTG+6trfN4FNVKFyo8DXBK4dabvjriZuCgrwZyQxKjgGlS++wc9QT3f35IuFnkAnuFC4jWZG3PnWcGM2gnjA9tXCtC4xWGOgBTzO4+yeu9/iHVFNIDGYRH+mcF4LAG0/WC0ZjylPwc1etmhEy1cxedsYJBXCTE1rqPrPi0Fy1Zg2lJIIUnM5i9XFbtLgqAV4sSMN+SbsCwcjIpW4xudw7UtsQ6RiDrUUxiohw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=EjLZV6FP8Qdodoo3W8eteYT5S6aCSJMiDR1sTazVJvc=; b=ftEI9ul6YiPZdtYcPEx3cW5+Hz/5YB0DSrByDx5r7SUmF9Erp7/ucELxe2V2NG5Qje0qH1uW1XEJometdo+BeLAxK5GjlHExrUmz/bf0Urf55tYY4AoVi/z9snWmK8JZ6ji1Gb697k08cb2UVIfH0NjchVwB1HD9Pbc1hYgBcd/F2xFlLyKxzhezdn5HwuojbXJ174moeBZoznaJv2M6YkCa5VJoz2cSGpN946EO6w84hO0JHoEXTRjwYfV3yktRiCr4kxY0Hyhlb62ode9fV4Sqyf68CyV4TiQ62P8uKkLhZKfEtvTbHCjWi8uxULiUkltSpUzNL0TrVaEMXTvMng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=EjLZV6FP8Qdodoo3W8eteYT5S6aCSJMiDR1sTazVJvc=; b=jeU7yswFMBNaCClLlpdxYxhpHirBxGg5w2Ix7uhk112vWk5w6KbOR3d1wZkIE7efZOnyCRua86tTbDPPp6oz7MpXXrp8NBIXWQFpVWMAYMzsTkzjxVB5SDaPHq+/lgeBmy2MWD9/hrhqzA2kRctAcw9Ap4mNRgM6LtXrRp5rIQenPfuhWOv6Qn0iZ360yUfSsZPgXoMolpx59hLjoSC1fngaBnhC9MEbl+PvDZZYrc4kxyFcov4TE9h22KxeEAsJGK8ANFLhk95sAluqFzT0yJwjQNnhLmOa2U46MSFW5C5k5qJkkWyf+fhJLKJcPD5AOjQUn8BmsCTyDqpZCiDueg== Received: from SJ0PR05CA0200.namprd05.prod.outlook.com (2603:10b6:a03:330::25) by MN0PR12MB6054.namprd12.prod.outlook.com (2603:10b6:208:3ce::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.26; Mon, 24 Jun 2024 07:31:42 +0000 Received: from MWH0EPF000971E9.namprd02.prod.outlook.com (2603:10b6:a03:330:cafe::e0) by SJ0PR05CA0200.outlook.office365.com (2603:10b6:a03:330::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.15 via Frontend Transport; Mon, 24 Jun 2024 07:31:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by MWH0EPF000971E9.mail.protection.outlook.com (10.167.243.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:31:40 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:29 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:29 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 24 Jun 2024 00:31:26 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , Tariq Toukan Subject: [PATCH net 6/7] net/mlx5e: Present succeeded IPsec SA bytes and packet Date: Mon, 24 Jun 2024 10:30:00 +0300 Message-ID: <20240624073001.1204974-7-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240624073001.1204974-1-tariqt@nvidia.com> References: <20240624073001.1204974-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E9:EE_|MN0PR12MB6054:EE_ X-MS-Office365-Filtering-Correlation-Id: 94e8affe-4f11-4a16-89df-08dc941fb082 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: QSwfqBTUzPB1N5M211rQ/u3hJagdRNEu5kKhQfg7R9IgDA/XXHmwsCG0Mhd0woVSQ5RFQtoyJ0nZ81FAYUHCG9ICaDQlVA6CnOVLTsQIMGm/mH/WmgyHqoKs45rTerpCr+ihtElIo3avgJdAsmrbU1W/V3uK9vsePYpAqWmT4nuacdWxhTKh9/mUEWJiOxCnf75E2SlqGRXzi0XaDPg8yBu1QivypZ6qVCrPX4V7xcuMDqXIG01ht468uYrH8sGJI5Duos+FgOhAMj0yLRqpcF4Is5w0TFevSMozhXcVJfWBUPv3Gi7hGJ86u59lGqQLLCaxORIFdp7F4XfhGEh/8eRKPRMM4OjhCbtxpKB+KWWBi039kU/S8n/oaAU/efiSENvbg90+A2FVV1gCap2kvunQjkSfqp4fe+0NX8/mxg9MJiSA/ICzlWaYzT2jl38VmPltl+hIWyH7t+lJB8Xs3X21dTb6rPqag7lXIwTepEq1ExOW3xI93gd6LVQaOy28ULGWonZI0cM55D74JqYgqK9Ad8Hv2KnujHmHJTNu+oDPtbTRNLum5s/bL5SNxcdMRpvNf9wUTkXJF/L4YN8kfCZekhrRrRvu0pq8v5rDGE5ed7brn/NQMOAJ741XRR0hYzYqk2YgK7wTm8QLZNyf1Rhdf7O+PH6k5o01I68ko2jNIyXChRwYfgemTQDBzHH60vGIljO4eOCBb6dqWxk4Qo54iApc+BbjJ4IvBC00UjH+2S3z6Xtkm25xwaVmweE84kWPjqAuxSCOOErpweYjPDrcGbCL0hlIRqND8hWRGCJlCnTUT/FgrdZKSAsggpdcYNH0bMyEOzN5IhJIsNPDhVNuhZeOQ+d0v/UnRe5ImYST8w3Et9OuHiVFYhFLT4vqDyx/g/LQaaV/QyHmub5kqQXQ3Omhk13yaY+w1/oCA5RoFFzeoKeqBSR48m7P2cSGwHAAdRbYy8LVivbzqfL1uTLsla84L8PyldQSnTRB4ppjygCRIYT6KOZqwO6YHGK82StWv2jSSEosq3fLFmS4UpQ9Em1q1hblwARaY8jhIbxAQv43R5E9DtsIpyWPGDSxVjbRtZiRuJGTrBbDegcn1adwjmgNcnPu757sPA+TRzx4ZZiFg0g9INOiqIF7gEmTbe9gmDxalPX59k39/jkqQbiT+IH7+hTgUoprSf8B8fgFiVT4KG12nAGcgdCXm6O+NTBj6QMrir8ZSoWq7kCTEQNfHdudOGBWKQJB1Bmka65SVl1LwjwmeHn/g+AX0wWQNaewV3AIMiIpOdJBxgX1cYgOsExnRlNc81K+67GHFPcmkA1mYv5cV+rv91hpvYBFt4VRNpLkCgrHoWqvjX6G0fIf0pXuDFjZ6hdHzJN52oiThulvN8ZvO+InsAPVy74rjfYKCY4hsMjXganBa6aknQ== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:31:40.5228 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94e8affe-4f11-4a16-89df-08dc941fb082 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6054 X-Patchwork-Delegate: kuba@kernel.org From: Leon Romanovsky IPsec SA statistics presents successfully decrypted and encrypted packet and bytes, and not total handled by this SA. So update the calculation logic to take into account failures. Fixes: c8dbbb89bfc0 ("net/mlx5e: Connect mlx5 IPsec statistics with XFRM core") Signed-off-by: Leon Romanovsky Signed-off-by: Tariq Toukan --- .../mellanox/mlx5/core/en_accel/ipsec.c | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c index c54fd01ea635..2a10428d820a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c @@ -989,6 +989,10 @@ static void mlx5e_xfrm_update_stats(struct xfrm_state *x) struct mlx5e_ipsec_sa_entry *sa_entry = to_ipsec_sa_entry(x); struct mlx5e_ipsec_rule *ipsec_rule = &sa_entry->ipsec_rule; struct net *net = dev_net(x->xso.dev); + u64 trailer_packets = 0, trailer_bytes = 0; + u64 replay_packets = 0, replay_bytes = 0; + u64 auth_packets = 0, auth_bytes = 0; + u64 success_packets, success_bytes; u64 packets, bytes, lastuse; lockdep_assert(lockdep_is_held(&x->lock) || @@ -999,26 +1003,32 @@ static void mlx5e_xfrm_update_stats(struct xfrm_state *x) return; if (sa_entry->attrs.dir == XFRM_DEV_OFFLOAD_IN) { - mlx5_fc_query_cached(ipsec_rule->auth.fc, &bytes, &packets, &lastuse); - x->stats.integrity_failed += packets; - XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATEPROTOERROR, packets); - - mlx5_fc_query_cached(ipsec_rule->trailer.fc, &bytes, &packets, &lastuse); - XFRM_ADD_STATS(net, LINUX_MIB_XFRMINHDRERROR, packets); + mlx5_fc_query_cached(ipsec_rule->auth.fc, &auth_bytes, + &auth_packets, &lastuse); + x->stats.integrity_failed += auth_packets; + XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATEPROTOERROR, auth_packets); + + mlx5_fc_query_cached(ipsec_rule->trailer.fc, &trailer_bytes, + &trailer_packets, &lastuse); + XFRM_ADD_STATS(net, LINUX_MIB_XFRMINHDRERROR, trailer_packets); } if (x->xso.type != XFRM_DEV_OFFLOAD_PACKET) return; - mlx5_fc_query_cached(ipsec_rule->fc, &bytes, &packets, &lastuse); - x->curlft.packets += packets; - x->curlft.bytes += bytes; - if (sa_entry->attrs.dir == XFRM_DEV_OFFLOAD_IN) { - mlx5_fc_query_cached(ipsec_rule->replay.fc, &bytes, &packets, &lastuse); - x->stats.replay += packets; - XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR, packets); + mlx5_fc_query_cached(ipsec_rule->replay.fc, &replay_bytes, + &replay_packets, &lastuse); + x->stats.replay += replay_packets; + XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR, replay_packets); } + + mlx5_fc_query_cached(ipsec_rule->fc, &bytes, &packets, &lastuse); + success_packets = packets - auth_packets - trailer_packets - replay_packets; + x->curlft.packets += success_packets; + + success_bytes = bytes - auth_bytes - trailer_bytes - replay_bytes; + x->curlft.bytes += success_bytes; } static int mlx5e_xfrm_validate_policy(struct mlx5_core_dev *mdev, From patchwork Mon Jun 24 07:30:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 13709116 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2077.outbound.protection.outlook.com [40.107.101.77]) (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 D13264085D for ; Mon, 24 Jun 2024 07:31:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214307; cv=fail; b=G8WOQ/KhSZ5dC/kKje2XyPSOzf+LLWBBWS2Xb31GPfgRd073Fq9fW9N9Qm2WbTWHqN6ktnCiXxxrbdzSOtSjHBZKhhWpWkH/uQPwkiu62lnyQwDhirpKOcHhWc86VjhJxUouEc/nuxMw55aqMsm5xd7g4zj5RfRf+y0XrGiAnfg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719214307; c=relaxed/simple; bh=lk+e2QqIMLXks1su1vtDkosoZWYpcTW6x+CK+9QHOpQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gojWPhcGUJxWLQ/5IouYlj8448vofsyTxsWCyFZyBWx1WVqTgokqFsOApIj4uw8x4Fj7J8OorWUULu9MMOzzAFdKNgXI/HDmzyWITf/G6RqqbZ1/coUnb5Z5meOc6h0MhnquoYs7jrBK7XSLMRkTbCBAxqRsSyxakgsEpsGQvTE= 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=cqUsqcRP; arc=fail smtp.client-ip=40.107.101.77 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="cqUsqcRP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GYJeWYJ9Zpphjmnq4NCXuAnDaa7Q9R3jnWYPL/aTC7SJiLcYFmWXC5imaedHtE/WLFRvgFm65RpcvE4l7vMEODCyRaikWE7BaecuYq8MT5mCyWRN6Uhqn/MmpKjyOlv6oTrKwRbaxNGO2x5f7EGVV71PZBLJPi7rOmEk1dbpyH1LqXhHagJEQKpewoNbO/lJJszKF6/JL5lFDhERaYhb7kVR+/ScdkbW+VL7vbUE4evIWEZ8fTn2sEoQgA28OOby8WbpZulOB18BFVkBMoj3bBsN56+eGeTrswiBAbX4Yi3Qt1pVIknz3udfS37iox2CnYi7nbJbjBoItjCI/FAlsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=4hCg8VCZDzUTSCudGzKrdIi4jPS2FNL+ci31fPsRHK0=; b=JE/IldjYxROP5hvqQ72yY0OJVPab5qkN9Mgm4wOsKH6U66qurylJeS8EW4DOwc7RwveQMpHgfguxi8KfEhrSjT5XyIOaLxX59g9oo3g/VgkCCiGWUSX2HyQTtfGF7+x83Z8dNQlYWiMx97kQByxCkVz9H9lCG7cLU/s44TJmQXKbkyhnRFVe2QJXbwm71+bCmSfvPKHU87HgFNeTng67qpPLxCW+dUF/+6h4qi1qYfNwI607vGYS07+grup4nZO1L19F2K6jFjtzGXZDGFx2KlncrQz3I5+tPxfAgRkIaL6x+HFv1EiT6z3fF71pYKdU0fAH8XSBlSc8iSTGiKfLxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=4hCg8VCZDzUTSCudGzKrdIi4jPS2FNL+ci31fPsRHK0=; b=cqUsqcRPTKTSiw5MOnXUAdjzgr99fRLve4mxs7w/qjO2/11Bxgb0Y6lGpN7evLMMVCSpPw8EhDbCM4ZJ2/0Zoi6u1CPkmV/ZijnJrdOAypTTS5wSitWtj93Ajluzsq4ZzuTZDQJsVFM+UoN1+gwjkkjz9RUbgnY1B+vN0Wqsb2Adc6V7+75XHyYv06tJgJg8kYDCFETEcnCt6lQTOXq3TsaGunrSj1WuiR8Grn6Zf/zCUzFcJppHjoKtZgqRoK6JwjDZWiP2dZBX4N9k1DV8NxjcAPiBs1NtDr71RPyiNX/DelrArvLMSgNkXV/+KRmK6ypWnBLzoahag7p0grIUOw== Received: from CH2PR02CA0013.namprd02.prod.outlook.com (2603:10b6:610:4e::23) by MW4PR12MB7168.namprd12.prod.outlook.com (2603:10b6:303:22d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.28; Mon, 24 Jun 2024 07:31:43 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:610:4e:cafe::f3) by CH2PR02CA0013.outlook.office365.com (2603:10b6:610:4e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Mon, 24 Jun 2024 07:31:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 24 Jun 2024 07:31:42 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:32 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 24 Jun 2024 00:31:31 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 24 Jun 2024 00:31:29 -0700 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet CC: , Saeed Mahameed , Gal Pressman , Leon Romanovsky , Tariq Toukan Subject: [PATCH net 7/7] net/mlx5e: Approximate IPsec per-SA payload data bytes count Date: Mon, 24 Jun 2024 10:30:01 +0300 Message-ID: <20240624073001.1204974-8-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240624073001.1204974-1-tariqt@nvidia.com> References: <20240624073001.1204974-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|MW4PR12MB7168:EE_ X-MS-Office365-Filtering-Correlation-Id: 88cd0f3b-1064-4773-0c3d-08dc941fb1a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|36860700010|376011|82310400023; X-Microsoft-Antispam-Message-Info: yilRXlYSSl/LmUExCl3m2wzDm9CvF5abmtLaARzk+A1dAu6foR7jDZxEVBtRGAq7Xsok+xT1+hJuz6YlML8z4YLiBdsdw+nfzBK9317sLPUOy7v6shwEAeif3VE33mCg21NwHT/q2hlLszbgtuiBcZg7LJud9dhhXN0qdaBmFu+Wy4GrXS/feFc3s/GvTZrpxsvHofZaTBh45hdeBvQO3Z8W7sw5eW0ifP4j/eVf8WxLNTxuUCWjSXOqfEoKxQSCSPsGD1vrEO4Y1U4Z5I5+jGwu3SbWouxagVWH/vA+z1hJddwltokHq3WI5DVy8CS8gbL6c688V4NMYkGki4rKl8qOU9Vmq6XRIL5p9Ak59Szg/lR1vbGV9rUgb6YmPvmC4FH63wPj0UNECxyFKH+PGqkEV4kce9Ep8BDV6DmV4uNaBBuS2gVQaLPgAv6V65qUw9Zac0Jz+aYHHMuUtlOEmS6EDZYwgsk1b1AlIeP20gPOLHbokZsX8vgu5Y8PyKklO1WizIFdsj80k03uxfikkhB4gf3Q6Su4VCZL5dRtDmngdLJjKLMqbUohrw9vjzgUobn1SlXp47C4upQjT4WiU3AxeY58r+eyUXrRISj5wXQRq0RsJPAwS6lhqHtTnUSBpp4ZrVg15QYhJAlRTLC0x4fXeODYEzZLZTq3g3yMO294unlaCgocGt3i0KJfjt+TAJ/4v3sKBfjrGr86hT1nFYVnpHydYNfaa9lEeLC73QgBewKMk2BOmcQICsjMVNi1E/e92EEYio6WfteU9xHnAUg8Fq/VzbTH/G5WkqRVMuPxvpvYRRsd+6c2v/1GhhAGd9LtWWv4aadYkYVuKqMIII4MqU4gSYKQTzv+NyFvb3sunvfib46TV4O66TrUlMLxYXpWfSNSNy6884fWg3aQQufDGb7FmA4z5wBMVlhlNcWf9jfODXcVW+JFyvMfEShhn7yj8nzGUCKt0aE7l1rVIy1AsBlpPkDvidpQ2JYfCdhqSHmIDnE7a7HzDPa0ezbacBQgAqlN/5s/CXMzzqjTqPzyS9ttazBLTKBXFb69FSftpd2PbvA6wIggDjykw8yrqzpP9DXbWI9deN1E1nkTggROsZn4e4+GT3e9h/5Wabsus+pLYu/XoKTgY/F3SEfE1PIxYVpZtxq1H309wfihCHPmxa148Bc0EIgBPUKdHNVGczZ0E2qkPF3lYhjAL7cHRSysaSzEjs5skRw96o4BaswejAyvwlLgDIEVlHW6FKyO6RmGDRIbtER3f6/LxZIbGBh2K4ebqTmvSEfFNfojNiHXuLGP+KEii/a9FcXfJvAoXEnf8rNw0lO04t13hdhUXDyMJxbwoVAjBZ/v/KJJL0EoHburW7c7SIluRFqJ3IWh8L6Cubn/dGkkqJZ+mMBE6vZ/ZpdUb025aWuGgRPnwg== X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(1800799021)(36860700010)(376011)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 07:31:42.3707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88cd0f3b-1064-4773-0c3d-08dc941fb1a6 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7168 X-Patchwork-Delegate: kuba@kernel.org From: Leon Romanovsky ConnectX devices lack ability to count payload data byte size which is needed for SA to return to libreswan for rekeying. As a solution let's approximate that by decreasing headers size from total size counted by flow steering. The calculation doesn't take into account any other headers which can be in the packet (e.g. IP extensions). Fixes: 5a6cddb89b51 ("net/mlx5e: Update IPsec per SA packets/bytes count") Signed-off-by: Leon Romanovsky Signed-off-by: Tariq Toukan --- .../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c index 2a10428d820a..3d274599015b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c @@ -994,6 +994,7 @@ static void mlx5e_xfrm_update_stats(struct xfrm_state *x) u64 auth_packets = 0, auth_bytes = 0; u64 success_packets, success_bytes; u64 packets, bytes, lastuse; + size_t headers; lockdep_assert(lockdep_is_held(&x->lock) || lockdep_is_held(&dev_net(x->xso.real_dev)->xfrm.xfrm_cfg_mutex) || @@ -1026,9 +1027,20 @@ static void mlx5e_xfrm_update_stats(struct xfrm_state *x) mlx5_fc_query_cached(ipsec_rule->fc, &bytes, &packets, &lastuse); success_packets = packets - auth_packets - trailer_packets - replay_packets; x->curlft.packets += success_packets; + /* NIC counts all bytes passed through flow steering and doesn't have + * an ability to count payload data size which is needed for SA. + * + * To overcome HW limitestion, let's approximate the payload size + * by removing always available headers. + */ + headers = sizeof(struct ethhdr); + if (sa_entry->attrs.family == AF_INET) + headers += sizeof(struct iphdr); + else + headers += sizeof(struct ipv6hdr); success_bytes = bytes - auth_bytes - trailer_bytes - replay_bytes; - x->curlft.bytes += success_bytes; + x->curlft.bytes += success_bytes - headers * success_packets; } static int mlx5e_xfrm_validate_policy(struct mlx5_core_dev *mdev,