From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E355310957 for ; Sun, 7 Sep 2025 01:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757208616; cv=none; b=RiJqI9AOpCeHBzgZwCsWGOqJejg2keomx7HwtEXJ+ZfULABmTpmmdngUHbg4V4dfqXIMosRXP6L6uO2GjmJQlSDmGsoPFbsPGfeEEn8z4euhP1IPFIosWt/aaGZ+jQiilknm/+mwZiJIbHW9SxpYBtrCwoh+cHKccMMa8bRAnYw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757208616; c=relaxed/simple; bh=EWbUFvMA4MXxX2lK1OzuBkqWJ0ExsqIf4ot/1FqlHoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RVTnC5fjN7Tp3PWifvGNIGVoQMayCQFXw0hrXT+0jnesI2OeFxXEsdLvMxu1GJLrONq3g0YPqzjjiGKgZn53Y/kj4Q230tUneZrxHLfWzLPp0Or7xAS0GO9qKch8axzCpQSO2rtikCJduD90IKv6t79KCw2wkoE7MflIS9H4FbI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ptk8X3Ip; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ptk8X3Ip" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABB00C4CEF7; Sun, 7 Sep 2025 01:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757208615; bh=EWbUFvMA4MXxX2lK1OzuBkqWJ0ExsqIf4ot/1FqlHoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptk8X3IpbvXaHqkwo6aiaeiJym4C79a+1vTkRukop1DoSJsOwHVCvrM4Do51tkJI9 kwGlBGVE5bCmlxfsHEOqMp+4spAVzjX+jJ/ZiPZY02Ouglmiz9lVTOjU1WNICNb1eP N5dLfYnDOuaCWmEqq8qKQxFm8pY3TYZTa7x8x7lQozLwR7nfaXKrnVN9sSpuwEcFYF COhRD0wTk/J9MyZ4zGJpUog2TmajYzX0sH8I4bh/CP+xHQQ7NVNmEyoh5Xhwi7qx3B uFn9eLYBNQxbmcL8ZvMiVgpUZ8XVHXzA3zymSnWZi3Z988fp7ileK8xymD7mwhMk+d AsB5FAU7520ZA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Jiri Pirko , Jacob Keller , Simon Horman , Vlad Dumitrescu , Kamal Heib Subject: [PATCH V7 net-next 01/11] devlink: Add 'total_vfs' generic device param Date: Sat, 6 Sep 2025 18:29:43 -0700 Message-ID: <20250907012953.301746-2-saeed@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250907012953.301746-1-saeed@kernel.org> References: <20250907012953.301746-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Vlad Dumitrescu NICs are typically configured with total_vfs=0, forcing users to rely on external tools to enable SR-IOV (a widely used and essential feature). Add total_vfs parameter to devlink for SR-IOV max VF configurability. Enables standard kernel tools to manage SR-IOV, addressing the need for flexible VF configuration. Signed-off-by: Vlad Dumitrescu Tested-by: Kamal Heib Reviewed-by: Jiri Pirko Signed-off-by: Saeed Mahameed Reviewed-by: Simon Horman --- Documentation/networking/devlink/devlink-params.rst | 5 +++++ include/net/devlink.h | 4 ++++ net/devlink/param.c | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/Documentation/networking/devlink/devlink-params.rst b/Documentation/networking/devlink/devlink-params.rst index 211b58177e12..c51da4fba7e7 100644 --- a/Documentation/networking/devlink/devlink-params.rst +++ b/Documentation/networking/devlink/devlink-params.rst @@ -143,3 +143,8 @@ own name. * - ``clock_id`` - u64 - Clock ID used by the device for registering DPLL devices and pins. + * - ``total_vfs`` + - u32 + - The max number of Virtual Functions (VFs) exposed by the PF. + after reboot/pci reset, 'sriov_totalvfs' entry under the device's sysfs + directory will report this value. diff --git a/include/net/devlink.h b/include/net/devlink.h index 5f44e702c25c..8d4362f010e4 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -530,6 +530,7 @@ enum devlink_param_generic_id { DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE, DEVLINK_PARAM_GENERIC_ID_ENABLE_PHC, DEVLINK_PARAM_GENERIC_ID_CLOCK_ID, + DEVLINK_PARAM_GENERIC_ID_TOTAL_VFS, /* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX, @@ -594,6 +595,9 @@ enum devlink_param_generic_id { #define DEVLINK_PARAM_GENERIC_CLOCK_ID_NAME "clock_id" #define DEVLINK_PARAM_GENERIC_CLOCK_ID_TYPE DEVLINK_PARAM_TYPE_U64 +#define DEVLINK_PARAM_GENERIC_TOTAL_VFS_NAME "total_vfs" +#define DEVLINK_PARAM_GENERIC_TOTAL_VFS_TYPE DEVLINK_PARAM_TYPE_U32 + #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \ { \ .id = DEVLINK_PARAM_GENERIC_ID_##_id, \ diff --git a/net/devlink/param.c b/net/devlink/param.c index 41dcc86cfd94..33134940c266 100644 --- a/net/devlink/param.c +++ b/net/devlink/param.c @@ -102,6 +102,11 @@ static const struct devlink_param devlink_param_generic[] = { .name = DEVLINK_PARAM_GENERIC_CLOCK_ID_NAME, .type = DEVLINK_PARAM_GENERIC_CLOCK_ID_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_TOTAL_VFS, + .name = DEVLINK_PARAM_GENERIC_TOTAL_VFS_NAME, + .type = DEVLINK_PARAM_GENERIC_TOTAL_VFS_TYPE, + }, }; static int devlink_param_generic_verify(const struct devlink_param *param) -- 2.51.0