Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1642595rdg; Sat, 14 Oct 2023 10:15:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGI3wlMy7Z/lw8KMnh6n/q0ihIvx5Uwtg71VwnZE2zIuLhb/1owQnV7gjUzsv7mnfYcmc17 X-Received: by 2002:a54:408c:0:b0:3a7:4b9a:43c2 with SMTP id i12-20020a54408c000000b003a74b9a43c2mr32625942oii.13.1697303744870; Sat, 14 Oct 2023 10:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697303744; cv=none; d=google.com; s=arc-20160816; b=WI+3C0pp7a5avcrcP3w67Uej0/1gLIivGMSxUUifVXVKuexbHrJIJ3oXsLaD5JFgBW jN4eXFPggUJ5f01Ah2tT+scouArInq07BP65j2H4gWZw5uXL1BYWVENRTBAI7jA2JP2G R+S+cW+yPOIS7N4bceZa9heNiP54zrZkz9RxpBc+75hHhnxYeTYRB33r34MZax7uqMtE vxOGni1PIYk3uH3GTO715EKRsKkenXRqpEgSqUJGXbIuISdD+u6tUhHLcxiDjX8lvmV0 AonjZ5kgMR0ZDMTOOVS1+8rCiTI4Yvwr03YU/wAOXp0Epi5q9+GAE42Fw5wTvmJGq5xW uvhw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RFB4W/lttFFinZCRqI4fRcVdzoARXKXzSN2cTHpzOiU=; fh=pbdktCCt2wJuv718rIqzCC/OpSnBg3qQmTtg1LbUuLo=; b=gYmGV2ABJcdSXw5das6tMoaydIsL47YZNwZz9oiQSTkn/wLwKeQXKxfUKbjhGJJnxS hyQiZ1VPd1SHBcFqi6h1POC8cjb4fA3Plel+I6ubu6uWp+aSkkvButNAK63PJHTEtYBP xmeKLEuCbx3Us096lxhO71QxLnOnmUOqKX9V2fs8Z0fMyneOGn0o3pOCYfpRJcCln8hI pw+IRy7T1Q6Xhg1On8AdESx5I8c/F9mLikTWofnud5Hb32IneMb6BMuJDlWzk/IAnuZV /gjW3+UgkijvPmiEj2V/e5vJ28EqUthTL7voFmDleFC6NRDoeGQdmAg/C0M95DHY+oqR V9AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=4UvxYq2L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id y22-20020a056a00191600b00690c0051dcdsi10765904pfi.143.2023.10.14.10.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 10:15:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=4UvxYq2L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 01DB680A13BC; Sat, 14 Oct 2023 10:15:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233197AbjJNRPM (ORCPT + 99 others); Sat, 14 Oct 2023 13:15:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230016AbjJNRPL (ORCPT ); Sat, 14 Oct 2023 13:15:11 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E29B7; Sat, 14 Oct 2023 10:15:10 -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-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=RFB4W/lttFFinZCRqI4fRcVdzoARXKXzSN2cTHpzOiU=; b=4UvxYq2LoZB9hmBramhrJxr9TV MQG05VmIisD6eTWMOjK6FIQvuunnFy5O++YvV8RNrFDSckdOc17rjC/m3fWw0hjfXuzvb230F1kKi P2j1GHn9XnOpi3/dT9xh38LcWYjagiYKpEaD3uL+9fTryWc2MEnGYQquLzOU9hQF4NTY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qriE5-002BvQ-M3; Sat, 14 Oct 2023 19:14:57 +0200 Date: Sat, 14 Oct 2023 19:14:57 +0200 From: Andrew Lunn To: Oleksij Rempel Cc: "David S. Miller" , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Woojung Huh , Arun Ramadoss , Conor Dooley , Krzysztof Kozlowski , Rob Herring , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, "Russell King (Oracle)" , devicetree@vger.kernel.org Subject: Re: [PATCH net-next v3 3/7] net: dsa: microchip: ksz9477: add Wake on LAN support Message-ID: <877cd674-dbb8-4786-891e-1652eee16f46@lunn.ch> References: <20231013122405.3745475-1-o.rempel@pengutronix.de> <20231013122405.3745475-4-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231013122405.3745475-4-o.rempel@pengutronix.de> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sat, 14 Oct 2023 10:15:30 -0700 (PDT) > + * ksz9477_get_wol - Get Wake-on-LAN settings for a specified port. > + * @dev: The device structure. > + * @port: The port number. > + * @wol: Pointer to ethtool Wake-on-LAN settings structure. > + * > + * This function checks the PME Pin Control Register to see if PME Pin Output > + * Enable is set, indicating PME is enabled. If enabled, it sets the supported > + * and active WoL flags. I'm missing something here: Why would the PME Pin Output Enable not be set? I also wounder if there should be one additional test. Is the MAC address on the user interface the same as the one programmed in the switch? If it is different supported should not be set. > +void ksz9477_get_wol(struct ksz_device *dev, int port, > + struct ethtool_wolinfo *wol) > +{ > + u8 pme_ctrl, pme_conf; > + int ret; > + > + ret = ksz_read8(dev, REG_SW_PME_CTRL, &pme_conf); > + if (ret) > + return; > + > + if (!(pme_conf & PME_ENABLE)) > + return; > + > + wol->supported = WAKE_MAGIC; > + > + ret = ksz_pread8(dev, port, REG_PORT_PME_CTRL, &pme_ctrl); > + if (ret) > + return; > + > + if (pme_ctrl & PME_WOL_MAGICPKT) > + wol->wolopts |= WAKE_MAGIC; > +} > +static void ksz_get_wol(struct dsa_switch *ds, int port, > + struct ethtool_wolinfo *wol) > +{ > + struct ksz_device *dev = ds->priv; > + > + memset(wol, 0, sizeof(*wol)); Drivers should not need this, i would expect the core to zero the structure. Andrew --- pw-bot: cr