From patchwork Tue Mar 21 16:58:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13182947 X-Patchwork-Delegate: kuba@kernel.org 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 29C4AC7619A for ; Tue, 21 Mar 2023 16:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbjCUQ6y (ORCPT ); Tue, 21 Mar 2023 12:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbjCUQ6x (ORCPT ); Tue, 21 Mar 2023 12:58:53 -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 0D1A4298FF for ; Tue, 21 Mar 2023 09:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=GzJYrO91ZX8KIsoClazcJ2vKadBJtISABB/uyQaRDBU=; b=OQeDNd6cY7mZfXSE4vuCiWryLI q+p3PyId1JgeRwGQQquQgeZ3FKcbhhb57YjC/iUsI9xRFaCPbONhMTVN0gOj2Vz7e+h7VXWDAGq+d WF+v9EszGapmNwtLEVCwHvOmWlCOSgFyYfVOuTJ3j34cHyB1Y+d0S9l0mBI6Vh7z5b//vxVPo1Lon GdSp4iSPZquk7PYHgF3P6OaPoyXeguLbQ50+m9gNtvBQ6Kpnur80p1/jvzukPsiIOAO1gJUki1p+E V58FmhVtuuG1byfOpQH7sdOFro+dh/+7bekQLjD/kgfcBXEgQ4oYaBrI/1REY5F7UyZa4ZQiXFef+ dCgYeOWg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:55150 helo=rmk-PC.armlinux.org.uk) 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 1pefJv-0001aG-9C; Tue, 21 Mar 2023 16:58:47 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pefJu-00Dn4P-JK; Tue, 21 Mar 2023 16:58:46 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: "David S. Miller" , Eric Dumazet , Frank Wunderlich , Jakub Kicinski , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 1/2] net: sfp-bus: allow SFP quirks to override Autoneg and pause bits MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 21 Mar 2023 16:58:46 +0000 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Allow SFP quirks to override the Autoneg, Pause and Asym_Pause bits in the support mask. Some modules have an inaccessible PHY on which is only accessible via 2500base-X without Autonegotiation. We therefore want to be able to clear the Autoneg bit. Rearrange sfp_parse_support() to allow a SFP modes quirk to override this bit. Tested-by: Frank Wunderlich Signed-off-by: Russell King (Oracle) Reviewed-by: Simon Horman --- drivers/net/phy/sfp-bus.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c index daac293e8ede..1dd50f2ca05d 100644 --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c @@ -151,6 +151,10 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, unsigned int br_min, br_nom, br_max; __ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, }; + phylink_set(modes, Autoneg); + phylink_set(modes, Pause); + phylink_set(modes, Asym_Pause); + /* Decode the bitrate information to MBd */ br_min = br_nom = br_max = 0; if (id->base.br_nominal) { @@ -329,10 +333,6 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, bus->sfp_quirk->modes(id, modes, interfaces); linkmode_or(support, support, modes); - - phylink_set(support, Autoneg); - phylink_set(support, Pause); - phylink_set(support, Asym_Pause); } EXPORT_SYMBOL_GPL(sfp_parse_support);