Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795993608; b=XG6tESXGMRaE8ZGICq03co3ggyTxX4mzxPJLWnERPwRBYt7DTrms9EK2EBOUQhj4Lr6z QS/j57FEC+dWibx+PfgBXGcrGHXk/Xm8NiWvn0KX5TGpQc3ARZiKLhnjI/oYzSnNGBfW0 FqKSD1+zYuyiXq+b4nMX2pFyaM2v31avL4NvWryIdNB8kK/CCrFKjmPgw6gWY5x8J0HME K1DBhGTnljVew7vKR9z8We6yNM/qIWE6624Agm5l7dpRjKtFJB83xfsfyxm6jdItkRv0G 5wkGwd83y+tNMkNHRHlKRI8LAPKWNTPuqtkCvwg+3B73kvu5obQEK0aR6j7Ul2z6qqw== 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=3qzfHGlMvRGiwdZe/54UvPu6pINP8tPbyJOUg1Gmb3386wHZ/mv/fCKQkR9+CXSF0OHA wPunecJK2nSLT7M3nAFDiVQiGF+OAv8xLntrIfCdM+yqEJtXsHk/33nli/roEGl8feVpd AdRc9ER9dNmfWIB0yGeiZhCJ3rYB2WexoNO7YAhsMp6dqOz+EJhbp7GTm0dc+IDhDL1Zm QxPUwuRUxLvmKgMiwuICBHdNFkSLvPGVXpOiGcrU1FaeP+3Z1TXsCtgForJGNth6xd1ah LVyosbrKq/kvPqsLT41qHYSJSIOTF4gK9VngpmcCUZqC8CsQA2kmLU8F+mPYxDS7DNQ== 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.48 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 EBA9860A2621 for ; Sun, 29 Nov 2026 23:06:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EBA9860A2621 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-f48.google.com with SMTP id 5b1f17b1804b1-4bb55cda775so59871945e9.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=e6H7W5EwYpvXVBPZxk+62FY7uoppwrQ048zbGiqywB3chAFyn0zvdECbCR8rSksr6+ IStgVfm6vrFDjGGHnesV4ogFLtktoTvVufTV8bdUG5KDncLo8TC9yRcqTvSIh+f/oNmZ qhb1zgPCLGDw8ueLuWo+lo8JUqxXuBQhWhuinxMY/uc3EYjXNstiYvUdibMrhVSvdWvo gRqt/blqYUosE//JqMy7mkDxPCIt5mXjKKYO9952U7/uquOFIHZyD2BJsPRIj9d35bxL hOOpcI9m3kUVyIvc2m+WfitOl4rgWIZ9gKdwQfoHWmCnb3NGAakdWoWbUvkVzj73MVBt 6+Bg== X-Forwarded-Encrypted: i=1; AL+hErG9x8DrQd7hftm1REDYW84/lxleiS5Xf7LNbLKo6iOA2w+ubQC/+5yMtejrBUzLNchZGS665hYT2mcP@vger.kernel.org X-Gm-Message-State: APuU4Z+OqC1nb9zzVIGLW8Oe8UZlXuGtpEj9+vpqkP4dfARidqzdWhLK /IOkWRCUS+5DphmtzrIzoktpXaqDaU69nlue2/uW5JHAaA0vYIl9a/72 X-Gm-Gg: AZFdTZcygVFsoK/u5JU+i/ui8/BmhwCe4Z5zU/MUytPGny9tvkQplTDIJVEZCGlAWuu ZZ0nNMubdiBSRAKArVAzYLKiZaoKhPzy3+yD+ex1jrH4sy9SA3HkJUZ28X5gqC1Bo/hT/eNkUHI /Y40djIr0EAbP9p9oWD9/XSdAnw2EUyEHCEwIQRPQtiifY2cmxPsV3020wUigSMLLO3L5RFLVCv vQZE0NsB3mQRH+P6ZJ1FWc9iem0DEp7CVbfaLTNK162w3WmQ3a6rHo+8bbRg6xDxEAfgez178Et JOEwHgUDRZCwH03BevAIz1GxjXGW3rlbNUjsu4Xa5CuHclLgLAJITrCbILnPG57LapApbmhr/ok UudB6QkYf6RW3OteI3IX/2oX1tJz92AkLeqzfu4zd2g3vySY/Zh0qpq9fvUt890VgOCCsKmPR3S vuwQbH6lrxvZ4qII0/8GYKA+A4aBfbbho1PXALbUOpzMbA5Rs191NwFhdI8e+cEYO5o0kUGcdOv R4zYAs2hVzEzo8ifjGHi2VkFsDxukpnPOTjVE6l/fHZGvnjDIb+eeHpVBJkAhlASGOWYqUlnRxp XEqoJ/c3yEuWuwwcxtkK1ThOoo3DnC0tAmjBCe8U9DO7eU0qL1Z/5/b0PGz6q61SgoPtTfti78L ba7YdR365HeP116n06t70IWqtVwREnn/hnrWvDy8= 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: devicetree@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