Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp794961rdb; Thu, 19 Oct 2023 22:09:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELwD290k/SvwVlvpGq8Ktph4gopxpmqn8EeeZcU9lVCnQKBRIcf/kbIvT/oOSIfWdAdaLG X-Received: by 2002:a05:6808:2029:b0:3b2:e2d5:bcec with SMTP id q41-20020a056808202900b003b2e2d5bcecmr1051927oiw.47.1697778580417; Thu, 19 Oct 2023 22:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697778580; cv=none; d=google.com; s=arc-20160816; b=R7U8SLA63QjEma3kf6wWLrgSSTl8sXCgkwVp7t5s0uikVFix5b7OEbdB4V3kjGKnaj HJViwXRBA4Ho3g0hZv7p7q4WBigA2hIuHRQtC3f37MWxF4eWJQXFwgR29809XB43vAb/ 3CgR6lKI+fIo+Lb56FMCqC9553FAh2/++ugeDDp6v6GIvd3XgDeuGZnWOWpIAdWeTUmw Me6yEodveqqLAYyeY5XnfDrgIhFPofwXJnXvgP2TlD6omy8XHp7Zl5HbyyzH8QrhbgtG 8bHc85mmFV8soF0gwbGDGQIRIju5LGDTR+Aykd6FIKcS1TunxFWsYCV41uDznT1sZCX5 JzVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=X7ecu0H0U28Si0PvSH9Un1tIuPCqzaXpvysQZCDDj+s=; fh=MsyOytneV/UVVriAgLwVpeHOE0BxBIa8WAJb5xxeFs8=; b=C6Hvh9XHvAwX/MeU8If1BSqb0xF/RhLJMyg0BsP0wEX1hNZ5hahBYB1lhs3qZP91qF 9RRCRT0PyrxehLov7SBL19wZRLIz/HR8cNDZ9VbUtdhJwd5JlpMfJc+xQDAr0TR7pld6 qQWrJ/qvIOpKMxxUNlJYuuSHjTPdAuGgoU7RDeRqFDSEH4jk/X28Zuc164BJcbczyP9E G2l7qdtEE/5oi9Iz8jG174LWd8XqXsq5l4VL731bg9zBLkKbYuxOgpxyzxteBjlAwrHd gzibaMvlAWAP05nlGZ0KF1wiklZyeP2E2UBIpQk4lM1itI4vLKHx6MNdU9jyYR38oz+j 1DDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id l190-20020a6388c7000000b005774978dd75si1167154pgd.175.2023.10.19.22.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 22:09:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CE3E481E61BE; Thu, 19 Oct 2023 22:09:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232838AbjJTFJa (ORCPT + 99 others); Fri, 20 Oct 2023 01:09:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231400AbjJTFJ3 (ORCPT ); Fri, 20 Oct 2023 01:09:29 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C093FB8 for ; Thu, 19 Oct 2023 22:09:26 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qthko-0001Lr-Dt; Fri, 20 Oct 2023 07:08:58 +0200 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qthkm-002xCC-Tz; Fri, 20 Oct 2023 07:08:56 +0200 Received: from ore by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qthkm-00FNf4-Pe; Fri, 20 Oct 2023 07:08:56 +0200 Date: Fri, 20 Oct 2023 07:08:56 +0200 From: Oleksij Rempel To: Vladimir Oltean Cc: "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , 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 v6 5/9] net: dsa: microchip: ksz9477: Add Wake on Magic Packet support Message-ID: <20231020050856.GB3637381@pengutronix.de> References: <20231019122850.1199821-1-o.rempel@pengutronix.de> <20231019122850.1199821-1-o.rempel@pengutronix.de> <20231019122850.1199821-6-o.rempel@pengutronix.de> <20231019122850.1199821-6-o.rempel@pengutronix.de> <20231019172953.ajqtmnnthohnlek7@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231019172953.ajqtmnnthohnlek7@skbuf> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 22:09:38 -0700 (PDT) On Thu, Oct 19, 2023 at 08:29:53PM +0300, Vladimir Oltean wrote: > On Thu, Oct 19, 2023 at 02:28:46PM +0200, Oleksij Rempel wrote: .... > > @@ -109,10 +110,22 @@ void ksz9477_get_wol(struct ksz_device *dev, int port, > > > > wol->supported = WAKE_PHY; > > > > + /* Check if at this moment we would be able to get the MAC address > > + * and use it for WAKE_MAGIC support. This result may change dynamically > > + * depending on configuration of other ports. > > + */ > > + ret = ksz_switch_macaddr_get(dev->ds, port, NULL); > > + if (!ret) { > > + wol->supported |= WAKE_MAGIC; > > + ksz_switch_macaddr_put(dev->ds); > > I don't get it, why do you release the reference on the MAC address as > soon as you successfully get it? Without a reference held, the > programmed address still lingers on, but the HSR offload code, on a > different port with a different MAC address, can change it and break WoL. It is ksz9477_get_wol() function. We do not actually need to program here the MAC address, we only need to test if we would be able to get it. To show the use more or less correct information on WoL capabilities. For example, instead showing the user that Wake on Magic is supported, where we already know that is not the case, we can already show correct information. May be it will be better to have extra option for ksz_switch_macaddr_get() to not allocate and do the refcounting or have a separate function. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |