* [PATCH net-next 0/2] devlink: extend phys_port_name controller prefix to non-external ports
@ 2026-07-02 11:17 Tariq Toukan
2026-07-02 11:17 ` [PATCH net-next 1/2] devlink: print controller prefix for non-zero controller Tariq Toukan
2026-07-02 11:17 ` [PATCH net-next 2/2] net/mlx5: Set satellite PF devlink ports as non-external Tariq Toukan
0 siblings, 2 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-07-02 11:17 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
netdev, Paolo Abeni
Cc: Adithya Jayachandran, Chris Mi, Daniel Jurgens, Jiri Pirko,
Jonathan Corbet, Kees Cook, Leon Romanovsky, linux-doc,
linux-kernel, linux-rdma, Mark Bloch, Moshe Shemesh, Or Har-Toov,
Parav Pandit, Saeed Mahameed, Shay Drori, Shuah Khan,
Simon Horman, Tariq Toukan
Hi,
This series by Moshe includes the controller number in phys_port_name
for non-external ports with a non-zero controller, and updates the mlx5
driver to mark satellite PFs as non-external.
The controller prefix (c) in phys_port_name was previously only included
for ports marked as external. However, newer devices can have multiple
controllers within the DPU itself, even within a single host
environment. For example, a SmartNIC may have additional local PCI
physical functions that are managed by the eswitch but are not on an
external host. These ports use a non-zero controller number to
distinguish them from the eswitch manager's own functions, while the
external flag remains unset.
Patch 1 updates the devlink core to include the controller prefix in
phys_port_name for any non-zero controller, regardless of the external
flag. Documentation and kdoc are updated accordingly.
Patch 2 updates the mlx5 driver to set satellite PF devlink ports as
non-external, since they are local to the DPU. It also distinguishes
satellite PF SFs from host PF SFs when setting the external attribute.
Regards,
Tariq
Moshe Shemesh (2):
devlink: print controller prefix for non-zero controller
net/mlx5: Set satellite PF devlink ports as non-external
Documentation/networking/devlink/devlink-port.rst | 9 +++++++++
.../net/ethernet/mellanox/mlx5/core/esw/devlink_port.c | 7 +++++--
include/net/devlink.h | 6 +++---
net/devlink/port.c | 6 +++---
4 files changed, 20 insertions(+), 8 deletions(-)
base-commit: 1c664ec4b9ea827b609d296921ed5bad8a40a158
--
2.44.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net-next 1/2] devlink: print controller prefix for non-zero controller
2026-07-02 11:17 [PATCH net-next 0/2] devlink: extend phys_port_name controller prefix to non-external ports Tariq Toukan
@ 2026-07-02 11:17 ` Tariq Toukan
2026-07-02 11:17 ` [PATCH net-next 2/2] net/mlx5: Set satellite PF devlink ports as non-external Tariq Toukan
1 sibling, 0 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-07-02 11:17 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
netdev, Paolo Abeni
Cc: Adithya Jayachandran, Chris Mi, Daniel Jurgens, Jiri Pirko,
Jonathan Corbet, Kees Cook, Leon Romanovsky, linux-doc,
linux-kernel, linux-rdma, Mark Bloch, Moshe Shemesh, Or Har-Toov,
Parav Pandit, Saeed Mahameed, Shay Drori, Shuah Khan,
Simon Horman, Tariq Toukan
From: Moshe Shemesh <moshe@nvidia.com>
The controller prefix (c<N>) in phys_port_name is currently restricted
to external host controllers. This layout sufficed when DPUs only had a
single local controller and one or more external host controllers.
However, newer devices can have multiple controllers within the DPU
itself, even within a single host environment. To support these
topologies, allow drivers to report the controller number regardless of
the "external" flag status. Any non-zero controller number will now be
explicitly reported, even for single-host or local DPU controllers.
Existing ports with controller=0 are unaffected.
Update documentation and kdoc to clarify that a non-zero controller
number does not require the external flag to be set.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
Documentation/networking/devlink/devlink-port.rst | 9 +++++++++
include/net/devlink.h | 6 +++---
net/devlink/port.c | 6 +++---
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/Documentation/networking/devlink/devlink-port.rst b/Documentation/networking/devlink/devlink-port.rst
index 9374ebe70f48..4211322d488b 100644
--- a/Documentation/networking/devlink/devlink-port.rst
+++ b/Documentation/networking/devlink/devlink-port.rst
@@ -107,6 +107,15 @@ doesn't have the eswitch. Local controller (identified by controller number = 0)
has the eswitch. The Devlink instance on the local controller has eswitch
devlink ports for both the controllers.
+A non-zero controller number may also be used for ports that are not external.
+For example, a SmartNIC may have additional local PCI physical functions
+that are managed by the eswitch but are not on an external host. These
+ports use a non-zero controller number to distinguish them from the eswitch
+manager's own functions, while the external flag remains unset.
+
+The ``phys_port_name`` includes the controller prefix (``c<controller_num>``)
+whenever the controller number is non-zero, regardless of the external flag.
+
Function configuration
======================
diff --git a/include/net/devlink.h b/include/net/devlink.h
index dd546dbd57cf..35bfdceeab9f 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -36,7 +36,7 @@ struct devlink_port_phys_attrs {
* struct devlink_port_pci_pf_attrs - devlink port's PCI PF attributes
* @controller: Associated controller number
* @pf: associated PCI function number for the devlink port instance
- * @external: when set, indicates if a port is for an external controller
+ * @external: when set, indicates if a port is for an external host controller.
*/
struct devlink_port_pci_pf_attrs {
u32 controller;
@@ -50,7 +50,7 @@ struct devlink_port_pci_pf_attrs {
* @pf: associated PCI function number for the devlink port instance
* @vf: associated PCI VF number of a PF for the devlink port instance;
* VF number starts from 0 for the first PCI virtual function
- * @external: when set, indicates if a port is for an external controller
+ * @external: when set, indicates if a port is for an external host controller.
*/
struct devlink_port_pci_vf_attrs {
u32 controller;
@@ -64,7 +64,7 @@ struct devlink_port_pci_vf_attrs {
* @controller: Associated controller number
* @sf: associated SF number of a PF for the devlink port instance
* @pf: associated PCI function number for the devlink port instance
- * @external: when set, indicates if a port is for an external controller
+ * @external: when set, indicates if a port is for an external host controller.
*/
struct devlink_port_pci_sf_attrs {
u32 controller;
diff --git a/net/devlink/port.c b/net/devlink/port.c
index 485029d43428..bde6d4125725 100644
--- a/net/devlink/port.c
+++ b/net/devlink/port.c
@@ -1529,7 +1529,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port,
WARN_ON(1);
return -EINVAL;
case DEVLINK_PORT_FLAVOUR_PCI_PF:
- if (attrs->pci_pf.external) {
+ if (attrs->pci_pf.external || attrs->pci_pf.controller) {
n = snprintf(name, len, "c%u", attrs->pci_pf.controller);
if (n >= len)
return -EINVAL;
@@ -1539,7 +1539,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port,
n = snprintf(name, len, "pf%u", attrs->pci_pf.pf);
break;
case DEVLINK_PORT_FLAVOUR_PCI_VF:
- if (attrs->pci_vf.external) {
+ if (attrs->pci_vf.external || attrs->pci_vf.controller) {
n = snprintf(name, len, "c%u", attrs->pci_vf.controller);
if (n >= len)
return -EINVAL;
@@ -1550,7 +1550,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port,
attrs->pci_vf.pf, attrs->pci_vf.vf);
break;
case DEVLINK_PORT_FLAVOUR_PCI_SF:
- if (attrs->pci_sf.external) {
+ if (attrs->pci_sf.external || attrs->pci_sf.controller) {
n = snprintf(name, len, "c%u", attrs->pci_sf.controller);
if (n >= len)
return -EINVAL;
--
2.44.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH net-next 2/2] net/mlx5: Set satellite PF devlink ports as non-external
2026-07-02 11:17 [PATCH net-next 0/2] devlink: extend phys_port_name controller prefix to non-external ports Tariq Toukan
2026-07-02 11:17 ` [PATCH net-next 1/2] devlink: print controller prefix for non-zero controller Tariq Toukan
@ 2026-07-02 11:17 ` Tariq Toukan
1 sibling, 0 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-07-02 11:17 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
netdev, Paolo Abeni
Cc: Adithya Jayachandran, Chris Mi, Daniel Jurgens, Jiri Pirko,
Jonathan Corbet, Kees Cook, Leon Romanovsky, linux-doc,
linux-kernel, linux-rdma, Mark Bloch, Moshe Shemesh, Or Har-Toov,
Parav Pandit, Saeed Mahameed, Shay Drori, Shuah Khan,
Simon Horman, Tariq Toukan
From: Moshe Shemesh <moshe@nvidia.com>
Satellite PFs are local to the DPU and are not on an external host.
Set their devlink port external attribute to false to reflect this.
For satellite PF SFs, distinguish them from host PF SFs by comparing
the SF controller number against the host PF controller
(hpf_host_number + 1). Only SFs whose controller matches the host PF
are marked external, since their PF resides on an external host.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c
index 6e50311faa27..4fcad15e7eb6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c
@@ -74,7 +74,7 @@ static void mlx5_esw_offloads_pf_vf_devlink_port_attrs_set(struct mlx5_eswitch *
memcpy(dl_port->attrs.switch_id.id, ppid.id, ppid.id_len);
dl_port->attrs.switch_id.id_len = ppid.id_len;
devlink_port_attrs_pci_pf_set(dl_port, controller_num, pfnum,
- true);
+ false);
}
}
@@ -134,13 +134,16 @@ static void mlx5_esw_offloads_sf_devlink_port_attrs_set(struct mlx5_eswitch *esw
{
struct mlx5_core_dev *dev = esw->dev;
struct netdev_phys_item_id ppid = {};
+ u32 hpf_ctrl;
u16 pfnum;
pfnum = mlx5_esw_sf_controller_to_pfnum(dev, controller);
+ hpf_ctrl = mlx5_esw_get_hpf_host_number(dev) + 1;
mlx5_esw_get_port_parent_id(dev, &ppid);
memcpy(dl_port->attrs.switch_id.id, &ppid.id[0], ppid.id_len);
dl_port->attrs.switch_id.id_len = ppid.id_len;
- devlink_port_attrs_pci_sf_set(dl_port, controller, pfnum, sfnum, !!controller);
+ devlink_port_attrs_pci_sf_set(dl_port, controller, pfnum, sfnum,
+ controller == hpf_ctrl);
}
int mlx5_esw_offloads_sf_devlink_port_init(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
--
2.44.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-02 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 11:17 [PATCH net-next 0/2] devlink: extend phys_port_name controller prefix to non-external ports Tariq Toukan
2026-07-02 11:17 ` [PATCH net-next 1/2] devlink: print controller prefix for non-zero controller Tariq Toukan
2026-07-02 11:17 ` [PATCH net-next 2/2] net/mlx5: Set satellite PF devlink ports as non-external Tariq Toukan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox