Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1214979rwd; Thu, 1 Jun 2023 12:05:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ivUDJE+dmhmnQFw86UwCZg6nKSt2retPxhSnNU7EoMjXF10iSAsF4w+hgkQ8AwLfqt6KI X-Received: by 2002:a05:6a00:234a:b0:63f:120a:1dc3 with SMTP id j10-20020a056a00234a00b0063f120a1dc3mr8244123pfj.0.1685646316783; Thu, 01 Jun 2023 12:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685646316; cv=none; d=google.com; s=arc-20160816; b=flhdF11gl5TopvDk5theBE5y8j4OI6CZaKU8WgiaKeUKA5+oQ/Jx3TzI3BemoGpsMd 96M3WcCEZRsPDZr//aR0h7tMccXJa1CqFxpGWAad7DxIhgZCmMjFepfmuILRuYdCeqnE j/JdE9kmnTWmWGt+DKrDkpmdWXMYfOf69NBKxQsgl1DFmbSL09IhC49Dt5+J3zHX44tr hyYzm4ioGYvS0DUM6RJzwIS2bKOM+p2htlgnrs2mFlZxCKXym1XAnZtSo6J1ROnJVrhx 3eLlqpEpSFfrl5ahuf8419AyPKG4qH3QXllJk20/XqKIt2HhrX4v12+5RdkR3N0obphc zMTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bHdmnR1Xzli1omfGwEoz5opBryIwcSOFGIV2/hia/f0=; b=r4bdBz2VQ8nbpcrMuvZzqVZtar1p2ozrKPS5H+U8ki2wBdZZuZuTYgeZkkjzAlOwEP X0o0xIi6ZLGD90x/gybazyP8v2TdOWpN+ppW4LdLq7wWMyElHTgAMSeWU2/tZJ3WNugI 94eKPv+xPFkxMs8tQk2Bg66pEkDyIbCHltn+kcGmQSYXztloLmZXq1DRJ8zPDbKFhrMT IdBvg1RgssqUQz2FUivrnHMVEOGrH3H5SaGNL6SL8JxHukSESZDtuFpUbdulMfX/6Iyb ciyZjXks7uVTho4icUsTddfo/MsWRdEKXzYP1VTRD+xfjVZwXK0LA+psdfqRnRtcVJJF Sw2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="Xjv90ww/"; 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=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b127-20020a62cf85000000b0064d2ddc63ebsi5823506pfg.306.2023.06.01.12.05.04; Thu, 01 Jun 2023 12:05:16 -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=@lunn.ch header.s=20171124 header.b="Xjv90ww/"; 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=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230526AbjFASs7 (ORCPT + 99 others); Thu, 1 Jun 2023 14:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjFASs6 (ORCPT ); Thu, 1 Jun 2023 14:48:58 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F1C718D; Thu, 1 Jun 2023 11:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=bHdmnR1Xzli1omfGwEoz5opBryIwcSOFGIV2/hia/f0=; b=Xj v90ww/C1HE3NKJDoyJpYVZ38/0NS0131d81z0uGkR2BYA4jQ0YHwR+b32P+Jw7CR/vgMk+bhCosbF vxap1wKiltEir3iYsSyn4+IHwgII+6jzdCxKswz9BMO1D2Eu5OsdyqAkfSORFQtsT73aVDD+k+K/T xvQa7naKxvwK31o=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1q4nLx-00EbD4-SR; Thu, 01 Jun 2023 20:48:53 +0200 Date: Thu, 1 Jun 2023 20:48:53 +0200 From: Andrew Lunn To: Florian Fainelli Cc: Justin Chen , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, bcm-kernel-feedback-list@broadcom.com, Daniil Tatianin , Yuiko Oshino , Horatiu Vultur , Steen Hegelund , Rakesh Sankaranarayanan , Arun Ramadoss Subject: Re: [PATCH net-next] ethtool: ioctl: improve error checking for set_wol Message-ID: <312c1067-aab6-4f04-b18e-ba1b7a0d1427@lunn.ch> References: <1685566429-2869-1-git-send-email-justin.chen@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 > > > I was planning to for the Broadcom drivers since those I can test. > > > But I could do it across the board if that is preferred. > > > > > > > > Signed-off-by: Justin Chen > > > > > --- > > > > > ? net/ethtool/ioctl.c | 14 ++++++++++++-- > > > > > ? 1 file changed, 12 insertions(+), 2 deletions(-) > > > > > > > > > > diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c > > > > > index 6bb778e10461..80f456f83db0 100644 > > > > > --- a/net/ethtool/ioctl.c > > > > > +++ b/net/ethtool/ioctl.c > > > > > @@ -1436,15 +1436,25 @@ static int ethtool_get_wol(struct > > > > > net_device *dev, char __user *useraddr) > > > > > ? static int ethtool_set_wol(struct net_device *dev, char > > > > > __user *useraddr) > > > > > ? { > > > > > -??? struct ethtool_wolinfo wol; > > > > > +??? struct ethtool_wolinfo wol, cur_wol; > > > > > ????? int ret; > > > > > -??? if (!dev->ethtool_ops->set_wol) > > > > > +??? if (!dev->ethtool_ops->get_wol || !dev->ethtool_ops->set_wol) > > > > > ????????? return -EOPNOTSUPP; > > > > > > > > Are there cases where (in-tree) drivers provide set_wol byt not get_wol? > > > > If so, does this break their set_wol support? > > > > > > > > > > My original thought was to match netlink set wol behavior. So > > > drivers that do that won't work with netlink set_wol right now. I'll > > > skim around to see if any drivers do this. But I would reckon this > > > should be a driver fix. > > > > > > Thanks, > > > Justin > > > > > > > I see a driver at drivers/net/phy/microchip.c. But this is a phy driver > > set_wol hook. > > That part of the driver appears to be dead code. It attempts to pretend to > support Wake-on-LAN, but it does not do any specific programming of wake-up > filters, nor does it implement get_wol. It also does not make use of the > recently introduced PHY_ALWAYS_CALL_SUSPEND flag. > > When it is time to determine whether to suspend the PHY or not, eventually > phy_suspend() will call phy_ethtool_get_wol(). Since no get_wol is > implemented, the wol.wolopts will remain zero, therefore we will just > suspend the PHY. > > I suspect this was added to work around MAC drivers that may forcefully try > to suspend the PHY, but that should not even be possible these days. > > I would just remove that logic from microchip.c entirely. The Microchip developers are reasonably responsive. So we should Cc: them. Andrew