From nobody Tue Sep 9 05:51:27 2025 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2069.outbound.protection.outlook.com [40.107.243.69]) (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 7D6961EDA0F; Sun, 7 Sep 2025 09:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757238059; cv=fail; b=Ggm4atWre7uNfUWT56oS5wIzFloPgyW4MQygUYe/5PnkWtWB2A+xMQzSdCDshX7BwWSK4YHviUJG2eCjMnsz+KugIyxAnu/vrLa7P/8kHQpG4D/6rvT5rKz0Ym87pt4MDbZvL2KzcOHmBvLIhXrA2MfE9IjhYVYl4KS6M+WCRjw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757238059; c=relaxed/simple; bh=rhSLSssGL/8u3nplWcCVM5schbIZ/eJ8GCSjr9NYk1U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nqWXc9Io/ZYiV9/S/svxXsl52LnUzSweF3IXjSBirxXRFCok9HIymQqXQAH4Q58u/Bx9E5n53HOrnQVs162Oz6LzvIicb3sQZp4lwYqJpD6kairRGqg/Twhn+XPh+9ioRyXwJDsCBv/OYxuMKsalxSlM3WDvAvGpqagYGCqvz5o= 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=L6YikHc2; arc=fail smtp.client-ip=40.107.243.69 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="L6YikHc2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nXvN0gn8+nGYY/mm81dWUUJiaS9MUI3z5eTApSPRUJlQ0rOMrmyQcxn7maHayQhuXXWGBwVcWqc+Z5EMMdkW8mpa9jYdBjgxy3skYO7cBrnMW/YjPy6W1YDurCgGbzxES7XodGRH8ez7hmG854USPQbQK7YWjPe2Yxy+MV5bBZ8Ul7t79RcuNPY2JBiJmdQiLCceqBFp8biloKzMbvteKmTeYzZwaO9G8T0f0C3L2E6njTpU9wOsih3qfQmq0q+6aaNEfNXHfc++JHhS1FBxx2PMbuaIpdLPDW6xS1+s5SvWLJnk8hwjhmKwA7c5ofEccdE2yyQDdNNSZyxM2CbGHQ== 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=ZRDGfa0DrIRtlG7gSQeu6lg7yAmGgt5i+xI/0gL3CME=; b=ZPBeT9+fAkLBzKV91cp5DwZX70qEpaYK4v+KUBTpXF4Q331KnLxP+mDvacX+HCJBPbrZRgp+4JpRvEIjVqiV5gW8aeOzuoDsEW7fazMqJz3k+pPt0CgArNa9kA36mBRm+IbBLiMehMjBuGCZyJy+Y9SYsUK1aS2X3dLQwYXmE5qwFZv1nk7nSCOY3h7CyCXOYqTvWy2cGQkwkjaedRvoKrdAInQnjz5QX1lYuIItGwAuSU5o0grCt+Z2Vri5XLa6Jlbkx8YPwXbxzbukgKByYSFSs7ImxG5fhCI59kmeVqbaJuSYQ0sBTEgH/p9LpUMT1nOe8HOAzM7wsu+rDLhYTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=google.com 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=ZRDGfa0DrIRtlG7gSQeu6lg7yAmGgt5i+xI/0gL3CME=; b=L6YikHc2uUISXgysIhBZ9E+C2j0rEpFJcq1M4sxN3sJtn5R8hyHqyZUCS2lPsaZBnuf+5NZ3PyPOY0AOPQ7K1fMxMj0uPaL0+KUhkoz3gsuZRjJ/4H4C0DJbKA30exB6IZXPLNhAZ6IBctqLtcbFhOcRh6ef68s3DaSZf0lqfuO0uGp7nGgRS1jIcn8K+FWUwrs1cl1+Q8SQDSIIOVifKqSQQ/KkHnjCkUvfYzrd05KhP1ZiZnRmS4C8tBGyD6QBYU/JUuAxnphuN6XQo0+UoVxUpcjzzB7OYQtE6J9x3c09MxottDWW5vpOA5sb4PQZ+julVNeAMSRrKar50WbkGg== Received: from CH2PR05CA0047.namprd05.prod.outlook.com (2603:10b6:610:38::24) by LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.19; Sun, 7 Sep 2025 09:40:51 +0000 Received: from CH2PEPF00000147.namprd02.prod.outlook.com (2603:10b6:610:38:cafe::ee) by CH2PR05CA0047.outlook.office365.com (2603:10b6:610:38::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.11 via Frontend Transport; Sun, 7 Sep 2025 09:40:52 +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 CH2PEPF00000147.mail.protection.outlook.com (10.167.244.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.14 via Frontend Transport; Sun, 7 Sep 2025 09:40:51 +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.14; Sun, 7 Sep 2025 02:40:48 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) 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.14; Sun, 7 Sep 2025 02:40:48 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Sun, 7 Sep 2025 02:40:44 -0700 From: Tariq Toukan To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "David S. Miller" CC: Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Mark Bloch , "Jonathan Corbet" , Jiri Pirko , , , , , Gal Pressman , Dragos Tatulea Subject: [PATCH net-next 1/2] net/mlx5e: Make PCIe congestion event thresholds configurable Date: Sun, 7 Sep 2025 12:39:35 +0300 Message-ID: <1757237976-531416-2-git-send-email-tariqt@nvidia.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1757237976-531416-1-git-send-email-tariqt@nvidia.com> References: <1757237976-531416-1-git-send-email-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@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: CH2PEPF00000147:EE_|LV2PR12MB5869:EE_ X-MS-Office365-Filtering-Correlation-Id: 6aa8caa5-96cd-4b59-aac2-08ddedf2a241 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ibsLXbo54XcwQPiv8x0omr3FvC9xHAdRQZEL7XvpOKyr3IOobNZSiYDTsMUA?= =?us-ascii?Q?4kiVAJZ3g3CUO0lOvYPKs1WhzgZ5ZvNUI/SLR5N4S6Xf+r1aCj9o+lvpyRT9?= =?us-ascii?Q?s1ULWkGsvQO6OYr4hCUH23Ere1YuQf7Joiu5S3459htGsEpN26aYhrhdTrps?= =?us-ascii?Q?1fmZcIJ5SlYsSToigHEHylc7w+QqTTFbATTiLobVJUXQOYzVXCONfCV9snK+?= =?us-ascii?Q?QNRgwgNrIErMMz+qwm9hsl8Nw/aFPmu5MoMj6zPBdTgVfMX7zWns/quZ9W4J?= =?us-ascii?Q?mp/zGI7AwxwPxVbX6Ari3sCLhRUdzXMe+uBNmDN25aNas0Fsnr+TzF9O9Htt?= =?us-ascii?Q?gHPodPlmVDl77C2ke0enLD5wd4BG4F+wlWfOBziBn5zL/T1n7751HmMVPgWf?= =?us-ascii?Q?JySZzDE91tKUZZkPVFONlNoHXZ4QlU57QLPFldd1ERti8KVROEGD9VWO2O41?= =?us-ascii?Q?YL/WqHVxCVRe7qan8gG8ICqbP7f9fE7UAu9RiNDuTsKl0+hFpZn9/IirZPvC?= =?us-ascii?Q?20JDmG9RV9siv8z3wBHOeJbrF9nmZj1yQyaIpapI1qB7IgYMQ50ma0vSvWA6?= =?us-ascii?Q?d10be5xwjmow6sWXldcxPTNDOoCCP7jPGWshcclppJ02PdrH6FtjIRgqAmcR?= =?us-ascii?Q?i4KBCYxwuk+RmvLqA4DzRso7kCSUKRMwqyyfo1oLIN0n6mhjn/ehCW9vA/8Z?= =?us-ascii?Q?F6H8XdY3g66Jw+oYunMmGWTnaUm2VF0J1l2GlhgGv2In/hgoerqyVzLymQVG?= =?us-ascii?Q?PrN/O9U3OFQvuJkFB51snR9TjWx/TGzDwVphFJV4tbvp8QyASN/nQirQoumf?= =?us-ascii?Q?5OCo/S207xzcf34WWTg3iSN0WNJJJkXa/OARFDnrF8EhQpwMZF7j6N+XdmYp?= =?us-ascii?Q?4P4Xf6rUEhsu5ogfp3LeXN+T16/kRri+BjCgnA6GEZ2ry+BCNSaAz+faN+EI?= =?us-ascii?Q?ROssntN5zGWS9lGXeRmzxYRh+EuT2pf8PPBBVpEyMA9OWtkVIvgLxALexTCp?= =?us-ascii?Q?cbVtdW0bMzXukjgvlc1b1exZ5legCbnajIXnpImziTHe8N4gH7mbzl+p8VFB?= =?us-ascii?Q?iVMR7ozaOypY4in/qlvSmARYYEedXkrf6LV3W9D6ILOHXF0fKo/YYyGlN3TB?= =?us-ascii?Q?m+jTF9k9OkcmU3RmN17v+Bq/Zarzsf3nAWvWkkP4ESwjI/FsK5uWRo/aGOPE?= =?us-ascii?Q?xOhysYNQoHll17r10p4HUs7x3oKZ2qQaXX/wGGJIzq6IW6EoXtGR5vzQy7xS?= =?us-ascii?Q?wUimcHPh3bhRmtsXp+FZZhbzc7wqDn4I+iRXZlUSbXI8fNHWKGCii5+Cdv/v?= =?us-ascii?Q?4mdUxKdUnN6+dTxCVNjo6mYZznA4VuCZXsngNe3QMAQRXBgyfT8T7EkWZf++?= =?us-ascii?Q?h8nenxhLxQ/0gUI2QjdxBxwyNgPri23JSg7/kUbLGwnOYQF+lOh6jGXW1AKr?= =?us-ascii?Q?ypHFgMwYP58FwVMQi478Hois2GBa+kHCIhFynCtLpEh/jyCUQ89fH6czUI8k?= =?us-ascii?Q?m2NP/nTSjABzQbf52SpI6YhrHUYh4zgf9LNs?= 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:(13230040)(376014)(7416014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2025 09:40:51.5301 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6aa8caa5-96cd-4b59-aac2-08ddedf2a241 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: CH2PEPF00000147.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5869 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dragos Tatulea Add devlink driverinit parameters for configuring the thresholds for PCIe congestion events. These parameters are registered only when the firmware supports this feature. Update the mlx5 devlink docs as well on these new params. Signed-off-by: Dragos Tatulea Signed-off-by: Tariq Toukan --- Documentation/networking/devlink/mlx5.rst | 52 +++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 106 ++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.h | 4 + .../mellanox/mlx5/core/en/pcie_cong_event.c | 72 ++++++++++-- 4 files changed, 226 insertions(+), 8 deletions(-) diff --git a/Documentation/networking/devlink/mlx5.rst b/Documentation/netw= orking/devlink/mlx5.rst index 7febe0aecd53..f51647536966 100644 --- a/Documentation/networking/devlink/mlx5.rst +++ b/Documentation/networking/devlink/mlx5.rst @@ -116,6 +116,58 @@ parameters. - u32 - driverinit - Control the size (in packets) of the hairpin queues. + * - ``pcie_cong_inbound_high`` + - u16 + - driverinit + - High threshold configuration for PCIe congestion events. The firmwa= re + will send an event once device side inbound PCIe traffic went + above the configured high threshold for a long enough period (at le= ast + 200ms). + + See pci_bw_inbound_high ethtool stat. + + Units are 0.01 %. Accepted values are in range [0, 10000]. + pcie_cong_inbound_low < pcie_cong_inbound_high. + Default value: 9000 (Corresponds to 90%). + * - ``pcie_cong_inbound_low`` + - u16 + - driverinit + - Low threshold configuration for PCIe congestion events. The firmware + will send an event once device side inbound PCIe traffic went + below the configured low threshold, only after having been previous= ly in + a congested state. + + See pci_bw_inbound_low ethtool stat. + + Units are 0.01 %. Accepted values are in range [0, 10000]. + pcie_cong_inbound_low < pcie_cong_inbound_high. + Default value: 7500. + * - ``pcie_cong_outbound_high`` + - u16 + - driverinit + - High threshold configuration for PCIe congestion events. The firmwa= re + will send an event once device side outbound PCIe traffic went + above the configured high threshold for a long enough period (at le= ast + 200ms). + + See pci_bw_outbound_high ethtool stat. + + Units are 0.01 %. Accepted values are in range [0, 10000]. + pcie_cong_outbound_low < pcie_cong_outbound_high. + Default value: 9000 (Corresponds to 90%). + * - ``pcie_cong_outbound_low`` + - u16 + - driverinit + - Low threshold configuration for PCIe congestion events. The firmware + will send an event once device side outbound PCIe traffic went + below the configured low threshold, only after having been previous= ly in + a congested state. + + See pci_bw_outbound_low ethtool stat. + + Units are 0.01 %. Accepted values are in range [0, 10000]. + pcie_cong_outbound_low < pcie_cong_outbound_high. + Default value: 7500. =20 The ``mlx5`` driver supports reloading via ``DEVLINK_CMD_RELOAD`` =20 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/devlink.c index 2c0e0c16ca90..fd1b4895f3ac 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -650,6 +650,105 @@ static void mlx5_devlink_eth_params_unregister(struct= devlink *devlink) ARRAY_SIZE(mlx5_devlink_eth_params)); } =20 +#define MLX5_PCIE_CONG_THRESH_MAX 10000 +#define MLX5_PCIE_CONG_THRESH_DEF_LOW 7500 +#define MLX5_PCIE_CONG_THRESH_DEF_HIGH 9000 + +static int +mlx5_devlink_pcie_cong_thresh_validate(struct devlink *devl, u32 id, + union devlink_param_value val, + struct netlink_ext_ack *extack) +{ + if (val.vu16 > MLX5_PCIE_CONG_THRESH_MAX) { + NL_SET_ERR_MSG_FMT_MOD(extack, "Value %u > max supported (%u)", + val.vu16, MLX5_PCIE_CONG_THRESH_MAX); + + return -EINVAL; + } + + switch (id) { + case MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_LOW: + case MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_HIGH: + case MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_LOW: + case MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_HIGH: + break; + default: + return -EOPNOTSUPP; + } + + return 0; +} + +static void mlx5_devlink_pcie_cong_init_values(struct devlink *devlink) +{ + union devlink_param_value value; + u32 id; + + value.vu16 =3D MLX5_PCIE_CONG_THRESH_DEF_LOW; + id =3D MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_LOW; + devl_param_driverinit_value_set(devlink, id, value); + + value.vu16 =3D MLX5_PCIE_CONG_THRESH_DEF_HIGH; + id =3D MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_HIGH; + devl_param_driverinit_value_set(devlink, id, value); + + value.vu16 =3D MLX5_PCIE_CONG_THRESH_DEF_LOW; + id =3D MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_LOW; + devl_param_driverinit_value_set(devlink, id, value); + + value.vu16 =3D MLX5_PCIE_CONG_THRESH_DEF_HIGH; + id =3D MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_HIGH; + devl_param_driverinit_value_set(devlink, id, value); +} + +static const struct devlink_param mlx5_devlink_pcie_cong_params[] =3D { + DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_LOW, + "pcie_cong_inbound_low", DEVLINK_PARAM_TYPE_U16, + BIT(DEVLINK_PARAM_CMODE_DRIVERINIT), NULL, NULL, + mlx5_devlink_pcie_cong_thresh_validate), + DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_HIGH, + "pcie_cong_inbound_high", DEVLINK_PARAM_TYPE_U16, + BIT(DEVLINK_PARAM_CMODE_DRIVERINIT), NULL, NULL, + mlx5_devlink_pcie_cong_thresh_validate), + DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_LOW, + "pcie_cong_outbound_low", DEVLINK_PARAM_TYPE_U16, + BIT(DEVLINK_PARAM_CMODE_DRIVERINIT), NULL, NULL, + mlx5_devlink_pcie_cong_thresh_validate), + DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_HIGH, + "pcie_cong_outbound_high", DEVLINK_PARAM_TYPE_U16, + BIT(DEVLINK_PARAM_CMODE_DRIVERINIT), NULL, NULL, + mlx5_devlink_pcie_cong_thresh_validate), +}; + +static int mlx5_devlink_pcie_cong_params_register(struct devlink *devlink) +{ + struct mlx5_core_dev *dev =3D devlink_priv(devlink); + int err; + + if (!mlx5_pcie_cong_event_supported(dev)) + return 0; + + err =3D devl_params_register(devlink, mlx5_devlink_pcie_cong_params, + ARRAY_SIZE(mlx5_devlink_pcie_cong_params)); + if (err) + return err; + + mlx5_devlink_pcie_cong_init_values(devlink); + + return 0; +} + +static void mlx5_devlink_pcie_cong_params_unregister(struct devlink *devli= nk) +{ + struct mlx5_core_dev *dev =3D devlink_priv(devlink); + + if (!mlx5_pcie_cong_event_supported(dev)) + return; + + devl_params_unregister(devlink, mlx5_devlink_pcie_cong_params, + ARRAY_SIZE(mlx5_devlink_pcie_cong_params)); +} + static int mlx5_devlink_enable_rdma_validate(struct devlink *devlink, u32 = id, union devlink_param_value val, struct netlink_ext_ack *extack) @@ -895,8 +994,14 @@ int mlx5_devlink_params_register(struct devlink *devli= nk) if (err) goto max_uc_list_err; =20 + err =3D mlx5_devlink_pcie_cong_params_register(devlink); + if (err) + goto pcie_cong_err; + return 0; =20 +pcie_cong_err: + mlx5_devlink_max_uc_list_params_unregister(devlink); max_uc_list_err: mlx5_devlink_auxdev_params_unregister(devlink); auxdev_reg_err: @@ -907,6 +1012,7 @@ int mlx5_devlink_params_register(struct devlink *devli= nk) =20 void mlx5_devlink_params_unregister(struct devlink *devlink) { + mlx5_devlink_pcie_cong_params_unregister(devlink); mlx5_devlink_max_uc_list_params_unregister(devlink); mlx5_devlink_auxdev_params_unregister(devlink); devl_params_unregister(devlink, mlx5_devlink_params, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h b/drivers/ne= t/ethernet/mellanox/mlx5/core/devlink.h index 961f75da6227..bf6191d49616 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.h @@ -22,6 +22,10 @@ enum mlx5_devlink_param_id { MLX5_DEVLINK_PARAM_ID_ESW_MULTIPORT, MLX5_DEVLINK_PARAM_ID_HAIRPIN_NUM_QUEUES, MLX5_DEVLINK_PARAM_ID_HAIRPIN_QUEUE_SIZE, + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_LOW, + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_HIGH, + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_LOW, + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_HIGH, }; =20 struct mlx5_trap_ctx { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c b= /drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c index 0ed017569a19..0cf142f71c09 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB // Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. =20 +#include "../devlink.h" #include "en.h" #include "pcie_cong_event.h" =20 @@ -41,13 +42,6 @@ struct mlx5e_pcie_cong_event { struct mlx5e_pcie_cong_stats stats; }; =20 -/* In units of 0.01 % */ -static const struct mlx5e_pcie_cong_thresh default_thresh_config =3D { - .inbound_high =3D 9000, - .inbound_low =3D 7500, - .outbound_high =3D 9000, - .outbound_low =3D 7500, -}; =20 static const struct counter_desc mlx5e_pcie_cong_stats_desc[] =3D { { MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats, @@ -249,8 +243,60 @@ static int mlx5e_pcie_cong_event_handler(struct notifi= er_block *nb, return NOTIFY_OK; } =20 +static int +mlx5e_pcie_cong_get_thresh_config(struct mlx5_core_dev *dev, + struct mlx5e_pcie_cong_thresh *config) +{ + u32 ids[4] =3D { + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_LOW, + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_HIGH, + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_LOW, + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_HIGH, + }; + struct devlink *devlink =3D priv_to_devlink(dev); + union devlink_param_value val[4]; + + for (int i =3D 0; i < 4; i++) { + u32 id =3D ids[i]; + int err; + + err =3D devl_param_driverinit_value_get(devlink, id, &val[i]); + if (err) + return err; + } + + config->inbound_low =3D val[0].vu16; + config->inbound_high =3D val[1].vu16; + config->outbound_low =3D val[2].vu16; + config->outbound_high =3D val[3].vu16; + + return 0; +} + +static int +mlx5e_thresh_config_validate(struct mlx5_core_dev *mdev, + const struct mlx5e_pcie_cong_thresh *config) +{ + int err =3D 0; + + if (config->inbound_low >=3D config->inbound_high) { + err =3D -EINVAL; + mlx5_core_err(mdev, "PCIe inbound congestion threshold configuration inv= alid: low (%u) >=3D high (%u).\n", + config->inbound_low, config->inbound_high); + } + + if (config->outbound_low >=3D config->outbound_high) { + err =3D -EINVAL; + mlx5_core_err(mdev, "PCIe outbound congestion threshold configuration in= valid: low (%u) >=3D high (%u).\n", + config->outbound_low, config->outbound_high); + } + + return err; +} + int mlx5e_pcie_cong_event_init(struct mlx5e_priv *priv) { + struct mlx5e_pcie_cong_thresh thresh_config =3D {}; struct mlx5e_pcie_cong_event *cong_event; struct mlx5_core_dev *mdev =3D priv->mdev; int err; @@ -258,6 +304,16 @@ int mlx5e_pcie_cong_event_init(struct mlx5e_priv *priv) if (!mlx5_pcie_cong_event_supported(mdev)) return 0; =20 + err =3D mlx5e_pcie_cong_get_thresh_config(mdev, &thresh_config); + if (WARN_ON(err)) + return err; + + err =3D mlx5e_thresh_config_validate(mdev, &thresh_config); + if (err) { + mlx5_core_err(mdev, "PCIe congestion event feature disabled\n"); + return err; + } + cong_event =3D kvzalloc_node(sizeof(*cong_event), GFP_KERNEL, mdev->priv.numa_node); if (!cong_event) @@ -269,7 +325,7 @@ int mlx5e_pcie_cong_event_init(struct mlx5e_priv *priv) =20 cong_event->priv =3D priv; =20 - err =3D mlx5_cmd_pcie_cong_event_set(mdev, &default_thresh_config, + err =3D mlx5_cmd_pcie_cong_event_set(mdev, &thresh_config, &cong_event->obj_id); if (err) { mlx5_core_warn(mdev, "Error creating a PCIe congestion event object\n"); --=20 2.31.1 From nobody Tue Sep 9 05:51:27 2025 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2086.outbound.protection.outlook.com [40.107.244.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 E5DA21EDA0F; Sun, 7 Sep 2025 09:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757238068; cv=fail; b=FqLFwx1IffNJhpXkyExhabh7NdtA/qwe3JHzPH8cG1+UP3Tw18aQhP8N48xgUFu+orjGafMXQJmntPC65RBLtlu3YfBUzmv+VI+EzGtbiavBXEF6nG+z5PA4l/hev3uCe2W0usilyLQJRykaKwHwPp/BW3w4tl5Od/ft9CKetqE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757238068; c=relaxed/simple; bh=DldPVdnY5SFmFAs54B+Ihdd8mCsRPpZnNBErY/Hixa4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QfukpKA6WEg4tqK24vpSBJICAS57B1kHFnmTHrGdvGPd2+a/w/kpeLT1qAvUC6CAUo36dVMvjetW6p0B4qrX2VCQqzJrXWBbuTTeXMT3gvaS+GSh4nCeggTFVRoZr7gFhpTQltt04UDyqV9YjnWNbCbMTuqquR4vO6JCNb81Eik= 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=BM8/BsTu; arc=fail smtp.client-ip=40.107.244.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="BM8/BsTu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ln3C+QvUuf40UML0EWBKYVadkpNSfBODyVqj5fchg/G/EHC+CKkjSO1yQZT9iX9rNyDv9TPx2PQpWlfW6dsR2hPhCnfi2tAxhJ2lhURZccBpny46PcUhkI8eHazSM4ivhAYDrBHC0wXVyNVHo7w43fzYd1J0O/WlC9Rb6ymfoh8+I8VNbbxL4uUU3BCErRf9IWmvoecFW/Xd3Z3iWB5b2heJ1Hnf4XwK1wvsn5jy5mihuNCM/rYyf/p9icTp+K+YujWxSLX4fryTQN8tnwx47abNZq1ZVOsgyk1UfF69IZJjiQW82jjWjeyexH1/1zhGAntxTNCbHH1yJxYWrMkvwg== 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=uajMb74mAMwI1zIC4c8YlkWVlMr2xrwKOLela5paoYg=; b=KJU+bafh0srvcZMH1JpcOT5zoUJ57t55Cc9qG8cDfZdQo6unuUGtu+xiqGiqow+q9t9g71A/lMrnbglw0T/6pS1Yf4UlZkXNP/43kH1DjmFbcQ7stqTTD1hAsQSnNnsRWf7wR0eNZkP2etHxZJSpiKIvV3zh4uBYqL5Tl1N+/njg5vdCY/88wz2KfxocRFcigHc71xQZnI2c1tgRaVMKt2dsRyg0CXfJfBmSbClsC4uWS0HeqI1tRfnnx9un8rjWQ8Qiz1FULigRu56oJ1h9FsBdcM28j3N3lVh3jXOIRAiD+CBEhdpjzxzwOBLHuh6tr5O9ZFFrCqJHrk2pznPICw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=google.com 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=uajMb74mAMwI1zIC4c8YlkWVlMr2xrwKOLela5paoYg=; b=BM8/BsTuSHI8CCOl85k2VJCs+0aPYAPEC/BFQcF/nNnK8HF3GGp3x+Np7CHJTlCaULEfUcWw3MmvPWePA3P2M1y7laJAZ7Vh7klu1TOj6TzXfI3+UYYCresQzFDpt0ABNdBOdhWM0n/bgmKdG6solwy5zPWgk1RzGPeuf+s9FIMj2ov5ba2U89kGEzS47DQ4LBbSqIgqBSU/K8iuXBXNyvzAfFCJ/9Gi3S4Awnlu8QW0mi6Aq/ljSRQGUA3rizP77DSrUNJUabhSzCansja3Tt7o4Oc4GO7G+dX+epiQa70RJPyB+MvD7PwKwGGSRLO/W5L0QBYr+HB8aJp2pU1Zgw== Received: from CH5PR05CA0008.namprd05.prod.outlook.com (2603:10b6:610:1f0::17) by SA1PR12MB7224.namprd12.prod.outlook.com (2603:10b6:806:2bb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.19; Sun, 7 Sep 2025 09:41:01 +0000 Received: from CH2PEPF00000145.namprd02.prod.outlook.com (2603:10b6:610:1f0:cafe::54) by CH5PR05CA0008.outlook.office365.com (2603:10b6:610:1f0::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Sun, 7 Sep 2025 09:41:00 +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 CH2PEPF00000145.mail.protection.outlook.com (10.167.244.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9052.8 via Frontend Transport; Sun, 7 Sep 2025 09:41:00 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) 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.14; Sun, 7 Sep 2025 02:40:53 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Sun, 7 Sep 2025 02:40:53 -0700 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Sun, 7 Sep 2025 02:40:48 -0700 From: Tariq Toukan To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "David S. Miller" CC: Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Mark Bloch , "Jonathan Corbet" , Jiri Pirko , , , , , Gal Pressman , Dragos Tatulea Subject: [PATCH net-next 2/2] net/mlx5e: Add stale counter for PCIe congestion events Date: Sun, 7 Sep 2025 12:39:36 +0300 Message-ID: <1757237976-531416-3-git-send-email-tariqt@nvidia.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1757237976-531416-1-git-send-email-tariqt@nvidia.com> References: <1757237976-531416-1-git-send-email-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@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: CH2PEPF00000145:EE_|SA1PR12MB7224:EE_ X-MS-Office365-Filtering-Correlation-Id: 590f5178-8347-44a1-0916-08ddedf2a7ca 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?Qba3o5DYH/HguBkE44m4tvlWh3ushsHIT3EUlYCMVjnUPGZo28y7WGuorKZm?= =?us-ascii?Q?Wwd2ujA631Cvdq5D7RjpXF7atjpTjiO1fvsLmkyfjqft4mbT/ZUbavuT3ZpV?= =?us-ascii?Q?zZgxdQDomsP4R4BeDdweo2aYIkGqp0aV/hd9wiuQgB0FN7KbzWdgq1MnmF3B?= =?us-ascii?Q?0Qb52LkDleB8XUoDhqYUBvt+jncfJoFoOCZC/GoRnQgY6rr5pn82LNWsnwTC?= =?us-ascii?Q?hityw4V0SSZOlYrHrcrW9goTpvSeLsgxmRxnVBe6CuATrgs2xf39xldKwSQ8?= =?us-ascii?Q?kH3SGXxaTYg5EL1rP4H1PVYZfErF/0QgY7GVMtf8yZgtgtXnouSrJG1YrNI8?= =?us-ascii?Q?EOYtIGjMMtR9MMY/ZHRr/MKyWjKgs4Ids9+/5hnskjl+6hBV71YutAZGsA6K?= =?us-ascii?Q?VhQpmIoPrtSEVE3uVAlMWsRdABEABMrIZxcjcMxmhRQmpNGfVoeHB/rq+cEp?= =?us-ascii?Q?JNqDLCgvdtrMM2j5L4F9TNpQTHh69h4g4Elw3pWiTwKsrEdlLXqtDfFV8CkC?= =?us-ascii?Q?zS/9LYR5MOZj3FcWBuZy4pHxTTLIpIFuJqK0Dp1cjlTXtaTDp7hfkY8mW60t?= =?us-ascii?Q?/4k8KPBq+MndAqMu8YqxUzYvl5/f60O5jX+FwPV3DZtLSnvvN4AkA6avJpPD?= =?us-ascii?Q?IAd4F9vEjVm6+Y82C037/DaQoY7RUgldfYyB6b3h2VJF41l5IJXVQ9DLDsmv?= =?us-ascii?Q?VTYC9tq3LF44g/QTFNRN0mR/Yi8cvZjej7KaB2V41IyaYsjmplp4fWzbYCOA?= =?us-ascii?Q?0/nXKQkrr4DMxhMWqb08Yl4+csdGVhsjRm4dvGC544Fn3mvH9Zgc0FkDJE++?= =?us-ascii?Q?HLeHFwUL8CbXuXwweXDH5JPPcfeMoNYj5SkaRyyciqXRSX7ZnfVgtn/Dhf1X?= =?us-ascii?Q?M4thBN2ZDQqdGz0PpIkux08FpeJ01/HRPRC4BtQupO7XA9LKJcPOGayALpjx?= =?us-ascii?Q?Qd6x1zIRT7B3HsTB1RSWozmK0yMYbCq0S2t+9bcEkfRIUzKcEsGKEacfRI+o?= =?us-ascii?Q?GZsktMpQfGz3HcfjjVVgSIvR74LWpHbjlDIxLQaiF+fDELtKOxomKSsuwHlJ?= =?us-ascii?Q?Sa86zWnweLqWVAs/lx67rQhiq9UE3DrJ2/iMhpH/W3auC8/0VK4wCKh+yB9T?= =?us-ascii?Q?paLEvzR3gfYHCNnvlcMFRpKH3AYpJCqCMM2LOFYV7qO4V4vUZXAZM4feWiaB?= =?us-ascii?Q?eZNz+T275U+G1lW3FJWFmwv9k96cR9iAwY19GM7d8rKwW5wpTr2pRpjlQ/FN?= =?us-ascii?Q?y0xsCqP9+SF55w4fN5JiIjuPS/h49OoDIdWvT3gR9f1kdyh78EQA1iWHrht/?= =?us-ascii?Q?eRta5KbecGPKmFTAJZ4yIZxOEj04u/g+yqBz2etchQaoCcz8KDTX5UQD8mIL?= =?us-ascii?Q?viWN6uLV5f8r2zHuBY/QyBCah+pKBS2ifUQrWwMxdjAw/bwN/tJ3lZM/AzYm?= =?us-ascii?Q?RdXU8Hdq4X7hjK5Hhml0/vnDGd352FrIMFNNaUxCPrVbpq5lAZJyJ22qg2cr?= =?us-ascii?Q?Tevo6iYW7dtCjrZJy6XWQjrOt/YtAIPuFpJn?= 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:(13230040)(36860700013)(1800799024)(82310400026)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2025 09:41:00.7906 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 590f5178-8347-44a1-0916-08ddedf2a7ca 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: CH2PEPF00000145.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7224 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dragos Tatulea This ethtool counter is meant to help with observing how many times the congestion event was triggered but on query there was no state change. This would help to indicate when a work item was scheduled to run too late and in the meantime the congestion state changed back to previous state. While at it, do a driveby typo fix in documentation for pci_bw_inbound_high. Signed-off-by: Dragos Tatulea Signed-off-by: Tariq Toukan --- .../device_drivers/ethernet/mellanox/mlx5/counters.rst | 7 ++++++- .../net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/networking/device_drivers/ethernet/mellanox/mlx5= /counters.rst b/Documentation/networking/device_drivers/ethernet/mellanox/m= lx5/counters.rst index 754c81436408..cc498895f92e 100644 --- a/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counte= rs.rst +++ b/Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counte= rs.rst @@ -1348,7 +1348,7 @@ Device Counters is in a congested state. If pci_bw_inbound_high =3D=3D pci_bw_inbound_low then the device is= not congested. If pci_bw_inbound_high > pci_bw_inbound_low then the device is cong= ested. - - Tnformative + - Informative =20 * - `pci_bw_inbound_low` - The number of times the device crossed the low inbound PCIe bandwid= th @@ -1373,3 +1373,8 @@ Device Counters If pci_bw_outbound_high =3D=3D pci_bw_outbound_low then the device = is not congested. If pci_bw_outbound_high > pci_bw_outbound_low then the device is co= ngested. - Informative + + * - `pci_bw_stale_event` + - The number of times the device fired a PCIe congestion event but on= query + there was no change in state. + - Informative diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c b= /drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c index 0cf142f71c09..2eb666a46f39 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c @@ -24,6 +24,7 @@ struct mlx5e_pcie_cong_stats { u32 pci_bw_inbound_low; u32 pci_bw_outbound_high; u32 pci_bw_outbound_low; + u32 pci_bw_stale_event; }; =20 struct mlx5e_pcie_cong_event { @@ -52,6 +53,8 @@ static const struct counter_desc mlx5e_pcie_cong_stats_de= sc[] =3D { pci_bw_outbound_high) }, { MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats, pci_bw_outbound_low) }, + { MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats, + pci_bw_stale_event) }, }; =20 #define NUM_PCIE_CONG_COUNTERS ARRAY_SIZE(mlx5e_pcie_cong_stats_desc) @@ -212,8 +215,10 @@ static void mlx5e_pcie_cong_event_work(struct work_str= uct *work) } =20 changes =3D cong_event->state ^ new_cong_state; - if (!changes) + if (!changes) { + cong_event->stats.pci_bw_stale_event++; return; + } =20 cong_event->state =3D new_cong_state; =20 --=20 2.31.1