All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Gal Pressman <gal@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
	Simon Horman <horms@kernel.org>,
	Vlad Dumitrescu <vdumitrescu@nvidia.com>,
	Kamal Heib <kheib@redhat.com>
Subject: [PATCH net-next V6 01/13] devlink: Add 'total_vfs' generic device param
Date: Tue,  8 Jul 2025 20:04:43 -0700	[thread overview]
Message-ID: <20250709030456.1290841-2-saeed@kernel.org> (raw)
In-Reply-To: <20250709030456.1290841-1-saeed@kernel.org>

From: Vlad Dumitrescu <vdumitrescu@nvidia.com>

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 <vdumitrescu@nvidia.com>
Tested-by: Kamal Heib <kheib@redhat.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 Documentation/networking/devlink/devlink-params.rst | 3 +++
 include/net/devlink.h                               | 4 ++++
 net/devlink/param.c                                 | 5 +++++
 3 files changed, 12 insertions(+)

diff --git a/Documentation/networking/devlink/devlink-params.rst b/Documentation/networking/devlink/devlink-params.rst
index 3da8f4ef2417..f2920371622c 100644
--- a/Documentation/networking/devlink/devlink-params.rst
+++ b/Documentation/networking/devlink/devlink-params.rst
@@ -140,3 +140,6 @@ own name.
    * - ``enable_phc``
      - Boolean
      - Enable PHC (PTP Hardware Clock) functionality in the device.
+   * - ``total_vfs``
+     - u32
+     - The total number of Virtual Functions (VFs) supported by the PF.
diff --git a/include/net/devlink.h b/include/net/devlink.h
index d0ce5a7e984c..32508b4d5df3 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -523,6 +523,7 @@ enum devlink_param_generic_id {
 	DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE,
 	DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE,
 	DEVLINK_PARAM_GENERIC_ID_ENABLE_PHC,
+	DEVLINK_PARAM_GENERIC_ID_TOTAL_VFS,
 
 	/* add new param generic ids above here*/
 	__DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -584,6 +585,9 @@ enum devlink_param_generic_id {
 #define DEVLINK_PARAM_GENERIC_ENABLE_PHC_NAME "enable_phc"
 #define DEVLINK_PARAM_GENERIC_ENABLE_PHC_TYPE DEVLINK_PARAM_TYPE_BOOL
 
+#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 396b8a7f6013..3a5fe0a639ea 100644
--- a/net/devlink/param.c
+++ b/net/devlink/param.c
@@ -97,6 +97,11 @@ static const struct devlink_param devlink_param_generic[] = {
 		.name = DEVLINK_PARAM_GENERIC_ENABLE_PHC_NAME,
 		.type = DEVLINK_PARAM_GENERIC_ENABLE_PHC_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.50.0


  reply	other threads:[~2025-07-09  3:05 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09  3:04 [PATCH net-next V6 00/13] devlink, mlx5: Add new parameters for link management and SRIOV/eSwitch configurations Saeed Mahameed
2025-07-09  3:04 ` Saeed Mahameed [this message]
2025-07-09  8:36   ` [PATCH net-next V6 01/13] devlink: Add 'total_vfs' generic device param Simon Horman
2025-07-10  2:53   ` Jakub Kicinski
2025-07-10  5:38     ` Saeed Mahameed
2025-09-02 21:24       ` Jacob Keller
2025-09-03 21:32         ` Saeed Mahameed
2025-07-09  3:04 ` [PATCH net-next V6 02/13] net/mlx5: Implement cqe_compress_type via devlink params Saeed Mahameed
2025-07-09  8:37   ` Simon Horman
2025-07-09  9:06   ` Subbaraya Sundeep
2025-07-10  5:51     ` Saeed Mahameed
2025-07-11 16:19       ` Subbaraya Sundeep
2025-07-10  2:53   ` Jakub Kicinski
2025-07-10  5:44     ` Saeed Mahameed
2025-07-10 22:16       ` Jakub Kicinski
2025-07-09  3:04 ` [PATCH net-next V6 03/13] net/mlx5: Implement devlink enable_sriov parameter Saeed Mahameed
2025-07-09  8:37   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 04/13] net/mlx5: Implement devlink total_vfs parameter Saeed Mahameed
2025-07-09  8:37   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 05/13] devlink: pass struct devlink_port * as arg to devlink_nl_param_fill() Saeed Mahameed
2025-07-09  8:38   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 06/13] devlink: Implement port params registration Saeed Mahameed
2025-07-09  8:38   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 07/13] devlink: Implement get/dump netlink commands for port params Saeed Mahameed
2025-07-09  8:38   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 08/13] devlink: Implement set netlink command " Saeed Mahameed
2025-07-09  8:40   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 09/13] devlink: Add 'keep_link_up' generic devlink device param Saeed Mahameed
2025-07-09  8:40   ` Simon Horman
2025-07-10  2:58   ` Jakub Kicinski
2025-07-10  6:04     ` Saeed Mahameed
2025-07-10 12:45       ` Jiri Pirko
2025-07-10 22:24       ` Jakub Kicinski
2025-08-28 20:09         ` Saeed Mahameed
2025-08-28 22:38           ` Jakub Kicinski
2025-09-02 19:02             ` Saeed Mahameed
2025-09-02 21:57           ` Jacob Keller
2025-09-03  6:45             ` Saeed Mahameed
2025-09-03 19:59               ` Jacob Keller
2025-09-03 21:30                 ` Saeed Mahameed
2025-07-09  3:04 ` [PATCH net-next V6 10/13] net/mlx5: Implement devlink keep_link_up port parameter Saeed Mahameed
2025-07-09  8:40   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 11/13] devlink: Throw extack messages on param value validation error Saeed Mahameed
2025-07-09  8:40   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 12/13] devlink: Implement devlink param multi attribute nested data values Saeed Mahameed
2025-07-09  8:41   ` Simon Horman
2025-07-09  3:04 ` [PATCH net-next V6 13/13] net/mlx5: Implement eSwitch hairpin per prio buffers devlink params Saeed Mahameed
2025-07-09  8:41   ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250709030456.1290841-2-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=jiri@nvidia.com \
    --cc=kheib@redhat.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vdumitrescu@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.