commit:     9df7cd026e7d1ceb423dfca8e46f2833b09c27e1
Author:     Arisu Tachibana <alicef <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 28 15:13:37 2025 +0000
Commit:     Arisu Tachibana <alicef <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 15:13:37 2025 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=9df7cd02

devlink: let driver opt out of automatic phys_port_name generation

Signed-off-by: Arisu Tachibana <alicef <AT> gentoo.org>

 0000_README                                        |  4 ++
 ...ut_of_automatic_phys_port_name_generation.patch | 81 ++++++++++++++++++++++
 2 files changed, 85 insertions(+)

diff --git a/0000_README b/0000_README
index 7698b47d..3b747ed9 100644
--- a/0000_README
+++ b/0000_README
@@ -75,6 +75,10 @@ Patch:  
2010_ipv4_fix_regression_in_local-broadcast_routes.patch
 From:   
https://lore.kernel.org/regressions/[email protected]/
 Desc:   net: ipv4: fix regression in local-broadcast routes
 
+Patch:  
2011_devlink_let_driver_opt_out_of_automatic_phys_port_name_generation.patch
+From:   
https://lore.kernel.org/all/20597f81c1439569e34d026542365aef1cedfb00.1756088250.git.cal...@wbinvd.org/
+Desc:   devlink: let driver opt out of automatic phys_port_name generation
+
 Patch:  2901_permit-menuconfig-sorting.patch
 From:   https://lore.kernel.org/
 Desc:   menuconfig: Allow sorting the entries alphabetically

diff --git 
a/2011_devlink_let_driver_opt_out_of_automatic_phys_port_name_generation.patch 
b/2011_devlink_let_driver_opt_out_of_automatic_phys_port_name_generation.patch
new file mode 100644
index 00000000..7d0ddb39
--- /dev/null
+++ 
b/2011_devlink_let_driver_opt_out_of_automatic_phys_port_name_generation.patch
@@ -0,0 +1,81 @@
+Subject: [PATCH 6.16.y 1/2] devlink: let driver opt out of automatic 
phys_port_name generation
+Date: Sun, 24 Aug 2025 20:30:13 -0700
+Message-ID: 
<20597f81c1439569e34d026542365aef1cedfb00.1756088250.git.cal...@wbinvd.org>
+X-Mailer: git-send-email 2.47.2
+Precedence: bulk
+X-Mailing-List: [email protected]
+List-Id: <stable.vger.kernel.org>
+List-Subscribe: <mailto:[email protected]>
+List-Unsubscribe: <mailto:[email protected]>
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+
+From: Jedrzej Jagielski <[email protected]>
+
+[ Upstream commit c5ec7f49b480db0dfc83f395755b1c2a7c979920 ]
+
+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 <[email protected]>
+Link: 
https://lore.kernel.org/all/nbwrfnjhvrcduqzjl4a2jafnvvud6qsbxlvxaxilnryglf4j7r@btuqrimnfuly/
+Signed-off-by: Jedrzej Jagielski <[email protected]>
+Signed-off-by: Tony Nguyen <[email protected]>
+Cc: [email protected] # 6.16
+Tested-By: Calvin Owens <[email protected]>
+Signed-off-by: Calvin Owens <[email protected]>
+---
+ include/net/devlink.h | 6 +++++-
+ net/devlink/port.c    | 2 +-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/include/net/devlink.h b/include/net/devlink.h
+index 0091f23a40f7..af3fd45155dd 100644
+--- a/include/net/devlink.h
++++ b/include/net/devlink.h
+@@ -78,6 +78,9 @@ 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 +90,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..cb8d4df61619 100644
+--- a/net/devlink/port.c
++++ b/net/devlink/port.c
+@@ -1519,7 +1519,7 @@ static int __devlink_port_phys_port_name_get(struct 
devlink_port *devlink_port,
+       struct devlink_port_attrs *attrs = &devlink_port->attrs;
+       int n = 0;
+ 
+-      if (!devlink_port->attrs_set)
++      if (!devlink_port->attrs_set || devlink_port->attrs.no_phys_port_name)
+               return -EOPNOTSUPP;
+ 
+       switch (attrs->flavour) {
+-- 
+2.47.2
+
+

Reply via email to