Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1238535rdb; Fri, 1 Dec 2023 10:20:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8igxvPXUJ1zGtOf8ovt8+KdLo9Z8mHYJ+5Poikt81YMiAqWVHdka889SHVtYlXQEEbKAB X-Received: by 2002:a17:902:cec3:b0:1d0:68a:4a46 with SMTP id d3-20020a170902cec300b001d0068a4a46mr13993594plg.3.1701454805475; Fri, 01 Dec 2023 10:20:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701454805; cv=none; d=google.com; s=arc-20160816; b=A3sigY6Q76zrwHOfHe8hJrY0bPInRcYpJdivYMaECcm+xTG3tDWgdBIapfd/mxWghw iMUT8bbLP7ruGZEX5EQaec0Y+54oUoK35V/b0PjSryB78Q5L4D8hcGOtqkLkKIkY5q2I bv7uaWZrPujbBd2Rc6IXT7vQUw+hLw1qIDBjEu1Szs3EHUSUyvReaswOZWuFnFmzhrGG Uw9nUwi4kVXVrtruhO3lCaP51ip9XfnBJN0B3dW6eP7U4IgdqpZ4ZKPUYtjawUMmUFPt U3Hweh0XSVqEP91nNAKWCQgJqjpV4gx1nDI/4eKFI/DkvOLbLMiik9QrgDyrA84nVsCn udng== 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; bh=bLHc1NYAjWziYYBrI4iZPfTG6It7qxvxN377zvjsdPY=; fh=94KxX0H0TlwHG3MsDbwGxb7DDuh6WOOCdBzoZ04qWh4=; b=tTY+77dIIAs0uoeoslxXIEnJoL7EGOF/3JQgz4AddpK1Hqps3KWn8Tfv38xMyQG0Wp QOXK+7Pi+V1kSkSpIfR+43fp8DuJe5AREoMkYucVxWydG3hfQFX4WxM0fq+GqCLXu+mD /Q/5iRUFnxstMTepWLRMpyM1ViuDn434nW/5mxYRCUroyMrnZIYgtyXpTvkomS0j+vO8 8Ih6MfoPOQX/lSjYzdKMk6ahz887AgWw1yLQ8YGu8iIHiAU0XdqvTr/MepD8JPaXyb4R 9xeSf1oSe3U/wIENULaCBLd4CjAad9sEQxhJQtb18pWF5VYyhvf/GoqGvm6PCz0Bczx6 SjFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id b14-20020a170902d50e00b001cc76bea504si3719048plg.345.2023.12.01.10.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 10:20:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 6E65381BFA9C; Fri, 1 Dec 2023 10:20:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379081AbjLASTl (ORCPT + 99 others); Fri, 1 Dec 2023 13:19:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379214AbjLASTj (ORCPT ); Fri, 1 Dec 2023 13:19:39 -0500 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A1EF13E; Fri, 1 Dec 2023 10:19:44 -0800 (PST) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1r986k-000740-1c; Fri, 01 Dec 2023 18:19:23 +0000 Date: Fri, 1 Dec 2023 18:19:20 +0000 From: Daniel Golle To: "Russell King (Oracle)" Cc: Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marek =?iso-8859-1?Q?Beh=FAn?= , Pali =?iso-8859-1?Q?Roh=E1r?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Woudstra , John Crispin Subject: Re: [PATCH net] net: phylink: set phy_state interface when attaching SFP Message-ID: References: <8abed37d01d427bf9d27a157860c54375c994ea1.1700887953.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 01 Dec 2023 10:20:02 -0800 (PST) On Sat, Nov 25, 2023 at 08:28:20AM +0000, Russell King (Oracle) wrote: > On Sat, Nov 25, 2023 at 04:56:20AM +0000, Daniel Golle wrote: > > Assume 'usxgmii' being set as initial interface mode in DTS. Now plug > > a 2.5GBase-T SFP module with exposed PHY. Currently this results in > > a rather bizare situation: > > > > RTL8221B-VB-CG 2.5Gbps PHY (C45) i2c:sfp1-wan:11: rtl822x_c45_get_features: supported=00,00000000,00008000,000080ef > > mtk_soc_eth 15100000.ethernet eth2: requesting link mode phy/2500base-x with support 00,00000000,00008000,0000e0ef > > mtk_soc_eth 15100000.ethernet eth2: switched to phy/2500base-x link mode <<< !!!!!! > > mtk_soc_eth 15100000.ethernet eth2: major config usxgmii <<< !!!!!! > > mtk_soc_eth 15100000.ethernet eth2: phylink_mac_config: mode=phy/usxgmii/none adv=00,00000000,00000000,00000000 pause=00 > > mtk_soc_eth 15100000.ethernet eth2: PHY [i2c:sfp1-wan:11] driver [RTL8221B-VB-CG 2.5Gbps PHY (C45)] (irq=POLL) > > mtk_soc_eth 15100000.ethernet eth2: phy: 2500base-x setting supported 00,00000000,00008000,0000e0ef advertising 00,00000000,00008000,0000e0ef > > > > Then the link seemingly comes up (but is dead) because no subsequent > > call to phylink_major_config actually configured MAC and PCS for > > 2500base-x mode. > > > > This is because phylink_mac_initial_config() considers > > pl->phy_state.interface if in MLO_AN_PHY mode while > > phylink_sfp_set_config() only sets pl->link_config.interface. > > > > Also set pl->phy_state.interface in phylink_sfp_set_config(). > > Does it _actually_ matter? It does matter, I'm suggesting this change because the SFP module won't work without it. > When the PHY's link comes up, doesn't it get sorted out for the real > mode that will be used? That does happen once the interface mode *changes* to anything else, than 2500M/Full and the PHY driver sets state->interface to SGMII. However, initially it does *not* happen, probably because phylink ends up believing MAC and PCS are already operating in 2500base-x mode (but that's not the case). Previously (eg. with the BananaPi R3) this has not been a problem because the default interface mode defined in device tree anyway has also been 2500base-x. Now that I'm testing the same module with the R4 which uses usxgmii by default the problem surfaced.