net/mlx5: Remove max_external_SFs device resource
Subsystems (6)
Tariq Toukan
maintainerPATCH 1/1 net/mlx5: Remove max_external_SFs device resource
From: Or Har-Toov <[email protected]>
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.
--- .../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(-)
Documentation/networking/devlink/devlink-resource.rst +0 -4
@@ -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:
drivers/net/ethernet/mellanox/mlx5/core/devlink.h +0 -1
@@ -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 ,
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c +6 -13
@@ -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
Signature · 1 line
2.44.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines
From: Or Har-Toov <[email protected]>
The device-level
max_external_SFsresource is redundant now that per-portmax_SFsresources 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 <[email protected]>Reviewed-by Shay Drori <[email protected]>Reviewed-by Moshe Shemesh <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
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.
Quoted 2 lines
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?
Quoted 23 lines
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c +2
-7@@ -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;
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c static void mlx5_sf_hw_table_res_unregister(struct mlx5_core_dev *dev) · line 277
Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c +3
-5- -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?
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261011093828.784454-1-tariqt%40nvidia.com
Quoted 129 lines · On 12/10/2026 12:40, [email protected] 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_SFsdevice resourceThis commit removes the device-level
max_external_SFsdevlink resource from mlx5. The reason given is that the per-portmax_SFsresources on each PF port representor make it redundant. Thedevlink-resource.rstexamples are updated to match.Quoted 2 lines
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 byDEVLINK_CMD_RESOURCE_DUMPinnet/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.rstupdated 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_SFsvalues come from devlink resource show, and that devlink port show only maps the port index to controller and pfnum?Quoted 23 lines
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c +2
-7@@ -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;drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c static void mlx5_sf_hw_table_res_unregister(struct mlx5_core_dev *dev) · line 277
Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c +3
-5- -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-portmax_SFsfully replacemax_external_SFs?
max_external_SFshas been visible on pci/<bdf> since commit6486c0f44ed8("net/mlx5: Expose max possible SFs via devlink resource"). It was registered at probe, gated only bymlx5_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 computesmax_ext_fnthroughmlx5_esw_sf_max_hpf_functions()and uses it forMLX5_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 frommlx5_esw_devlink_port_res_register()throughmlx5_core_dbg(). If that registration fails, nothing exposes the value at all.
max_local_SFsstays device-level and is always visible, so the two limits are now exposed in different ways.
Quoted 9 lines
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.rstupdate says that a user-visible resource is being removed. Neither says that the port-levelmax_SFsentries 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.
Quoted 2 lines
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261011093828.784454-1-tariqt%40nvidia.com
Quoted 11 lines · Tariq Toukan
From: Or Har-Toov <[email protected]>
The device-level
max_external_SFsresource is redundant now that per-portmax_SFsresources 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 <[email protected]>Reviewed-by Shay Drori <[email protected]>Reviewed-by Moshe Shemesh <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sun, 11 Oct 2026 12:38:28 +0300 you wrote:
From: Or Har-Toov <[email protected]>
The device-level
max_external_SFsresource is redundant now that per-portmax_SFsresources 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.[...]
Here is the summary with links:
- [net-next] net/mlx5: Remove max_external_SFs device resource
https://git.kernel.org/netdev/net-next/c/001e9181ada8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html