From 1bc107cc0607e1aaf44de37fbb8dc8d4e5cc60f2 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Date: Thu, 26 Sep 2024 17:29:06 +0530 Subject: [PATCH] net: stmmac: Assigning the eth2 to passthrough interface Address the name conflict between the virtualized interface and the passthrough interface to ensure that the interface name is independent of the driver probe order. Change-Id: I305b22cbd3860b0df3346ccb89aed4c879cef864 Signed-off-by: Shashank Shekhar --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 91fa1a31c865..741b9223e511 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7409,8 +7409,13 @@ int stmmac_dvr_probe(struct device *device, u32 rxq; int i, ret = 0; - ndev = devm_alloc_etherdev_mqs(device, sizeof(struct stmmac_priv), - MTL_MAX_TX_QUEUES, MTL_MAX_RX_QUEUES); + if (of_property_read_bool(device->of_node, "virtio-mdio")) + ndev = alloc_netdev_mqs(sizeof(struct stmmac_priv), "eth2", NET_NAME_ENUM, + ether_setup, MTL_MAX_TX_QUEUES, MTL_MAX_TX_QUEUES); + else + ndev = devm_alloc_etherdev_mqs(device, sizeof(struct stmmac_priv), + MTL_MAX_TX_QUEUES, MTL_MAX_TX_QUEUES); + if (!ndev) return -ENOMEM;