Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: ftgmac100: assign interface name from device tree alias
@ 2026-05-27  6:31 Kyle Hsieh
  2026-05-27 16:56 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Hsieh @ 2026-05-27  6:31 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: netdev, linux-kernel, Kyle Hsieh

Currently, the ftgmac100 driver relies on the probe order to assign network
interface names (e.g., eth0, eth1).

This patch allows the driver to fetch the "ethernet" alias ID from the
device tree via of_alias_get_id() and assign it to netdev->name before
registering the netdev.

This provides a standard and robust way to achieve deterministic interface
naming (e.g., ethernet0 -> eth0) directly from the device tree, preventing
potential userspace race conditions during network setup.

Signed-off-by: Kyle Hsieh <kylehsieh1995@gmail.com>
---
Hi all,

This patch series introduces deterministic interface naming for the 
ftgmac100 driver by utilizing device tree aliases.

Background:
Currently, ftgmac100 assigns interface names strictly based on probe order. 
On platforms like the ASPEED AST2600, this often leads to naming collisions 
(e.g., mac2 and mac3 defaulting to eth0 and eth1). 

While userspace tools like systemd-udevd are typically responsible for 
renaming, we encounter a severe race condition on BMC systems: the NCSI 
driver frequently brings the management interface UP before udev can rename 
it, resulting in the kernel locking the name and rejecting the rename 
request.

Solution:
By parsing the "ethernet" alias from the device tree during probe, the 
driver can now assign the correct name out-of-the-box, completely 
bypassing the userspace race condition.

Testing:
- Tested on ASPEED AST2600 BMC.
- Verified that device tree aliases (ethernet0 = &mac3, ethernet1 = &mac2) 
  are correctly applied at probe time.

Please review and consider for inclusion.

Thanks,
Kyle Hsieh
---
 drivers/net/ethernet/faraday/ftgmac100.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 6d2fe5c2f390..e058a10500ee 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1949,6 +1949,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
 	struct ftgmac100 *priv;
 	struct device_node *np;
 	int err = 0;
+	int alias_id;
 
 	np = pdev->dev.of_node;
 	if (np) {
@@ -1973,6 +1974,11 @@ static int ftgmac100_probe(struct platform_device *pdev)
 	if (!netdev)
 		return -ENOMEM;
 
+	/* Assign interface name based on DTS alias (e.g., ethernet0 -> eth0) */
+	alias_id = of_alias_get_id(pdev->dev.of_node, "ethernet");
+	if (alias_id >= 0)
+		snprintf(netdev->name, IFNAMSIZ, "eth%d", alias_id);
+
 	SET_NETDEV_DEV(netdev, &pdev->dev);
 
 	netdev->ethtool_ops = &ftgmac100_ethtool_ops;

---
base-commit: eb3f4b7426cfd2b79d65b7d37155480b32259a11
change-id: 20260527-addethalias-d25e2f188697

Best regards,
-- 
Kyle Hsieh <kylehsieh1995@gmail.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-27 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-27  6:31 [PATCH net-next] net: ftgmac100: assign interface name from device tree alias Kyle Hsieh
2026-05-27 16:56 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox