Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2676070rwr; Fri, 21 Apr 2023 12:13:27 -0700 (PDT) X-Google-Smtp-Source: AKy350b+ykYaU/hSyZkthigExyCa3hH4yX2cNka7gSLzZ7Gj85raFFqC7RGMXi8ORjG/880+QNaT X-Received: by 2002:a05:6a21:9982:b0:e8:dcca:d9cb with SMTP id ve2-20020a056a21998200b000e8dccad9cbmr8306876pzb.5.1682104407438; Fri, 21 Apr 2023 12:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682104407; cv=none; d=google.com; s=arc-20160816; b=l99WdUXTf/T6QzLBPynQZj2KiiyJkMsVXWWdg0LAMWKLvIJkmq0MEz37tJOMjM2/6i WVVddT+t/3sEdeXItz45LkjE57uAg5DNHql8lKQ6yeM07nwyVrYOgo7mXr4rGHxuC32s kB6lZG48KynoGsS3QToWvWPc8WLam9NtvD1iv3pntORbj4jYpHb8R0kCLAv1LcvOnw9x BWOm/kU7+G9sTk3hI79PkhCBnxOcGoBxHDPlLP3wanx/JAjTT9SULKsjmHNbOGoyZgNL Hv8l/DQdj1FhcdgSJh2I2lrt6M7zsItAhoMYkZu6kB9nrx2ri/yxY1jQ/Hs5L+X/UqNa aLhw== 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; bh=UhLjyN4tYEO6qiQco1Fdg6Ccp2OH168n/MpjpP46Wr4=; b=S31US9ZNpeYYWXwZMjT8CQQrM2rlRjFpPrVksJLO3gDVMboL6MWPin8+QL0zKjwDuv ZA3dcw5lpow24Y+xjouctG+wfZoySLR8yiCu929WX23qSyuHlhD3id1VLVcf+hSxxPnH LbdA4UfoyLHjdIzXx7RdiJNKzykaHu9cEQJvCkLFSuKROa+tYbPhErySr7Fri/Mf27tO 8Z3INOikd56Qs5+5BB/eLpYM9go7HPUGBy86x67gSUVtuNm9garlWDKTrRzWQhgx8NY0 IRmH7Uf4/4CP856Y9iUvzwC54fAlBLjJHd8+nYMx5e4fRWRcUiMAyGQzbMaF/e29+acE MLbw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h186-20020a636cc3000000b00520861f7c0csi5070678pgc.501.2023.04.21.12.13.15; Fri, 21 Apr 2023 12:13:27 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232770AbjDUTD7 (ORCPT + 99 others); Fri, 21 Apr 2023 15:03:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbjDUTD5 (ORCPT ); Fri, 21 Apr 2023 15:03:57 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC60C1B7; Fri, 21 Apr 2023 12:03:55 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1ppw2m-0002mI-06; Fri, 21 Apr 2023 21:03:40 +0200 Date: Fri, 21 Apr 2023 20:03:37 +0100 From: Daniel Golle To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , 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: [RFC PATCH net-next 08/22] net: dsa: mt7530: change p{5,6}_interface to p{5,6}_configured Message-ID: References: <20230421143648.87889-1-arinc.unal@arinc9.com> <20230421143648.87889-9-arinc.unal@arinc9.com> <810aa47b-7007-7d53-9a23-c2d17d43d8a8@arinc9.com> <235c80fc-3f1b-a9c9-6364-6f50ee45b21b@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <235c80fc-3f1b-a9c9-6364-6f50ee45b21b@arinc9.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, 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 On Fri, Apr 21, 2023 at 09:25:39PM +0300, Arınç ÜNAL wrote: > > > On 21.04.2023 21:20, Arınç ÜNAL wrote: > > On 21.04.2023 21:17, Arınç ÜNAL wrote: > > > On 21.04.2023 20:28, Daniel Golle wrote: > > > > On Fri, Apr 21, 2023 at 05:36:34PM +0300, arinc9.unal@gmail.com wrote: > > > > > From: Arınç ÜNAL > > > > > > > > > > The idea of p5_interface and p6_interface pointers is to prevent > > > > > mt753x_mac_config() from running twice for MT7531, as it's > > > > > already run with > > > > > mt753x_cpu_port_enable() from mt7531_setup_common(), if the > > > > > port is used as > > > > > a CPU port. > > > > > > > > > > Change p5_interface and p6_interface to p5_configured and > > > > > p6_configured. > > > > > Make them boolean. > > > > > > > > > > Do not set them for any other reason. > > > > > > > > > > The priv->p5_intf_sel check is useless as in this code path, > > > > > it will always > > > > > be P5_INTF_SEL_GMAC5. > > > > > > > > > > There was also no need to set priv->p5_interface and > > > > > priv->p6_interface to > > > > > PHY_INTERFACE_MODE_NA on mt7530_setup() and mt7531_setup() > > > > > as they would > > > > > already be set to that when "priv" is allocated. The > > > > > pointers were of the > > > > > phy_interface_t enumeration type, and the first element of the enum is > > > > > PHY_INTERFACE_MODE_NA. There was nothing in between that > > > > > would change this > > > > > beforehand. > > > > > > > > > > Tested-by: Arınç ÜNAL > > > > > Signed-off-by: Arınç ÜNAL > > > > > > > > NACK. This assumes that a user port is configured exactly once. > > > > However, interface mode may change because of mode-changing PHYs (e.g. > > > > often using Cisco SGMII for 10M/100M/1000M but using 2500Base-X for > > > > 2500M, ie. depending on actual link speed). > > > > > > > > Also when using SFP modules (which can be hotplugged) the interface > > > > mode may change after initially setting up the driver, e.g. when SFP > > > > driver is loaded or a module is plugged or replaced. > > > > > > I'm not sure I understand. pX_configured would be set to true only > > > when the port is used as a CPU port. mt753x_mac_config() should run > > > for user or DSA ports more than once, if needed. > > > > Looking at this again, once pX_interface is true, the check will prevent > > even user or DSA ports to be configured again. What about setting > > pX_interface to false after mt753x_mac_config() is run? > > On a third thought, pX_interface will never be true for the port if it's a > user or DSA port so this should not be a problem at all. I also followed the individual codepaths and conclude that you are right. I've also tested this by now on several boards with MT753x, incl. BPi-R3 and SerDes interface mode switching is anyway handled in the PCS driver (I should have rembered that...) Hence Acked-by: Daniel Golle > > Arınç