net: stmmac: fix 'ethtool -P' return -EBUSY
Subsystems (4)
PATCH v3 1/1 net: stmmac: fix 'ethtool -P' return -EBUSY
The permanent mac address should be available for query when the device is not up.
NetworkManager, the system network daemon, uses 'ethtool -P' to obtain the permanent address after the kernel start. When the network device is not up, it will return the device busy error with 'ethtool -P'. At that time, it is unable to access the Internet through the permanent address by NetworkManager.
I think that the '.begin' is not used to check if the device is up.
Signed-off-by Hao Chen <[email protected]>
--- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +5 -2
@@ -15,6 +15,7 @@#include <linux/phylink.h> #include <linux/net_tstamp.h> #include <asm/io.h> +#include <linux/pm_runtime.h> #include "stmmac.h" #include "dwmac_dma.h"
@@ -412,8 +413,10 @@ static void stmmac_ethtool_setmsglevel(struct net_device *dev, u32 level)static int stmmac_check_if_running (struct net_device *dev) { -if (!netif_running (dev)) -return -EBUSY ; +struct stmmac_priv *priv =netdev_priv (dev); + +pm_runtime_get_sync (priv->device); +return 0 ; }
Signature · 1 line
2.20.1