Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4177937pxp; Tue, 15 Mar 2022 14:31:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqR+DG43TsXlLPBrmb4wGG8c2sv9VEk7Jtgv+rJDzx2mfGnYWws3/f0YPMnIMN3Tr8tNm0 X-Received: by 2002:a17:90a:2b0f:b0:1bf:37d6:a49d with SMTP id x15-20020a17090a2b0f00b001bf37d6a49dmr6835377pjc.30.1647379894279; Tue, 15 Mar 2022 14:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647379894; cv=none; d=google.com; s=arc-20160816; b=Os1m6HQiKBrKniSGxFu+XSTka1/mQdV0etDu1Rl+RElB3Eq5w1qC3Lu8bjgFS96xto 3k1c71VwHoY3wgfHz2QQFbukZM4ZpK8M/N8OGCJdWp61ctAX6THWqoOrQ9MSwgAU8nWu 2pV14lYMQNXesBb92cQ5R9L4enjrnjibiNaIdWdonxB8TeZEvup6YkZbP7tO9ARlo9Vv Y6PzuCC4dB45ZASx68jLpMpBAPWOkaHbEZQgETxYpV5LSt8DCpswOaZnluH+8OIZMuC/ 8GYXP1VeI65lJ8PZ/4eARcjXpixbSnE/VhDoTlnVRA5NNpTnccF62ezW+HjzROSlAW/l cccg== 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=TUCXkv7iioubOyE3YHg7hl8STFqm5dl6qM3YZonCQyc=; b=lD0lFZ5FlJwEmDZLDOsMnXjQXM1ofuewBDSryKmhsyyVqcKQOamChAMDdgnHR3rNER evjcMvlUM2YjLSmAlW4vwjA8ymh6CZmmbJtUquV/gwiWte2CAZ9NIkQTz+cnlWbdO7WI lN0snw9g5j8U+bCv9M7ARFI0XTT3PhUuksi08px479hdbsILrZTMm2JMfB+iEdONMnYk BBVq5QJAKa0YUYiCBiIftBRvt+WYtA4siTD+xpC5BqcWJPlI9UwYOzeU3EfMg/Y4qHEh 2LbiBrwCwGJKuz5ycQ2JVLWFC72lMkIZgg3l7YgpdbyzDfMLuVNswd3d1gx1nKSg3+Uf iWYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UKHfBtLI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p42-20020a056a000a2a00b004f64f065982si315618pfh.37.2022.03.15.14.31.20; Tue, 15 Mar 2022 14:31:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UKHfBtLI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S243739AbiCNMbX (ORCPT + 99 others); Mon, 14 Mar 2022 08:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242995AbiCNMT7 (ORCPT ); Mon, 14 Mar 2022 08:19:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BBC852B28; Mon, 14 Mar 2022 05:15:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5F129B80DE1; Mon, 14 Mar 2022 12:15:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF7EC340E9; Mon, 14 Mar 2022 12:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647260107; bh=i7xv0jglIHn4FUUINh7I6a5MJYZqrXrWYxEtF5hnFLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKHfBtLIEXa4yeAnW0LCaEH8y2Gx3j5p++PAWy7/QaM8b6X5UJkecKVVcYFBjnQOd NUyN1Bkc/564IQBeyAmCvkXOnHZK6hUWtvELouJM4gU8f6l54y0ne/Vw0eSUvYTNpV 36dXZiiuLyPLso8By/1Ql3f6bVnLT0AHQsfcaDKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Linton , Peter Robinson , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 058/121] net: bcmgenet: Dont claim WOL when its not available Date: Mon, 14 Mar 2022 12:54:01 +0100 Message-Id: <20220314112745.745078143@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeremy Linton [ Upstream commit 00b022f8f876a3a036b0df7f971001bef6398605 ] Some of the bcmgenet platforms don't correctly support WOL, yet ethtool returns: "Supports Wake-on: gsf" which is false. Ideally if there isn't a wol_irq, or there is something else that keeps the device from being able to wakeup it should display: "Supports Wake-on: d" This patch checks whether the device can wakup, before using the hard-coded supported flags. This corrects the ethtool reporting, as well as the WOL configuration because ethtool verifies that the mode is supported before attempting it. Fixes: c51de7f3976b ("net: bcmgenet: add Wake-on-LAN support code") Signed-off-by: Jeremy Linton Tested-by: Peter Robinson Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/20220310045535.224450-1-jeremy.linton@arm.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c index e31a5a397f11..f55d9d9c01a8 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c @@ -40,6 +40,13 @@ void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct bcmgenet_priv *priv = netdev_priv(dev); + struct device *kdev = &priv->pdev->dev; + + if (!device_can_wakeup(kdev)) { + wol->supported = 0; + wol->wolopts = 0; + return; + } wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER; wol->wolopts = priv->wolopts; -- 2.34.1