From 442dd0068f07d299869148dbd7906f0cd542f6aa Mon Sep 17 00:00:00 2001 From: Narayan Reddy Date: Fri, 8 Nov 2024 19:29:45 +0000 Subject: [PATCH] nvethernet: deregister fixed link in remove issue: PHY ID allocation is failing during the stress test of insmod and rmmod of nvethernet module, since PHYIDs were exhausing during the module insertion. fix: deregister fixed link in remove for freeing up the PHYIDs which were allocated during probe. Bug 4754744 Signed-off-by: Narayan Reddy Change-Id: I6e71c684d4fcc5bb99a971c7d4d41726998cd8ec Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3245742 Reviewed-by: Bitan Biswas Reviewed-by: Bhadram Varka GVS: buildbot_gerritrpt Reviewed-by: Mohan Thadikamalla --- drivers/net/ethernet/nvidia/nvethernet/ether_linux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c index 06ff4c63..6abf05b7 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c @@ -7717,6 +7717,8 @@ static int ether_remove(struct platform_device *pdev) { struct net_device *ndev = platform_get_drvdata(pdev); struct ether_priv_data *pdata = netdev_priv(ndev); + struct device *dev = pdata->dev; + struct device_node *np = dev->of_node; #ifdef MACSEC_SUPPORT macsec_remove(pdata); @@ -7727,6 +7729,11 @@ static int ether_remove(struct platform_device *pdev) /* remove nvethernet sysfs group under /sys/devices// */ ether_sysfs_unregister(pdata); + /* De registering the fixed link */ + if (of_phy_is_fixed_link(np)) { + of_phy_deregister_fixed_link(np); + } + ether_put_clks(pdata); /* Assert MAC RST gpio */