Thread (5 messages) flat view 5 messages, 3 authors, 2025-08-04

RE: [PATCH net 1/2] devlink: allow driver to freely name interfaces

From: Jagielski, Jedrzej <hidden>
Date: 2025-08-04 11:39:59

From: Jakub Kicinski <kuba@kernel.org> 
Sent: Friday, August 1, 2025 10:15 PM
On Fri,  1 Aug 2025 10:22:37 -0700 Tony Nguyen wrote:
quoted
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
Sure, title will be changed
quoted
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?
yeah, why not, it provides some context
quoted
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
  * @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
It was Jiri who instantly suggested that note :P
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;
oh right, it will be moved to kdoc
BTW the name is a bit long, "no_phys_port_name" please?
sure, i like it, will be changed
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help