Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2680431pxj; Mon, 31 May 2021 08:07:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdkKsxpglxdzl5xTJUM2sQCeAHGRkrtitA3AZd6hHDmh7xZBMKW/Tdd9Z1Hi3TvtYCA4zK X-Received: by 2002:a17:906:bfc8:: with SMTP id us8mr11084081ejb.217.1622473632378; Mon, 31 May 2021 08:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622473632; cv=none; d=google.com; s=arc-20160816; b=VUuQtvRwsKryAmqlw59PYfEcBQERa1P6nhmQ4HSwBEwyY00WaJ9b/AL5g1LrOUh49B ejnwcLZOp41HRqOukGWSBkhg9I7Hjof3RqWGhoh3yAa5tim9pwUtcI8R/pghfYl89YHH DSB3wgKkpqoJAhyqTdw7i90sYbR72sfwtOPS+2X6RJqVETNCL8ndXJ4W389PMPmngt8G FuOyXgZGBqT+jpi2aLreAK6WhC9kydWxgsJAF5YPrSFZKSvNVUiFdu7oCDWNexsQm15S tBkvYSyWCv9GYNMAPAn+mKE+WXWQLrSqGjxFBYu25fPC32j21fDoy6pPXtrS6GYhfhxY mo/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d1pIk0tOIUydwvzm7cWwdbkGbQSKD6EYI29A+47AYDg=; b=onry94TJ1UVw2aX+MWyjdn2ngv+NbBTyd0Twa8R2/Df9Cz4BbESYpvchah3nb7dGF0 KNEJ1chXAyw3o+2NIxmuovA3OyxJOtd9R+suHlTOBzAspD2iHkNXvMcCLulZ2YiuDgv6 tzO9ahhxtkBH4mXk9kogTH9sXI6jtM5uZ9bGkjBD4MuQbTJgmi4c13a5chmk2fuxBSoN A6kcxBeO7UHaZGzFxZZUxdiT+2NethIt3jcnIuYwTYcQIH2L7NsvANBoEif7nd28UIbh HNJpHA8MLPlEhPSNGNMZkwPOjMC2KxISSg/V/XneVO6OCJTvV3VfRSxZOCvvLpgkkPA+ dDGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hI4inqZM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si11375947edc.428.2021.05.31.08.06.49; Mon, 31 May 2021 08:07:12 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hI4inqZM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232700AbhEaPHc (ORCPT + 99 others); Mon, 31 May 2021 11:07:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:40994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233140AbhEaOJB (ORCPT ); Mon, 31 May 2021 10:09:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5752261976; Mon, 31 May 2021 13:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468402; bh=Bv0mKAu8qZJjC3ph8xwj70XSBa7tA99L509BR5nvgdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hI4inqZMMS/5yYk/xNQdWvdwyKtUpl8dklSLFqfPfttmvHznxIWMR7fMg0ooxH7tM XqUxPVl1K9eDarimzy+lZC8rFwRzuVaUI+cDU0x609nOCNlAOcOPNP/33lBUb8Eh4k HLRe4eFQjKfCyHbL+XL7Xn91WvVH9+RhqIhDcYy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jisheng Zhang , Joakim Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 194/252] net: stmmac: Fix MAC WoL not working if PHY does not support WoL Date: Mon, 31 May 2021 15:14:19 +0200 Message-Id: <20210531130704.603862220@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joakim Zhang [ Upstream commit 576f9eacc680d2b1f37e8010cff62f7b227ea769 ] Both get and set WoL will check device_can_wakeup(), if MAC supports PMT, it will set device wakeup capability. After commit 1d8e5b0f3f2c ("net: stmmac: Support WOL with phy"), device wakeup capability will be overwrite in stmmac_init_phy() according to phy's Wol feature. If phy doesn't support WoL, then MAC will lose wakeup capability. To fix this issue, only overwrite device wakeup capability when MAC doesn't support PMT. For STMMAC now driver checks MAC's WoL capability if MAC supports PMT, if not support, driver will check PHY's WoL capability. Fixes: 1d8e5b0f3f2c ("net: stmmac: Support WOL with phy") Reviewed-by: Jisheng Zhang Signed-off-by: Joakim Zhang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4374ce4671ad..3134f7e669f8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1052,7 +1052,6 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv) */ static int stmmac_init_phy(struct net_device *dev) { - struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; struct stmmac_priv *priv = netdev_priv(dev); struct device_node *node; int ret; @@ -1078,8 +1077,12 @@ static int stmmac_init_phy(struct net_device *dev) ret = phylink_connect_phy(priv->phylink, phydev); } - phylink_ethtool_get_wol(priv->phylink, &wol); - device_set_wakeup_capable(priv->device, !!wol.supported); + if (!priv->plat->pmt) { + struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; + + phylink_ethtool_get_wol(priv->phylink, &wol); + device_set_wakeup_capable(priv->device, !!wol.supported); + } return ret; } -- 2.30.2