From nobody Sat Feb 7 17:09:53 2026 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013062.outbound.protection.outlook.com [40.93.196.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 3F05D2192EE; Tue, 3 Feb 2026 07:11:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.196.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102705; cv=fail; b=lrQZfqZVvFKDYaUFYznNqfgrTQSzoaMbRQfEC8S/YAf3L6O/gC7uWMsE/9InxLRE+cTh/7xBzxmGv29y0lpPrpaGsmS3pLaCm3hNlkZMb/j8sdwsHDaykx7cMCzrqOazdEkMq+p1VY1LEhLOQKfFWXrBZ0wsfxUtNJUyRnR1UAA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102705; c=relaxed/simple; bh=7zrA6/0Ay0CZ3tMPEfbJYO1ollFqHNQPwVhQFTk4Xj4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EUyl6jFTqy/W7ZScNGWa7j5mU0ge4jNguETemcoJHQlktIDqvdsTHWFbvAqZ/jE+DdF9VU/D8bgTTMYHt2oeB/Ae4b4i4GRjCmmTL33paNCgHItQ12+7MxKQ61ha9pXSAXzZWFZ8WyoAS1LbEBnpMQl18puDLlF3k/MMyNIJhoM= 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=aTaAiM9a; arc=fail smtp.client-ip=40.93.196.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="aTaAiM9a" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Tb9doYt2q6FlrIHlxTgwhFPrt0VkGemHmAijkOy14ns3ai754t+xiH7VA30vi/crVBJu/X49nQERk+ir20QjaQpUSpFLsJPCaYgru4dDUZGsvCqGO5wQ2lLgU+xXhD+vuNtnM5JZclJnEL0kD8omWEFrfughfvxlkddyGb2gvCBweMcLKkvz0dIiJTIlq5oVYs6Vtu7fLoP7nHPhdxkt7s16nYK1Vfrq1LeVN03r+6smnwuGIwbVqKYJ8BlXnGMaJYbMViFj+ef9EsU+ew1j71xRAIl8anUNPcOcy5zrpxpsEqM5A7826W1mK1foyPqacC1AEszixDMPu8gwXIDqJA== 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=WvUxnC66vz/5hqJQ0TOUryNBGbuojbM8qDnaVuYepv0=; b=s0jHj9dkjjrtYuZrbk8tYPhC0x95HdG2I7PHUqB6/F0tb36WUU+Ku31a2FKWaTF5tqVxsGQz/EQNFqtS+ywx6oYBdTgcqhZNdCmgzAX9JMZ89J3swc9NH3M5qFRkP1LS/a+DrX6LJChVrwL758YQNYN+PLIK/kXfzLkIhOrvDPKYtkuGJr8gdEYSz4PAnf6J2O2cHFeR7n9dW/UqjU4vcdw9d0fvROF6jZsVpxmyjGeo7tb7Yh8cek51gTJirX1GwMljRDOgT3fRq8w+9QCyATSuE7WihAe5cCWICwKuCaiub2XWEdHl9HatTNQ1xkgPVHJs+HS9xOmsSAEl24RsGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=WvUxnC66vz/5hqJQ0TOUryNBGbuojbM8qDnaVuYepv0=; b=aTaAiM9acc96Mj8kN6GyoH6BQUIn9y/IqXVb5ozK2dCv3kd6u0MkTiRzYaeZ27m5sluLLeVhpRXEs/BTUp2D9YspMWttY46Mmi7eUEOU0E6m4vQ/EFUwQaQlE+r36phi5mQkMv620RUJH0NlRXdTxupS3xCAFa0vhYr6tcpWR+r8KDmDG/oVQ2kh2+gCTGsWTDgA6fWijO1oencjFzxxoyixocelABJ8MzY0XxlLRJABRnxs3rPw7NYw/bXZDGUJNW4MKrwAVoDHjwBi1jks1I/NIqvUSmp96JxGZ6zNBcW4DJMdcR2C5zHMScZKD1x420XEYUMiYZuOxagFydRcGA== Received: from DM6PR01CA0012.prod.exchangelabs.com (2603:10b6:5:296::17) by SJ2PR12MB9243.namprd12.prod.outlook.com (2603:10b6:a03:578::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.16; Tue, 3 Feb 2026 07:11:31 +0000 Received: from DS2PEPF0000343F.namprd02.prod.outlook.com (2603:10b6:5:296:cafe::7) by DM6PR01CA0012.outlook.office365.com (2603:10b6:5:296::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.16 via Frontend Transport; Tue, 3 Feb 2026 07:11:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS2PEPF0000343F.mail.protection.outlook.com (10.167.18.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.10 via Frontend Transport; Tue, 3 Feb 2026 07:11:31 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:15 -0800 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:14 -0800 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.2562.20 via Frontend Transport; Mon, 2 Feb 2026 23:11:09 -0800 From: Tariq Toukan To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "David S. Miller" CC: Donald Hunter , Jiri Pirko , Jonathan Corbet , Saeed Mahameed , "Leon Romanovsky" , Tariq Toukan , Mark Bloch , Shuah Khan , , , , , , Gal Pressman , Moshe Shemesh , Shay Drori , Jiri Pirko , Or Har-Toov Subject: [PATCH net-next 1/5] devlink: Add port-level resource infrastructure Date: Tue, 3 Feb 2026 09:10:29 +0200 Message-ID: <20260203071033.1709445-2-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20260203071033.1709445-1-tariqt@nvidia.com> References: <20260203071033.1709445-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343F:EE_|SJ2PR12MB9243:EE_ X-MS-Office365-Filtering-Correlation-Id: 605cdc84-b375-4dcc-d60c-08de62f3752f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?xvIusCj95u/Bc4m14xS+taqWx/kNR1T0yV5yeFI3s8lY+n3DjtJUJb8g5ZD6?= =?us-ascii?Q?beFybwnYjsELiJCNCcgeeWoVMgpxUMPYdB/SjlHCqPhtDnOh9o4lsgc2zc9o?= =?us-ascii?Q?xmNlLuwBScX3tYOHm2AyusOtmEi/XR+6e0O/5SYSJ0vxkbcAJCKg7bUXuNCe?= =?us-ascii?Q?bBiMId/o5ERgN4eYwEtahHdiFjVunen1L6uGe4cH04D3bcjo2YdGG/+DyD6a?= =?us-ascii?Q?jc6lGLqapTYkglg1DiUaWlqix3qhnMI7hOMidwgH/tUwdjwaBUpa5t9ZO9fM?= =?us-ascii?Q?hNn46Q+55/XzOSxYTsCTGpVCZVcD+vkGbkUx23xaVi1wLWqEkrKWKT0vOy8i?= =?us-ascii?Q?md8G5YhzqJuANDaHgNakXwO6azEifvcthI7785rbbNpUQFlHfipzoqxviY8q?= =?us-ascii?Q?gyGoqCST63VNbYqAx00hAyWE+cOBbB+YL7SZTnQQ3PXK2ta32bhtCIpmdWK9?= =?us-ascii?Q?ME2/zXVNwWqtaPVbLcrnTnAxRrBOPUzxAjZR04/39lzMSS+PWK2v8SPJ0ZMr?= =?us-ascii?Q?tMlDnsxjTFgMLGwh+KLw2p8wg9BUcBFNQtQTaxnBqATFSfFxon+S+RBvDNjF?= =?us-ascii?Q?sVePIG3FK/dsjYQZuG9OxMIGDcIzoXigpE7pl78I5+nTq+WGFik2357GGNoj?= =?us-ascii?Q?zYfMMnNjpqYN0R3+d5QU4SLm1KRspDUF3i8tgkf0LEMSgqNTyYKTkDieDTYs?= =?us-ascii?Q?XENmW7NePbnqObJtAi9QtkO+HYLquaTXWiDo47XWXxNWTKI6b5aASt86xeS8?= =?us-ascii?Q?JjPAZvgLKNDlZWmcKctEI1+1LHktDUVr87kaIAm0cH4fXq6jOtUXtXblqA6E?= =?us-ascii?Q?+zer/3hef9Tiaos9a2TtjgGW+HjravicxiNOsMxXWOz4Mmp9u4Hz34CToM8x?= =?us-ascii?Q?V1C4hkXxCcogS+BISBTDql7euYENh5pksQiuCLORUEV22WP9Wflzis+TA6ie?= =?us-ascii?Q?mlijuLAROIQUAfkPgVgPZQHls9yO7Y5CnRKW/tO7+IQQTG8ossh4USL1fMAf?= =?us-ascii?Q?s/t/IjoPRs9fUhh2nWYNfcabHTgE9/NDhrsP3roHhYWCwMv4e9IAPVxiC8Gq?= =?us-ascii?Q?wOcN9dZNa+vNXihEqMSsTYNGd1XY/bEB4PWf29LI3lmOjLyXCZgcSD/6jJu7?= =?us-ascii?Q?QY17vuyLI4pgAfvKjICUG2wEyHcLqGBcvvQSMKwKusPq0VGCGYReGTfYnpsR?= =?us-ascii?Q?Tvwl3J9CGguwBxjRXjZWmD889hK5thht/Zn27EfLpeYA1YaxPvzsGT9L0R94?= =?us-ascii?Q?UsamULMkZ42iHRfh9E7kDEy20ei3Ls2KJHHiRDSOqzPzj2PkpirS9GNdnDIy?= =?us-ascii?Q?rDT4VmDsIoBrIRLnvzT8uf5e8i/0OOWOHMv/QcsrSFe2UufOgr12ZSzuTl2i?= =?us-ascii?Q?gLjlw2dVwaCRK8gse+C4/i5IGPQ/o96ZZhLxe8yb4vNHbwA+/ySKhtKgLxgh?= =?us-ascii?Q?Ox50F/oQyOcabC/98d2egQZsX6XOn/6QFOUsCEc+C7vuS09PWsRcaTkU72+a?= =?us-ascii?Q?/acXx7MjXTp6h+qrZuDmMvdB94ujRgrFyB0+Q2HHNDhz3V1CHGYSwAVZFyOe?= =?us-ascii?Q?CAdOUvQM+JZPMVCRzmaeHuTYW4rfSj8L0YjzPSvWv8dFwG7/JJu6QJ5tcWTb?= =?us-ascii?Q?xNDorWCf6IUSTTTBW2WycwNoIFtVWNLYcn8zUcboCzeFuJZM0R9v4XwhUVQW?= =?us-ascii?Q?mdkcmA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 481BhEc6qaRd32cMex5jZgtJlLK+LGfPcLKbDrdqckErqdqeQ4Q4aQmVzVW5XpTt9nxLncr36RE4TUSqpNel7NE6b0A9/l12/Sv86rKWHDgQfDeksJBK0JYbBCvS+AU2gS7+ySyKdPKTSu3K2SozGl/lvQXymlhyXQMqRFTGtcKZ0faubYBbmCgYPI5Vhgi2TiLk8phwkk1/neBggruc0lL5dEJTGRMVtu82eS0u1iAk2HYX+Uoutxii5P+8XW3wt4s0RawQzm4L1VBngI3zV6Nb7AfzCm4yPRPbuVxyrSRc2CBsTG/e4lFc8lLd4qMorfdoNh86VHIp9YnquviyHVHDGW+0aw+N3h3udtzs2apf6sAF4A7rMW1rYZe3rFLNcN1ySt+dJWc2/Z6GnKpmXT+/sN6A2/oRlIBHSweiNPPEIc/JdZj83YUv8fwFi/l9 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2026 07:11:31.4246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 605cdc84-b375-4dcc-d60c-08de62f3752f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF0000343F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9243 Content-Type: text/plain; charset="utf-8" From: Or Har-Toov The current devlink resource infrastructure only supports device-level resources. Some hardware resources are associated with specific ports rather than the entire device, and today we have no way to show resource per-port. Add support for registering and querying resources at the port level, allowing drivers to expose per-port resource limits and usage. Example output: $ devlink port resource show pci/0000:03:00.0/196608: name max_SFs size 20 unit entry pci/0000:03:00.1/262144: name max_SFs size 20 unit entry $ devlink port resource show pci/0000:03:00.0/196608 pci/0000:03:00.0/196608: name max_SFs size 20 unit entry Signed-off-by: Or Har-Toov Reviewed-by: Shay Drori Reviewed-by: Moshe Shemesh Signed-off-by: Tariq Toukan --- Documentation/netlink/specs/devlink.yaml | 23 ++ include/net/devlink.h | 8 + include/uapi/linux/devlink.h | 2 + net/devlink/netlink.c | 2 +- net/devlink/netlink_gen.c | 32 ++- net/devlink/netlink_gen.h | 6 +- net/devlink/port.c | 3 + net/devlink/resource.c | 282 ++++++++++++++++++----- 8 files changed, 301 insertions(+), 57 deletions(-) diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netli= nk/specs/devlink.yaml index 837112da6738..0290db1b8393 100644 --- a/Documentation/netlink/specs/devlink.yaml +++ b/Documentation/netlink/specs/devlink.yaml @@ -2336,3 +2336,26 @@ operations: - bus-name - dev-name - port-index + + - + name: port-resource-get + doc: Get port resources. + attribute-set: devlink + dont-validate: [strict] + do: + pre: devlink-nl-pre-doit-port + post: devlink-nl-post-doit + request: + value: 85 + attributes: *port-id-attrs + reply: &port-resource-get-reply + value: 85 + attributes: + - bus-name + - dev-name + - port-index + - resource-list + dump: + request: + attributes: *dev-id-attrs + reply: *port-resource-get-reply diff --git a/include/net/devlink.h b/include/net/devlink.h index cb839e0435a1..40335ecc3343 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -129,6 +129,7 @@ struct devlink_rate { struct devlink_port { struct list_head list; struct list_head region_list; + struct list_head resource_list; struct devlink *devlink; const struct devlink_port_ops *ops; unsigned int index; @@ -1881,6 +1882,13 @@ void devlink_resources_unregister(struct devlink *de= vlink); int devl_resource_size_get(struct devlink *devlink, u64 resource_id, u64 *p_resource_size); +int +devl_port_resource_register(struct devlink_port *devlink_port, + const char *resource_name, + u64 resource_size, u64 resource_id, + u64 parent_resource_id, + const struct devlink_resource_size_params *params); +void devl_port_resources_unregister(struct devlink_port *devlink_port); int devl_dpipe_table_resource_set(struct devlink *devlink, const char *table_name, u64 resource_id, u64 resource_units); diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index e7d6b6d13470..74a541013af6 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -141,6 +141,8 @@ enum devlink_command { =20 DEVLINK_CMD_NOTIFY_FILTER_SET, =20 + DEVLINK_CMD_PORT_RESOURCE_GET, /* can dump */ + /* add new commands above here */ __DEVLINK_CMD_MAX, DEVLINK_CMD_MAX =3D __DEVLINK_CMD_MAX - 1 diff --git a/net/devlink/netlink.c b/net/devlink/netlink.c index 593605c1b1ef..c78c31779622 100644 --- a/net/devlink/netlink.c +++ b/net/devlink/netlink.c @@ -367,7 +367,7 @@ struct genl_family devlink_nl_family __ro_after_init = =3D { .module =3D THIS_MODULE, .split_ops =3D devlink_nl_ops, .n_split_ops =3D ARRAY_SIZE(devlink_nl_ops), - .resv_start_op =3D DEVLINK_CMD_SELFTESTS_RUN + 1, + .resv_start_op =3D DEVLINK_CMD_PORT_RESOURCE_GET + 1, .mcgrps =3D devlink_nl_mcgrps, .n_mcgrps =3D ARRAY_SIZE(devlink_nl_mcgrps), .sock_priv_size =3D sizeof(struct devlink_nl_sock_priv), diff --git a/net/devlink/netlink_gen.c b/net/devlink/netlink_gen.c index f4c61c2b4f22..692d7862183a 100644 --- a/net/devlink/netlink_gen.c +++ b/net/devlink/netlink_gen.c @@ -604,8 +604,21 @@ static const struct nla_policy devlink_notify_filter_s= et_nl_policy[DEVLINK_ATTR_ [DEVLINK_ATTR_PORT_INDEX] =3D { .type =3D NLA_U32, }, }; =20 +/* DEVLINK_CMD_PORT_RESOURCE_GET - do */ +static const struct nla_policy devlink_port_resource_get_do_nl_policy[DEVL= INK_ATTR_PORT_INDEX + 1] =3D { + [DEVLINK_ATTR_BUS_NAME] =3D { .type =3D NLA_NUL_STRING, }, + [DEVLINK_ATTR_DEV_NAME] =3D { .type =3D NLA_NUL_STRING, }, + [DEVLINK_ATTR_PORT_INDEX] =3D { .type =3D NLA_U32, }, +}; + +/* DEVLINK_CMD_PORT_RESOURCE_GET - dump */ +static const struct nla_policy devlink_port_resource_get_dump_nl_policy[DE= VLINK_ATTR_DEV_NAME + 1] =3D { + [DEVLINK_ATTR_BUS_NAME] =3D { .type =3D NLA_NUL_STRING, }, + [DEVLINK_ATTR_DEV_NAME] =3D { .type =3D NLA_NUL_STRING, }, +}; + /* Ops table for devlink */ -const struct genl_split_ops devlink_nl_ops[74] =3D { +const struct genl_split_ops devlink_nl_ops[76] =3D { { .cmd =3D DEVLINK_CMD_GET, .validate =3D GENL_DONT_VALIDATE_STRICT, @@ -1284,4 +1297,21 @@ const struct genl_split_ops devlink_nl_ops[74] =3D { .maxattr =3D DEVLINK_ATTR_PORT_INDEX, .flags =3D GENL_CMD_CAP_DO, }, + { + .cmd =3D DEVLINK_CMD_PORT_RESOURCE_GET, + .validate =3D GENL_DONT_VALIDATE_STRICT, + .pre_doit =3D devlink_nl_pre_doit_port, + .doit =3D devlink_nl_port_resource_get_doit, + .post_doit =3D devlink_nl_post_doit, + .policy =3D devlink_port_resource_get_do_nl_policy, + .maxattr =3D DEVLINK_ATTR_PORT_INDEX, + .flags =3D GENL_CMD_CAP_DO, + }, + { + .cmd =3D DEVLINK_CMD_PORT_RESOURCE_GET, + .dumpit =3D devlink_nl_port_resource_get_dumpit, + .policy =3D devlink_port_resource_get_dump_nl_policy, + .maxattr =3D DEVLINK_ATTR_DEV_NAME, + .flags =3D GENL_CMD_CAP_DUMP, + }, }; diff --git a/net/devlink/netlink_gen.h b/net/devlink/netlink_gen.h index 2817d53a0eba..204a665d2fd2 100644 --- a/net/devlink/netlink_gen.h +++ b/net/devlink/netlink_gen.h @@ -18,7 +18,7 @@ extern const struct nla_policy devlink_dl_rate_tc_bws_nl_= policy[DEVLINK_RATE_TC_ extern const struct nla_policy devlink_dl_selftest_id_nl_policy[DEVLINK_AT= TR_SELFTEST_ID_FLASH + 1]; =20 /* Ops table for devlink */ -extern const struct genl_split_ops devlink_nl_ops[74]; +extern const struct genl_split_ops devlink_nl_ops[76]; =20 int devlink_nl_pre_doit(const struct genl_split_ops *ops, struct sk_buff *= skb, struct genl_info *info); @@ -146,5 +146,9 @@ int devlink_nl_selftests_get_dumpit(struct sk_buff *skb, int devlink_nl_selftests_run_doit(struct sk_buff *skb, struct genl_info *i= nfo); int devlink_nl_notify_filter_set_doit(struct sk_buff *skb, struct genl_info *info); +int devlink_nl_port_resource_get_doit(struct sk_buff *skb, + struct genl_info *info); +int devlink_nl_port_resource_get_dumpit(struct sk_buff *skb, + struct netlink_callback *cb); =20 #endif /* _LINUX_DEVLINK_GEN_H */ diff --git a/net/devlink/port.c b/net/devlink/port.c index 93d8a25bb920..10d0d88894a3 100644 --- a/net/devlink/port.c +++ b/net/devlink/port.c @@ -1024,6 +1024,7 @@ void devlink_port_init(struct devlink *devlink, return; devlink_port->devlink =3D devlink; INIT_LIST_HEAD(&devlink_port->region_list); + INIT_LIST_HEAD(&devlink_port->resource_list); devlink_port->initialized =3D true; } EXPORT_SYMBOL_GPL(devlink_port_init); @@ -1041,6 +1042,7 @@ EXPORT_SYMBOL_GPL(devlink_port_init); void devlink_port_fini(struct devlink_port *devlink_port) { WARN_ON(!list_empty(&devlink_port->region_list)); + WARN_ON(!list_empty(&devlink_port->resource_list)); } EXPORT_SYMBOL_GPL(devlink_port_fini); =20 @@ -1135,6 +1137,7 @@ void devl_port_unregister(struct devlink_port *devlin= k_port) devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_DEL); xa_erase(&devlink_port->devlink->ports, devlink_port->index); WARN_ON(!list_empty(&devlink_port->reporter_list)); + devlink_port_fini(devlink_port); devlink_port->registered =3D false; } EXPORT_SYMBOL_GPL(devl_port_unregister); diff --git a/net/devlink/resource.c b/net/devlink/resource.c index 2d6324f3d91f..1c563c76ddb6 100644 --- a/net/devlink/resource.c +++ b/net/devlink/resource.c @@ -36,15 +36,16 @@ struct devlink_resource { }; =20 static struct devlink_resource * -devlink_resource_find(struct devlink *devlink, - struct devlink_resource *resource, u64 resource_id) +devlink_resource_find_by_list(struct list_head *res_list_head, + struct devlink_resource *resource, + u64 resource_id) { struct list_head *resource_list; =20 if (resource) resource_list =3D &resource->resource_list; else - resource_list =3D &devlink->resource_list; + resource_list =3D res_list_head; =20 list_for_each_entry(resource, resource_list, list) { struct devlink_resource *child_resource; @@ -52,14 +53,23 @@ devlink_resource_find(struct devlink *devlink, if (resource->id =3D=3D resource_id) return resource; =20 - child_resource =3D devlink_resource_find(devlink, resource, - resource_id); + child_resource =3D devlink_resource_find_by_list(res_list_head, + resource, + resource_id); if (child_resource) return child_resource; } return NULL; } =20 +static struct devlink_resource * +devlink_resource_find(struct devlink *devlink, + struct devlink_resource *resource, u64 resource_id) +{ + return devlink_resource_find_by_list(&devlink->resource_list, + resource, resource_id); +} + static void devlink_resource_validate_children(struct devlink_resource *resource) { @@ -214,8 +224,10 @@ static int devlink_resource_put(struct devlink *devlin= k, struct sk_buff *skb, } =20 static int devlink_resource_fill(struct genl_info *info, + struct list_head *resource_list, enum devlink_command cmd, int flags) { + struct devlink_port *devlink_port =3D info->user_ptr[1]; struct devlink *devlink =3D info->user_ptr[0]; struct devlink_resource *resource; struct nlattr *resources_attr; @@ -226,8 +238,11 @@ static int devlink_resource_fill(struct genl_info *inf= o, int i; int err; =20 - resource =3D list_first_entry(&devlink->resource_list, - struct devlink_resource, list); + if (list_empty(resource_list)) + return -EOPNOTSUPP; + + resource =3D list_first_entry(resource_list, struct devlink_resource, + list); start_again: err =3D devlink_nl_msg_reply_and_new(&skb, info); if (err) @@ -243,6 +258,10 @@ static int devlink_resource_fill(struct genl_info *inf= o, if (devlink_nl_put_handle(skb, devlink)) goto nla_put_failure; =20 + if (devlink_port && nla_put_u32(skb, DEVLINK_ATTR_PORT_INDEX, + devlink_port->index)) + goto nla_put_failure; + resources_attr =3D nla_nest_start_noflag(skb, DEVLINK_ATTR_RESOURCE_LIST); if (!resources_attr) @@ -250,7 +269,7 @@ static int devlink_resource_fill(struct genl_info *info, =20 incomplete =3D false; i =3D 0; - list_for_each_entry_from(resource, &devlink->resource_list, list) { + list_for_each_entry_from(resource, resource_list, list) { err =3D devlink_resource_put(devlink, skb, resource); if (err) { if (!i) @@ -286,10 +305,8 @@ int devlink_nl_resource_dump_doit(struct sk_buff *skb,= struct genl_info *info) { struct devlink *devlink =3D info->user_ptr[0]; =20 - if (list_empty(&devlink->resource_list)) - return -EOPNOTSUPP; - - return devlink_resource_fill(info, DEVLINK_CMD_RESOURCE_DUMP, 0); + return devlink_resource_fill(info, &devlink->resource_list, + DEVLINK_CMD_RESOURCE_DUMP, 0); } =20 int devlink_resources_validate(struct devlink *devlink, @@ -314,26 +331,12 @@ int devlink_resources_validate(struct devlink *devlin= k, return err; } =20 -/** - * devl_resource_register - devlink resource register - * - * @devlink: devlink - * @resource_name: resource's name - * @resource_size: resource's size - * @resource_id: resource's id - * @parent_resource_id: resource's parent id - * @size_params: size parameters - * - * Generic resources should reuse the same names across drivers. - * Please see the generic resources list at: - * Documentation/networking/devlink/devlink-resource.rst - */ -int devl_resource_register(struct devlink *devlink, - const char *resource_name, - u64 resource_size, - u64 resource_id, - u64 parent_resource_id, - const struct devlink_resource_size_params *size_params) +static int +devl_resource_reg_by_list(struct devlink *devlink, + struct list_head *res_list_head, + const char *resource_name, u64 resource_size, + u64 resource_id, u64 parent_res_id, + const struct devlink_resource_size_params *params) { struct devlink_resource *resource; struct list_head *resource_list; @@ -341,9 +344,10 @@ int devl_resource_register(struct devlink *devlink, =20 lockdep_assert_held(&devlink->lock); =20 - top_hierarchy =3D parent_resource_id =3D=3D DEVLINK_RESOURCE_ID_PARENT_TO= P; + top_hierarchy =3D parent_res_id =3D=3D DEVLINK_RESOURCE_ID_PARENT_TOP; =20 - resource =3D devlink_resource_find(devlink, NULL, resource_id); + resource =3D devlink_resource_find_by_list(res_list_head, NULL, + resource_id); if (resource) return -EEXIST; =20 @@ -352,15 +356,15 @@ int devl_resource_register(struct devlink *devlink, return -ENOMEM; =20 if (top_hierarchy) { - resource_list =3D &devlink->resource_list; + resource_list =3D res_list_head; } else { - struct devlink_resource *parent_resource; + struct devlink_resource *parent_res; =20 - parent_resource =3D devlink_resource_find(devlink, NULL, - parent_resource_id); - if (parent_resource) { - resource_list =3D &parent_resource->resource_list; - resource->parent =3D parent_resource; + parent_res =3D devlink_resource_find_by_list(res_list_head, NULL, + parent_res_id); + if (parent_res) { + resource_list =3D &parent_res->resource_list; + resource->parent =3D parent_res; } else { kfree(resource); return -EINVAL; @@ -372,46 +376,78 @@ int devl_resource_register(struct devlink *devlink, resource->size_new =3D resource_size; resource->id =3D resource_id; resource->size_valid =3D true; - memcpy(&resource->size_params, size_params, - sizeof(resource->size_params)); + memcpy(&resource->size_params, params, sizeof(resource->size_params)); INIT_LIST_HEAD(&resource->resource_list); list_add_tail(&resource->list, resource_list); =20 return 0; } + +/** + * devl_resource_register - devlink resource register + * + * @devlink: devlink + * @resource_name: resource's name + * @resource_size: resource's size + * @resource_id: resource's id + * @parent_resource_id: resource's parent id + * @params: size parameters + * + * Generic resources should reuse the same names across drivers. + * Please see the generic resources list at: + * Documentation/networking/devlink/devlink-resource.rst + * + * Return: 0 on success, negative error code otherwise. + */ +int devl_resource_register(struct devlink *devlink, const char *resource_n= ame, + u64 resource_size, u64 resource_id, + u64 parent_resource_id, + const struct devlink_resource_size_params *params) +{ + return devl_resource_reg_by_list(devlink, &devlink->resource_list, + resource_name, resource_size, + resource_id, parent_resource_id, + params); +} EXPORT_SYMBOL_GPL(devl_resource_register); =20 -static void devlink_resource_unregister(struct devlink *devlink, - struct devlink_resource *resource) +static void devlink_resource_unregister(struct devlink_resource *resource) { struct devlink_resource *tmp, *child_resource; =20 list_for_each_entry_safe(child_resource, tmp, &resource->resource_list, list) { - devlink_resource_unregister(devlink, child_resource); + devlink_resource_unregister(child_resource); list_del(&child_resource->list); kfree(child_resource); } } =20 -/** - * devl_resources_unregister - free all resources - * - * @devlink: devlink - */ -void devl_resources_unregister(struct devlink *devlink) +static void +devl_resources_unregister_by_list(struct devlink *devlink, + struct list_head *res_list_head) { struct devlink_resource *tmp, *child_resource; =20 lockdep_assert_held(&devlink->lock); =20 - list_for_each_entry_safe(child_resource, tmp, &devlink->resource_list, + list_for_each_entry_safe(child_resource, tmp, res_list_head, list) { - devlink_resource_unregister(devlink, child_resource); + devlink_resource_unregister(child_resource); list_del(&child_resource->list); kfree(child_resource); } } + +/** + * devl_resources_unregister - free all resources + * + * @devlink: devlink + */ +void devl_resources_unregister(struct devlink *devlink) +{ + devl_resources_unregister_by_list(devlink, &devlink->resource_list); +} EXPORT_SYMBOL_GPL(devl_resources_unregister); =20 /** @@ -502,3 +538,141 @@ void devl_resource_occ_get_unregister(struct devlink = *devlink, resource->occ_get_priv =3D NULL; } EXPORT_SYMBOL_GPL(devl_resource_occ_get_unregister); + +/** + * devl_port_resource_register - devlink port resource register + * + * @devlink_port: devlink port + * @resource_name: resource's name + * @resource_size: resource's size + * @resource_id: resource's id + * @parent_resource_id: resource's parent id + * @params: size parameters for the resource + * + * Generic resources should reuse the same names across drivers. + * Please see the generic resources list at: + * Documentation/networking/devlink/devlink-resource.rst + * + * Return: 0 on success, negative error code otherwise. + */ +int +devl_port_resource_register(struct devlink_port *devlink_port, + const char *resource_name, + u64 resource_size, u64 resource_id, + u64 parent_resource_id, + const struct devlink_resource_size_params *params) +{ + return devl_resource_reg_by_list(devlink_port->devlink, + &devlink_port->resource_list, + resource_name, resource_size, + resource_id, parent_resource_id, + params); +} +EXPORT_SYMBOL_GPL(devl_port_resource_register); + +/** + * devl_port_resources_unregister - unregister all devlink port resources + * + * @devlink_port: devlink port + */ +void devl_port_resources_unregister(struct devlink_port *devlink_port) +{ + devl_resources_unregister_by_list(devlink_port->devlink, + &devlink_port->resource_list); +} +EXPORT_SYMBOL_GPL(devl_port_resources_unregister); + +static int devlink_nl_port_resource_fill(struct sk_buff *msg, + struct devlink_port *devlink_port, + enum devlink_command cmd, + u32 portid, u32 seq, int flags) +{ + struct devlink *devlink =3D devlink_port->devlink; + struct devlink_resource *resource; + struct nlattr *resources_attr; + void *hdr; + + if (list_empty(&devlink_port->resource_list)) + return 0; + + hdr =3D genlmsg_put(msg, portid, seq, &devlink_nl_family, flags, cmd); + if (!hdr) + return -EMSGSIZE; + + if (devlink_nl_put_handle(msg, devlink)) + goto nla_put_failure; + if (nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX, devlink_port->index)) + goto nla_put_failure; + + resources_attr =3D nla_nest_start_noflag(msg, DEVLINK_ATTR_RESOURCE_LIST); + if (!resources_attr) + goto nla_put_failure; + + list_for_each_entry(resource, &devlink_port->resource_list, list) { + if (devlink_resource_put(devlink, msg, resource)) { + nla_nest_cancel(msg, resources_attr); + goto nla_put_failure; + } + } + nla_nest_end(msg, resources_attr); + genlmsg_end(msg, hdr); + return 0; + +nla_put_failure: + genlmsg_cancel(msg, hdr); + return -EMSGSIZE; +} + +int devlink_nl_port_resource_get_doit(struct sk_buff *skb, + struct genl_info *info) +{ + struct devlink_port *devlink_port =3D info->user_ptr[1]; + struct sk_buff *msg; + int err; + + msg =3D nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); + if (!msg) + return -ENOMEM; + + err =3D devlink_nl_port_resource_fill(msg, devlink_port, + DEVLINK_CMD_PORT_RESOURCE_GET, + info->snd_portid, info->snd_seq, 0); + if (err) { + nlmsg_free(msg); + return err; + } + + return genlmsg_reply(msg, info); +} + +static int +devlink_nl_port_resource_get_dump_one(struct sk_buff *msg, + struct devlink *devlink, + struct netlink_callback *cb, int flags) +{ + struct devlink_nl_dump_state *state =3D devlink_dump_state(cb); + u32 cmd =3D DEVLINK_CMD_PORT_RESOURCE_GET; + struct devlink_port *devlink_port; + unsigned long port_index; + int err; + + xa_for_each_start(&devlink->ports, port_index, devlink_port, + state->idx) { + err =3D devlink_nl_port_resource_fill(msg, devlink_port, cmd, + NETLINK_CB(cb->skb).portid, + cb->nlh->nlmsg_seq, flags); + if (err) { + state->idx =3D port_index; + return err; + } + } + + return 0; +} + +int devlink_nl_port_resource_get_dumpit(struct sk_buff *skb, + struct netlink_callback *cb) +{ + return devlink_nl_dumpit(skb, cb, + devlink_nl_port_resource_get_dump_one); +} --=20 2.40.1 From nobody Sat Feb 7 17:09:53 2026 Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazon11010040.outbound.protection.outlook.com [52.101.193.40]) (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 E615F3921C5; Tue, 3 Feb 2026 07:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.193.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102707; cv=fail; b=ZoD9Gd1XXlYaFhYzAwYsXpV0svmKFFWJ6iO29zyqItNrMvB4vU2wiokWHz/6Mr+U4jdWcac458Y4sxWuExAJ41gAwLOt9ML/J81hLs01LNnnnbYXxj58YpOCEsZEuF0mXVJ7c9JZRrhua6bauIdhI5tTZhwbTfcsHMAvU5pItdg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102707; c=relaxed/simple; bh=rHtIcE5zK+CnxWJsFlNj47+idUSnzobEstb1nHGkwgk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WISrNxqnW6ox0CTYGOIzbFEEf7v8zevfflWfi/cQV6Oze/ySKUNWd/vSIU2I92Mq8GOT8OkqZWoPYnOYixsiWch5RdoKLdqq8r0oduQ/2TC2eFsHjqSP43Or9EWwNEEvyh9l2ngvPwplISM+br0wH57FPE8jNdN8SKp/agHL6hA= 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=d1De2J9w; arc=fail smtp.client-ip=52.101.193.40 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="d1De2J9w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NpvJOXig+VFsqWRsgNguPzVBEVLx3ZqCg9sOnWedXa6S4a05egtA94dNQ8tBtVWOy513xIGkeoODFmy+jdlmOnF565ul3jqAyd0wpoo/MgUOm3qU5EP9i6CiUuWvaXaDREXgzclSC+SDFjJhTfMlqi7XofdHzw8+Mj08tiz6PNV/WrcFpZMGfGoNLOAGWDcneNU3934odB3n62BW7kBTL1TR+fiukydMNrg3UFEq7z1o33/C6rld5pPkdWFaeiJicAitEsT163HMb3Pdw9VsHbfq4g7zRp3dXyl9TPmMEwn9t+ct/mTN7X8NOQwQAcelyWAQ0JkkGCINihHdkpxzeg== 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=vrAeCkdFP6Ljc9myCwPEtBqQPE+DeCrmDhWpH9FapHs=; b=j33NmEtdaMQWL7hHe0VGZ8bic6GgU2bcFY/dpZSz5T25BMbhPDFUQ89W2kIDoy9Rz4EkWRTsEKDUBtxkawxs/S1XWYxd3Ow/4Ky7sIAFXbDvIUh8HOuvbeY3lkQxrwaJOcMdrnr6G2n8BmqR0TbJH0eda43iCBFs040PSfPJMrfBMGK0ggJ/dEolMBwwgoJeKlli4ZiORI5BDyheaZ/pgscR/I0/LemU+0xR7PBGdUXv8jMEQyOUzx2/4sJK904VVsQUwQonkJ098+M1bSrC8bhhoadnkzq0yhK1dx4atWJxm4Qf7PKAwDnh3D5SAdrYcQnN7P0Juo0cZ9DG8MhdCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=vrAeCkdFP6Ljc9myCwPEtBqQPE+DeCrmDhWpH9FapHs=; b=d1De2J9wptIn3rFITWqfx9eDnYc44I3P+73rHt6R0UBRIlLiW1raZU23QrudiYfcnFAvlDdl2MT9SIVGlqIqFyewxcTXJM9xB9bkl8jSgdONelOqD8F5cPypLkNrXdUyzzoOCp2ncd9he0cbnvX+n80+i/hXuywwpCg2tx11PRKCE8iaJHkuRMA+ZSCkVzXp7xuB3syRJo4KtI89cCbKEq3L2rhhZrGzcvKLbLkp2M1bkcUP73FKb7e/vzYw69h7V6E5kZ0xQOd5H3akljyetNtmRRSMbpq0gblqGcreO45oFwzE6EyAtKm+jXTIChkP0W0gUXr4tNg6YaOYpcwE1A== Received: from DM5PR07CA0120.namprd07.prod.outlook.com (2603:10b6:4:ae::49) by SJ2PR12MB8012.namprd12.prod.outlook.com (2603:10b6:a03:4c7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.16; Tue, 3 Feb 2026 07:11:40 +0000 Received: from DS3PEPF000099E0.namprd04.prod.outlook.com (2603:10b6:4:ae:cafe::c7) by DM5PR07CA0120.outlook.office365.com (2603:10b6:4:ae::49) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9587.12 via Frontend Transport; Tue, 3 Feb 2026 07:11:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS3PEPF000099E0.mail.protection.outlook.com (10.167.17.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.10 via Frontend Transport; Tue, 3 Feb 2026 07:11:39 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:21 -0800 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:20 -0800 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.2562.20 via Frontend Transport; Mon, 2 Feb 2026 23:11:15 -0800 From: Tariq Toukan To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "David S. Miller" CC: Donald Hunter , Jiri Pirko , Jonathan Corbet , Saeed Mahameed , "Leon Romanovsky" , Tariq Toukan , Mark Bloch , Shuah Khan , , , , , , Gal Pressman , Moshe Shemesh , Shay Drori , Jiri Pirko , Or Har-Toov Subject: [PATCH net-next 2/5] net/mlx5: Register SF resource on PF port representor Date: Tue, 3 Feb 2026 09:10:30 +0200 Message-ID: <20260203071033.1709445-3-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20260203071033.1709445-1-tariqt@nvidia.com> References: <20260203071033.1709445-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E0:EE_|SJ2PR12MB8012:EE_ X-MS-Office365-Filtering-Correlation-Id: 74e56165-536a-4c8f-d6f6-08de62f37a43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?SX3H291jaw0sJRqeFPGiqgVI7liLo0QIBmlnrSne8v+wewHbPlka6te0MILh?= =?us-ascii?Q?ELOobtvmtJcGqo2C9JNlVM1He1rcdvsZw10nySa2C67eGBS3zYo5uHA+vVXN?= =?us-ascii?Q?1Ba0h4R9q38ke40oHdx/XMHXymjqTZjnCZwMzJOw0NIdYGykCxwpMn2KNlQQ?= =?us-ascii?Q?IjF24bVwDSCHLyRlOOLM9A4CS454oVzXbrH90G0D72D0tCScXnvi1XdqPeBA?= =?us-ascii?Q?GEh3AeFtkt823Abw39iENqpPX4V34yKtcJvYuYCEtJ5hmK0zGdgNOwtRp6hM?= =?us-ascii?Q?uHoovVzOPwfyxsopUulPll+7MuWCen950c3XmkYMc448+lVrJCcse1IsxYrn?= =?us-ascii?Q?eGv15RKR/kRmbtBhjJmOItOhqL1BzGunMh3USDmGFgXFIY94b4HgArVdjtLd?= =?us-ascii?Q?3z0W/+6ZzHsQR6SWZ91wq3GaGQzl1E6K959BwocTA4P0e4oFWnJNKyWiooEf?= =?us-ascii?Q?qzqc2ozvTMNVngFKMihWdFF1jNaOC+GhysDmB30zjfZhQar2qAf4CJqUwIB2?= =?us-ascii?Q?2dsn8d18TJrOdynqq2D2ep/m55khjkC1MMc/tz8VwVlVXx6irQrOSI1mywni?= =?us-ascii?Q?uXtRMPHBo5iXsolgLiXha9G+W/9p1WGWnVgi0V6OtIW+ffi4dMxSRpGrTRS1?= =?us-ascii?Q?0NWlxv7jvBFHJ/auk3cEiIvcwCThMBUkXhHsif3b5LhsqzkEMutmJf9TO2EP?= =?us-ascii?Q?G0kZXRtf20RxJF+aTmuJfPtMskV49k+L8gZZ/PKJtlmGgq21C5gPR2XlHmNn?= =?us-ascii?Q?gJl8XlR9ZHzYUJWi2vDPtBpjZgWrxuE6pgzyhZ4zi8j69xwZakOLqiTS8T00?= =?us-ascii?Q?SkebnED4LBIkco7smf/3M13qaP0VB4VATITbZ491WFpy7WPN1AB41J6Tk1BT?= =?us-ascii?Q?1UDNz9xpqdIhnzOWn3z27SsvfKgOk/sCJJsoGPRZlLmphAhxu+kFSOQpzgi/?= =?us-ascii?Q?NJbYYgYum9Bv76MZU/Hp8otbJfuaL4pbZVEvOPZAbvGU8yYHTirmzz03UhT6?= =?us-ascii?Q?ToVs1QcwNESts+pqA7XstmJLPwNNgaDEn/fyJ1wCqovVGD8+yKLgOIXCXH8b?= =?us-ascii?Q?/FiNOZL39Ug5VgEUs1r8FaQ6LyMTnQ4NQrBfxq4mg1AikDBW7Tw/gvKko3iH?= =?us-ascii?Q?UYtl5sXSx1+RnjwQ5e1Dc1abBG24fzh7Kye8m/CfK/BWGvN9t6dZvHq8jrFM?= =?us-ascii?Q?QtzK6bhN62BDEMx/Wf3EZMiSN/lRPBHMAjDJfcmx8JLgAfBtJ9/psbL8JlWz?= =?us-ascii?Q?0iIEPTDc9Ts7QjrzVFjHjqWL7KeEtWeA5YsDBrn9uZiDAGZXjS1sl9CwTMDk?= =?us-ascii?Q?JL1/wbSURR3mbxFrambz6FtWvx05rWMzk6blEgBLUkznSBPAYrzmihZoP/wy?= =?us-ascii?Q?nLIgcluUUJeODkzzpZIVtEm0kEKQvil5fT/l5630o/6sjJdzw8WTt9tkuQxS?= =?us-ascii?Q?MXPI2mV1yFdiKrPex+4y9qJ6pHTpE8gejSxfkmtS1VRnbl2jSQFuEliX8qU3?= =?us-ascii?Q?LsZ5+8q6vg3wYPy3RabFKZp6dwXQoOrOndvIlnFXHe/34t8TMyN5IrE+kOFw?= =?us-ascii?Q?39aVFENqEeLBYF7J+xBbJAbuUslkQl75qsgeHIkCHCaYd4DJrnBaSZLA+e9X?= =?us-ascii?Q?88fcbUIU6/DXVk6ZzMJQFQwJwkCsXQaQTHR86YHriyyH2Ejq9LzwXa/8jG5G?= =?us-ascii?Q?EiwJJQ=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GSbGD8NMChqJlDB8nwg+i37/ce+emDNpynEPSpzO/Uj9xoZSTuAVjZuz+KoivtARRjv8l1DTYf8XC4dFTeUMCSIevAb5rDwZsHmkO4kGudJWQcYgh+C1MI0BLWNZFYhmgY0Mt5blDgKKt/5IuV/bkhB0EextV/k2ozd8eJKsvmQZOqTZSKLDmn7QOHx3maj97zbirFMf62knSYMbgWHBc9M2OTjz3u9a6D8K7Uth6JtukNYF3h4D+Ku/fOCuchvSuaO3d825M8u/1H71YzDGMkHMY6kv29uH8BS7vIb5b3qTBmqWL/WLK4qaD+uS9f52uYxXw0yvn7XJAFRAIfBbdPE8XjbxV9f0oidD8ZPhTkn9RRtuCY0U9UnXDowDHIMp1uJHTttc/vyU/T/wbH9QizcOEEun61os/ooypT9N34y4VNQ6g4thVQZNgYnyPK9q X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2026 07:11:39.9648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74e56165-536a-4c8f-d6f6-08de62f37a43 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8012 Content-Type: text/plain; charset="utf-8" From: Or Har-Toov The device-level "resource show" displays max_local_SFs and max_external_SFs without indicating which port each resource belongs to. Users cannot determine the controller number and pfnum associated with each SF pool. Register max_SFs resource on the Host PF representor port to expose per-port SF limits. Users can correlate the port resource with the controller number and pfnum shown in 'devlink port show'. Future patches will introduce an ECPF that manages multiple PFs, where each PF has its own SF pool. Example usage: $ devlink port resource show pci/0000:03:00.0/196608: name max_SFs size 20 unit entry pci/0000:03:00.1/262144: name max_SFs size 20 unit entry $ devlink port resource show pci/0000:03:00.0/196608 pci/0000:03:00.0/196608: name max_SFs size 20 unit entry $ devlink port show pci/0000:03:00.0/196608 pci/0000:03:00.0/196608: type eth netdev pf0hpf flavour pcipf controller 1 pfnum 0 external true splittable false function: hw_addr b8:3f:d2:e1:8f:dc roce enable max_io_eqs 120 We can create up to 20 SFs over devlink port pci/0000:03:00.0/196608, with pfnum 0 and controller 1. Signed-off-by: Or Har-Toov Reviewed-by: Shay Drori Reviewed-by: Moshe Shemesh Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/devlink.h | 4 ++ .../mellanox/mlx5/core/esw/devlink_port.c | 37 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h b/drivers/ne= t/ethernet/mellanox/mlx5/core/devlink.h index 43b9bf8829cf..4fbb3926a3e5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.h @@ -14,6 +14,10 @@ enum mlx5_devlink_resource_id { MLX5_ID_RES_MAX =3D __MLX5_ID_RES_MAX - 1, }; =20 +enum mlx5_devlink_port_resource_id { + MLX5_DL_PORT_RES_MAX_SFS =3D 1, +}; + enum mlx5_devlink_param_id { MLX5_DEVLINK_PARAM_ID_BASE =3D DEVLINK_PARAM_GENERIC_ID_MAX, MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c b/d= rivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c index 89a58dee50b3..2b6c3c9e5cc3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c @@ -3,6 +3,7 @@ =20 #include #include "eswitch.h" +#include "devlink.h" =20 static void mlx5_esw_get_port_parent_id(struct mlx5_core_dev *dev, struct netdev_phys_= item_id *ppid) @@ -156,6 +157,32 @@ static const struct devlink_port_ops mlx5_esw_dl_sf_po= rt_ops =3D { .port_fn_max_io_eqs_set =3D mlx5_devlink_port_fn_max_io_eqs_set, }; =20 +static int mlx5_esw_devlink_port_res_register(struct mlx5_eswitch *esw, + struct devlink_port *dl_port) +{ + struct devlink_resource_size_params size_params; + struct mlx5_core_dev *dev =3D esw->dev; + u16 max_sfs, sf_base_id; + int err; + + err =3D mlx5_esw_sf_max_hpf_functions(dev, &max_sfs, &sf_base_id); + if (err) + return err; + + devlink_resource_size_params_init(&size_params, max_sfs, max_sfs, 1, + DEVLINK_RESOURCE_UNIT_ENTRY); + + return devl_port_resource_register(dl_port, "max_SFs", max_sfs, + MLX5_DL_PORT_RES_MAX_SFS, + DEVLINK_RESOURCE_ID_PARENT_TOP, + &size_params); +} + +static void mlx5_esw_devlink_port_res_unregister(struct devlink_port *dl_p= ort) +{ + devl_port_resources_unregister(dl_port); +} + int mlx5_esw_offloads_devlink_port_register(struct mlx5_eswitch *esw, stru= ct mlx5_vport *vport) { struct mlx5_core_dev *dev =3D esw->dev; @@ -187,6 +214,15 @@ int mlx5_esw_offloads_devlink_port_register(struct mlx= 5_eswitch *esw, struct mlx if (err) goto rate_err; =20 + if (vport_num =3D=3D MLX5_VPORT_PF) { + err =3D mlx5_esw_devlink_port_res_register(esw, + &dl_port->dl_port); + if (err) + mlx5_core_dbg(dev, + "Failed to register port resources: %d\n", + err); + } + return 0; =20 rate_err: @@ -201,6 +237,7 @@ void mlx5_esw_offloads_devlink_port_unregister(struct m= lx5_vport *vport) if (!vport->dl_port) return; dl_port =3D vport->dl_port; + mlx5_esw_devlink_port_res_unregister(&dl_port->dl_port); =20 mlx5_esw_qos_vport_update_parent(vport, NULL, NULL); devl_rate_leaf_destroy(&dl_port->dl_port); --=20 2.40.1 From nobody Sat Feb 7 17:09:53 2026 Received: from SJ2PR03CU001.outbound.protection.outlook.com (mail-westusazon11012010.outbound.protection.outlook.com [52.101.43.10]) (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 63BB83921D0; Tue, 3 Feb 2026 07:12:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.43.10 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102721; cv=fail; b=ne/zl9+pOG8CTthQmd2NQACMb8fHkp0oGORLv88AD7NfZWXH6lliR3DUlNEurjGFapGykuI1x9CyQ4G5vb5sO48TV0RzrdJPoyjptSMHPGSqNuimatvFJ//YBqkznSz9CLTupNVJv2CZuyhxh4GBBuowrv+z3xHeinEQu7rL7Tw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102721; c=relaxed/simple; bh=v4s9fRlYFfIJBlf1h6Q7S9bnEzRb4/bF70sWHTiCxEo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s5r68jvUHnGOl2IXUggRgeJpW9r3F/6nwoinVY8XT0X4IOmLAU2RWJYRVp1hq5gl4e7VzldcuXdPts9X78rdbmOBQR9Cq2DEscWqjjV4ie9JiIH43PqB6OH/SOfOeyhOTkoM2svF/miBvw8TKYJuDc0vb18XcJ19pMX5QHSw1do= 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=Qk2dRcJG; arc=fail smtp.client-ip=52.101.43.10 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="Qk2dRcJG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yokdakQCuAgW1M/dVT/DYvviuoFQrLDWBngVz3ii5UaPtg1k3zUd5zKavGGqQI+qwGgKHklO+SiX8g2t7ZgU7Qb3kaWYY0pUtLUKmUbhQzxam9PyVi0IDMrg+X7QCEvn3F4KNNkv5VMe6uwGVEnPGdUSo48SXT2ghA5yuhWyqxOoOGYm9KDk44T8s0Uq9Tf5EjnnDapgarhuWFXC9OsAmzlpXUGxMdYvrp2gGhyXl4lGSqhU3hw+3rELe/AbmNYtKW5bb25bSxQIgReT7wUWtgDYEtmf44+wQGRuSfIfbc4zXqIzHpPb42AjAYAlUD3pZwrfvQeb8N8CI8gy/227Gg== 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=NvEFVRfH+bPCjsjgi9fG23mHPi7GrBbj5rSGheTjP/k=; b=FDYK6dCSesi5qI66WBV/zgVYqOYQsEIv2W4QhXfMy8rY6YqYZl9UOcomVcRtqIy/Hhd1E1toBqfBYqknSVGCZT+L0HrlU6RuIzeviXsjR+gJfmcic4m6XvtypKFuAxc74G2hhetq6Y6+Gh+MM8n+Tc/AUOCQ6yvDA4cujbOXuInm+OP41KxTHtfIQjLyt8GOXxp8v+8Q5mE6uVKsPjQ7rXo8lo6UkT/RDdTWkA2mBAbIgSnJxsVmsnxB7cBHbv04Hmfhrh03/Mha0gzNF7S06CR2E0MEHPMUqcVYepZ2d3X0y5doYkcAvOvySKtBWL021sLmghukOgLFzi7ygBHOzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=NvEFVRfH+bPCjsjgi9fG23mHPi7GrBbj5rSGheTjP/k=; b=Qk2dRcJGNLRRgcJJw5VEzG9QR/yeqonHlvJJTM86ezU+lYciLkM5vsQ66wNUjLYcTt/zGyKUvdZFKzOTXJl6uNq5MnGzs/RZrVWA/DBbZX9CPN8Mxzz5QORYtQrBAcR7GFFvAfjAZjBE7FuAjshwpTEWrzsKvzdJU3q8PFDfnq7dj+5jtakQ/azw8oQ++JFPoWNSh97rP7f8tI/nPjl8nQfqYXGXi0J5u+CkYhlmSy32UgzGYzLBwPwKejHfj0GaRER9ZWdyXvdlegyRHyc6KuX+CKoiG4Q7ulcaLWQHHSt71ey3pY19qRw4TojQlL35qwBt8CnyK2b2RQLTz1e0WA== Received: from DS7PR03CA0258.namprd03.prod.outlook.com (2603:10b6:5:3b3::23) by MW5PR12MB5651.namprd12.prod.outlook.com (2603:10b6:303:19f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.16; Tue, 3 Feb 2026 07:11:44 +0000 Received: from DS2PEPF0000343D.namprd02.prod.outlook.com (2603:10b6:5:3b3:cafe::1b) by DS7PR03CA0258.outlook.office365.com (2603:10b6:5:3b3::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9587.12 via Frontend Transport; Tue, 3 Feb 2026 07:11:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS2PEPF0000343D.mail.protection.outlook.com (10.167.18.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.10 via Frontend Transport; Tue, 3 Feb 2026 07:11:43 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:27 -0800 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:26 -0800 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.2562.20 via Frontend Transport; Mon, 2 Feb 2026 23:11:21 -0800 From: Tariq Toukan To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "David S. Miller" CC: Donald Hunter , Jiri Pirko , Jonathan Corbet , Saeed Mahameed , "Leon Romanovsky" , Tariq Toukan , Mark Bloch , Shuah Khan , , , , , , Gal Pressman , Moshe Shemesh , Shay Drori , Jiri Pirko , Or Har-Toov Subject: [PATCH net-next 3/5] netdevsim: Add devlink port resource registration Date: Tue, 3 Feb 2026 09:10:31 +0200 Message-ID: <20260203071033.1709445-4-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20260203071033.1709445-1-tariqt@nvidia.com> References: <20260203071033.1709445-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343D:EE_|MW5PR12MB5651:EE_ X-MS-Office365-Filtering-Correlation-Id: b1f1689f-bdd8-4caf-2fea-08de62f37c8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Agk7fHg3V+bNYbdNTtKLiCKItSZHEpuVcz6vGioadRfzI1TE8GFy69mm3ovL?= =?us-ascii?Q?zP2Rt0WfWkAAq5T71Cxi8VLUqgwuVwWXogTAkyEJLMivJEhZlnABcqNUyZ9L?= =?us-ascii?Q?E4RCPW3JQgLv6UlYYm6i8mpHp7RavvCFLmLCer6AVB0MA9eRU9p6uxpHoF7K?= =?us-ascii?Q?wqktAtNwLlRts9YVccWXEp2u4JEMaZH+24PVtuG+bf5tWTQizdwjyhO3jmQ2?= =?us-ascii?Q?uqelWUSYottAhStCeLoQNMYODwUMBNEz6b/nL7evN5cocmNlLrRo388TS6RM?= =?us-ascii?Q?k6yxNuRNwVRQMZCs+DW+pYkHHUJR9g2nDQmbn5hh9q4urtyrP1oj+hiTdx10?= =?us-ascii?Q?4BfbSbv81YSjZZkFh3cDOUqtboeuIuw0a0sc3VOFpcPO5zU4MMqaK57UP/Ec?= =?us-ascii?Q?lg2IHlGjQVUglgEvv2r5qoRBGETNeXcK6x4+UGReGIaxRaEaOxwECOe994f9?= =?us-ascii?Q?9QLBXL2X/3d3KrNYIfwWHynhrM9mt2I1+F31hgBeEPYCWC20ySoaKywIXkI+?= =?us-ascii?Q?evy4knIwAfUY/DGWJOxNJBAktqpLmWl89ijoLSZtBrRVzMSCDquD5SWZ6VRC?= =?us-ascii?Q?NOTHCXZJA1J3JXfk+X7DB6g/Zd9OaoDgyHQtZuu9z/CvYePDWYdseUNH94xO?= =?us-ascii?Q?6S9mTwKJA/TtpuPqGwCcGQrDq4XoGa9vsMdC7961GnzPAXAPwUaUxQMJPqV6?= =?us-ascii?Q?Vhm4+tsXEDF3YV+JsHnYVrFEQ5fg6c0HGBcz/sohuGV3C/EIw4FUTLDawXu7?= =?us-ascii?Q?igF0ynfSzxhBa1ps7Svpu6Pz5CCs2Xk3eo4Pf+zdqbggZPvSJZlss9tXRJ04?= =?us-ascii?Q?f2AXYfV/7N7vYBn5UFCGoxzNHQTN95X4xe1qm7Ljj1Ba4jZ9K5aXGhAfQF+f?= =?us-ascii?Q?Jg2N8qZR4+TxZ4doDey2xBW/egBMEw6aIEoc/NPozIzc7b0O0UHakr4qAHtZ?= =?us-ascii?Q?ZwQ4h6FRwrzV6Ww0+wYAFigP9uh0Bkfnzgzz8veVGc2MfmYEWR93pRKs0DPK?= =?us-ascii?Q?qcZderq0SV2iPB1J87dAzp4yg+kuzbyAHB5ywodM/uzVcoEVmv2RJzz7e9Fs?= =?us-ascii?Q?a68KhreEFA49zYz0m7zq2FJK+K2BL0zTt9rTIGlsIgi72mLjlYcM6ysTXhfL?= =?us-ascii?Q?bgE0wlfJ9tykh0JEAQVpOENpY2FePAE66/omVLNl9BBm3j5dcWFCw11HFFel?= =?us-ascii?Q?2n0gZJCfPGDljJCNPlNe0pbHomU1CVNrhmwe9DQ6M1r63xiGgoocAmhzdlnp?= =?us-ascii?Q?+/Gl54AGCLBlEl8lMBiVMllUJ0CNHz9qAPwqNYRvm0EiZ9Ups6ieB7hM6QR4?= =?us-ascii?Q?MSjOmR8LY2363+3hYfmvA1+f+ARWcJwzQUEmNORmOTK/fcr6ZDjK8/x23du5?= =?us-ascii?Q?SLFYIzN6oH+qClKZK0m+WaF9Bjv7N+Jf3p/7yMK/D1TRLkukFT+r71P8ahQ+?= =?us-ascii?Q?HHo8gPB3Q8YZw2RoknW6SoFtKm+1o1x6k9rG18tsvwEB3fqkqO2TI5Dvs3+j?= =?us-ascii?Q?EwAYDSW0rWYDPmm6SMDZfcThR1tdcXaBpGuEdt1AJxCu8D9ygHbpux/5ESX0?= =?us-ascii?Q?lZSOC8LiCBlu8CkpPGpOvJEFiJVtx+E3TODjMjN8prqtGnOvXJoBSlOfoBfU?= =?us-ascii?Q?FfUtNlWRl3HWmKqPXYt2U/sYR5PkfZdjt7OLIYH7zan8WYEx+zcBL2wAcq2y?= =?us-ascii?Q?hPeAJw=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L3WO+05kYsa7miUoCFEA/sbpch+n2m9WMu12b5bjWQowuvxSCrncNSYEF9wjt2wMJ+RKWzxDkV3iAEks5iiCoTLXRueGlz14ZeXstmj3Zx/nu8tYDv2/qdAJPwD5h4nziGohGf8Hnu7xs272IcqvEfk2NTQS8Nk4NuZtv4EzKDP9Ku6MA/0rdEtxdtiY4cqYHslD0nn7NOrQd0WH36TbMPt6WhcR7STW8ML8qsFIJBSAbabxLb3Xyez7FzhG2enkIacX67q/gUAtQiS6LQ/QajYdLau+oGbSwKIMXCe9+i0EIG+FRWUBSbJtS42w2aWsVYI+a6FzouBIKmT/aUVOP/Q32saEYNZffh1lpI0Ve5K9wPG5iJGzzsaQq6OJ3YuHN4kD70u4/DjfYR5y3taWFhE5B8g4C/sKexXaOd0hNxYqdJgFeNYHjbQiD0tuj0Lj X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2026 07:11:43.7773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1f1689f-bdd8-4caf-2fea-08de62f37c8b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF0000343D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5651 Content-Type: text/plain; charset="utf-8" From: Or Har-Toov Register port-level resources for netdevsim ports to enable testing of the port resource infrastructure. Signed-off-by: Or Har-Toov Reviewed-by: Shay Drori Reviewed-by: Moshe Shemesh Signed-off-by: Tariq Toukan --- drivers/net/netdevsim/dev.c | 22 +++++++++++++++++++++- drivers/net/netdevsim/netdevsim.h | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index dfd571b22107..ebda1b961664 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -1486,9 +1486,24 @@ static int __nsim_dev_port_add(struct nsim_dev *nsim= _dev, enum nsim_dev_port_typ if (err) goto err_port_free; =20 + if (nsim_dev_port_is_pf(nsim_dev_port)) { + u64 parent_id =3D DEVLINK_RESOURCE_ID_PARENT_TOP; + struct devlink_resource_size_params params =3D { + .size_max =3D 100, + .size_granularity =3D 1, + .unit =3D DEVLINK_RESOURCE_UNIT_ENTRY + }; + + err =3D devl_port_resource_register(devlink_port, "max_sfs", 20, + NSIM_PORT_RESOURCE_MAX_SFS, + parent_id, ¶ms); + if (err) + goto err_dl_port_unregister; + } + err =3D nsim_dev_port_debugfs_init(nsim_dev, nsim_dev_port); if (err) - goto err_dl_port_unregister; + goto err_port_resource_unregister; =20 nsim_dev_port->ns =3D nsim_create(nsim_dev, nsim_dev_port, perm_addr); if (IS_ERR(nsim_dev_port->ns)) { @@ -1511,6 +1526,9 @@ static int __nsim_dev_port_add(struct nsim_dev *nsim_= dev, enum nsim_dev_port_typ nsim_destroy(nsim_dev_port->ns); err_port_debugfs_exit: nsim_dev_port_debugfs_exit(nsim_dev_port); +err_port_resource_unregister: + if (nsim_dev_port_is_pf(nsim_dev_port)) + devl_port_resources_unregister(devlink_port); err_dl_port_unregister: devl_port_unregister(devlink_port); err_port_free: @@ -1527,6 +1545,8 @@ static void __nsim_dev_port_del(struct nsim_dev_port = *nsim_dev_port) devl_rate_leaf_destroy(&nsim_dev_port->devlink_port); nsim_destroy(nsim_dev_port->ns); nsim_dev_port_debugfs_exit(nsim_dev_port); + if (nsim_dev_port_is_pf(nsim_dev_port)) + devl_port_resources_unregister(devlink_port); devl_port_unregister(devlink_port); kfree(nsim_dev_port); } diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netd= evsim.h index f767fc8a7505..11ea1a52924a 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -224,6 +224,10 @@ enum nsim_resource_id { NSIM_RESOURCE_NEXTHOPS, }; =20 +enum nsim_port_resource_id { + NSIM_PORT_RESOURCE_MAX_SFS =3D 1, +}; + struct nsim_dev_health { struct devlink_health_reporter *empty_reporter; struct devlink_health_reporter *dummy_reporter; --=20 2.40.1 From nobody Sat Feb 7 17:09:53 2026 Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazon11010060.outbound.protection.outlook.com [52.101.193.60]) (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 8DD143921D0; Tue, 3 Feb 2026 07:11:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.193.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102715; cv=fail; b=pGbxeRAvzPpMO/9t/p3M+8g7+McjH8k5qnJwKKg4br22qQxDMiRb359bPveG316mwTcyzj9vDi29QpRedCDiSQq1GRShGr0taT3V440ZOlaw8rnAgfACBJQBtsmtrHf9fhhb5CpoqWg2znv0k5r8ZtZJ9Hn5hYI9uFkf79ZnZdU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102715; c=relaxed/simple; bh=egl0fmOIj7zO5A9NIVKzGt68lYKsaGJjdvfd35iKDr0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jYTsBO7vSEci28/QVdWmrV692jjCTP/UXwUzuDfBaaAyoLSk/ScCDhXCpGJ8HamPqpHd1/LtWjuPI6Au4a5jeFUswu0KR0vrE8VILd8byDYHUquKNxhvAmwgKbj4FCecX63HQ88JSa3XvTpbFYFokVkEHRY0HFygxB0I3qVsfeQ= 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=gn0KNfJW; arc=fail smtp.client-ip=52.101.193.60 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="gn0KNfJW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Qz0i0RO5t0eVfR87uEnsnV+dVjTjwD+0xnU051a8SQvpshoVVrK3vqevkrlRT2zTRX298P+ZBSLR0IVUEeRxLcqEnnJG8fbTajh2DSgJlmZlHGd7X6VLCR9SSrlyWGi8I1p3yhO8C9BW05WT1fTs5zTsjX87HxzjNITixw7lT6QoZ7n8G4/Ycu+3qUrV344N3LpRtjbjXP55X8mnrwQJ3gtkOKBV/BLpBtXG7E/VbAvgaWY7bzfsoV29l+b4WYndolE5gIRiTRTS3DyqRVfLPGayyIViAtD+hj96EhFwol5KHUbEPQ8j2CTvPzTfPfFgzg9kgzl8Ft88AaYfCo3K/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eNetfffhvdWWj85Ax7O4Nt/B0AJj8D5JWKtCOpcOSp4=; b=SxJLYgbWCnczHhtcLW1vYGETjPdzq+Mj9ymJ5B8FtKHKRrb+7bakmxd0PL9wZ2llw3xQKPTJ1kOf7dzGJPJtHLU8DDyx6k8rWMBoBubhczqVyD+zvbl+7MlBxRNekTrGI2W4eV+iS6kYjMjqiRQaqlFls+7FA/fDOpT1kagjzwyxRYeU+EYa8v8fO6tak7xaP4HB019kzdvEvE9nPtU/pXaACjdhqpAI9qotV10or2HAOfKkvTh6u4TAh0oM/dFH7Sp3bJpchVuO49t4PlUu3qyiYG9IyKh/sCfeNgFyrCFNuoe9ERFlySod+AP5JKEiZweQEjLxHHI1hR4ij72H/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=eNetfffhvdWWj85Ax7O4Nt/B0AJj8D5JWKtCOpcOSp4=; b=gn0KNfJWISLBIWuZPYXNVy9Q7s4SFDE/2czT7i94gWtwNSsv5jhFAcWnX5vY+1OJqCLt7A3IoGjOoWuYCswNb4PjJye5RMbMNzsvBavRkfpY4ZPg1/tvvCFejcAPCCoMIJr5FRTO4FWlRy4ENXzTimsNEHxaj6HOvQzV4+faYkmSCBj5e6n5Z8QuZb9ZA0KZftoJtWeEjN+a0V+g0OTcCrm4QyCjGLNmLFq6N+x2lCbcXyBX8j8hnB1/ZhorxiWYe3NV37rEYMzLsCqKqLUM8jlA/4jPnPlE9WhNcc0bnFa1z5D3e6Uy0upeJbYoo/qjy4Q2Wr/5zMZsFBqfoniBZw== Received: from CH0PR03CA0311.namprd03.prod.outlook.com (2603:10b6:610:118::13) by IA0PR12MB9009.namprd12.prod.outlook.com (2603:10b6:208:48f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.16; Tue, 3 Feb 2026 07:11:49 +0000 Received: from DS3PEPF000099E2.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::96) by CH0PR03CA0311.outlook.office365.com (2603:10b6:610:118::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.12 via Frontend Transport; Tue, 3 Feb 2026 07:11:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS3PEPF000099E2.mail.protection.outlook.com (10.167.17.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.10 via Frontend Transport; Tue, 3 Feb 2026 07:11:49 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:33 -0800 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:32 -0800 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.2562.20 via Frontend Transport; Mon, 2 Feb 2026 23:11:27 -0800 From: Tariq Toukan To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "David S. Miller" CC: Donald Hunter , Jiri Pirko , Jonathan Corbet , Saeed Mahameed , "Leon Romanovsky" , Tariq Toukan , Mark Bloch , Shuah Khan , , , , , , Gal Pressman , Moshe Shemesh , Shay Drori , Jiri Pirko , Or Har-Toov Subject: [PATCH net-next 4/5] selftest: netdevsim: Add devlink port resource test Date: Tue, 3 Feb 2026 09:10:32 +0200 Message-ID: <20260203071033.1709445-5-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20260203071033.1709445-1-tariqt@nvidia.com> References: <20260203071033.1709445-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E2:EE_|IA0PR12MB9009:EE_ X-MS-Office365-Filtering-Correlation-Id: b657ca2c-8124-4f98-458c-08de62f37faa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?aQzMZYw5ZMGAK9vDyHUNiDlOqHeXO/uqk9oDB7ObNc5Dnidfzh4MJdmxmMsv?= =?us-ascii?Q?0fp9lX3CXjyFkVb3Cy+85WcfBsOA41xqcjVGlzSBF+vQYO3ia8bn1M/66iY0?= =?us-ascii?Q?cZ2d33QmxZn52vGkKGesfmbPCLJBaMjR3cMpcXXHkRFvSWedzGMqa1ZH9P+I?= =?us-ascii?Q?XKuitSr0J/D6634fKv4zDCMHCCNxM0KtF7y5ZqNiU0ylRayvRhyrnwxwzwFJ?= =?us-ascii?Q?8v5FPDiQHzVP54ZiLVKEMJJg8ziD12vOTX2ei78FP+5vliV+3JC2v9p3QlN/?= =?us-ascii?Q?kGXlWLOl2GaCNKkTVpixzHP185UR5mms5IGPrao7Vb4ysfMQoANdpg6cDJdV?= =?us-ascii?Q?b79wWO0977g8GWR9PIGbVbBLcM+ndWLuZ1Sz028INtMot02JrDhhpvnmj4V5?= =?us-ascii?Q?nuuKMSR0R/Xv+OX/94ukIe/RHBLEr4xgynvCuax2bFVoTJthFDaYdFkHU0cA?= =?us-ascii?Q?1hZiijomtDcvyf8YBixRsZbujAZkdbpz0W8Sm1tWWy2iqMvebrfLD9nyLp+x?= =?us-ascii?Q?AblEn0nBttTmHYq6gXKV+P5XOx4o1wGBaBZ6LiCLwBQciKQRKFptjrGtRpKT?= =?us-ascii?Q?Wr4TD/ixLDYLrmr5wAZsBSyVAXt0GYVSvEIP7Gij8jzUHe+wEI8SPLVFweX7?= =?us-ascii?Q?k1hqYUxWBEVhysnX/8FqUsuDCCl/SOSvoRnxxa1gI8nZ3W+ogQeyzacO/qJR?= =?us-ascii?Q?zeel/YqtWA+VhycvfP5Y9e3lSYodWbAU8T6d1/TI146lmYbIM8RyCsY9UWEB?= =?us-ascii?Q?H1p16EJ+Xob8Gqb88iFBjOsH0XxOGbiXAegl3q6NcrrRbS8M/cVu3LPavAfY?= =?us-ascii?Q?cOoHwmkEpbu0w3VDkC06xScNZ2IvvvpWJOQHsnpPivgwwtrHbPO2NsFJnAPf?= =?us-ascii?Q?6dXvcarNx3hCArNkbwv+KW4aIHShBUovVh91fqH3U7YDi6H18pD/QyA+e013?= =?us-ascii?Q?NAGiOA3MVKyKOk0l8vG9eccGiw55OiApGQBezPwokn6fJL1Rr9P/GdatDSed?= =?us-ascii?Q?0/mcz9eySAIbcibAnJw6hcRtxWXWLfy7CCp6807l0kIFe4u5shv0cpPvPHR6?= =?us-ascii?Q?UBy3bfDeZsFSf/3VOLnCYaEY2c5AJiwrLeVhbq/NLu775k5OCq/nvY6MFfZb?= =?us-ascii?Q?9fusOY8uhtRw7YSxEaI4xlNATvrI8ock+YqAgpyQdbREdnL4Cz+UaqNZBmqR?= =?us-ascii?Q?jVWXB/4uKFiYOdBLhDHWhPzQm9cC9skzDmL4lkjVVnHAjx7MejO2OQ2ARcuS?= =?us-ascii?Q?6cNzRL9/sSbMN63IevzbskBpacIeo/1ZEUac3IZTb6dSPJ47uGa50obJrbm+?= =?us-ascii?Q?Nj8Fh8PPOsydpdLHpVhYnkYflLecHeXUDPfuGFcPTW0IyNE7RcuP1iQ5ePOV?= =?us-ascii?Q?4xNhFLbAsGxxhKRAp+yh2H4D1EFEFb1c48vcreFNRtuOFpVnVBcX6A7XoWuh?= =?us-ascii?Q?QoaqQjHAZcF/3WN9HJZJGCC9GiGnwYryMC8J52edZBX8wtAdzxI2+Mh9Lrp+?= =?us-ascii?Q?bv8tkbPjkBPwNdf8lEJysTHuJ6xchcF57VNPqJjsV36bmMwuS+8pHr2SdEQH?= =?us-ascii?Q?DGz+GI+C69QZWPUVkWZWT+LogwM6/w+c8EY7TcaJOC3hPBXI3dEpwEC0/u1e?= =?us-ascii?Q?jCxHTCscLJcYu2CekcKB68c0jl4IWiQu3oYRRAiIaKgmglYWce4PWHCcZMpj?= =?us-ascii?Q?re2xBg=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(7416014)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EgKlvxBtVhjVT3+X2gUfA4hPKX8z85a1rQ2ABlSHFeqjqAk1DyILbeJS7gsBM2HtdzW1ztnOR4Oa8xD7daAe7c7uZ/ukPAeHYTXqr86vdwETuxTT/o1ZNUohZD+Tqh4EjFpWj/pqeQAj4wuJwtvTbcmSZ7PMhND/n0+8pbJeWwO9u113pOuSENwaHy60IrKxG8BkWryQJactWS/hFmiBvk6rWzHEWsoma+xzEAQenNr8gPBDuB40C8IoqfppgQZ/uONza7uHoRooqOwQxAjjMc9+yAZSiE86rOwu5sRn2eY98OF+z4Urk/YIayz4XcX3Upkv3ZEUoWxY26bJMvm3vvjBA6DWAGSP97z5yZ4rMMm8qwRlE9CvePG/KrwGYT5vcVkSHmNTvaaOGjpB5WfWN/gWULmCHf3RwAjX/Es/NSPOOQMy3LfHf82Zkfu4qVRl X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2026 07:11:49.0195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b657ca2c-8124-4f98-458c-08de62f37faa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099E2.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB9009 Content-Type: text/plain; charset="utf-8" From: Or Har-Toov Add selftest to verify port-level resource functionality using netdevsim. Signed-off-by: Or Har-Toov Reviewed-by: Shay Drori Reviewed-by: Moshe Shemesh Signed-off-by: Tariq Toukan --- .../drivers/net/netdevsim/devlink.sh | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh b/too= ls/testing/selftests/drivers/net/netdevsim/devlink.sh index 1b529ccaf050..674f0e981ab0 100755 --- a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh +++ b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh @@ -5,7 +5,7 @@ lib_dir=3D$(dirname $0)/../../../net/forwarding =20 ALL_TESTS=3D"fw_flash_test params_test \ params_default_test regions_test reload_test \ - netns_reload_test resource_test dev_info_test \ + netns_reload_test resource_test port_resource_test dev_info_test \ empty_reporter_test dummy_reporter_test rate_test" NUM_NETIFS=3D0 source $lib_dir/lib.sh @@ -856,6 +856,36 @@ rate_test() log_test "rate test" } =20 +port_resource_test() +{ + RET=3D0 + + local first_port=3D"${DL_HANDLE}/0" + local name + local size + + devlink port resource show "$first_port" > /dev/null 2>&1 + check_err $? "Failed to show port resource for $first_port" + + name=3D$(cmd_jq "devlink port resource show $first_port -j" \ + ".[][][].name") + [ "$name" =3D=3D "max_sfs" ] + check_err $? "Unexpected resource name $name (expected max_sfs)" + + size=3D$(cmd_jq "devlink port resource show $first_port -j" \ + ".[][][].size") + [ "$size" =3D=3D "20" ] + check_err $? "Unexpected resource size $size (expected 20)" + + devlink port resource show "$DL_HANDLE" > /dev/null 2>&1 + check_err $? "Failed to show port resources for $DL_HANDLE" + + devlink port resource show > /dev/null 2>&1 + check_err $? "Failed to dump all port resources" + + log_test "port resource test" +} + setup_prepare() { modprobe netdevsim --=20 2.40.1 From nobody Sat Feb 7 17:09:53 2026 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012066.outbound.protection.outlook.com [40.107.200.66]) (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 AB82C392838; Tue, 3 Feb 2026 07:12:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.200.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102724; cv=fail; b=t+pqDxJ+IGUn2PfdP06ctzqTdicngt/djleNZCmbdDZN/9gAtClZDhNbuhJEO06QY/fSST0tX5/csp473C0psnDKHFlNl+/BEGWV+IuKFySkhj1UEGDvXCuqxRfd1rfVzxBIJ7wFzsoQU1e3h0bQ9NO62fqlx9VryOdCxyAyZxw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102724; c=relaxed/simple; bh=IeDfjw48HmZ3YdMpG3r21iM0qs71h8hcjNaJ+NF4vL8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KhlXsXYAfwKMn3mLVA+F2c1kLiC7RDMZ6qCdEafC92cwHGD0JkZ4tUz54cMy8aLCykB5fU64ETRByP93Kmdxj+AXT+q5PMcjw2yJn8LlKD/X3k2U7zN2fq5XEy6jE+lKT4/kT9ibeRW49F950kyQKpsVPHnanXA8OTlH5GIXGdM= 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=RmnPPfXA; arc=fail smtp.client-ip=40.107.200.66 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="RmnPPfXA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iSSqjRZj5ygLpzDR2hKsOTuKhj5V1SGEbzOfUmkNi/+3u8M5ig/znR3Vv8AzZchViukz6ZOrCdyfW70a3stra9WleXQsmj68DNgZogu/tGrjdgv3V0ffVYV8hZfgWtyhKm4KWmSylc2DwIg8gYz1ezslT6Snx2xDSUVaFvSuDy93AGQcak6XeCLOiOVI501PDc2m64UCG/ytPA0LdmrQGwW4+3HIqi1jVn1nDzdoCCVz6da3/BxHFNY+LiyOKgU+kXEAvcySVIvLCV4+8OeJkWdB+N+Gp2biL4+wHNY8hs2JP0fDG6CLF3QFTqN0ABsY8fwage194PfEH+ytvT71cA== 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=JoWkJA/x1MYMhZqgwhvoRYJPhCcqdNZBLJ/u6wfJcyY=; b=JwrhCC0TqpQEHTfa0o819AnViSzSQpnKcgtacz/JTPFEN/EesdWeqcRekl4YxcTxxsfjUz+7K/Nc+ssaPH5dppOQfgw54QsZx3GBlQ6/v1Cg8Ju8ZkfRBq36gXDjYQy+8Px9cbo0aULZwraeGKQcEVonFO2CVN5gavHi0eJf9lkV0Vo2KC4RSboYjBdq+itFisDvpfnvtYJLG0bn5Tit4c/KyO+Pty2CyzzVSN3ioi3rrse2b0vuPmKtSB19sjUZPpOehXpYQvoA5IEFixAJzEoLppV3C+8zDZVKpM7kND0Tn4rjcz+ICg9VnVodUk2EtWfCrTqtapcG6vEHJ2AbLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=JoWkJA/x1MYMhZqgwhvoRYJPhCcqdNZBLJ/u6wfJcyY=; b=RmnPPfXALHniL1WNtx0FKJNUD1LDgRONyry29zO9umpCQkUIcNFbDA/MB7zb2LEshOrmepnNdXe+7Rc/LZYceGwwj8gVlnjwNFqNquQBWfc4bzoKy+F624lPZ/ANB4+UUmOzQTBHYjyJsJcmDFEy9bLw+3zJwuVeS5Odz8ndnUCOkj4uGHMuOhN1uoAOdgDVt2Ksu/948/DIg7Gx9a+1COM+obvavbvf5b78fn3hpSkVJQ9jURRPEIxbzsD5cmIuPhVz5mq1LliAHr0nASvBVA4uyqaWs3wa11mlKtQP2xIid3k3eNUeX1v0ntPRS0pqdQOHB7IK0U+7RqGeaXCVMg== Received: from DS7PR05CA0070.namprd05.prod.outlook.com (2603:10b6:8:57::28) by BN5PR12MB9488.namprd12.prod.outlook.com (2603:10b6:408:2a9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.7; Tue, 3 Feb 2026 07:11:56 +0000 Received: from DS2PEPF0000343E.namprd02.prod.outlook.com (2603:10b6:8:57:cafe::28) by DS7PR05CA0070.outlook.office365.com (2603:10b6:8:57::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9587.12 via Frontend Transport; Tue, 3 Feb 2026 07:11:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS2PEPF0000343E.mail.protection.outlook.com (10.167.18.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.10 via Frontend Transport; Tue, 3 Feb 2026 07:11:56 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:39 -0800 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Mon, 2 Feb 2026 23:11:38 -0800 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.2562.20 via Frontend Transport; Mon, 2 Feb 2026 23:11:33 -0800 From: Tariq Toukan To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "David S. Miller" CC: Donald Hunter , Jiri Pirko , Jonathan Corbet , Saeed Mahameed , "Leon Romanovsky" , Tariq Toukan , Mark Bloch , Shuah Khan , , , , , , Gal Pressman , Moshe Shemesh , Shay Drori , Jiri Pirko , Or Har-Toov Subject: [PATCH net-next 5/5] devlink: Document port-level resources Date: Tue, 3 Feb 2026 09:10:33 +0200 Message-ID: <20260203071033.1709445-6-tariqt@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20260203071033.1709445-1-tariqt@nvidia.com> References: <20260203071033.1709445-1-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343E:EE_|BN5PR12MB9488:EE_ X-MS-Office365-Filtering-Correlation-Id: 3fb59586-862d-4a99-d6dd-08de62f3840f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GDg2vsJO3riCoRsWPwBJ7TUU90kHMTfH5qrdnLrfgmnRbTPkMswTMr1hI1Zx?= =?us-ascii?Q?mqZzyq3q3UhZpCEw5fuTRVzp79AGgb0zSkvTcmQCHfrYSOzU8/bciz43ix2Q?= =?us-ascii?Q?yer19ldZIW4JDCmidwjSRapqqAkvf3axmGjqPT+S1SySMFLHxyQXk5/CVopn?= =?us-ascii?Q?96w9Aoitle35tgYWXrOR6M5PKaG7QafW+G/LhJrAzbAieUK0XyH4f444D5Jw?= =?us-ascii?Q?3v8urHjQYQpHPzKcuzvv0uqJFULwkcZcZhZxeac2cIcmFcpHz0iEsYitSkCL?= =?us-ascii?Q?VAwzDn6iHSZzqVwaAos/Ho4si0UUcmn+F+ZMrhcRfTQxbx914WipyGn8qOI9?= =?us-ascii?Q?kkGAjvIVHhcf2fPRudHSqIr39Lova4j62+8cynK5Soen/xLo3Q2N7kL+1r1b?= =?us-ascii?Q?t/r5mBMGchlkc5+N8ZkPlbgswXPVR2tnA/bokc448UFYZsh1ONxGM0vQsPhU?= =?us-ascii?Q?V8jAXSyQ5Ifo3eweRO71XTXoFuezdEhgBxnYGOSgnvfBKxoVsLEJlVSnPPJz?= =?us-ascii?Q?StVLv+VPJgLvjhbjNidF7QioDRcJzt+xURhnvV2oIRZ5uvyI+L/pG13Xy1C+?= =?us-ascii?Q?zyjjuxr3mDSivQaetYgBGZaW+KHEpJ9LFoQPmfDuNDO9mW3k0OnxICv1KcLk?= =?us-ascii?Q?Rmx63hfWu8lP5jg3LxxXlbYWDu7kX8Cj5gfRhHvEsdura2KzzmPQIWTO3C94?= =?us-ascii?Q?d0JegEKN6aRt0mDigWFXNqGjh7DBMWwI648SR5h2HM5iEqe2NyTs8LR7GkRe?= =?us-ascii?Q?zLH6qlVBrKCL24MUY/F80VHx32xCHUgEDYZcjCODTICfyaereDaYDrYPO0Gu?= =?us-ascii?Q?HNqm2npw8yp3YypQhtW1RedfCTRN8OYw16EbOXRAF+vlb+nC91PbLU5yworf?= =?us-ascii?Q?rwT0wjDJa3afqpZdsvNTS7QeyvkQpdv0rKiN+eEA8vUowdW00nLgDKrT6ys7?= =?us-ascii?Q?W3//Ko79UkjEfeeqvUaeOU2DQeE8f1T0yw6xqj/0m/zbZCqovlG29hvXSeL5?= =?us-ascii?Q?lwAPB/ATo09W1UWw0YfLdoP5L3qUBqvR/gZxBhfUJUItGQM3WMDhBfPfYla6?= =?us-ascii?Q?okSBQLQ2gE+xooJA7GqsTCFX47JXCcw4skJA96plVWy05PwWGiThzgtuo+Ka?= =?us-ascii?Q?WxSS/m7wslSva9ljytEWcqjNycwQiDe59y8uxW4yjnu0Zqa2/cpn/+UY24k3?= =?us-ascii?Q?+s7qN48k8rNbRQCsxHEkMT08CkJ0/fVi1qTOqYs79tNPU3PaJhXvUCPmZGe8?= =?us-ascii?Q?tawPjZYGmyjYUghS30g8FcirYl6LqqjLxLxq4PBkjT0oel+5Au/OEy5C/a4+?= =?us-ascii?Q?mTdr3oTH6aLkY5Be+J/3HRT3y/O3rBJonAlI8uiZoT0HAyJnsBuKo0v4t24Y?= =?us-ascii?Q?x1gE0vpCRVYLXT+UqE8ZwNl5BM7Dp/NEFrnSnuff1YURJUrlIK8xI1woLpwq?= =?us-ascii?Q?MQI1Yab3YXmIR3zq9Qz1ATiU6RdLcM50do3A7sgrcL2SK+pzC5bN/4lVkYCB?= =?us-ascii?Q?FhdfE9THpuqBD8cC0QwHf0+19HiJz4FA5qB+PRLJ2vBRMMTLiyYuK26sHfTJ?= =?us-ascii?Q?wPIBYNeUiI0r2mAbdzIoZolSuwThaFlJsUA4YddOasetfYDofJuRYsqYevQP?= =?us-ascii?Q?g+k9zyHeNxTj7vHEkudVD9P+7XNHw7ag4Bts2k0dC6zg0q6JjjTuZqHSEV3j?= =?us-ascii?Q?BCo2JQ=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NhEuXjaJBTQ0ajlLVh2cqNMv4erVuNtr/u07pHndinOjaF5tiaDs4uJzAUXJoR85UCfZoLYggcncbVNHvH2Q45Kr3p+eESia8JSONG2k05PcYAacvFVLiOZwHrUlO6WWhp09d3Df6zcJXDPzbNQrReQWogkVv/GaQhu9wlJWxYNP9Y0RFU/IPjAkiKRepsYoObkOF6cseF9jfHBza9UCPKsLxnhHz370MkWKCeRQilXU1OqTRfd09x9Da6pBtA//cq7KXWzaej8JGn7nqZuowLXchW4qfL55Xt3mCpYiU2xZBI2gA9EHJwmqGn/LdYngZiNK2xUNxG7JrfJfTSRT6MwFzTMKwg/hh5qhhPeK0bBxBPDLiETXvDkr5kayJHkM73DDm6g5r1+hEml1HT6UDOf2SVUxUUNqAGBPgqlTgqw5FRtJU8nRPedN/lLa0Tuu X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2026 07:11:56.3963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3fb59586-862d-4a99-d6dd-08de62f3840f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF0000343E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN5PR12MB9488 Content-Type: text/plain; charset="utf-8" From: Or Har-Toov Add documentation for the port-level resource feature to devlink-resource.rst. Port-level resources allow viewing resources associated with specific devlink ports. Currently, port-level resources only support the show command for viewing resource information. Signed-off-by: Or Har-Toov Reviewed-by: Shay Drori Reviewed-by: Moshe Shemesh Signed-off-by: Tariq Toukan --- .../networking/devlink/devlink-resource.rst | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Documentation/networking/devlink/devlink-resource.rst b/Docume= ntation/networking/devlink/devlink-resource.rst index 3d5ae51e65a2..4cdfc1dce180 100644 --- a/Documentation/networking/devlink/devlink-resource.rst +++ b/Documentation/networking/devlink/devlink-resource.rst @@ -74,3 +74,39 @@ attribute, which represents the pending change in size. = For example: =20 Note that changes in resource size may require a device reload to properly take effect. + +Port-level Resources +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +In addition to device-level resources, ``devlink`` also supports port-level +resources. These resources are associated with a specific devlink port rat= her +than the device as a whole. + +Currently, port-level resources only support the ``show`` command for view= ing +resource information. + +Port-level resources can be viewed for a specific port: + +.. code:: shell + + $ devlink port resource show pci/0000:03:00.0/196608 + pci/0000:03:00.0/196608: + name max_sfs size 20 unit entry + +Or for ports of a specific device: + +.. code:: shell + + $ devlink port resource show pci/0000:03:00.0 + pci/0000:03:00.0/196608: + name max_sfs size 20 unit entry + +Or for all ports across all devices: + +.. code:: shell + + $ devlink port resource show + pci/0000:03:00.0/196608: + name max_sfs size 20 unit entry + pci/0000:03:00.1/262144: + name max_SFs size 20 unit entry --=20 2.40.1