Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3320042rwl; Mon, 27 Mar 2023 12:16:11 -0700 (PDT) X-Google-Smtp-Source: AKy350a3lMueQ9CKeOW3yU45EGlIKvITHCtEZ74YVgI4PijKVw2kSQPUSK2pCM3VpdRP7PpMeOJ2 X-Received: by 2002:a17:906:1514:b0:92b:ae6c:23e7 with SMTP id b20-20020a170906151400b0092bae6c23e7mr13395299ejd.56.1679944570854; Mon, 27 Mar 2023 12:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679944570; cv=none; d=google.com; s=arc-20160816; b=hzeCnXIadeRzcRxoJ34Oxpmiklj4nbGEiYmHeCD9cd+WrFQuodz8PwuyDxU4gCSBde VPjP653pdrrpBZqBC4nFkf/A58lK8BF8r1O3EZaATLG8me4C4OFThl8U9Y5VWVEWZc34 ib/xgXxfuET+Hf3Z32+1ePEKP0GrEFP/OjJ3rEMHyc/3F0ZdNecAQvbd5SfxOL5zFCtN usJtMkVa/0uydP1kOyUxDbOlSzACrE54J0pJrH8ppPh/r93IMBsknRRjffdwBTuWEQ6V V0htOclAAJxxJQ7Y8NDpSKeoTs0WOzQbifDIYadf4IHyIP1j/xiKwiMikKQHfMcxglOs Q4uQ== 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=HYVINSPcX570meD+tbiju4gbaHHy2aZVdws7rdRLV/U=; b=y5ZixTmgIkKCP0CR2NxyTYGhEBso6PtLXUtKlGm1KCLV3YgoaIY2rD504EQYuY4TIM 2elm/F78IMoswJ+Y3ppvb7IUddyFEqayiQh0Fdklb4oqvK32XiiLpTSDlCQs8Ma4c+A0 DYgE+BI/w7GTZTlJ8qriIsnJ6e39OtUwpAFR+MvdKiZkM0DsriSqkVV7TQk1FXBq4Khr 8hzDdadcktgp9amfI7hje/ikLw+69hThzptR9CqcCvVpJGMxSlIDFyhOSoN1d1OF6xpi 1XCToF+fj6L2QkIxLRzoWCBQeGE+yFcelbRx8gFVOB9hT9WaCNNwSVnkK+8HciBopKtA iT0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KK68TZUy; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a170906361100b00932b536587csi27122864ejb.354.2023.03.27.12.15.43; Mon, 27 Mar 2023 12:16:10 -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=@gmail.com header.s=20210112 header.b=KK68TZUy; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232854AbjC0TNq (ORCPT + 99 others); Mon, 27 Mar 2023 15:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232646AbjC0TNX (ORCPT ); Mon, 27 Mar 2023 15:13:23 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A13814488; Mon, 27 Mar 2023 12:12:47 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id v1so9889028wrv.1; Mon, 27 Mar 2023 12:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679944365; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=HYVINSPcX570meD+tbiju4gbaHHy2aZVdws7rdRLV/U=; b=KK68TZUyb+HjYZ0CT1XzfVmxm49E3yfbXe3orrjtJTlDrkwsoLOl0N/qqEXfKQdiug 9ObLgEKV80TmHgjR3TkTRtmyu0L2wdEYHfTCPt3ppDJDlmPpWI2zoArUty3g6GYcCcaA ve+hm8dWOolIdC/kqciF2FqMVRnImO1jO7UMqw3epBVc9vSJQncDg25FDtX3EokW8Ybs zYIpH3hyjBPw6L+lLPp7VZ55p9QsX910cv+BSoDT/Sn7ZpG3O7mCZ5iUoeZIHNTQDwnV gFwLhQp6tVnPpsCP1wPUznIJz+EyX5Qs6Iq/jYI/c1nRBxU8B6AZ4Z4Ph7CJt5mCu0r5 uRiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679944365; h=in-reply-to:content-transfer-encoding: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=HYVINSPcX570meD+tbiju4gbaHHy2aZVdws7rdRLV/U=; b=EUIt0ku5UX63KvVShrde6WkGI/VpIfiUPl7m6wzGOa+FAtJDJ8jmypU62QtBH9i0/g XES94hfTS/PCFouqbmoirPqeuUrZY9TG5DIAJvC5YIhWmoVdDHQHsTj1fAy32Jh5gH1L MDRRBg7l3G+WVbWdeJeatPPfqYqLu6dnQWsvo+mWNBdHtLJft5I1cbAs4fRAbzLg3Hd4 2N1cnaitaXd9CVY/9+DRbsKsbv/eMa2heNIdhoY1R3Rd3/NEzPyq4+S2FcneqjZZyb6J t6kwsvoAdfFPu5yqndYB2YR2Ml7j07y5V38kqT/knKsXTzDYGH08nRb6VBuQpql/hPvD q+hA== X-Gm-Message-State: AAQBX9fRhxtMvPYLL33GtT3JfJDedykgxZ39gYglUwhUnswpYXTtCPCk BqlOJL6kvDp9jVNFftO618o= X-Received: by 2002:a5d:526a:0:b0:2d0:58f9:a6a with SMTP id l10-20020a5d526a000000b002d058f90a6amr10553468wrc.57.1679944365660; Mon, 27 Mar 2023 12:12:45 -0700 (PDT) Received: from skbuf ([188.27.184.189]) by smtp.gmail.com with ESMTPSA id f6-20020a05600c154600b003ef7058ea02sm3295888wmg.29.2023.03.27.12.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 12:12:45 -0700 (PDT) Date: Mon, 27 Mar 2023 22:12:42 +0300 From: Vladimir Oltean To: arinc9.unal@gmail.com Cc: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?B?UmVuw6k=?= van Dorst , =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= , Russell King , Ilya Lipnitskiy , Richard van Schagen , Richard van Schagen , Frank Wunderlich , erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH net 4/7] net: dsa: mt7530: set both CPU port interfaces to PHY_INTERFACE_MODE_NA Message-ID: <20230327191242.4qabzrn3vtx3l2a7@skbuf> References: <20230326140818.246575-1-arinc.unal@arinc9.com> <20230326140818.246575-5-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230326140818.246575-5-arinc.unal@arinc9.com> X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 26, 2023 at 05:08:15PM +0300, arinc9.unal@gmail.com wrote: > From: Arınç ÜNAL > > Set interfaces of both CPU ports to PHY_INTERFACE_MODE_NA. Either phylink > or mt7530_setup_port5() on mt7530_setup() will handle the rest. > > This is already being done for port 6, do it for port 5 as well. > > Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5") This is getting comical.. I think I'm putting too much energy in trying to understand the hidden meaning of this patch set. In include/linux/phy.h we have: typedef enum { PHY_INTERFACE_MODE_NA, In lack of other initializer, the first element of an enum gets the value 0 in C. Then, "priv" is allocated by this driver with devm_kzalloc(), which means that its entire memory is zero-filled. So priv->p5_interface and priv->p6_interface are already set to 0, or PHY_INTERFACE_MODE_NA. There is no code path between the devm_kzalloc() and the position in mt7530_setup() that would change the value of priv->p5_interface or priv->p6_interface from their value of 0 (PHY_INTERFACE_MODE_NA). For example, mt753x_phylink_mac_config() can only be called from phylink, after dsa_port_phylink_create() was called. But dsa_port_phylink_create() comes later than ds->ops->setup() - one comes from dsa_tree_setup_ports(), and the other from dsa_tree_setup_switches(). The movement of the priv->p6_interface assignment with a few lines earlier does not change anything relative to the other call sites which assign different values to priv->p6_interface, so there isn't any functional change there, either. So this patch is putting 0 into a variable containing 0, and claiming, through the presence of the Fixes: tag and the submission to the "net" tree, that it is a bug fix which should be backported to "stable". Can it be that you are abusing the meaning of a "bug fix", and that I'm trying too hard to take this patch set seriously? > Tested-by: Arınç ÜNAL > Signed-off-by: Arınç ÜNAL > --- > drivers/net/dsa/mt7530.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index 6d33c1050458..3deebdcfeedf 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -2203,14 +2203,18 @@ mt7530_setup(struct dsa_switch *ds) > mt7530_rmw(priv, MT7530_TRGMII_RD(i), > RD_TAP_MASK, RD_TAP(16)); > > + /* Let phylink decide the interface later. If port 5 is used for phy > + * muxing, its interface will be handled without involving phylink. > + */ > + priv->p5_interface = PHY_INTERFACE_MODE_NA; > + priv->p6_interface = PHY_INTERFACE_MODE_NA; > + > /* Enable port 6 */ > val = mt7530_read(priv, MT7530_MHWTRAP); > val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; > val |= MHWTRAP_MANUAL; > mt7530_write(priv, MT7530_MHWTRAP, val); > > - priv->p6_interface = PHY_INTERFACE_MODE_NA; > - > /* Enable and reset MIB counters */ > mt7530_mib_reset(ds); > > -- > 2.37.2 >