* [PATCH net-next] net/mlx5: Remove max_external_SFs device resource
@ 2026-10-11 9:38 Tariq Toukan
2026-10-12 9:40 ` netdev-bot+sashiko
0 siblings, 1 reply; 3+ messages in thread
From: Tariq Toukan @ 2026-10-11 9:38 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
netdev, Paolo Abeni
Cc: Carolina Jubran, Chris Mi, Cosmin Ratiu, Gal Pressman,
Jiri Pirko, Jonathan Corbet, Kees Cook, Leon Romanovsky,
linux-doc, open list, linux-rdma, Mark Bloch, Moshe Shemesh,
Or Har-Toov, Randy Dunlap, Saeed Mahameed, Shay Drori,
Shuah Khan, Simon Horman, Tariq Toukan
From: Or Har-Toov <ohartoov@nvidia.com>
The device-level max_external_SFs resource is redundant now that
per-port max_SFs resources are registered on each PF port representor.
Users can look up SF limits per-port directly via 'devlink port show'
to correlate with controller number and pfnum.
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
.../networking/devlink/devlink-resource.rst | 4 ----
.../net/ethernet/mellanox/mlx5/core/devlink.h | 1 -
.../ethernet/mellanox/mlx5/core/sf/hw_table.c | 19 ++++++-------------
3 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/Documentation/networking/devlink/devlink-resource.rst b/Documentation/networking/devlink/devlink-resource.rst
index 47eec8f875b4..b7172d94b2c6 100644
--- a/Documentation/networking/devlink/devlink-resource.rst
+++ b/Documentation/networking/devlink/devlink-resource.rst
@@ -89,14 +89,12 @@ To list resources for all devlink devices and ports:
$ devlink resource show
pci/0000:03:00.0:
name max_local_SFs size 128 unit entry dpipe_tables none
- name max_external_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.0/196608:
name max_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.0/196609:
name max_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.1:
name max_local_SFs size 128 unit entry dpipe_tables none
- name max_external_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.1/196708:
name max_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.1/196709:
@@ -124,10 +122,8 @@ To dump only device-level resources across all devices:
$ devlink resource show scope dev
pci/0000:03:00.0:
name max_local_SFs size 128 unit entry dpipe_tables none
- name max_external_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.1:
name max_local_SFs size 128 unit entry dpipe_tables none
- name max_external_SFs size 128 unit entry dpipe_tables none
To dump only port-level resources across all devices:
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h b/drivers/net/ethernet/mellanox/mlx5/core/devlink.h
index 4fbb3926a3e5..b4092eadfe53 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.h
@@ -8,7 +8,6 @@
enum mlx5_devlink_resource_id {
MLX5_DL_RES_MAX_LOCAL_SFS = 1,
- MLX5_DL_RES_MAX_EXTERNAL_SFS,
__MLX5_ID_RES_MAX,
MLX5_ID_RES_MAX = __MLX5_ID_RES_MAX - 1,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
index 1724bf7e0e7a..c36dbd7de877 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
@@ -262,24 +262,17 @@ static void mlx5_sf_hw_table_res_unregister(struct mlx5_core_dev *dev)
devl_resources_unregister(priv_to_devlink(dev));
}
-static int mlx5_sf_hw_table_res_register(struct mlx5_core_dev *dev, u16 max_fn,
- u16 max_ext_fn)
+static int mlx5_sf_hw_table_res_register(struct mlx5_core_dev *dev,
+ u16 max_fn)
{
struct devlink_resource_size_params size_params;
struct devlink *devlink = priv_to_devlink(dev);
- int err;
devlink_resource_size_params_init(&size_params, max_fn, max_fn, 1,
DEVLINK_RESOURCE_UNIT_ENTRY);
- err = devl_resource_register(devlink, "max_local_SFs", max_fn, MLX5_DL_RES_MAX_LOCAL_SFS,
- DEVLINK_RESOURCE_ID_PARENT_TOP, &size_params);
- if (err)
- return err;
-
- devlink_resource_size_params_init(&size_params, max_ext_fn, max_ext_fn, 1,
- DEVLINK_RESOURCE_UNIT_ENTRY);
- return devl_resource_register(devlink, "max_external_SFs", max_ext_fn,
- MLX5_DL_RES_MAX_EXTERNAL_SFS, DEVLINK_RESOURCE_ID_PARENT_TOP,
+ return devl_resource_register(devlink, "max_local_SFs", max_fn,
+ MLX5_DL_RES_MAX_LOCAL_SFS,
+ DEVLINK_RESOURCE_ID_PARENT_TOP,
&size_params);
}
@@ -303,7 +296,7 @@ int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev)
if (err)
return err;
- if (mlx5_sf_hw_table_res_register(dev, max_fn, max_ext_fn))
+ if (mlx5_sf_hw_table_res_register(dev, max_fn))
mlx5_core_dbg(dev, "failed to register max SFs resources");
if (!max_fn && !max_ext_fn && !mlx5_esw_has_spf_sfs(dev))
base-commit: d8674294aefef02266c4d47ad10131f1bffbe534
--
2.44.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/mlx5: Remove max_external_SFs device resource
2026-10-11 9:38 [PATCH net-next] net/mlx5: Remove max_external_SFs device resource Tariq Toukan
@ 2026-10-12 9:40 ` netdev-bot+sashiko
2026-10-12 17:12 ` Or Har-Toov
0 siblings, 1 reply; 3+ messages in thread
From: netdev-bot+sashiko @ 2026-10-12 9:40 UTC (permalink / raw)
To: tariqt
Cc: andrew+netdev, davem, edumazet, kuba, netdev, pabeni, cjubran,
cmi, cratiu, gal, jiri, corbet, kees, leon, linux-doc,
linux-kernel, linux-rdma, mbloch, moshe, ohartoov, rdunlap,
saeedm, shayd, skhan, horms
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch removes the device-scope devlink resource
`max_external_SFs` (resource id 2, MLX5_DL_RES_MAX_EXTERNAL_SFS) from…
- [Low] The commit message says "Users can look up SF limits per-port
directly via 'devlink port show'".
--
net/mlx5: Remove max_external_SFs device resource
This commit removes the device-level max_external_SFs devlink resource
from mlx5. The reason given is that the per-port max_SFs resources on
each PF port representor make it redundant. The devlink-resource.rst
examples are updated to match.
> Users can look up SF limits per-port directly via 'devlink port show'
> to correlate with controller number and pfnum.
[Severity: Low]
Is 'devlink port show' the right command here? Port-scoped resources are
returned by DEVLINK_CMD_RESOURCE_DUMP in net/devlink/resource.c. The port
get reply does not include them:
net/devlink/resource.c:devlink_nl_resource_dump_doit() {
...
resource_list = devlink_port ?
&devlink_port->resource_list : &devlink->resource_list;
...
}
The devlink-resource.rst updated by this patch lists port resources with
'devlink resource show pci/0000:03:00.0/196608' and 'devlink resource
show scope port'.
Could the commit message say that the max_SFs values come from devlink
resource show, and that devlink port show only maps the port index to
controller and pfnum?
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
> index 1724bf7e0e7af..c36dbd7de8778 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
> @@ -262,24 +262,17 @@ static void mlx5_sf_hw_table_res_unregister(struct mlx5_core_dev *dev)
> devl_resources_unregister(priv_to_devlink(dev));
> }
>
> -static int mlx5_sf_hw_table_res_register(struct mlx5_core_dev *dev, u16 max_fn,
> - u16 max_ext_fn)
> +static int mlx5_sf_hw_table_res_register(struct mlx5_core_dev *dev,
> + u16 max_fn)
> {
> struct devlink_resource_size_params size_params;
> struct devlink *devlink = priv_to_devlink(dev);
> - int err;
>
> devlink_resource_size_params_init(&size_params, max_fn, max_fn, 1,
> DEVLINK_RESOURCE_UNIT_ENTRY);
> - err = devl_resource_register(devlink, "max_local_SFs", max_fn, MLX5_DL_RES_MAX_LOCAL_SFS,
> - DEVLINK_RESOURCE_ID_PARENT_TOP, &size_params);
> - if (err)
> - return err;
> -
> - devlink_resource_size_params_init(&size_params, max_ext_fn, max_ext_fn, 1,
> - DEVLINK_RESOURCE_UNIT_ENTRY);
> - return devl_resource_register(devlink, "max_external_SFs", max_ext_fn,
> - MLX5_DL_RES_MAX_EXTERNAL_SFS, DEVLINK_RESOURCE_ID_PARENT_TOP,
> + return devl_resource_register(devlink, "max_local_SFs", max_fn,
> + MLX5_DL_RES_MAX_LOCAL_SFS,
> + DEVLINK_RESOURCE_ID_PARENT_TOP,
> &size_params);
> }
[Severity: Medium]
Does the per-port max_SFs fully replace max_external_SFs?
max_external_SFs has been visible on pci/<bdf> since commit 6486c0f44ed8
("net/mlx5: Expose max possible SFs via devlink resource"). It was
registered at probe, gated only by mlx5_vhca_event_supported(). Anything
that looks it up by name, or by resource id 2, will no longer find it in
any eswitch mode.
The replacement is registered only on this path:
mlx5_esw_offloads_load_rep()
mlx5_esw_offloads_devlink_port_register()
mlx5_esw_devlink_port_res_register()
Both ends of that path can skip it:
eswitch_offloads.c:mlx5_esw_offloads_load_rep() {
if (esw->mode != MLX5_ESWITCH_OFFLOADS)
return 0;
...
}
esw/devlink_port.c:mlx5_esw_devlink_port_res_register() {
...
if (vport_num != MLX5_VPORT_HOST_PF &&
!mlx5_esw_is_spf_vport(esw, vport_num))
return 0;
...
}
In legacy mode (the default at probe), or when the host PF representor
isn't loaded, does any devlink resource still report the external host
SF capacity?
mlx5_sf_hw_table_init() still computes max_ext_fn through
mlx5_esw_sf_max_hpf_functions() and uses it for MLX5_SF_HWC_EXT_HOST. So
the driver still has the value, but no longer exposes it.
Also, mlx5_esw_offloads_devlink_port_register() only reports a failure
from mlx5_esw_devlink_port_res_register() through mlx5_core_dbg(). If
that registration fails, nothing exposes the value at all.
max_local_SFs stays device-level and is always visible, so the two
limits are now exposed in different ways.
SF port creation already requires switchdev mode, so in legacy mode the
missing value is planning information rather than something needed at
runtime. Even so, neither the commit message nor the devlink-resource.rst
update says that a user-visible resource is being removed. Neither says
that the port-level max_SFs entries exist only in switchdev mode.
Could this be stated, or could the device-level entry be kept for
compatibility?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261011093828.784454-1-tariqt%40nvidia.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/mlx5: Remove max_external_SFs device resource
2026-10-12 9:40 ` netdev-bot+sashiko
@ 2026-10-12 17:12 ` Or Har-Toov
0 siblings, 0 replies; 3+ messages in thread
From: Or Har-Toov @ 2026-10-12 17:12 UTC (permalink / raw)
To: netdev-bot+sashiko, tariqt
Cc: andrew+netdev, davem, edumazet, kuba, netdev, pabeni, cjubran,
cmi, cratiu, gal, jiri, corbet, kees, leon, linux-doc,
linux-kernel, linux-rdma, mbloch, moshe, rdunlap, saeedm, shayd,
skhan, horms
On 12/10/2026 12:40, netdev-bot+sashiko@kernel.org wrote:
>
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 1
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] The patch removes the device-scope devlink resource
> `max_external_SFs` (resource id 2, MLX5_DL_RES_MAX_EXTERNAL_SFS) from…
> - [Low] The commit message says "Users can look up SF limits per-port
> directly via 'devlink port show'".
>
> --
>
> net/mlx5: Remove max_external_SFs device resource
>
> This commit removes the device-level max_external_SFs devlink resource
> from mlx5. The reason given is that the per-port max_SFs resources on
> each PF port representor make it redundant. The devlink-resource.rst
> examples are updated to match.
>
>> Users can look up SF limits per-port directly via 'devlink port show'
>> to correlate with controller number and pfnum.
>
> [Severity: Low]
> Is 'devlink port show' the right command here? Port-scoped resources are
> returned by DEVLINK_CMD_RESOURCE_DUMP in net/devlink/resource.c. The port
> get reply does not include them:
>
> net/devlink/resource.c:devlink_nl_resource_dump_doit() {
> ...
> resource_list = devlink_port ?
> &devlink_port->resource_list : &devlink->resource_list;
> ...
> }
>
> The devlink-resource.rst updated by this patch lists port resources with
> 'devlink resource show pci/0000:03:00.0/196608' and 'devlink resource
> show scope port'.
>
> Could the commit message say that the max_SFs values come from devlink
> resource show, and that devlink port show only maps the port index to
> controller and pfnum?
>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
>> index 1724bf7e0e7af..c36dbd7de8778 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
>> @@ -262,24 +262,17 @@ static void mlx5_sf_hw_table_res_unregister(struct mlx5_core_dev *dev)
>> devl_resources_unregister(priv_to_devlink(dev));
>> }
>>
>> -static int mlx5_sf_hw_table_res_register(struct mlx5_core_dev *dev, u16 max_fn,
>> - u16 max_ext_fn)
>> +static int mlx5_sf_hw_table_res_register(struct mlx5_core_dev *dev,
>> + u16 max_fn)
>> {
>> struct devlink_resource_size_params size_params;
>> struct devlink *devlink = priv_to_devlink(dev);
>> - int err;
>>
>> devlink_resource_size_params_init(&size_params, max_fn, max_fn, 1,
>> DEVLINK_RESOURCE_UNIT_ENTRY);
>> - err = devl_resource_register(devlink, "max_local_SFs", max_fn, MLX5_DL_RES_MAX_LOCAL_SFS,
>> - DEVLINK_RESOURCE_ID_PARENT_TOP, &size_params);
>> - if (err)
>> - return err;
>> -
>> - devlink_resource_size_params_init(&size_params, max_ext_fn, max_ext_fn, 1,
>> - DEVLINK_RESOURCE_UNIT_ENTRY);
>> - return devl_resource_register(devlink, "max_external_SFs", max_ext_fn,
>> - MLX5_DL_RES_MAX_EXTERNAL_SFS, DEVLINK_RESOURCE_ID_PARENT_TOP,
>> + return devl_resource_register(devlink, "max_local_SFs", max_fn,
>> + MLX5_DL_RES_MAX_LOCAL_SFS,
>> + DEVLINK_RESOURCE_ID_PARENT_TOP,
>> &size_params);
>> }
>
> [Severity: Medium]
> Does the per-port max_SFs fully replace max_external_SFs?
>
> max_external_SFs has been visible on pci/<bdf> since commit 6486c0f44ed8
> ("net/mlx5: Expose max possible SFs via devlink resource"). It was
> registered at probe, gated only by mlx5_vhca_event_supported(). Anything
> that looks it up by name, or by resource id 2, will no longer find it in
> any eswitch mode.
>
> The replacement is registered only on this path:
>
> mlx5_esw_offloads_load_rep()
> mlx5_esw_offloads_devlink_port_register()
> mlx5_esw_devlink_port_res_register()
>
> Both ends of that path can skip it:
>
> eswitch_offloads.c:mlx5_esw_offloads_load_rep() {
> if (esw->mode != MLX5_ESWITCH_OFFLOADS)
> return 0;
> ...
> }
>
> esw/devlink_port.c:mlx5_esw_devlink_port_res_register() {
> ...
> if (vport_num != MLX5_VPORT_HOST_PF &&
> !mlx5_esw_is_spf_vport(esw, vport_num))
> return 0;
> ...
> }
>
> In legacy mode (the default at probe), or when the host PF representor
> isn't loaded, does any devlink resource still report the external host
> SF capacity?
>
> mlx5_sf_hw_table_init() still computes max_ext_fn through
> mlx5_esw_sf_max_hpf_functions() and uses it for MLX5_SF_HWC_EXT_HOST. So
> the driver still has the value, but no longer exposes it.
>
> Also, mlx5_esw_offloads_devlink_port_register() only reports a failure
> from mlx5_esw_devlink_port_res_register() through mlx5_core_dbg(). If
> that registration fails, nothing exposes the value at all.
>
> max_local_SFs stays device-level and is always visible, so the two
> limits are now exposed in different ways.
>
> SF port creation already requires switchdev mode, so in legacy mode the
> missing value is planning information rather than something needed at
> runtime. Even so, neither the commit message nor the devlink-resource.rst
> update says that a user-visible resource is being removed. Neither says
> that the port-level max_SFs entries exist only in switchdev mode.
>
> Could this be stated, or could the device-level entry be kept for
> compatibility?
>
legacy mode is not relevant for SFs and when no host PF rep is loaded,
the external max SF showed 0 anyway.
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261011093828.784454-1-tariqt%40nvidia.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-12 17:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-11 9:38 [PATCH net-next] net/mlx5: Remove max_external_SFs device resource Tariq Toukan
2026-10-12 9:40 ` netdev-bot+sashiko
2026-10-12 17:12 ` Or Har-Toov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®