From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DFD5CC7618E for ; Fri, 21 Apr 2023 19:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UhLjyN4tYEO6qiQco1Fdg6Ccp2OH168n/MpjpP46Wr4=; b=G3FZRYxmm7NOFUZjVrtuq7d6Kg 3Q77GdZ2gFI+iibubDa6HG9vC76XgolfIxH9JkiKuPk+ZkWtbQKSGIJkVSTe2BURJlRYOF83I4u28 kVBJVPZdGpb4yRxOXC/XXiBJZ5KGf2U8dRqHngzu3j8SVYmLxPBNDiYFK1T9vDoGULfMp0gq6wcKz jm32AdwI924THlgqmP5VWVMkOP9FaGZrVT1p/CvKA84Tu2MqAEzc6qHuPoeBzn9uo+YbBkEPg+lRa yG/KcRwsMK9KXoJP80Qbo7UL2i8rktyGvC/wUFtryZbIICtTksELK/DU4r772my8n+fTAaUaJ/MEW y9z8ueBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppw36-00Bgs6-24; Fri, 21 Apr 2023 19:04:00 +0000 Received: from fudo.makrotopia.org ([2a07:2ec0:3002::71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ppw33-00BgrE-0T; Fri, 21 Apr 2023 19:03:58 +0000 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==?= 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230421_120357_179926_DB77208E X-CRM114-Status: GOOD ( 37.43 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Landen Chao , Florian Fainelli , netdev@vger.kernel.org, Sean Wang , Russell King , linux-kernel@vger.kernel.org, Richard van Schagen , DENG Qingfang , Eric Dumazet , Paolo Abeni , linux-mediatek@lists.infradead.org, Richard van Schagen , Matthias Brugger , Jakub Kicinski , Vladimir Oltean , erkin.bozoglu@xeront.com, "David S. Miller" , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.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ç From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DC93C77B76 for ; Fri, 21 Apr 2023 19:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iAtVvB4qLD1M261gluFohz/1nXUZKqJVTRbBix0qipo=; b=zVI6v36UDZ1qMg z+UbdmmQwH6VB4chwEfaN1nXPC0jzd0+BCfcAHbo6Ig1Gginm+TlfjxdmBEvE2H0mP4K2w6RX3899 Of914FpLS2uzT1s+O+RmsXv077sN1iXLZ+EA1sArw5k42GGdeNLPig4QUrn3NrTsUDmm2mQzJmal6 UXfgry2+NSJ8Eifhb0F5e41soWqHG8+63XmopcF2qiC7icoNM1u1aoWKZ9poXXgGlB6s34vSIChfy rT4nDWeo2PrTSGavVN8v5YQLHg4I95kKntt7uAbsaSdpCc1+0cp80RsJzuYwg2phLjh/QXLIMAFf3 ZzkaoFEWoburgax1gojQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppw35-00Bgru-2V; Fri, 21 Apr 2023 19:03:59 +0000 Received: from fudo.makrotopia.org ([2a07:2ec0:3002::71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ppw33-00BgrE-0T; Fri, 21 Apr 2023 19:03:58 +0000 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-Disposition: inline In-Reply-To: <235c80fc-3f1b-a9c9-6364-6f50ee45b21b@arinc9.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230421_120357_179926_DB77208E X-CRM114-Status: GOOD ( 37.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org T24gRnJpLCBBcHIgMjEsIDIwMjMgYXQgMDk6MjU6MzlQTSArMDMwMCwgQXLEsW7DpyDDnE5BTCB3 cm90ZToKPiAKPiAKPiBPbiAyMS4wNC4yMDIzIDIxOjIwLCBBcsSxbsOnIMOcTkFMIHdyb3RlOgo+ ID4gT24gMjEuMDQuMjAyMyAyMToxNywgQXLEsW7DpyDDnE5BTCB3cm90ZToKPiA+ID4gT24gMjEu MDQuMjAyMyAyMDoyOCwgRGFuaWVsIEdvbGxlIHdyb3RlOgo+ID4gPiA+IE9uIEZyaSwgQXByIDIx LCAyMDIzIGF0IDA1OjM2OjM0UE0gKzAzMDAsIGFyaW5jOS51bmFsQGdtYWlsLmNvbSB3cm90ZToK PiA+ID4gPiA+IEZyb206IEFyxLFuw6cgw5xOQUwgPGFyaW5jLnVuYWxAYXJpbmM5LmNvbT4KPiA+ ID4gPiA+IAo+ID4gPiA+ID4gVGhlIGlkZWEgb2YgcDVfaW50ZXJmYWNlIGFuZCBwNl9pbnRlcmZh Y2UgcG9pbnRlcnMgaXMgdG8gcHJldmVudAo+ID4gPiA+ID4gbXQ3NTN4X21hY19jb25maWcoKSBm cm9tIHJ1bm5pbmcgdHdpY2UgZm9yIE1UNzUzMSwgYXMgaXQncwo+ID4gPiA+ID4gYWxyZWFkeSBy dW4gd2l0aAo+ID4gPiA+ID4gbXQ3NTN4X2NwdV9wb3J0X2VuYWJsZSgpIGZyb20gbXQ3NTMxX3Nl dHVwX2NvbW1vbigpLCBpZiB0aGUKPiA+ID4gPiA+IHBvcnQgaXMgdXNlZCBhcwo+ID4gPiA+ID4g YSBDUFUgcG9ydC4KPiA+ID4gPiA+IAo+ID4gPiA+ID4gQ2hhbmdlIHA1X2ludGVyZmFjZSBhbmQg cDZfaW50ZXJmYWNlIHRvIH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1haWxpbmcgbGlzdApsaW51eC1hcm0ta2Vy bmVsQGxpc3RzLmluZnJhZGVhZC5vcmcKaHR0cDovL2xpc3RzLmluZnJhZGVhZC5vcmcvbWFpbG1h bi9saXN0aW5mby9saW51eC1hcm0ta2VybmVsCg== From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B379C77B76 for ; Fri, 21 Apr 2023 19:04:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbjDUTEB (ORCPT ); Fri, 21 Apr 2023 15:04:01 -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> 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ç