Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp867927rdb; Fri, 20 Oct 2023 01:29:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9NWn9/7nFyrOAHxOA60ivkj2oJAlTnWSsY7AmNkAuP9B35BN2droVOVCAV1WuJwJyHAiw X-Received: by 2002:a1f:1997:0:b0:496:2282:5c2f with SMTP id 145-20020a1f1997000000b0049622825c2fmr1013932vkz.6.1697790587544; Fri, 20 Oct 2023 01:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697790587; cv=none; d=google.com; s=arc-20160816; b=G5QUt+j9QsGFT94+o2i7A+oIdl/DTfkyGrZG8dxEPdlQt79BbkCwrVe3G8a1mJLmC5 Y5QLnv6f9qyE5/7B+2JMGv6Ey6OI4x2GzWKJWv1235LQSMSuxDgPIxPmVjbFvGueSQCg x8dVDhnQqKjoQriByKFbftOAp5ZAcr/ErSb7/gvUSawM6tTwa2YoLmVzl7P+FDdiDgMT fS0TiefdjO7STK4rm+XRAhcvD4WmKYQsoxu5Tfpp46k1zzIAIwCVGY27LwxJKvUj0IOF Omno6BzXHJONWzOUSabYP5xm7X9pQ5Xg1nX2VmFX/Zr4gVsjdBdAxOcjf1qBzzFUJ//f +VAA== 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=HjHnYS/roHyURAgzXLOkXsDbtDs4sZ8GsZC8irxBauc=; fh=4w3Pqs5x2lCMSSUPACK3dMuO7uUmsmglpPHc5D/SCqY=; b=RJI7ddj7WaHHzne4axDmgEk/k5lIBAU1/fTlxW03gVqScPrHUanUGB1ne4Rn3G6Pei 1yAj4/jLD9dbw+Lh61RRZ3SnxljvWQy23RrvQmciUvgVveupmmRAZQFzCSKLKAcjZC+K 7n2gzmM3VsMNigbiaMsH3nNvUwBsFFVYXEMJcZlf1m9tXlNWcMpxfp2jKw1qCG9sL2z0 59BCzIZB9xOBhBn3yp4Prjwt8+g5qVs4qEQoTkYlrJgacY4moorUXO2n/BMZarX1RJiY APKgsQaij/MUfVwWVgnNwQVWYbe8U0u/m7+5Wor5hrrM1DqPptFFPIGlJEPF9sL5fO0f HCRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Zd8AjeQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id g21-20020a056a0023d500b0068beee4922csi1486841pfc.23.2023.10.20.01.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 01:29:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Zd8AjeQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 937AD82B6F5D; Fri, 20 Oct 2023 01:29:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376458AbjJTI3m (ORCPT + 99 others); Fri, 20 Oct 2023 04:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376433AbjJTI3l (ORCPT ); Fri, 20 Oct 2023 04:29:41 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B248112; Fri, 20 Oct 2023 01:29:39 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-507d7b73b74so728544e87.3; Fri, 20 Oct 2023 01:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697790577; x=1698395377; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HjHnYS/roHyURAgzXLOkXsDbtDs4sZ8GsZC8irxBauc=; b=Zd8AjeQ4qDi1StKGmV5r1XgzlJk/MjRKwv0zkewW3UsVxelTteNEQQlgmSGRYeK1El 9Kr35/z6ssYaJakFMhMU3k9GMNXZ04h745w4ej7GO08ZW7xqsQ00T1MQRZUPxjFdOzIq aTd5OWjVJUZhVUOMnnKx52vXi8qM9Jko7c6XybCQbVc26S1Z3NlAfcFpo3bER/zkPDDx VtX3qQ4bqhlbmHi86m5t8HqTLolgRxkq8WU6atEveGkYdsOF+K81OAJlyNkLWMSb7gj3 7xDDPAYPmEufj8SzsaI3u1yiSFztSZJa1ICbIYbJQRn/I9kPhHF+h2rTxDyZ1GVWG4Um 2z1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697790577; x=1698395377; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HjHnYS/roHyURAgzXLOkXsDbtDs4sZ8GsZC8irxBauc=; b=PtQEv6+JbOJak6eSrXNu3BMbmNx6TEj4pddrQ6hD2y1RKblpDEq4y2I04zaMjBr01/ MfVAXYf9OwXQvHvP1deieGReZ5GuIOMJhroVw9a9Xxw1QRzSaScae+v4eJ3CU9CUIerG QRcEmSgEiSMRQefPWiPwKygYxxwSswWoFPpYZBDk8wXDLGWlyoGS6G+etltektVySFQj kk5z21+FQdvoyPyy8yHeMHypHTGirWkqZJKaVyF6KidiIzuvsLeBi5ac4f6ZMK4glda9 lcxSyhBN2ejdDKa+CinZ3Vqj76qnx3HsWvOlbG10jzocuq+8IH45kA1HYRjD2lMOiX32 MMqQ== X-Gm-Message-State: AOJu0YwHxhhj+kMOsU4CBdu0/tdUdy0dn5wRfcPrDRdtmJcaOieK8IPH fj6IyymhRe1CloA7QbLlquU= X-Received: by 2002:ac2:4e85:0:b0:507:ab58:7f7a with SMTP id o5-20020ac24e85000000b00507ab587f7amr660874lfr.10.1697790576929; Fri, 20 Oct 2023 01:29:36 -0700 (PDT) Received: from skbuf ([188.26.57.160]) by smtp.gmail.com with ESMTPSA id k17-20020a5d6291000000b003217cbab88bsm1192220wru.16.2023.10.20.01.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 01:29:36 -0700 (PDT) Date: Fri, 20 Oct 2023 11:29:34 +0300 From: Vladimir Oltean To: Oleksij Rempel 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: <20231020082934.teh24h557qox5hna@skbuf> 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> <20231020050856.GB3637381@pengutronix.de> <20231020082350.f3ttjnn6qfcmskno@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231020082350.f3ttjnn6qfcmskno@skbuf> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 20 Oct 2023 01:29:46 -0700 (PDT) On Fri, Oct 20, 2023 at 11:23:50AM +0300, Vladimir Oltean wrote: > On Fri, Oct 20, 2023 at 07:08:56AM +0200, Oleksij Rempel wrote: > > On Thu, Oct 19, 2023 at 08:29:53PM +0300, Vladimir Oltean wrote: > > > 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. > > Ah, yes, it is from get_wol(). Maybe a ksz_switch_macaddr_tryget(ds, port) > which returns bool (true if dev->switch_macaddr is NULL, or if non-NULL > and ether_addr_equal(dev->switch_macaddr->addr, port addr))? Hmm, I've checked other uses of the "tryget" name in the kernel and their semantics all seem to imply that upon success, a reference is acquired. That would not be the case here, so the naming would be confusing. How about a bool ksz_switch_macaddr_check(ds, port)?