From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiner Kallweit Subject: [PATCH net 0/2] net: phy: fix WoL handling when suspending the PHY Date: Mon, 24 Sep 2018 20:08:23 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "netdev@vger.kernel.org" To: Andrew Lunn , Florian Fainelli , David Miller , Realtek linux nic maintainers Return-path: Received: from mail-wm1-f68.google.com ([209.85.128.68]:38239 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727497AbeIYAL5 (ORCPT ); Mon, 24 Sep 2018 20:11:57 -0400 Received: by mail-wm1-f68.google.com with SMTP id z16-v6so4562934wmi.3 for ; Mon, 24 Sep 2018 11:08:33 -0700 (PDT) Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: phy_suspend doesn't always recognize that WoL is enabled and therefore suspends the PHY when it should not. First idea to address the issue was to reuse checks used in mdio_bus_phy_may_suspend which check whether relevant devices are wakeup-enabled. Florian raised some concerns because drivers may enable wakeup even if WoL isn't enabled (e.g. certain USB network drivers). The new approach focuses on reducing the risk to break existing stuff. We add a flag wol_enabled to struct net_device which is set in ethtool_set_wol(). Then this flag is checked in phy_suspend(). This doesn't cover 100% of the cases yet (e.g. if WoL is enabled w/o explicit configuration), but it covers the most relevant cases with very little risk of regressions. Heiner Kallweit (2): net: core: add member wol_enabled to struct net_device net: phy: fix WoL handling when suspending the PHY drivers/net/phy/phy_device.c | 12 +++++++++--- include/linux/netdevice.h | 3 +++ net/core/ethtool.c | 9 ++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) -- 2.19.0