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=JsEdynKbDvsLIn1P4suV/voE60ub+Cm/Mg1CStCX/FMbrLxAlgKQuGEYG+befUTolDK3 G3KzXmVmjeUBajy3CNZFb3vcydTglIRaqVvM9ZAP/SLw9r8OWq2X10eErHvJGIpWVMOCj vnSKY+uzFVEyNjty2X5NusrLsyq8QLxwcdwDCCa7xqdcAHjGuAq2Frrc3WPd9Ot8G6w4t ebxYiAaCB1zf0OM9xJoN7ovYT4Mn4gT0EoqcCegZ8rj/u4CLv41J6eBJ/clyNwJnXrYzU eqn0wbRyG0HcPpCPAfsAN0rhPmWh9Ja3jsw6CfCEcIW9F/56dz2PTLm/FEGIjnMlfZQ== 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=3g1/bl0l9/UBKMPiwiUk8x85ZWJ7/Na3D4OLuRGUbizROb4tdtF1tbX6kVGTPJnTYcDV cMS2jrZCV07qVaIoO8orQW2G+zVZFLzQYyZGBm/SjNh/+dBMOfzBy3yS1Vjmt3jjSDXHt /7gC4cwcTqg5DpOUvLR2kvhYGHOagISNH3vq15DCg6YMlHKLzonrm4siJPwEEl6PuFw0T xYgiJ7MArHE3pOJu7qbhJ5x5fR+3/hua9k1GijgE3ds2nWUQLR8ArGSy0LBJkHFG2j0lm mBkv7ofIpdDTeS2b/2/MJGsgxPlX3kzw7FMgV6ZI+xYjLicIqsAknNfnXswsuZ+M0sw== 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 E06E1606A68B for ; Sun, 29 Nov 2026 23:06:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E06E1606A68B 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-4bb666304fdso93474605e9.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=gpKFmSw56NOcERlo02PfguLOd3P25gOHnKhKhdIu7ZuJiG3n8sR624/BNGs4P1ZxWl pRBXAVcwuyJcWv+MGsMPJdv6rV9RXl554Ys4Nqz0HgJEA6aEAyIG0NnPe7v5a1kUmK0b 9STXzzXFMYZiVuCeamGZky0pxjwwtZst8Jk8QsnW/KWIAFoxbCEIRDOay9Va88NrS9OO wDuivGv2Z0OApmufWv1U4885XRR+JbfEX2Ciazisur7oIY1riEGFJshfDXbLUCeiMY6j Jg1RF2IuEcxP2BEOiI86t8SWIzWkbOCQNiZGfFZEMmhWdbWgUuWIRBFfENDPMs6eAB8w q3PA== X-Forwarded-Encrypted: i=1; AL+hErEg34r5Jl6OSzoAfAbpbrGSdl733DWSEIQhVdZ5+xBnPf/y86p6yKzs/PzAzDW+pkYE4P/zM+Mz8dk=@vger.kernel.org X-Gm-Message-State: APuU4Z+0lXaK8ua+KOqPdW7yHUbHl+ZEgnvqyUPUXmYjyzGwLP0BW8FQ U6XkQOLmHrJ46GZtYEYkj4ar/zR9qZibAAq9rJxGqQ20fLiThwojZttL X-Gm-Gg: AZFdTZepVXs3sublnMqvHKEaemXowmrOMoC/CGJ0QMqJNDkA0xAW1Ysmi4+2j4ElVoY iUJimh8Y84yPwbmaCx/5mvnJyeTyITcr2Ku6Amjxfw9fPlChAvD6zLgoG+M1dv4XsExqbnEWA7r aOoyFnTVd9m6bcty/oXCULw5bWqkbMa47H8kEg+WZk7SDRw2BhByqBdafCa4qBHErkj6pPK6pkY arhQGrEOSo1qUdWE/K/l6KIGUTsGnyogDtWFXQPn7n4puSJRac+hK72ZVcdFIEzFSxij/D7c8xq KidFxM0GPm/0EDde8ANnicUsw7L+PMdDKTZjtaBR8YFi3ArKicesGts8v1/zTv+mavuplOVSo18 LWkkXd+zrZqsEVHB9V60W/VdzUTQ3/rjL670YqCTo+Z3TC81e5BNsydpRNK2lvGrTw4zQID4UMn o+xBvvjZBcKa/iSDeHPzjBuWCdPyNtHmVyqZBjyhkVQ4+N9iSLHVnGkvLuJsCNrxRAmBAdfM3ti zfSII0U+fjuYi1aKcYRfekhNfjF7Nv7mCSCF7by6FafNFNXX5VnUWJ75IVaadhISwULnyaQ11JY rd40gh7yOoe5X9RX/bGYIoJ8+3djVatnrPOPUet3AUyPwoiGmVXpdgD1OKIWLhkikHSoomBsYo0 rKWw4v32s/6GKC2GfV7zJEPCD/Y4zk/rqsk2U3Mg= 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-doc@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