From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795993608; b=KpUaDjBtssB9RWGVC53XhgBp5OkgTvT8Jod5y3NWfyGmy3hKTLeEZ8L5nFAmraPa9alB kT0dBVjTVBlFEEkYCNB8/khB8AOMO1FRWuNtHkb1pJ2pzJw/VZYNfbbGnQbaEcWoEQIsW /aIdLw8zZ6tWwfFve9ohmaMh6xxi+Mo4cugXzA0al/Qrz0NUp1/Fgg4GNAtACukQgumpj 81qs/Zsbrh3hJUi8+mKT7vdl/h/ODVnmWK1WZRqhh01g/m0K9Dj4+17dNG6iI96YOK2e2 yjAC2ZjzbAR7tYQXFG1bVMW5kLr6G/V4wDRnaD9OPw59aQNEVpTC0lo6qxoNd15FbAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795993608; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=7YzYkLmaKyXv95/SyuafeQe35PB5D6aeGsF3IsAY2Lg=; b=LZk8EyKDgFR4GLaIi8dBzPixnOLHOIAof+FZFkzALpTh25petdhK3PyoJT5/i9+oGnsZ XAD1YS8yn3G9bcBDi3p2WGpghopbbkhV1WNAIhCIFCo+VYfouQLNam4jNx8kLum6AAxao 87iFvUH/rawP4M89NHFlw4FIF0lgSzQoL9D17hhtnuO7zDZXA07wHbqyYwIRIl4B2cPNE 4y16bKBzjp79aRDOxNtpnRViZ+h2p00QhLEWfx0Di/MB7/z5M33g5DA8Km8NWG9fTN8nQ 5OymhbvmSvFJ+MvpxxWYheYtQ2h2RcQ14AyBpuWmALpOrPvVuf3632QOed/eE0kYWiQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xg6Ka6S3; arc=none smtp.remote-ip=209.85.128.47 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0745606A69A for ; Sun, 29 Nov 2026 23:06:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E0745606A69A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xg6Ka6S3 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4bb55cda775so59871935e9.0 for ; Sun, 29 Nov 2026 15:06:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795993606; x=1796598406; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=7YzYkLmaKyXv95/SyuafeQe35PB5D6aeGsF3IsAY2Lg=; b=xg6Ka6S3kVMG8xzjU61dWlvCHP1KSBjTNX4bI+PRwNYpwskuaNLor6/vIpqbz/qG3k 9kELMtyf0+GeK1uMGZ7FJTgRFUvhoZh8wRhJ+gUEYpX1a0YriS8RAyeWbrZNnu1YBuAU Tr1GCBdcXTMYmXCsPYaiDaltMyGyuYKcfGJei+efqcpROnkDsGI05wDo1IZ0sB6H5JeO xTzSoGv7fUIUoXaVo6+KY7WD2u5sNxbM6cCk0qzZhzGaXoCptI0AOi1Znj6afLnwk6L3 UfGTwwhu3krhvhJowcejh05kg/IcXh88sp/uGzwC613I6ACCsyEp8MGCIwVmS05EUkjQ +fxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795993606; x=1796598406; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=7YzYkLmaKyXv95/SyuafeQe35PB5D6aeGsF3IsAY2Lg=; b=ZAMrR36qsMIV896fHg3eHEVi+eWWggTUCFZAVb+BMVZdAVo0bwEzDByz8SMKpNNWRg VzRs3DfCIYpc0/4JcijbqoEBrf0REzFDSdZiUlIFEDqkyezf+Aq5jd2K4hkQtSDdcec3 LuqI/2aOXGr+pYy+BvCbDpq3LldzekcIdAcRWrloEJ73aqVtURw2dcbklWmR185Nu/VZ OUfMLXawDOO6iAw4+M6fU0vC2RiTBOc8hG6CwB7N0ykJiv2SiFrvDNAsJUDEA4HUdvQs gltyJ23/mInqDwOZ7YPVbU61BgcXJDMGCgnEuH4dvL0ehYTOaqe18pg+nFWZ8qTQpy6Z YTZg== X-Forwarded-Encrypted: i=1; AL+hErGl268grSW4tLgUJOCMz2zP8Nef+PMUj4Tb9EBnyXodz0nL9uZ0Yvzm5DD6H6YYa27D01g73Vafhli1oIQ=@vger.kernel.org X-Gm-Message-State: APuU4Z9gSv0fSAlIKi54MT5UicIRoEPin6yDwzA+yVRjnFz5nT2qdshO oaeSvaBHtlWndCDfT8kr/THH9qtKyS3UifYIIE/IuoBkTJL0KGAR6vcH X-Gm-Gg: AZFdTZeTryr1NQm58fJUeBGVp1ww13MhVatAuLwovYbLanxlCLG/3gwgN1+4TmskX+4 Bx/NcG3CSsl7Plw+BqkJDUJ8OnQM8ZbxE98/jwxhWvTrzBojGb6KyiR0hxSaPQ3IVCrEOWLGuvV h9oZuqu4Lt8gi0OFcpljonrIB2sTfjGsyH5M0ZU0+rEMo6i8KD0hhJcqYMdmM0l+5f2DBC04Br6 OFlK/YOW8zTfdqn/fRKuhmWsr6qKeQ8jVexcAW9AWB780i0FdCr6dJC8y9l6N8H3nEbZFFIWqJI JFRVI3+vW7DLeB5orvLVKcVQc2DaKNmHUekxU2NgQSJJz16EJwZVkAV65kAraj9DEs4wfZZGzb0 PtKVruhXYG0ByGfHyoljHYp9tdsGSLlnVaQahK3DuFGECuVnYTGV2H37liJSJoapj61bCOjT7Pm FsqUzz08sQJn3X4J7zI1v++y0VweH+VEpcmmTKsvabJUHf4Nm+gyOGnjYRtwDrd1hH8HDBRSGs0 oCJjLPHR6EPR4SXQmxLXJFZXeYIn+dAEt83LHslh1nGMuqa4R73dUGkwULHRNFyttF6tY0eruHL es0790kTw08rBlwQB8mvk1+37mrAPHE3pX2FsA7RGDyoiixOgcluMhjwdqFBPuzZuQ7zhzEn/cd NGfpKeq5f2IckAKpKjzdsth7Kd8bUMiDkAJ1wmD8= X-Received: by 2002:a05:600c:8b6b:b0:4bb:5e8c:13bc with SMTP id 5b1f17b1804b1-4bbba61a187mr131773475e9.7.1795993606219; Sun, 29 Nov 2026 15:06:46 -0800 (PST) Received: from Ansuel-XPS24 (93-34-92-103.ip49.fastwebnet.it. [93.34.92.103]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-4ab6c4353d6sm58448894f8f.56.2026.11.29.15.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 15:06:45 -0800 (PST) From: Christian Marangi To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Willem de Bruijn , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap , Christian Marangi , Lorenzo Bianconi , Heiner Kallweit , Russell King , Maxime Chevallier , Philipp Zabel , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , "Russell King (Oracle)" , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, llvm@lists.linux.dev Subject: [PATCH net-next v23 12/15] net: phylink: add .pcs_link_down PCS OP Date: Mon, 30 Nov 2026 00:05:42 +0100 Message-ID: <20261129230558.612526-13-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261129230558.612526-1-ansuelsmth@gmail.com> References: <20261129230558.612526-1-ansuelsmth@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Permit for PCS driver to define specific operation to tear down the link between the MAC and the PCS. This might be needed for some PCS that reset counter or require special reset to correctly work if the link needs to be restored later. On phylink_link_down() call, the additional phylink_pcs_link_down() will be called after .mac_link_down to tear down the link. PCS driver will need to define .pcs_link_down to make use of this. Signed-off-by: Christian Marangi Reviewed-by: Maxime Chevallier --- drivers/net/phy/phylink.c | 9 +++++++++ include/linux/phylink.h | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 3471ba8d5ba6..b57a7de058b8 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1163,6 +1163,12 @@ static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); } +static void phylink_pcs_link_down(struct phylink_pcs *pcs) +{ + if (pcs && pcs->ops->pcs_link_down) + pcs->ops->pcs_link_down(pcs); +} + static void phylink_pcs_disable_eee(struct phylink_pcs *pcs) { if (pcs && pcs->ops->pcs_disable_eee) @@ -1889,6 +1895,9 @@ static void phylink_link_down(struct phylink *pl) pl->mac_ops->mac_link_down(pl->config, pl->act_link_an_mode, pl->cur_interface); + + phylink_pcs_link_down(pl->pcs); + phylink_info(pl, "Link is Down\n"); } diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 9ce66b034437..d53319e67f77 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -531,6 +531,7 @@ struct phylink_pcs { * @pcs_an_restart: restart 802.3z BaseX autonegotiation. * @pcs_link_up: program the PCS for the resolved link configuration * (where necessary). + * @pcs_link_down: tear down link between MAC and PCS. * @pcs_disable_eee: optional notification to PCS that EEE has been disabled * at the MAC. * @pcs_enable_eee: optional notification to PCS that EEE will be enabled at @@ -558,6 +559,7 @@ struct phylink_pcs_ops { void (*pcs_an_restart)(struct phylink_pcs *pcs); void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int neg_mode, phy_interface_t interface, int speed, int duplex); + void (*pcs_link_down)(struct phylink_pcs *pcs); void (*pcs_disable_eee)(struct phylink_pcs *pcs); void (*pcs_enable_eee)(struct phylink_pcs *pcs); int (*pcs_pre_init)(struct phylink_pcs *pcs); @@ -693,6 +695,16 @@ void pcs_an_restart(struct phylink_pcs *pcs); void pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, phy_interface_t interface, int speed, int duplex); +/** + * pcs_link_down() - tear down link between MAC and PCS + * @pcs: a pointer to a &struct phylink_pcs. + * + * This call will be made just after mac_link_down() to inform the PCS the + * link has gone down. PCS should be configured to stop processing packets + * for transmission and reception. + */ +void pcs_link_down(struct phylink_pcs *pcs); + /** * pcs_disable_eee() - Disable EEE at the PCS * @pcs: a pointer to a &struct phylink_pcs -- 2.55.0