Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp6020730pxv; Wed, 7 Jul 2021 17:48:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN0OkHPLLH4eAGUD9BWOQmYTZiHP0GOb4injua6Cv78bZpH791EPqD4soqY/7axtJyc0XF X-Received: by 2002:a05:6402:26c2:: with SMTP id x2mr34370821edd.10.1625705295094; Wed, 07 Jul 2021 17:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625705295; cv=none; d=google.com; s=arc-20160816; b=ka4p6IgSrAsoe903GmFeVJjkAIbCG8yB0T1UuMfPL7jlq+CtL6sagkQtmUkbLAZift v72c2g+7nyXn9u/jBH+Zse1DwHjfLFrFOAr2hTSGDKlQ0f4VAix1XUo6tA90YxTyhsMq jGayBpYEy7K62Oevf5qIru372eYiPvEPHkRyXMfIbQi6yV384Y+9llO0yQ9kmI7mxym1 WVoLMenhZHhGue7kCD1Nmnxg9C2YBcDgov03vZGZGl1JITyK8SR9rqcU5mZghAdjwaqw Af0VuugPJ4oKTRVtFybaeXPhqZuokS/UNs59unPi0ARZDCrA3Tlp0M5pQ/OK9aIQx5a/ Oc0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Z1r3sIf/ICtsvbtSR8AEPDM6z2etpk99JsfPmXk40Q4=; b=Fp+R3Eh7e6EvpAogwYY4QVV/nJE1xBRNXUWisbgEAMlVtNvJPR0oTsSYgglpQeXO1M E5HYmE6UDxhwrCUhKQsF8q4LvbF0k5Owr1MSuQVeEt0xqXbwvF0QYC9aTgVWDjwDZejD yqzbAecSIV5wvl8JcJn/F1ZVVHWnN1SZnPT5IfTq1q39ki/mBE0fk/gyjKWzXc//Y1Nw Fq6UToSAek4Pu1VtvSPMsQzYgkC4pjSLqvP0zIA5c7YnaNlu0M4xyyQdyK+TkX8DMRa+ CWxxylcmnVBMh0a+j9NM89nUKzvlEpmczzFPwyCEXHiD8qkTNiNVh6aY3TZJc5ihAvnq Ghnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hc14si690213ejc.378.2021.07.07.17.47.50; Wed, 07 Jul 2021 17:48:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230164AbhGHAqf (ORCPT + 99 others); Wed, 7 Jul 2021 20:46:35 -0400 Received: from mga04.intel.com ([192.55.52.120]:9478 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbhGHAqe (ORCPT ); Wed, 7 Jul 2021 20:46:34 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10038"; a="207596051" X-IronPort-AV: E=Sophos;i="5.84,222,1620716400"; d="scan'208";a="207596051" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2021 17:43:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,222,1620716400"; d="scan'208";a="457694129" Received: from mismail5-ilbpg0.png.intel.com ([10.88.229.82]) by orsmga008.jf.intel.com with ESMTP; 07 Jul 2021 17:43:45 -0700 From: mohammad.athari.ismail@intel.com To: Andrew Lunn , Heiner Kallweit , "David S . Miller" , Russell King , Jakub Kicinski , Florian Fainelli Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mohammad.athari.ismail@intel.com Subject: [PATCH net] net: phy: reconfigure PHY WOL in resume if WOL option still enabled Date: Thu, 8 Jul 2021 08:42:53 +0800 Message-Id: <20210708004253.6863-1-mohammad.athari.ismail@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mohammad Athari Bin Ismail When the PHY wakes up from suspend through WOL event, there is a need to reconfigure the WOL if the WOL option still enabled. The main operation is to clear the WOL event status. So that, subsequent WOL event can be triggered properly. This fix is needed especially for the PHY that operates in PHY_POLL mode where there is no handler (such as interrupt handler) available to clear the WOL event status. Fixes: 611d779af7ca ("net: phy: fix MDIO bus PM PHY resuming") Signed-off-by: Mohammad Athari Bin Ismail --- drivers/net/phy/phy_device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 5d5f9a9ee768..d68703ce03b1 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -295,6 +295,7 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev) static __maybe_unused int mdio_bus_phy_resume(struct device *dev) { + struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; struct phy_device *phydev = to_phy_device(dev); int ret; @@ -314,6 +315,13 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev) if (ret < 0) return ret; no_resume: + /* If the PHY has WOL option still enabled, reconfigure the WOL mainly + * to clear the WOL event status. + */ + phy_ethtool_get_wol(phydev, &wol); + if (wol.wolopts) + phy_ethtool_set_wol(phydev, &wol); + if (phydev->attached_dev && phydev->adjust_link) phy_start_machine(phydev); -- 2.17.1