RE: [PATCH net-next 1/2] devlink: add generic device max_sfs parameter
From: Loktionov, Aleksandr
Date: Mon May 18 2026 - 04:58:22 EST
> -----Original Message-----
> From: Tariq Toukan <tariqt@xxxxxxxxxx>
> Sent: Sunday, May 17, 2026 1:27 PM
> To: Eric Dumazet <edumazet@xxxxxxxxxx>; Jakub Kicinski
> <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>; Andrew Lunn
> <andrew+netdev@xxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>
> Cc: Jiri Pirko <jiri@xxxxxxxxxxx>; Simon Horman <horms@xxxxxxxxxx>;
> Jonathan Corbet <corbet@xxxxxxx>; Shuah Khan
> <skhan@xxxxxxxxxxxxxxxxxxx>; Saeed Mahameed <saeedm@xxxxxxxxxx>; Leon
> Romanovsky <leon@xxxxxxxxxx>; Tariq Toukan <tariqt@xxxxxxxxxx>; Mark
> Bloch <mbloch@xxxxxxxxxx>; Vlad Dumitrescu <vdumitrescu@xxxxxxxxxx>;
> Loktionov, Aleksandr <aleksandr.loktionov@xxxxxxxxx>; Daniel Zahka
> <daniel.zahka@xxxxxxxxx>; David Ahern <dsahern@xxxxxxxxxx>; Nikolay
> Aleksandrov <razor@xxxxxxxxxxxxx>; netdev@xxxxxxxxxxxxxxx; linux-
> doc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> rdma@xxxxxxxxxxxxxxx; Gal Pressman <gal@xxxxxxxxxx>; Dragos Tatulea
> <dtatulea@xxxxxxxxxx>; Jiri Pirko <jiri@xxxxxxxxxx>; Nikolay
> Aleksandrov <nikolay@xxxxxxxxxx>
> Subject: [PATCH net-next 1/2] devlink: add generic device max_sfs
> parameter
>
> From: Nikolay Aleksandrov <nikolay@xxxxxxxxxx>
>
> Add a new generic devlink device parameter (max_sfs) to control if and
> how many light-weight NIC subfunctions can be created. Subfunctions
> are a light-weight network functions backed by an underlying PCI
> function.
> Their lifecycle can already be managed by devlink, but currently users
> cannot enable them in the device. They can be enabled/disabled only
> via external vendor tools. This parameter allows subfunctions to be
> enabled
> (>0) or disabled (0) via devlink. A subsequent patch will add support
> for max_sfs to the mlx5 driver.
>
> Signed-off-by: Nikolay Aleksandrov <nikolay@xxxxxxxxxx>
> Reviewed-by: David Ahern <dsahern@xxxxxxxxxx>
> Reviewed-by: Jiri Pirko <jiri@xxxxxxxxxx>
> Signed-off-by: Tariq Toukan <tariqt@xxxxxxxxxx>
> ---
> Documentation/networking/devlink/devlink-params.rst | 6 ++++++
> include/net/devlink.h | 4 ++++
> net/devlink/param.c | 5 +++++
> 3 files changed, 15 insertions(+)
>
> diff --git a/Documentation/networking/devlink/devlink-params.rst
> b/Documentation/networking/devlink/devlink-params.rst
> index ea17756dcda6..29b8a9246fb6 100644
> --- a/Documentation/networking/devlink/devlink-params.rst
> +++ b/Documentation/networking/devlink/devlink-params.rst
> @@ -165,3 +165,9 @@ own name.
> - u32
> - Controls the maximum number of MAC address filters that can be
> assigned
> to a Virtual Function (VF).
> + * - ``max_sfs``
> + - u32
> + - The maximum number of subfunctions which can be created on the
> device.
> + Modifying this parameter may require a device restart and PCI
> bus
> + rescanning because the BAR layout may change. A value of 0
> disables
> + subfunction creation.
> diff --git a/include/net/devlink.h b/include/net/devlink.h index
> bcd31de1f890..4ec455cfe7a4 100644
> --- a/include/net/devlink.h
> +++ b/include/net/devlink.h
> @@ -546,6 +546,7 @@ enum devlink_param_generic_id {
> DEVLINK_PARAM_GENERIC_ID_TOTAL_VFS,
> DEVLINK_PARAM_GENERIC_ID_NUM_DOORBELLS,
> DEVLINK_PARAM_GENERIC_ID_MAX_MAC_PER_VF,
> + DEVLINK_PARAM_GENERIC_ID_MAX_SFS,
>
> /* add new param generic ids above here*/
> __DEVLINK_PARAM_GENERIC_ID_MAX,
> @@ -619,6 +620,9 @@ enum devlink_param_generic_id { #define
> DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_NAME "max_mac_per_vf"
> #define DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_TYPE
> DEVLINK_PARAM_TYPE_U32
>
> +#define DEVLINK_PARAM_GENERIC_MAX_SFS_NAME "max_sfs"
> +#define DEVLINK_PARAM_GENERIC_MAX_SFS_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
> cf95268da5b0..523243e49d88 100644
> --- a/net/devlink/param.c
> +++ b/net/devlink/param.c
> @@ -117,6 +117,11 @@ static const struct devlink_param
> devlink_param_generic[] = {
> .name = DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_NAME,
> .type = DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_TYPE,
> },
> + {
> + .id = DEVLINK_PARAM_GENERIC_ID_MAX_SFS,
> + .name = DEVLINK_PARAM_GENERIC_MAX_SFS_NAME,
> + .type = DEVLINK_PARAM_GENERIC_MAX_SFS_TYPE,
> + },
> };
>
> static int devlink_param_generic_verify(const struct devlink_param
> *param)
> --
> 2.44.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>