From patchwork Wed Jan 15 14:43:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13940509 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8997A24A7E1; Wed, 15 Jan 2025 14:43:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736952218; cv=none; b=ZArLcjGZ2haQ8+IiXiBDfxIPKvRGDbz9GXbezh9guMwiQMyIFhYsS6jHonhe3z/xIajj3+IWZMmSgk7Da0NOo1A7eDDJCKiJeae734yJfhTVxQ7LwHRKjKw1lkCWmwa3Z2ShuC3JogcHJsH5LhSDHfGsPoeix401e04FudsPWvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736952218; c=relaxed/simple; bh=xnOxfyk5tk3vQWH/7rCmunOnasL4TwI1A7iKjnCtwCE=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=Im4w5fdVsCG9YuWgOhYlk1N3BpCFuERkzRH2Xh4zxmrpKIgbD6dwA5cva8Te7h8f+E0BbjiwulnOJY6d0WDDMcfvpHcbKbsz3KdyjA2bKSINBiHnVOGaLqTU9iCtLAxn4q7tVvqaa75Z82WKG4/cITPukJ3btKeqcdZH4KWOaSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98) (envelope-from ) id 1tY4cC-0000000021h-1jAb; Wed, 15 Jan 2025 14:43:28 +0000 Date: Wed, 15 Jan 2025 14:43:24 +0000 From: Daniel Golle To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Daniel Golle , "Russell King (Oracle)" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 0/3] net: phy: realtek: fix status when link is down Message-ID: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Patchwork-Delegate: kuba@kernel.org The .read_status method for RealTek RTL822x PHYs (both C22 and C45) has multilpe issues which result in reporting bogus link partner advertised modes as well as speed and duplex while the link is down and no cable is plugged in. Example: ethtool after disconnecting a 1000M/Full capable link partner, now with no wire plugged: Settings for lan1: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full 2500baseT/Full Supported pause frame use: Symmetric Receive-only Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full 2500baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Link partner advertised link modes: 1000baseT/Full Link partner advertised pause frame use: No Link partner advertised auto-negotiation: No Link partner advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Auto-negotiation: on Port: Twisted Pair PHYAD: 7 Transceiver: external MDI-X: Unknown Supports Wake-on: d Wake-on: d Link detected: no Fix this by making sure all of the fields populated by rtl822x_c45_read_status() or rtl822x_read_status() get reset, also in case the link is down. Daniel Golle (3): net: phy: realtek: clear 1000Base-T lpa bits if link is down net: phy: realtek: clear master_slave_state if link is down net: phy: realtek: always clear 10gbase-t link partner advertisement drivers/net/phy/realtek.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)