Skip to contentSkip to conversation

net: ethernet: mtk_eth_soc: add label support for GMACs

PATCH In review Arınç ÜNAL 2 participants 3 messages Apr 4, 2022 – Apr 5, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: mtk_eth_soc: add label support for GMACs

From: René van Dorst <[email protected]>

Add label support for GMACs. The network interface of the GMAC will have the string of the label property defined on the devicetree as its name.

[[email protected]: change commit log and rebase to current net-next]
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +4 -0
index f02d07ec5ccb..af2f0693180a 100644
@@ -2911,6 +2911,7 @@ static const struct net_device_ops mtk_netdev_ops = {
 
 static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
 {
+	const char *name = of_get_property(np, "label", NULL);
 	const __be32 *_id = of_get_property(np, "reg", NULL);
 	phy_interface_t phy_mode;
 	struct phylink *phylink;
@@ -3033,6 +3034,9 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
 	else
 		eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN;
 
+	if (name)
+		strlcpy(eth->netdev[id]->name, name, IFNAMSIZ);
+
 	return 0;
 
 free_netdev:
Signature · 7 lines
2.25.1


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#1 lore raw
Quoted 4 lines · Arınç ÜNAL

From: René van Dorst <[email protected]>

Add label support for GMACs. The network interface of the GMAC will have the string of the label property defined on the devicetree as its name.

Sorry, but no. This has been discussed a few times, you need something in user space, udev or systemd etc to set interface names.

Please look back in the archive at previous discussions.

Andrew

#2 lore raw
Quoted 10 lines · Andrew Lunn
Quoted 4 lines · Arınç ÜNAL

From: René van Dorst <[email protected]>

Add label support for GMACs. The network interface of the GMAC will have the string of the label property defined on the devicetree as its name.

Sorry, but no. This has been discussed a few times, you need something in user space, udev or systemd etc to set interface names.

Please look back in the archive at previous discussions.

Thanks for the heads up Andrew, I found your quote from https://lore.kernel.org/all/Ydhwfa%[email protected]/:

Quoted 8 lines

I agree with Russell here. I doubt this is going to be accepted.

DSA is special because DSA is very old, much older than DT, and maybe older than udev. The old DSA platform drivers had a mechanism to supply the interface name to the DSA core. When we added a DT binding to DSA we kept that mechanism, since that mechanism had been used for a long time.

Quoted 4 lines

Even if you could show there was a generic old mechanism, from before the days of DT, that allowed interface names to be set from platform drivers, i doubt it would be accepted because there is no continuity, which DSA has.

On MT7621 SoC, we can mux a switch phy of MT7530 (must be phy0 or 4) to the SoC's gmac1. So a UTP port connected to that phy becomes directly connected to the SoC's gmac1. Because of that, I wanted to be able to give the gmac's netdev interface a name from DT like DSA. However, the quote above makes sense why not to do so.

Thanks.
Arınç

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek