From patchwork Fri Jul 10 12:46:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 1326756 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=oOL4ijxB; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4B3CWQ1ddCz9sTH for ; Fri, 10 Jul 2020 22:48:02 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbgGJMrb (ORCPT ); Fri, 10 Jul 2020 08:47:31 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:50532 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726820AbgGJMr1 (ORCPT ); Fri, 10 Jul 2020 08:47:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594385247; x=1625921247; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LAboS01sDMUr2hIzOB5JCAVYKTW4PFCO3EQWiwSvIXo=; b=oOL4ijxBTJhQlEKPLTWOgO7kq1bveOL4z7F6vivAVJtFgSjMPDn5qsRg oYj4VDIsag5Zr7tBVjZseCind3Sw976C2BZwlOoWE53AoD5sVXM3oq6wQ MAXTsAtIYOGugbWdnxyV6qsQp2R0+TZXCrObyWxmmI44GG8oDcSOfThUc KqAGp0LlA4kFwIyHSSnUwN3Q0TY5P4kh+3bk8nnS2omVNReTB+HIvyM2p /mFNOR2YhIM/JcnWvuG6m6se/7rmQGQH4+wI4y4h7wpFOVcaDmf22ce0n nrXsI/ls/r6+f9tT79vUFbnIG99qKZD3DN/RqvVLAT3vA84rgEC206bJ3 g==; IronPort-SDR: hFcQnaWCLTr6DrUAL8L0pmv0mceNMbvloToGxr3RyABt2fhLzL3AF2V8KSwJfGizBhQH34NSuL 61kQRIMTvSYpdMbYTaqxW9C6/vCv7nKH+gkxb8BdarIlqbd0s77LVCspodpasMfvC1hUVn3nLj ekhoT+zHcmZLy+ROCDbX+8DsNEovmZq3VsjSF9r0kRiwAXbqk+xXsWbIolcHNNenEHww9TOxUj 2haHk5R4udQ3vuLKYb/YkdJbKLg5s4G+sS9JFcFxfsmqGmETBn8G4O0MNgr9LBEm3BrR+mijE2 Y4A= X-IronPort-AV: E=Sophos;i="5.75,335,1589266800"; d="scan'208";a="83305778" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 10 Jul 2020 05:47:25 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 10 Jul 2020 05:46:58 -0700 Received: from ness.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 10 Jul 2020 05:47:22 -0700 From: To: , , , Claudiu Beznea , , CC: , "David S. Miller" , Alexandre Belloni , , Nicolas Ferre Subject: [PATCH v5 1/5] net: macb: fix wakeup test in runtime suspend/resume routines Date: Fri, 10 Jul 2020 14:46:41 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nicolas Ferre Use the proper struct device pointer to check if the wakeup flag and wakeup source are positioned. Use the one passed by function call which is equivalent to &bp->dev->dev.parent. It's preventing the trigger of a spurious interrupt in case the Wake-on-Lan feature is used. Fixes: d54f89af6cc4 ("net: macb: Add pm runtime support") Cc: Claudiu Beznea Cc: Harini Katakam Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- drivers/net/ethernet/cadence/macb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 52582e8ed90e..55e680f35022 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4654,7 +4654,7 @@ static int __maybe_unused macb_runtime_suspend(struct device *dev) struct net_device *netdev = dev_get_drvdata(dev); struct macb *bp = netdev_priv(netdev); - if (!(device_may_wakeup(&bp->dev->dev))) { + if (!(device_may_wakeup(dev))) { clk_disable_unprepare(bp->tx_clk); clk_disable_unprepare(bp->hclk); clk_disable_unprepare(bp->pclk); @@ -4670,7 +4670,7 @@ static int __maybe_unused macb_runtime_resume(struct device *dev) struct net_device *netdev = dev_get_drvdata(dev); struct macb *bp = netdev_priv(netdev); - if (!(device_may_wakeup(&bp->dev->dev))) { + if (!(device_may_wakeup(dev))) { clk_prepare_enable(bp->pclk); clk_prepare_enable(bp->hclk); clk_prepare_enable(bp->tx_clk); From patchwork Fri Jul 10 12:46:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 1326755 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=iAEGsQJI; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4B3CWK1B9Zz9sRR for ; Fri, 10 Jul 2020 22:47:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727927AbgGJMrc (ORCPT ); Fri, 10 Jul 2020 08:47:32 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:50543 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbgGJMra (ORCPT ); Fri, 10 Jul 2020 08:47:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594385249; x=1625921249; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3dSAtd0YST9naogJUwhR283iRPreXicwpYimF4Vmvi0=; b=iAEGsQJIbz2QIwJd9GGxifSENkQEEskX8osCpOkgrEPgvyO93dTal5O+ qAu3zxe9vJQr9ZY6BevRZZ5NGVdrkSuuhSe7XpZLL9cAayHH8UTD/Ktit GZqFw5BxcSF7DvkYyJlKDHiSEInQb0wRfoySX8kip6ogWLXxp/icX0qZZ YtvzWhpr51OAZYzb7cb7Hof8reaXPm/5sy2BKZnEx8JSkYZwtkMJxvqZD QHGLqiIXyQCv1rRn4/oH9d1/k+UJY7NvgVTc5OtSNqgk0HrJvF2Na0hyY XXkyQHEH+jdoLNjz9SlbsF14Itp3ysthIHPzePFbRRvffwdWCn305KYqk w==; IronPort-SDR: SwZKNCbVMNiyrrtLkALj6JNq8fh0MZ2dVkj7HytbeXgGXnQikweAeLAJJZiauk3XXQbrW+8uNf bARdVIdkKIbaDpuw0Y0q1X69lwMLUcRxQcsGNpVxM63XK02v7LTkUYimiatzLPvANHSA4hDT0s VnF6QH+kB6ZDZSxKqfXEvytZGi608N7K5pOmZX1eBjV1cgjwfIFxSaxrDHYx/3U24KK3wKCoJI 6A58hGLNlafdyqhigrB7r25poiUmOZs+e1T2c0gW3X2FsJ0X8DMrkj+UlpOy7Ulbv7E8IOBsWa aM8= X-IronPort-AV: E=Sophos;i="5.75,335,1589266800"; d="scan'208";a="83305784" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 10 Jul 2020 05:47:29 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 10 Jul 2020 05:47:01 -0700 Received: from ness.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 10 Jul 2020 05:47:25 -0700 From: To: , , , Claudiu Beznea , , CC: , "David S. Miller" , Alexandre Belloni , , Nicolas Ferre , Sergio Prado Subject: [PATCH v5 2/5] net: macb: mark device wake capable when "magic-packet" property present Date: Fri, 10 Jul 2020 14:46:42 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nicolas Ferre Change the way the "magic-packet" DT property is handled in the macb_probe() function, matching DT binding documentation. Now we mark the device as "wakeup capable" instead of calling the device_init_wakeup() function that would enable the wakeup source. For Ethernet WoL, enabling the wakeup_source is done by using ethtool and associated macb_set_wol() function that already calls device_set_wakeup_enable() for this purpose. That would reduce power consumption by cutting more clocks if "magic-packet" property is set but WoL is not configured by ethtool. Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Sergio Prado Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 55e680f35022..4cafe343c0a2 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4422,7 +4422,7 @@ static int macb_probe(struct platform_device *pdev) bp->wol = 0; if (of_get_property(np, "magic-packet", NULL)) bp->wol |= MACB_WOL_HAS_MAGIC_PACKET; - device_init_wakeup(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); + device_set_wakeup_capable(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); spin_lock_init(&bp->lock); From patchwork Fri Jul 10 12:46:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 1326753 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=XZFFh4cM; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4B3CW627gZz9sTF for ; Fri, 10 Jul 2020 22:47:46 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728009AbgGJMrl (ORCPT ); Fri, 10 Jul 2020 08:47:41 -0400 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:15336 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727092AbgGJMrd (ORCPT ); Fri, 10 Jul 2020 08:47:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594385253; x=1625921253; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CXqNu8fKVw9rY4hUYMuHMCoxx0VX8MHiv6b9yf2xcA0=; b=XZFFh4cMfiQF9188YXVRXr1DaI1oCirdwEbwGcIqWHKMw8OIbHwsSfc/ 1cBi+osxRTLOUgiYHXSCvTTP2Ef5W+vh/tAKGKLRSgWK1CTWHNMz1zPPE v7m3jvADFmJxqkAsaNrTd+GQguzAJN6+KIbim0YYevwUo43rR2BFtmxDC VHDW3guwbqn1IJ6TnBuOgzLUF0pD0o9wubPSnflxNw6Sm69B2nCoQdIJp EWqsvyfE515/RON/1Z3nwNu9HqPwp/2kp9quNn/6OKi1H6srvEQhjS1QD O/aEx1+TVYRvaw0CyNSfcCZorGWIsdtPVEVlCjOqIHmMgrV7qvY7XChzL A==; IronPort-SDR: pjId5Jp/Nsf/F0YkmieRr6fv/tTZUtlGX3W78j7dJA7gc0aZ1Xv1wTAfgWggfPSFz0JPmp6VAs +18Jz0GdEEX37h/x5H2FKjPqM4nnzCtEtGFs/oo0gboDGypSN2dSwvGwYN/GU3YNXs5Z8VrZny 5ZxEQRtA9I4ZKZsyC7oHge/hJWPDXFSGsr04BTnHYAfdhORNmHyGVzeoyzeNRSaQUeZ4VBSQsf Jx9g8ZrW53mlyJDkS2jwCNP/OXrK4wM6jAB6D2uXTCmMNd6NUbIdHDV+xqwHBqr3RtJ6lLIXWP 7qY= X-IronPort-AV: E=Sophos;i="5.75,335,1589266800"; d="scan'208";a="18675455" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 10 Jul 2020 05:47:32 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 10 Jul 2020 05:47:03 -0700 Received: from ness.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 10 Jul 2020 05:47:29 -0700 From: To: , , , Claudiu Beznea , , CC: , "David S. Miller" , Alexandre Belloni , , Nicolas Ferre Subject: [PATCH v5 3/5] net: macb: fix macb_get/set_wol() when moving to phylink Date: Fri, 10 Jul 2020 14:46:43 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nicolas Ferre Keep previous function goals and integrate phylink actions to them. phylink_ethtool_get_wol() is not enough to figure out if Ethernet driver supports Wake-on-Lan. Initialization of "supported" and "wolopts" members is done in phylink function, no need to keep them in calling function. phylink_ethtool_set_wol() return value is considered and determines if the MAC has to handle WoL or not. The case where the PHY doesn't implement WoL leads to the MAC configuring it to provide this feature. Fixes: 7897b071ac3b ("net: macb: convert to phylink") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Antoine Tenart Cc: Florian Fainelli Signed-off-by: Nicolas Ferre --- Changes in v5: - Addressed the error code returned by phylink_ethtool_set_wol() as suggested by Russell. If PHY handles WoL, MAC doesn't stay in the way. - Removed Florian's tag drivers/net/ethernet/cadence/macb_main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 4cafe343c0a2..79c2fe054303 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2821,11 +2821,13 @@ static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct macb *bp = netdev_priv(netdev); - wol->supported = 0; - wol->wolopts = 0; - - if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) + if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) { phylink_ethtool_get_wol(bp->phylink, wol); + wol->supported |= WAKE_MAGIC; + + if (bp->wol & MACB_WOL_ENABLED) + wol->wolopts |= WAKE_MAGIC; + } } static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) @@ -2833,9 +2835,13 @@ static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) struct macb *bp = netdev_priv(netdev); int ret; + /* Pass the order to phylink layer */ ret = phylink_ethtool_set_wol(bp->phylink, wol); - if (!ret) - return 0; + /* Don't manage WoL on MAC if handled by the PHY + * or if there's a failure in talking to the PHY + */ + if (!ret || ret != -EOPNOTSUPP) + return ret; if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) || (wol->wolopts & ~WAKE_MAGIC)) From patchwork Fri Jul 10 12:46:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 1326752 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=hppezngz; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4B3CVz55Zyz9sSn for ; Fri, 10 Jul 2020 22:47:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbgGJMrj (ORCPT ); Fri, 10 Jul 2020 08:47:39 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:50138 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727978AbgGJMrg (ORCPT ); Fri, 10 Jul 2020 08:47:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594385257; x=1625921257; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zvVFXVg26gKJue+5xGIofrm/3BbbDksLZVvakopyGEQ=; b=hppezngz0Stb8tiFsXsQo1wc/UNoK1GeZlVkIlRZq1Nr1MNnZz4GaAU7 g9QhmgXc0YgZrkfh1ttgi4LawCX6g2Rf+qcKzFhI7BFtqmE4cw/bXFI3y QKYRxxl0dniVV8rvy6WxIczbcoOy5Fuq39dkm8ITcRQXRSt7qnrJeVGXU 38k7mEDPfhs3jBk6g0rwwTVHhhBr1ggwVVYd2nopsaw1XevH0Om/DUn4A bijlhKc8Wiv7BsVLURYfmq8uEs7vEyRKh8SfFpysYfgOrMreJ+Mwl6guW IeSKe/UvMl89Smh9dazAEgphaLspL0FT2/riuxgow8dMUQofaYcEw8jvH A==; IronPort-SDR: NplFPck3JUElnTy7fY7g5mvxsN7nFfXmDdWETcEKVZfYIdeQZotJt85eSxGX4KpCNzRoUcYCq/ RW0GoOduYim8yskSCvoOcJLTgHrPyuciSHDoTYa/FasuBZnmIaKdiiS8nE76VlocbVqhULifY5 rDBM9ExDSlR/3E7CjFUeJzbwalEImzFQQzoQdD0hUSI24qFkZvJ6ziWGGGDfVeB17DJ5Zt6d5O k/oXJ2ktWyBcaWMzNkFrfSbEz3+nCzwLNYiXJho2gi8R0nxqJNOOTY0mL6Jt4XmWnWLga7Dcng RX0= X-IronPort-AV: E=Sophos;i="5.75,335,1589266800"; d="scan'208";a="82588083" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 10 Jul 2020 05:47:37 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 10 Jul 2020 05:47:35 -0700 Received: from ness.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 10 Jul 2020 05:47:32 -0700 From: To: , , , Claudiu Beznea , , CC: , "David S. Miller" , Alexandre Belloni , , Nicolas Ferre Subject: [PATCH v5 4/5] net: macb: fix macb_suspend() by removing call to netif_carrier_off() Date: Fri, 10 Jul 2020 14:46:44 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nicolas Ferre As we now use the phylink call to phylink_stop() in the non-WoL path, there is no need for this call to netif_carrier_off() anymore. It can disturb the underlying phylink FSM. Fixes: 7897b071ac3b ("net: macb: convert to phylink") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Antoine Tenart Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- Changes in v2: - new in v2 serries drivers/net/ethernet/cadence/macb_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 79c2fe054303..548815255e22 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4604,7 +4604,6 @@ static int __maybe_unused macb_suspend(struct device *dev) bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT); } - netif_carrier_off(netdev); if (bp->ptp_info) bp->ptp_info->ptp_remove(netdev); pm_runtime_force_suspend(dev); From patchwork Fri Jul 10 12:46:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 1326754 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=ThsXM2K9; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4B3CWC01WJz9sRR for ; Fri, 10 Jul 2020 22:47:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728041AbgGJMrr (ORCPT ); Fri, 10 Jul 2020 08:47:47 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:50564 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728002AbgGJMrk (ORCPT ); Fri, 10 Jul 2020 08:47:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594385259; x=1625921259; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=F198PHt3CmmrCPyBEGbcvHM9j1ntyqNfdwfITtlue5c=; b=ThsXM2K90MFFuEGtgYxvZ07M8KLSRku348/7A1WtorNpHn3DET3x7wYP rthbetdaWbhS2JbCFIF4Bdkmc4/y6h2kiMczev1YxDEc9S0dqf6VqO2zF st68rL3ArmY8GDGGi/mHa9KYnGlxYL/vhir8kuetLucqJmtf8zXQfJzO0 y9kMeVX4B4qXkaOVts6Djp88jaKw07LkKn7BvbhngZupBtl7AvktMLpUP 0o86j13aXtueOBoZ9GbnPQM5dpjKRd/NjF7TwcnkF9O38FtlNSjmrouA8 8x4wInunZ3lHQrUVFLkSSFI2pL7zm66p69NJQzOQemFy5EP+7uGuMNnMN A==; IronPort-SDR: HBrMMwKuQf6Di2FjkopmR62P4XsHGDVVK0EcV4Qycn5uxTjsqfSMYOw02a3/ONXxVGifaPQGNr ZJCEgKFg3nPdEC4lIOCIimu1j438AkraRJ79I2NB/i1xEmbzlHs2dX7M2PhYcJheq0MohvDVnR TMMsPcTnNfqAMnoF7RrtsSNWW8sOySK4GbCTy17m/1wmfGd+Bx8fa2lbscmjD/lW+q9/JJ5RK2 P+g/oIfXZwj01BfvX5/DPFRRnQabec5l9WkvDAU4OpWvfRxswus0RT2WEhBzDWO++Y6wEIfimW zjQ= X-IronPort-AV: E=Sophos;i="5.75,335,1589266800"; d="scan'208";a="83305801" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 10 Jul 2020 05:47:39 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 10 Jul 2020 05:47:39 -0700 Received: from ness.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 10 Jul 2020 05:47:35 -0700 From: To: , , , Claudiu Beznea , , CC: , "David S. Miller" , Alexandre Belloni , , Nicolas Ferre , Sergio Prado Subject: [PATCH v5 5/5] net: macb: fix call to pm_runtime in the suspend/resume functions Date: Fri, 10 Jul 2020 14:46:45 +0200 Message-ID: <5d36a9f6956fb4fb55778cabd2c21bbfc3670cf5.1594384335.git.nicolas.ferre@microchip.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nicolas Ferre The calls to pm_runtime_force_suspend/resume() functions are only relevant if the device is not configured to act as a WoL wakeup source. Add the device_may_wakeup() test before calling them. Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Sergio Prado Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- Changes in v3: - remove the parenthesis around device_may_wakeup() Changes in v2: - new in v2 serries drivers/net/ethernet/cadence/macb_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 548815255e22..f1f0976e7669 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4606,7 +4606,8 @@ static int __maybe_unused macb_suspend(struct device *dev) if (bp->ptp_info) bp->ptp_info->ptp_remove(netdev); - pm_runtime_force_suspend(dev); + if (!device_may_wakeup(dev)) + pm_runtime_force_suspend(dev); return 0; } @@ -4621,7 +4622,8 @@ static int __maybe_unused macb_resume(struct device *dev) if (!netif_running(netdev)) return 0; - pm_runtime_force_resume(dev); + if (!device_may_wakeup(dev)) + pm_runtime_force_resume(dev); if (bp->wol & MACB_WOL_ENABLED) { macb_writel(bp, IDR, MACB_BIT(WOL));