[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250805223346.3293091-2-anthony.l.nguyen@intel.com>
Date: Tue, 5 Aug 2025 15:33:41 -0700
From: Tony Nguyen <anthony.l.nguyen@...el.com>
To: davem@...emloft.net,
kuba@...nel.org,
pabeni@...hat.com,
edumazet@...gle.com,
andrew+netdev@...n.ch,
netdev@...r.kernel.org
Cc: Jedrzej Jagielski <jedrzej.jagielski@...el.com>,
anthony.l.nguyen@...el.com,
przemyslaw.kitszel@...el.com,
jiri@...nulli.us,
horms@...nel.org,
David.Kaplan@....com,
dhowells@...hat.com,
Paul Menzel <pmenzel@...gen.mpg.de>,
Jacob Keller <jacob.e.keller@...el.com>
Subject: [PATCH net v2 1/2] devlink: let driver opt out of automatic phys_port_name generation
From: Jedrzej Jagielski <jedrzej.jagielski@...el.com>
Currently when adding devlink port, phys_port_name is automatically
generated within devlink port initialization flow. As a result adding
devlink port support to driver may result in forced changes of interface
names, which breaks already existing network configs.
This is an expected behavior but in some scenarios it would not be
preferable to provide such limitation for legacy driver not being able to
keep 'pre-devlink' interface name.
Add flag no_phys_port_name to devlink_port_attrs struct which indicates
if devlink should not alter name of interface.
Suggested-by: Jiri Pirko <jiri@...nulli.us>
Link: https://lore.kernel.org/all/nbwrfnjhvrcduqzjl4a2jafnvvud6qsbxlvxaxilnryglf4j7r@btuqrimnfuly/
Reviewed-by: Paul Menzel <pmenzel@...gen.mpg.de>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@...el.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
---
include/net/devlink.h | 5 ++++-
net/devlink/port.c | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 93640a29427c..4458b46407ee 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -78,6 +78,8 @@ 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.
+ * @no_phys_port_name: skip automatic phys_port_name generation; for compatibility only,
+ * newly added driver/port instance should never set this.
* @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 +89,8 @@ struct devlink_port_pci_sf_attrs {
*/
struct devlink_port_attrs {
u8 split:1,
- splittable:1;
+ splittable:1,
+ no_phys_port_name:1;
u32 lanes;
enum devlink_port_flavour flavour;
struct netdev_phys_item_id switch_id;
diff --git a/net/devlink/port.c b/net/devlink/port.c
index 939081a0e615..44f808e65006 100644
--- a/net/devlink/port.c
+++ b/net/devlink/port.c
@@ -1522,6 +1522,9 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port,
if (!devlink_port->attrs_set)
return -EOPNOTSUPP;
+ if (devlink_port->attrs.no_phys_port_name)
+ return 0;
+
switch (attrs->flavour) {
case DEVLINK_PORT_FLAVOUR_PHYSICAL:
if (devlink_port->linecard)
--
2.47.1
Powered by blists - more mailing lists