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=-12.8 required=3.0 tests=BAYES_00,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_GIT 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 53CEAC433DF for ; Fri, 10 Jul 2020 12:48:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 09FF72077D for ; Fri, 10 Jul 2020 12:48:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UmBZ9Yw0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="K+YVe0oZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09FF72077D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BtvysT24Tkjw5X10Efq5NqPu7ae9B29EMshZNUrW0Xo=; b=UmBZ9Yw0HgqBFhr44ZFsfxGE6 gb+TPTTWx1mYd8JXyhOM6qtg7r6ZLbdbfArubPm1B1mFPgBofZpyMJNtGU55uMO9lFp9oF2UGl+tG LROvdfhvONcXIya4JOqieaefOvZTQvrKOspk1P/7VsiOx8gpGlVAM2nNNP00ZPgfEudqCsloUvgNs aQ1UGpyu6DC+RZ1tIBdgCp83gyJZJBbw25HGqNv+5qJYEt/XWf7Lj97uWTMe+Ny2WkrsWeUfKcHh5 111Bb53EGmu6sYQlYrr04Np+HO617DfDFLm6H59KMNe586evv2A/kHOiP/MMc7KtVnOZMZKj5mkCC Ej2DsokHg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtsRG-00050Z-6E; Fri, 10 Jul 2020 12:47:38 +0000 Received: from esa6.microchip.iphmx.com ([216.71.154.253]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtsRC-0004yu-Dq for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 12:47:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594385254; x=1625921254; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CXqNu8fKVw9rY4hUYMuHMCoxx0VX8MHiv6b9yf2xcA0=; b=K+YVe0oZS6meVFE10CNyiSPZ+jJ8SXcZkD+/UKsDeFASxQhuzHRmaoRs M/m6TkmEc8JjyM/JtkXLKWvb7obU6+NvKgAwmS+S7H9Z7kpMYMa5wF44e A27daNkNu20OeY21mIYCBiNgA7bY7QxrAohIS48A4ACoFNkXRxCFlfM5I 2JgZ2kwz7mkiuuHowEZbCqt1Grur6t2xFViIXerrKyuOVTLrNB5Y4l2GI 62EqKz4FLqPhsYqtsxktvkNh6HdsD94fwzYdrjLDSduAw4PG4WlGT/bUZ Azw6+wmtgAgYkiaFW/2D3ESTd33h6Rz8NwkwThmtWnQgZZ6ysLnWkOcag w==; 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 , , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_084734_695023_754ABED7 X-CRM114-Status: GOOD ( 15.04 ) 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: antoine.tenart@bootlin.com, Alexandre Belloni , linux-kernel@vger.kernel.org, "David S. Miller" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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)) -- 2.27.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel