From patchwork Mon Jan 13 09:22:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937033 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 73227E7719E for ; Mon, 13 Jan 2025 09:31:39 +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:Date: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-Owner; bh=EPdy4BPERTnLbmDgPw9nRNno9SSxaofX4cvpIH3U9fw=; b=1Us3bvsSybhMFIwAEsIAbvULZK L0akm4o0YjD8z8ip5NaqbEC0V4QQPFqnSjZyaIfAB3Frfhvi7bXtYb4jXBRkuGKHpCTs3ZuGViLVK nkzJJI+B6ZHJ5aOYj79wKDkac+dAomSWPLHjHO1XtIFNnjmNsi67EOnB3kZXilzh7MRQGbVVHawka ZJCHUCbjntQwZkIL+OwQPqQoXTa1iAS4t06IcJnhqnljVdqN9ZeDfMyZ7o4EkXX+3j6deOphUdyb+ 3ehUMb6Ym1m/M0Hg1rodlEZH7WvewZNhIvkJqbTUt+ofVyplo/pfmzJ9kGvd9MXgSBGTVckHGVtdk aRGZ61QQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXGnK-00000004cBy-2hp3; Mon, 13 Jan 2025 09:31:38 +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 1tXGfG-00000004aZc-2Kcc; Mon, 13 Jan 2025 09:23:20 +0000 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=EPdy4BPERTnLbmDgPw9nRNno9SSxaofX4cvpIH3U9fw=; b=ElvuuZkTLSBTcqfiqbMMBgMXv4 Gwq48/8T+sGg1s+3cZ+aJpecUPSN31D8mVBOdPJdJpKc1BGcmBlj9mAxVhCKDQL2p6G1qcc+fKLzt AxER0QB8hbvRyWoMp4z8gxe/aTkbfCw3AClXiaG0LShnaWwn0Hk8adCPs1Pc3nzHdW5NiU9sjV7+k SBJYY7xx4mbNcJbEw970MbKgIerDzarG5QVAarppLHgv32RSfQ6qo6jgTled+65o2NS6u51G7cFGX Jit7fVZVGO6U70UDudyNSGXXpOmA/hgw2zKIrmsFynZhVCn3a4RTibhnswZsJRJyYpbdtA77JapJY 7HdgRgcA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36114 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.96) (envelope-from ) id 1tXGew-0006Hq-2Q; Mon, 13 Jan 2025 09:22:58 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXGed-000EtF-CN; Mon, 13 Jan 2025 09:22:39 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexander Couzens , Alexander Duyck , Andrew Lunn , AngeloGioacchino Del Regno , "Chester A. Unal" , Claudiu Beznea , Daniel Golle , Daniel Machon , "David S. Miller" , DENG Qingfang , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , kernel-team@meta.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Matthias Brugger , Michal Simek , netdev@vger.kernel.org, Nicolas Ferre , Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Sean Wang , Steen Hegelund , Taras Chornyi , UNGLinuxDriver@microchip.com, Vladimir Oltean , Eric Woudstra Subject: [PATCH net-next v2 4/5] net: phylink: use neg_mode in phylink_mii_c22_pcs_decode_state() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 09:22:39 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_012318_594043_DA123341 X-CRM114-Status: GOOD ( 12.60 ) 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 Rather than using the state of the Autoneg bit, which is unreliable with the new PCS neg mode support, use the passed neg_mode to decide whether to decode the link partner advertisement data. Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index b29b7e73b5bd..b79f975bc164 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3877,11 +3877,15 @@ void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state, { state->link = !!(bmsr & BMSR_LSTATUS); state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE); - /* If there is no link or autonegotiation is disabled, the LP advertisement - * data is not meaningful, so don't go any further. + + /* If the link is down, the advertisement data is undefined. */ + if (!state->link) + return; + + /* If in-band is disabled, then the advertisement data is not + * meaningful. */ - if (!state->link || !linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, - state->advertising)) + if (neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED) return; switch (state->interface) {