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 <narayanr@nvidia.com>
Change-Id: I6e71c684d4fcc5bb99a971c7d4d41726998cd8ec
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3245742
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mohan Thadikamalla <mohant@nvidia.com>
This commit is contained in:
Narayan Reddy
2024-11-08 19:29:45 +00:00
committed by Jon Hunter
parent 20e9790c9e
commit 442dd0068f

View File

@@ -7717,6 +7717,8 @@ static int ether_remove(struct platform_device *pdev)
{ {
struct net_device *ndev = platform_get_drvdata(pdev); struct net_device *ndev = platform_get_drvdata(pdev);
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct device *dev = pdata->dev;
struct device_node *np = dev->of_node;
#ifdef MACSEC_SUPPORT #ifdef MACSEC_SUPPORT
macsec_remove(pdata); macsec_remove(pdata);
@@ -7727,6 +7729,11 @@ static int ether_remove(struct platform_device *pdev)
/* remove nvethernet sysfs group under /sys/devices/<ether_device>/ */ /* remove nvethernet sysfs group under /sys/devices/<ether_device>/ */
ether_sysfs_unregister(pdata); 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); ether_put_clks(pdata);
/* Assert MAC RST gpio */ /* Assert MAC RST gpio */