From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 13E01C2D0FD for ; Wed, 13 May 2020 14:16:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BBCD420659 for ; Wed, 13 May 2020 14:16:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GrXWl/At"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="UJogM0J7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBCD420659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SOsqEyoY5eBZKx+mb9gDod5sl6qo2X9pvSzXUgkS9pw=; b=GrXWl/AtAOwwQ0Vc7/dECbY5T ihpChUV4XCnILGz6FZ2oSB8LS7OZX5WKyAob/0Wk2/JmD++K65F2dGmIUf0+tclcmbBLUF2TqySV+ yk0jmAGjiTinwyM5giO+cajluJ7xAhfQDrjkpL0v629yJAgF1tltKhsf9oBPicM/xE8JCQQVaT4XG Yv7xJpwNnTs3vDREOiwTjhEcatWQy/hSefxPGxNycLca1u0vajhl0eSKy8N+Rl9W9iqlIBuvGOUma j6ZJBUAaEcW2U5vgQTQyd3BTq8aowZt2G6bDsMFoRqfAGomERBOX5pnGWf6UJuRPp2LKw7JT6DTDK +rJI3BzZw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYsBA-0006bc-F8; Wed, 13 May 2020 14:16:12 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYsB7-0006as-LV for linux-arm-kernel@lists.infradead.org; Wed, 13 May 2020 14:16:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1589379369; x=1620915369; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=UzkFgk4KxPXdtpumytvjaT9DH3n8QRgbvV1ZsZ7ca9s=; b=UJogM0J71OFbu86bGuhubpX+0bTaBSWsD7hmKAJpzP4Yo93BxLT4KKaW Zpuh+5eH6AiuCbF8jh8HN27c4dH5L0RXYChGrHcu2nPFxGGLC/UzQ1vOY 7hXKY/3/Svhq7cOO/x3PvTcAG8GrkxP6HMETtP3StzjGuy5cOlz3ocwPU JGfBQ+aJGrV3MFy1G9kFdqMPGj6p9+kKSXSC2pvSDsx2Onl4Ehpp/YdDs AoFpZJnisfKSDlaBPFOH2VSGC3h6rQUWqM+IvAkacv5yjQ9a2Q0fYVkHT 7nd5NuJ12bw/TXUmDvBO7sJabVBWQZXcg+JD8vZJK4XfD91jw7GVYf2EX g==; IronPort-SDR: BAhFBmj8YgfLl9K0CKFV6Il6Sh3mNN5rA25bxiNtKTAFHTSbtw1UbUhFshasWmVsDmrUmh34OF 6V6JPqzxQ5e8fH9gJdbnXvkZS6ueKYbciyV84JBVSLybdKYySn2h39eApCA4yGMqbwSyCzbvRi 1WXiyYmrxUPcL+c0JEmHlzOMbdn7wFxc14zIurUdvC/9by6sHYiDbdrj8O1lTqx48LSTISNCGK 0mHXOw7MbZRfa8sRz171/iir+iS1yWQeYULipTTL777gBlA/OFTceROHJB1SQfarxYRdJrax7o v7g= X-IronPort-AV: E=Sophos;i="5.73,388,1583218800"; d="scan'208";a="76511186" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 13 May 2020 07:16:08 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) 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.1713.5; Wed, 13 May 2020 07:16:08 -0700 Received: from [10.171.246.28] (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 13 May 2020 07:16:05 -0700 Subject: Re: [PATCH v4 3/5] net: macb: fix macb_get/set_wol() when moving to phylink To: Russell King - ARM Linux admin References: <4aeebe901fde6db70a5ca12b10e793dd2ee6ce60.1588763703.git.nicolas.ferre@microchip.com> <20200513130536.GI1551@shell.armlinux.org.uk> From: Nicolas Ferre Organization: microchip Message-ID: Date: Wed, 13 May 2020 16:16:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200513130536.GI1551@shell.armlinux.org.uk> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200513_071609_717029_0A629B25 X-CRM114-Status: GOOD ( 25.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , f.fainelli@gmail.com, antoine.tenart@bootlin.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , harini.katakam@xilinx.com, Claudiu Beznea , linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Russell, Thanks for the feedback. On 13/05/2020 at 15:05, Russell King - ARM Linux admin wrote: > On Wed, May 06, 2020 at 01:37:39PM +0200, nicolas.ferre@microchip.com wrote: >> 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 not enough to determine >> if WoL is enabled for the calling Ethernet driver. Call it first >> but don't rely on its return value as most of simple PHY drivers >> don't implement a set_wol() function. >> >> Fixes: 7897b071ac3b ("net: macb: convert to phylink") >> Signed-off-by: Nicolas Ferre >> Reviewed-by: Florian Fainelli >> Cc: Claudiu Beznea >> Cc: Harini Katakam >> Cc: Antoine Tenart >> --- >> drivers/net/ethernet/cadence/macb_main.c | 18 ++++++++++-------- >> 1 file changed, 10 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c >> index 53e81ab048ae..24c044dc7fa0 100644 >> --- a/drivers/net/ethernet/cadence/macb_main.c >> +++ b/drivers/net/ethernet/cadence/macb_main.c >> @@ -2817,21 +2817,23 @@ 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) >> { >> struct macb *bp = netdev_priv(netdev); >> - int ret; >> >> - ret = phylink_ethtool_set_wol(bp->phylink, wol); >> - if (!ret) >> - return 0; >> + /* Pass the order to phylink layer. >> + * Don't test return value as set_wol() is often not supported. >> + */ >> + phylink_ethtool_set_wol(bp->phylink, wol); > > If this returns an error, does that mean WOL works or does it not? In my use case (simple phy: "Micrel KSZ8081"), if I have the error "-EOPNOTSUPP", it simply means that this phy driver doesn't have the set_wol() function. But on the MAC side, I can perfectly wake-up on WoL event as the phy acts as a pass-through. > Note that if set_wol() is not supported, this will return -EOPNOTSUPP. > What about other errors? True, I don't manage them. But for now this patch is a fix that only reverts to previous behavior. In other terms, it only fixes the regression. But can I make the difference, and how, between? 1/ the phy doesn't support WoL and could prevent the WoL to happen on the MAC 2/ the phy doesn't implement (yet) the set_wol() function, if MAC can manage, it's fine > If you want to just ignore the case where it's not supported, then > this looks like a sledge hammer to crack a nut. Do you suggest that I just don't call phylink_ethtool_set_wol() at all? But what if the underlying phy does support WoL? Best regards, -- Nicolas Ferre _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel