Re: [PATCH net 1/2] devlink: allow driver to freely name interfaces
From: Jakub Kicinski <kuba@kernel.org>
Date: 2025-08-01 20:15:14
On Fri, 1 Aug 2025 10:22:37 -0700 Tony Nguyen wrote:
Subject: [PATCH net 1/2] devlink: allow driver to freely name interfaces
The subject is a bit misleading.. Maybe something like: let driver opt out of automatic phys_port_name generation
Date: Fri, 1 Aug 2025 10:22:37 -0700 X-Mailer: git-send-email 2.47.1 From: Jedrzej Jagielski <redacted> Currently when adding devlink port it is prohibited to let a driver name an interface on its own. In some scenarios it would not be preferable to provide such limitation, eg some compatibility purposes. Add flag skip_phys_port_name_get to devlink_port_attrs struct which indicates if devlink should not alter name of interface. Suggested-by: Jiri Pirko <jiri@resnulli.us>
Link to the suggestion could be useful?
quoted hunk ↗ jump to hunk
Signed-off-by: Jedrzej Jagielski <redacted> Reviewed-by: Paul Menzel <redacted> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> --- include/net/devlink.h | 7 ++++++- net/devlink/port.c | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-)diff --git a/include/net/devlink.h b/include/net/devlink.h index 93640a29427c..bfa795bf9998 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h@@ -78,6 +78,7 @@ struct devlink_port_pci_sf_attrs { * @flavour: flavour of the port * @split: indicates if this is split port * @splittable: indicates if the port can be split. + * @skip_phys_port_name_get: if set devlink doesn't alter interface name
Again, we're not actually doing anything the the interface name. We're exposing a sysfs attribute which systemd/udev then uses to rename the interface. From kernel PoV this is about attributes.
quoted hunk ↗ jump to hunk
* @lanes: maximum number of lanes the port supports. 0 value is not passed to netlink. * @switch_id: if the port is part of switch, this is buffer with ID, otherwise this is NULL * @phys: physical port attributes@@ -87,7 +88,11 @@ struct devlink_port_pci_sf_attrs { */ struct devlink_port_attrs { u8 split:1, - splittable:1; + splittable:1, + skip_phys_port_name_get:1; /* This is for compatibility only, + * newly added driver/port instance + * should never set this. + */
Thanks for noting that this is compat-only. I think it'd be better to consolidate the comments, since we have kdoc.. Move this note up to kdoc; or document the member inline: splittable:1, /** * @skip_phys_port_..: bok bok ba-gok! */ skip_phys_port_name_get:1; BTW the name is a bit long, "no_phys_port_name" please?