From patchwork Tue Nov 23 09:52:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12633793 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 DAA4DC433F5 for ; Tue, 23 Nov 2021 09:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234586AbhKWJ4V (ORCPT ); Tue, 23 Nov 2021 04:56:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbhKWJ4U (ORCPT ); Tue, 23 Nov 2021 04:56:20 -0500 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 09BC2C061574 for ; Tue, 23 Nov 2021 01:53:12 -0800 (PST) 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=JYTFw20Aliur826yDh9Z24rOItlz7fSKajI2iQUIiX8=; b=Yo5f0SjEg9Wh3UxlfGJuxZ+WQV dAHwd5WaUxJlf9Iu6bL3REtmMg/0/Lwm5nWdWsPOBFcp/ioL9trUi/wmizlnt5GVAfNZb5IsAiKJm W6neUohco6UibmMiF/FCeAcghv0kUvxPwttW3LIA/KkEjsX9CQtZUaGA8ZTHYKoXnsBH2MIzJBoao JIbTKcO578taMyUhLNto/S8QOgJL/XsXIEoOKvH5cBTr8PeJ82WIEcnWLxbUvdilfncLbZjI19f56 fLIYOb58vPS8xtMxnR6cSKXBce3h8xVa71GXCRK5Mqpw8Jt2//pIWYu+qKWnM2MMZ0XRY7sOTvprB Q3n5/NAA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:55808) 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 1mpSTy-0007gp-Ut; Tue, 23 Nov 2021 09:52:58 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mpSTs-00007E-Pi; Tue, 23 Nov 2021 09:52:52 +0000 Date: Tue, 23 Nov 2021 09:52:52 +0000 From: "Russell King (Oracle)" To: Chris Snook , Felix Fietkau , Florian Fainelli , John Crispin , Mark Lee , Matthias Brugger , Michal Simek , Radhey Shyam Pandey , Sean Wang , Vivien Didelot , Vladimir Oltean Cc: Andrew Lunn , "David S. Miller" , Heiner Kallweit , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH RFC net-next 0/8] net: phylink: introduce legacy mode flag Message-ID: MIME-Version: 1.0 Content-Disposition: inline Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Hi all, In March 2020, phylink gained support to split the PCS support out of the MAC callbacks. By doing so, a slight behavioural difference was introduced when a PCS is present, specifically: 1) the call to mac_config() when the link comes up or advertisement changes were eliminated 2) mac_an_restart() will never be called 3) mac_pcs_get_state() will never be called The intention was to eventually remove this support once all phylink users were converted. Unfortunately, this still hasn't happened - and in some cases, it looks like it may never happen. Through discussion with Sean Anderson, we now need to allow the PCS to be optional for modern drivers, so we need a different way to identify these legacy drivers. In order to do that, this series of patches introduce a "legacy_pre_march2020" which is used to allow the old behaviour - in other words, we get the old behaviour only when there is no PCS and this flag is true. Otherwise, we get the new behaviour. I decided to use the date of the change in the flag as just using "legacy" or "legacy_driver" is too non-descript. An alternative could be to use the git sha1 hash of the set of changes. As part of this series, I have consolidated DSA's phylink creation, so only one place needs maintenance. This reduces the size of subsequent changes, including further changes I have lined up. I believe I have added the legacy flag to all the drivers which use legacy mode - that being the ag71xx, mtk_eth_soc and axienet ethernet drivers, and many DSA drivers - the ones which need the old behaviour are identified by having non-NULL phylink_mac_link_state or phylink_mac_an_restart methods in their dsa_switch_ops structure. drivers/net/ethernet/atheros/ag71xx.c | 1 + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++ drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 1 + drivers/net/phy/phylink.c | 32 +++++++++----- include/linux/phylink.h | 20 +++++++++ net/dsa/dsa_priv.h | 2 +- net/dsa/port.c | 51 ++++++++++++++++------- net/dsa/slave.c | 19 ++------- 8 files changed, 86 insertions(+), 44 deletions(-)