Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp55733pxp; Tue, 15 Mar 2022 23:40:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDe4dtOPGpv/33YbEgzOB9jnjFRWzs1HFutI04cSTtWhi9aTFy6SiYaSkXm+KNlcDrZFJT X-Received: by 2002:a17:90a:9dc6:b0:1bc:5c73:522b with SMTP id x6-20020a17090a9dc600b001bc5c73522bmr8656406pjv.35.1647412825045; Tue, 15 Mar 2022 23:40:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647412825; cv=none; d=google.com; s=arc-20160816; b=vh32QA12MyfFb68bPoCDNP1KtCcekcyu/JaASQgp6CoEqD9wIH4UZopiEMw5n0JpCE X8koV2GEICmZUHvwJIYmu3eOAGRUy1zbE7ZhviVJAYTphJXhGDihQRcN2LjT9m6qufBo Ykivfb1pKYTdemdsvKhXR4AybswEsRre9rgkPlcnzPy/nIVztNYkMsT1ngoCV1wmaZOd Vo+AhlWcM9tRT8pPPi1AOcqI1FPMOuBjOCx4CeCsasqkJVAkHMSDMKuMkRi3u5HQfaOk W2SuA8K9jzHtdk57BB8xsdvjJJfQ4F0ZvuSsnBhXdlUsUtq1Pw7Ev8PV7S3FTO8yPmiT go9g== 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=RlVZ+LFPnWnopgc95bYKG04MzIQ13jeqrM7IdHcAoymEVY4P6yVW6xpvdo39Dx5bZK m0bl9EGPLAcFB2zgIiXHRAV+xVklSN+E/0NssmhF2Q70yxbZHoo+iGjwvOpPBJU0sDzB Y4x8L904uMnVXnLHgj3aDuH3dO2Rida7sQ1GEd1N3VLvvcM9kuKA3s807xoR9pTCL1AE GUizz8GJ2UoOt8yEjIWY05XMkSYlnb6QoCiPcFkW5dFuY/uSRH+RMJLKRhVsP8flZJ2/ BZ+cFEWeze6xOIMyTl7lC+gHSuWBb6uptdusS3qnwLAuDyhPbBP+i8h8csceCqbRu+h9 grYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gsP2ODDZ; 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 bt3-20020a17090af00300b001bd14e01fb1si3898075pjb.159.2022.03.15.23.40.12; Tue, 15 Mar 2022 23:40:25 -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=gsP2ODDZ; 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 S235771AbiCNMRc (ORCPT + 99 others); Mon, 14 Mar 2022 08:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242292AbiCNMJu (ORCPT ); Mon, 14 Mar 2022 08:09:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A111D26558; Mon, 14 Mar 2022 05:07:02 -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 F2E92B80DED; Mon, 14 Mar 2022 12:06:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48CF0C340E9; Mon, 14 Mar 2022 12:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259616; bh=i7xv0jglIHn4FUUINh7I6a5MJYZqrXrWYxEtF5hnFLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gsP2ODDZfTww0d0Op/XUZl0cVg45FWqxFjfxbNuXZuFsE02yAvmqBPoaOyqanExn1 pWAvY/DRJNldsSqENMGWBs230Ni3+CAVL1b9syghAqSrYKD9O++SPOCkBKoE+UMDEU SCB4VHnJZOPpO1yHG6Mb4Zu2GdvQXK21pypj5L5g= 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.15 050/110] net: bcmgenet: Dont claim WOL when its not available Date: Mon, 14 Mar 2022 12:53:52 +0100 Message-Id: <20220314112744.433400772@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112743.029192918@linuxfoundation.org> References: <20220314112743.029192918@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