From patchwork Mon Dec 9 14:23:33 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: 13899874 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (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 E8EE91ACEDB for ; Mon, 9 Dec 2024 14:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733754224; cv=none; b=P+e9ufONzVqYjYY8Q8m6ef8cOeR2ktr4+HyN1BlE+9hAsy0jgUTQAn+ngGe5oNqaKbF/TENlrRsN7FZS0kmbMT50DzHTYCMCJWCmxcvCY9G3HmMu2nodD6sbazYiLFvCFqsre5wIIL+kQUlv2V9dSw9mITF7e/p4YnSl32FU6x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733754224; c=relaxed/simple; bh=JV/WwFp3fqXTfzMLEgGdwIWbg55XZ4woW6T5c8HEfCY=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=F7z+Kq9q04zsKwXZED3AlugLGE35+FZeYROwR5VjoaYQt3KT4amLMmGTZObQKJAPhgB63Cee6UNWUQ/JftZrr19U5FRAt2onhwFAlrTJOpbTMsmEjA5+dkZl0aZw0I5GahCSbfzwJ9cl82AVRt4prn9o/ug2zo0HtcypVobG79w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=Iwfumhix; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="Iwfumhix" 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=8jCFq5Q5+3RurTDdH5R2Fu36cqAzrySp/SCeFUsRR7I=; b=IwfumhixGJYr/6hSWaM7EtlX+e /pWVpO22ayfIk/KsDgM8H+cssEqakd0ctYj8botGy9fy/FXESGyZiqKK4Skvc3l1Y2Vxy4lKmnn9Z 8VRQYMLZtMLRYCA2GjA9YOR5wjtui13Ihr7B4rKaAt8YidwLVZFQXIM2ocexcGMsqMyuW3XPwWXAI GbHsYk9APZxuA0nd8rRcfrWf4k1RLRqM6fis9TkScI9I9hvqE49VnWMdKJs637t9Zn6Ns/CGTFOiE ZQwFPu7jsRgZFTrRoVNcoHhgzlIeOAnfiTJQ9Apmoxj4rz0CqeIadyRlLJQhvBXJyfWC/N/rimdWB Ecpgz4cg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36586 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 1tKefe-0000ww-2k; Mon, 09 Dec 2024 14:23:35 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tKefd-006SMj-EI; Mon, 09 Dec 2024 14:23:33 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Andrew Lunn , Bryan Whitehead , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marcin Wojtas , netdev@vger.kernel.org, Paolo Abeni , UNGLinuxDriver@microchip.com Subject: [PATCH net-next 04/10] net: phylink: add phylink_link_is_up() helper Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Mon, 09 Dec 2024 14:23:33 +0000 X-Patchwork-Delegate: kuba@kernel.org Add a helper to determine whether the link is up or down. Currently this is only used in one location, but becomes necessary to test when reconfiguring EEE. Signed-off-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- drivers/net/phy/phylink.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 95fbc363f9a6..03509fdaa1ec 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1630,20 +1630,21 @@ static void phylink_link_down(struct phylink *pl) phylink_info(pl, "Link is Down\n"); } +static bool phylink_link_is_up(struct phylink *pl) +{ + return pl->netdev ? netif_carrier_ok(pl->netdev) : pl->old_link_state; +} + static void phylink_resolve(struct work_struct *w) { struct phylink *pl = container_of(w, struct phylink, resolve); struct phylink_link_state link_state; - struct net_device *ndev = pl->netdev; bool mac_config = false; bool retrigger = false; bool cur_link_state; mutex_lock(&pl->state_mutex); - if (pl->netdev) - cur_link_state = netif_carrier_ok(ndev); - else - cur_link_state = pl->old_link_state; + cur_link_state = phylink_link_is_up(pl); if (pl->phylink_disable_state) { pl->link_failed = false;