From patchwork Mon Jun 21 09:45:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ling Pei Lee X-Patchwork-Id: 465643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4352AC48BE5 for ; Mon, 21 Jun 2021 09:46:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29E35610EA for ; Mon, 21 Jun 2021 09:46:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230304AbhFUJsP (ORCPT ); Mon, 21 Jun 2021 05:48:15 -0400 Received: from mga18.intel.com ([134.134.136.126]:3842 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbhFUJsP (ORCPT ); Mon, 21 Jun 2021 05:48:15 -0400 IronPort-SDR: ACKINIfdYFznCtK5tu8GZSp/ZmGJga/zHav6t9gh2QtbWfFvweCqGdsqCnfjDAmp9BjkzeEzy/ 1TGPs5XuBcOA== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194122097" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="194122097" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 02:45:57 -0700 IronPort-SDR: UYcFbSaQpm9HP8pM6XRraAIQTHeKL9oInUzshZB5a+JJ/FV65qNZQVGpiocM2/Rs0dUiJ9nNoP TGDPEiytJ4pA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="638720260" Received: from peileeli.png.intel.com ([172.30.240.12]) by fmsmga006.fm.intel.com with ESMTP; 21 Jun 2021 02:45:52 -0700 From: Ling Pei Lee To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Maxime Coquelin , Russell King , Ong Boon Leong , Voon Weifeng , Wong Vee Khee , Wong Vee Khee , Tan Tee Min , Michael Sit Wei Hong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: pei.lee.ling@intel.com Subject: [PATCH net-next V1 1/4] net: stmmac: option to enable PHY WOL with PMT enabled Date: Mon, 21 Jun 2021 17:45:33 +0800 Message-Id: <20210621094536.387442-2-pei.lee.ling@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210621094536.387442-1-pei.lee.ling@intel.com> References: <20210621094536.387442-1-pei.lee.ling@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The current stmmac driver WOL implementation will enable MAC WOL if MAC HW PMT feature is on. Else, the driver will check for PHY WOL support. There is another case where MAC HW PMT is enabled but the platform still goes for the PHY WOL option. E.g, Intel platform are designed for PHY WOL but not MAC WOL although HW MAC PMT features are enabled. Introduce use_phy_wol platform data to select PHY WOL instead of depending on HW PMT features. Set use_phy_wol will disable the plat->pmt which currently used to determine the system to wake up by MAC WOL or PHY WOL. Signed-off-by: Ling Pei Lee --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- include/linux/stmmac.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 0a266fa0af7e..a3b79ddcf08e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6533,7 +6533,8 @@ static int stmmac_hw_init(struct stmmac_priv *priv) * register (if supported). */ priv->plat->enh_desc = priv->dma_cap.enh_desc; - priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up; + priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up && + !priv->plat->use_phy_wol; priv->hw->pmt = priv->plat->pmt; if (priv->dma_cap.hash_tb_sz) { priv->hw->multicast_filter_bins = diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index e55a4807e3ea..9496e6c9ee82 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -263,5 +263,6 @@ struct plat_stmmacenet_data { int msi_sfty_ue_vec; int msi_rx_base_vec; int msi_tx_base_vec; + bool use_phy_wol; }; #endif From patchwork Mon Jun 21 09:45:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ling Pei Lee X-Patchwork-Id: 464904 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 172C3C48BE5 for ; Mon, 21 Jun 2021 09:46:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F027361002 for ; Mon, 21 Jun 2021 09:46:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230311AbhFUJsT (ORCPT ); Mon, 21 Jun 2021 05:48:19 -0400 Received: from mga18.intel.com ([134.134.136.126]:3842 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbhFUJsQ (ORCPT ); Mon, 21 Jun 2021 05:48:16 -0400 IronPort-SDR: 5B/JDXYYSf0o71+ZcnZvrXXxTs5Z0JaqJAYBajWUrzY751VqYPmj9Q82QVVxTEVwYQci2r1edX YsdROkAwwKnA== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194122115" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="194122115" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 02:46:03 -0700 IronPort-SDR: 7AHo2x31FLcRLJxwRpcdGXHrLqvIGSoW2va7D+rASj9Rttp5HskP+Eza6RuFt3k39MPzfUITba /yYtJMVgFBKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="638720283" Received: from peileeli.png.intel.com ([172.30.240.12]) by fmsmga006.fm.intel.com with ESMTP; 21 Jun 2021 02:45:58 -0700 From: Ling Pei Lee To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Maxime Coquelin , Russell King , Ong Boon Leong , Voon Weifeng , Wong Vee Khee , Wong Vee Khee , Tan Tee Min , Michael Sit Wei Hong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: pei.lee.ling@intel.com Subject: [PATCH net-next V1 2/4] stmmac: intel: Enable PHY WOL option in EHL Date: Mon, 21 Jun 2021 17:45:34 +0800 Message-Id: <20210621094536.387442-3-pei.lee.ling@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210621094536.387442-1-pei.lee.ling@intel.com> References: <20210621094536.387442-1-pei.lee.ling@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Enable PHY Wake On LAN in Intel EHL Intel platform. PHY Wake on LAN option is enabled due to Intel EHL Intel platform is designed for PHY Wake On LAN but not MAC Wake On LAN. Signed-off-by: Ling Pei Lee --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 2ecf93c84b9d..73be34a10a4c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -567,6 +567,7 @@ static int ehl_common_data(struct pci_dev *pdev, plat->rx_queues_to_use = 8; plat->tx_queues_to_use = 8; plat->clk_ptp_rate = 200000000; + plat->use_phy_wol = 1; plat->safety_feat_cfg->tsoee = 1; plat->safety_feat_cfg->mrxpee = 1; From patchwork Mon Jun 21 09:45:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ling Pei Lee X-Patchwork-Id: 465642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64B6BC48BE5 for ; Mon, 21 Jun 2021 09:46:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4DB8761002 for ; Mon, 21 Jun 2021 09:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbhFUJs0 (ORCPT ); Mon, 21 Jun 2021 05:48:26 -0400 Received: from mga18.intel.com ([134.134.136.126]:3858 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbhFUJsW (ORCPT ); Mon, 21 Jun 2021 05:48:22 -0400 IronPort-SDR: 3mML0K9elmusekbyW7XbPPoH+uXZwXM079Pm4o+ggfVDqY1D+zRnD3eYEwIOzVIe/v5x/BdfEU 9Qq1/ilOf8Tw== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194122128" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="194122128" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 02:46:08 -0700 IronPort-SDR: 70Om74wC96WXY6QQq1oNOcC15HXQ8DTOvYgVhomis9iwl7xy2CbKm5/do2wcd0Si3LN/kHX9wu uNvofljvB6jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="638720304" Received: from peileeli.png.intel.com ([172.30.240.12]) by fmsmga006.fm.intel.com with ESMTP; 21 Jun 2021 02:46:04 -0700 From: Ling Pei Lee To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Maxime Coquelin , Russell King , Ong Boon Leong , Voon Weifeng , Wong Vee Khee , Wong Vee Khee , Tan Tee Min , Michael Sit Wei Hong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: pei.lee.ling@intel.com Subject: [PATCH net-next V1 3/4] net: stmmac: Reconfigure the PHY WOL settings in stmmac_resume() Date: Mon, 21 Jun 2021 17:45:35 +0800 Message-Id: <20210621094536.387442-4-pei.lee.ling@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210621094536.387442-1-pei.lee.ling@intel.com> References: <20210621094536.387442-1-pei.lee.ling@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Muhammad Husaini Zulkifli After PHY received a magic packet, the PHY WOL event will be triggered then PHY WOL event interrupt will be disarmed. Ethtool settings will remain with WOL enabled after a S3/S4 suspend resume cycle as expected. Hence,the driver should reconfigure the PHY settings to reenable/disable WOL depending on the ethtool WOL settings in the resume flow. Signed-off-by: Muhammad Husaini Zulkifli Co-developed-by: Ling Pei Lee Signed-off-by: Ling Pei Lee --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a3b79ddcf08e..cd96e4d7a22e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7246,6 +7246,16 @@ int stmmac_resume(struct device *dev) phylink_start(priv->phylink); /* We may have called phylink_speed_down before */ phylink_speed_up(priv->phylink); + /* Reconfigure PHY WOL if the WOL is enabled in ethtool, + * so that subsequent WOL still can be triggered. + */ + if (!priv->plat->pmt) { + struct ethtool_wolinfo phy_wol = { .cmd = ETHTOOL_GWOL }; + + phylink_ethtool_get_wol(priv->phylink, &phy_wol); + if (phy_wol.wolopts) + phylink_ethtool_set_wol(priv->phylink, &phy_wol); + } rtnl_unlock(); } From patchwork Mon Jun 21 09:45:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ling Pei Lee X-Patchwork-Id: 464903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79EB6C48BE5 for ; Mon, 21 Jun 2021 09:46:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 605B4611B0 for ; Mon, 21 Jun 2021 09:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231144AbhFUJss (ORCPT ); Mon, 21 Jun 2021 05:48:48 -0400 Received: from mga03.intel.com ([134.134.136.65]:62591 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbhFUJsa (ORCPT ); Mon, 21 Jun 2021 05:48:30 -0400 IronPort-SDR: cxiT4A+hFsFQS8WsrkA2drggYYxaWXo5BdCSCiX/OdYraVSjzp2PLhJSZi0YnfLB/4YYURmeeZ MfWEAo3CaPSg== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="206852457" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="206852457" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 02:46:15 -0700 IronPort-SDR: neKELTmt31WoAvjNQcXp+1P6WpL/4Do+v28x74Uedwxd8vt3xG6AIgcdfznSP26mRdEAIRLioM CD6Zrh0XniJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="638720326" Received: from peileeli.png.intel.com ([172.30.240.12]) by fmsmga006.fm.intel.com with ESMTP; 21 Jun 2021 02:46:10 -0700 From: Ling Pei Lee To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Maxime Coquelin , Russell King , Ong Boon Leong , Voon Weifeng , Wong Vee Khee , Wong Vee Khee , Tan Tee Min , Michael Sit Wei Hong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: pei.lee.ling@intel.com Subject: [PATCH net-next V1 4/4] stmmac: intel: set PCI_D3hot in suspend Date: Mon, 21 Jun 2021 17:45:36 +0800 Message-Id: <20210621094536.387442-5-pei.lee.ling@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210621094536.387442-1-pei.lee.ling@intel.com> References: <20210621094536.387442-1-pei.lee.ling@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Voon Weifeng During suspend, set the Intel mgbe to D3hot state to save power consumption. Signed-off-by: Voon Weifeng Signed-off-by: Ling Pei Lee --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 73be34a10a4c..69a725b661c2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -1088,6 +1088,7 @@ static int __maybe_unused intel_eth_pci_suspend(struct device *dev) return ret; pci_wake_from_d3(pdev, true); + pci_set_power_state(pdev, PCI_D3hot); return 0; }