From patchwork Tue Nov 26 09:23:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13885673 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 0DACFD3B7CA for ; Tue, 26 Nov 2024 09:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: 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:In-Reply-To:References:List-Owner; bh=qVPL0RdD4hnmz4XYDjVggcqfPiFjhTjUbOauD820jSM=; b=Q37wriCr41EqM/XOKT2GbwP08f US3I8jTZXUHlCMqxK0FPaDMSZQSo6mr//B08X+sBHd+LLsQld3MuxELXrNBGs8QqHyyst07NX99FX XuDoe06P6KsyuBN5QZ8vAjTFzBag8yC2UGKYBQ7gubmIljWCrBEeUD3l+oPIN8kXRXNgoE60zVyOI G0b4jEB33MG7DF6oM87x7T3m0dPRRVR46weWNy7cLlNZszR87AdlDBLaz6AGFAkxXZJwgmLMedq/J Wypcwxaph75WuL1bOMvSfiJRjHrwumO2Wll+863/3FDoNalSxaFmWwNpSq8SrOjw4zq3zDWLN0ZGm 7s0WLMMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tFrqh-0000000A936-0Lq7; Tue, 26 Nov 2024 09:27:11 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tFrnt-0000000A8GC-3800; Tue, 26 Nov 2024 09:24:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: 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:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qVPL0RdD4hnmz4XYDjVggcqfPiFjhTjUbOauD820jSM=; b=zzT4dMuTJkpC3NnKY2hawXduOh PbEAYhOg6UWAai71+bXosnUAQX6y1wUPJD6QRmHaqz866weG4pV6klHL8w7ALIQ/HBlrMKx7UhAhy QPa4DCqlnTpChq6us+nNiYlPuJtn46kTGpzihoHcKAsXRQwXH+W278+thEykecLaAYtBJtnn+6hAZ u74FUonF6dKYIIHMC4bSZYHatmGFDC2w30VH8lPuJHAq9LNKPHlBeJZBtfgwYM/lEshBf2EYKEudY onFeRs7HfsXC+4n2tNKhOJ39JB4uzciZColpghXrw5eaLUPDxA3lt0KBokpBRX/lNXPhSI3ClukbC KLmGMU3w==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:39506) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tFrnX-0006RQ-2S; Tue, 26 Nov 2024 09:23:56 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.96) (envelope-from ) id 1tFrnQ-0004Ra-2v; Tue, 26 Nov 2024 09:23:48 +0000 Date: Tue, 26 Nov 2024 09:23:48 +0000 From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexander Couzens , Andrew Lunn , AngeloGioacchino Del Regno , Broadcom internal kernel review list , Daniel Golle , "David S. Miller" , Eric Dumazet , Florian Fainelli , Ioana Ciornei , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Marcin Wojtas , Matthias Brugger , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH RFC net-next 00/16] net: add negotiation of in-band capabilities Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241126_012418_875050_B6F9EF9A X-CRM114-Status: GOOD ( 19.36 ) 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: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Hi, Yes, this is one patch over the limit of 15 for netdev - but I think it's important to include the last patch to head off review comments like "why don't you remove phylink_phy_no_inband() in this series?" Phylink's handling of in-band has been deficient for a long time, and people keep hitting problems with it. Notably, situations with the way- to-late standardized 2500Base-X and whether that should or should not have in-band enabled. We have also been carrying a hack in the form of phylink_phy_no_inband() for a PHY that has been used on a SFP module, but has no in-band capabilities, not even for SGMII. When phylink is trying to operate in in-band mode, this series will look at the capabilities of the MAC-side PCS and PHY, and work out whether in-band can or should be used, programming the PHY as appropriate. This includes in-band bypass mode at the PHY. We don't... yet... support that on the MAC side PCS, because that requires yet more complexity. Patch 1 passes struct phylink and struct phylink_pcs into phylink_pcs_neg_mode() so we can look at more state in this function in a future patch. Patch 2 splits "cur_link_an_mode" (the MLO_AN_* mode) into two separate purposes - a requested and an active mode. The active mode is the one we will be using for the MAC, which becomes dependent on the result of in-band negotiation. Patch 3 adds debug to phylink_major_config() so we can see what is going on with the requested and active AN modes. Patch 4 adds to phylib a method to get the in-band capabilities of the PHY from phylib. Patches 5 and 6 add implementations for BCM84881 and some Marvell PHYs found on SFPs. Patch 7 adds to phylib a method to configure the PHY in-band signalling, and patch 8 implements it for those Marvell PHYs that support the method in patch 4. Patch 9 does the same as patch 4 but for the MAC-side PCS, with patches 10 through 14 adding support to several PCS. Patch 15 adds the code to phylink_pcs_neg_mode() which looks at the capabilities, and works out whether to use in-band or out-band mode for driving the link between the MAC PCS and PHY. Patch 16 removes the phylink_phy_no_inband() hack now that we are publishing the in-band capabilities from the BCM84881 PHY driver. drivers/net/ethernet/marvell/mvneta.c | 27 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 25 +- drivers/net/pcs/pcs-lynx.c | 22 ++ drivers/net/pcs/pcs-mtk-lynxi.c | 16 ++ drivers/net/pcs/pcs-xpcs.c | 28 ++ drivers/net/phy/bcm84881.c | 10 + drivers/net/phy/marvell.c | 48 ++++ drivers/net/phy/phy.c | 52 ++++ drivers/net/phy/phylink.c | 352 +++++++++++++++++++----- include/linux/phy.h | 34 +++ include/linux/phylink.h | 17 ++ 11 files changed, 539 insertions(+), 92 deletions(-)