Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9158367rwr; Thu, 11 May 2023 10:42:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ54MH1qWd2MnyGqiqgHu31wyUd/omt467gKbvQp8chryrOqTcDNgFAzAfNVVrm4oCk3zFv6 X-Received: by 2002:a17:90b:4b81:b0:23f:6d4e:72b3 with SMTP id lr1-20020a17090b4b8100b0023f6d4e72b3mr21543362pjb.25.1683826938820; Thu, 11 May 2023 10:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683826938; cv=none; d=google.com; s=arc-20160816; b=jZyQxK5x5K2Ev6rCTZPD+ri9ekkkE29II4YzZCWYddgZTRg6F5htGChxQMk+8nRIpY g7kMkZ3yrYn7KyXfEpWwP8EIecNoA49bsJWb/iQGeyfubzO44NXNCayoyKBsHGsdJV6l id93HKGySQCtdoK1JqMRMWqSc/LclyflsqGJ4VE8JZJG1c8vdSzdIw0XyWKXHrlKQl3J BRUW2f5ps0wQW2VxNDQ7I4SuGKTtuUHOWtwA3sRUCiV8tdJiH65hs2+o5nAU5btlFxdm 9t95ZBbvYmKalSoosz+2wC1gEELb/4qJcn0UOX+xt08tZybqKClT9MVw87HLsSEEfhZb Mopw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=+3MeGD4e+zpTZm4qDwhrhx/AMIAONPMrTTkRjCrQwwA=; b=CK7QT52xMPPcP7eet0Hi5OLvV1+N5D77NMr1C6QJT0yagBIy38fUTu20dEdz3RRL7Q 8YEq1pPGoyR7XI2DD8B8vs/ma4OV/gjs1c10dGDxE+IkH2ZneqgY+ghKImGrBU9IblDt PY+4rMuZDzBwhYWj1qDTcgnR50MDLcaa1asm2fOpNjl2bpo3SxbJmAYZnxXLphQ0u9FQ SbDVtjfseoyPaFuI0U69YBldMg7tMmLfQRloSH9DbckoblW3jYEQ4BfIIhseOduz0Bzm p3q5fdSPtdQKPD8lte0VgN1CO9VvJASBIxHlM2lJMPN8IjXvs/Pgzkla0rTS0tMuL9an o9UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=wPhJHkv6; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gw18-20020a17090b0a5200b002470ea7f67fsi20665857pjb.3.2023.05.11.10.42.06; Thu, 11 May 2023 10:42:18 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=wPhJHkv6; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238741AbjEKRbK (ORCPT + 99 others); Thu, 11 May 2023 13:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238615AbjEKRbJ (ORCPT ); Thu, 11 May 2023 13:31:09 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1268640C1; Thu, 11 May 2023 10:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+3MeGD4e+zpTZm4qDwhrhx/AMIAONPMrTTkRjCrQwwA=; b=wPhJHkv6R+rjiJGI0cDi92rsxN 0dmmlqZzFR6KpV7LrZ724rqU/7TSYLzUrbSR8Badw5GPQNsXFFkFzEP7VcolyRHqYKkDNmcmRLBVr YzSnXHnd9i7SNPdqyZYUJndYEZlDxSY6Xiy7LzEWXKldMnz0dP8wXQEhkkUjrZOu1Aa01w6Wj6mm6 o5kwGXXSPO08myLrgcYRn3Xdcyfn51Kc16YYytB/0VNAiFJrH+iLwdqP6To46vjLffLJIRyhS4vz6 YnRNb9/TL3yII7sVhIYiYyzfMoUaei4KV9FAWqComQ+xCUDfTg999BX9xE/3kepIMcChV6H/63xBb JEWcXePQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:37684) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pxA83-00072F-LC; Thu, 11 May 2023 18:30:59 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pxA81-0004CA-K6; Thu, 11 May 2023 18:30:57 +0100 Date: Thu, 11 May 2023 18:30:57 +0100 From: "Russell King (Oracle)" To: Daniel Golle Cc: Andrew Lunn , netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , AngeloGioacchino Del Regno Subject: Re: [PATCH net-next 0/8] Improvements for RealTek 2.5G Ethernet PHYs Message-ID: References: <55c11fd9-54cf-4460-a10c-52ff62b46a4c@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 Thu, May 11, 2023 at 07:14:48PM +0200, Daniel Golle wrote: > On Thu, May 11, 2023 at 02:28:15AM +0200, Andrew Lunn wrote: > > On Thu, May 11, 2023 at 12:53:22AM +0200, Daniel Golle wrote: > > > Improve support for RealTek 2.5G Ethernet PHYs (RTL822x series). > > > The PHYs can operate with Clause-22 and Clause-45 MDIO. > > > > > > When using Clause-45 it is desireable to avoid rate-adapter mode and > > > rather have the MAC interface mode follow the PHY speed. The PHYs > > > support 2500Base-X for 2500M, and Cisco SGMII for 1000M/100M/10M. > > > > I don't see what clause-45 has to do with this. The driver knows that > > both C22 and C45 addresses spaces exists in the hardware. It can do > > reads/writes on both. If the bus master does not support C45, C45 over > > C22 will be performed by the core. > > My understanding is/was that switching the SerDes interface mode is only > intended with Clause-45 PHYs, derived from this comment and code: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/phy/phylink.c#n1661 It's only because: 1) Clause 22 PHYs haven't done this. 2) There is currently no way to know what set of interfaces a PHY would make use of - and that affects what ethtool linkmodes are possible. What you point to is nothing more than a hack to make Clause 45 PHYs work with the code that we currently have. To sort this properly, we need PHY drivers to tell phylink what interfaces they are going to switch between once they have been attached to the network interface. This is what these patches in my net-queue branch are doing: net: phy: add possible interfaces net: phy: marvell10g: fill in possible_interfaces net: phy: bcm84881: fill in possible_interfaces net: phylink: split out PHY validation from phylink_bringup_phy() net: phylink: validate only used interfaces for c45 PHYs Why only C45 PHYs again? Because the two PHY drivers that I've added support for "possible_interfaces" to are both C45. There's no reason we can't make that work for C22 PHYs as well. We could probably make it work for C22 PHYs out of the box by setting the appropriate bit for the supplied interface in "possible_interfaces" inside phy_attach_direct() after the call to phy_init_hw() if "possible_interfaces" is still empty, which means that if a PHY driver isn't updated to setup "possible_interfaces" then we get basically whatever interface mode we're attaching with there. There may be a problem if phy_attach_direct() gets called with PHY_INTERFACE_MODE_NA (which I believe is possible with DSA.) -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!