From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795993608; b=KTZU1BKC72RHfOSloc6SDDB+O3zOaq2YIfcJQF/kZk2yR4rnGWymevlhhkkk8gv7w7E1 d7RU7nDOSreG2JRCfrrBqaHfZu8ipqFEtL3uO/U4UmsfwPmfEM5/UMCS6E4sBS8RHKU9M ujb7JXGwnv1lnO4/a8IDwxcGWZcAbjS9obWISvh0Ad25mYoQdaBy/SgmhCjIlKLoipa9i J0cFa4OhS5tKl+5UvOMcv/S/D5I+YrrZlgnl6ewmx118xz7l65T2OWmrPHD69GYxub9EH 3ztY60bO/Ue79cT8IdEUjptzJZsnib6vtV4FLAoLexUd57OIFgGkBMcXB/MGgY7scsg== 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=rurl15jtEAj0tSGO5U+tvmm+6zLu84E2RzMHCCdQf3HIbd6rfG2AYWdKBRYbzgUrPYuy w+q/SXO1mSrwSLFB2O0gwN5WePJjpTzaKFWDKKVzr16URXO/rQuKFmv1DaVU0Tt75ZTHu /OJjMmda9ysp3CL3GBXNVpZnXexe7JLRzCD1XghXofDGJ9WqJauNIFC445MNT1pu/ABFx OgG7Y4SkJJo7NH0lW+5X4qP9gl5PEEWac5/V91J7J2ON+pBrv4CmWBIQqNtlkFA/W442q OdGxts35AziO49ghXC2dbQf5t3BMu5W7D+WdMAChPgTb8X81eaXsz1V+DTcFiqauwww== 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.46 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 D38D3606A33E for ; Sun, 29 Nov 2026 23:06:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D38D3606A33E 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-f46.google.com with SMTP id 5b1f17b1804b1-4bb77a462c6so76697805e9.1 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=suidzYXbvEboT/MRNw6NsAIwVHR7sVgqgGBMuR+V7VXm/uZ2+LJVZW8guVLINBqRif EznikTo6PglyaxHzD0nEacHpmSgGWQYJdeNQewPOTwzSRS24dVaUGqB6bM16kEhAAmI4 KDDi13DMry04xRbi5nANSx8t6s18ctb7H4Mdtf5RSEvMThSaCt7dMdyF2ZgkXKbY6c3L 8NgCSArW47PHcietO9WFkRRUwqrBg+h0dLJlicj9x5BVdbuGRy6usiIpXun9slWccIdG k2Ama1oGyGSxA8dzzfYJ+NI9gzarDy5kJ/4J8N1HF4WIO9KjC9Sls9VQaYNqFkUW0aeN fJWQ== X-Forwarded-Encrypted: i=1; AL+hErHcGze/ClvzKz/Hfs5+jc/ByrnR+xoSm1x8fbQ90m2Wa09wjizVmyZaPjU6dWjE4MsY0xFfNu4=@vger.kernel.org X-Gm-Message-State: APuU4Z+FEOHDGvHzYykb6JbdgqABjuExwEs+K8U3s0QscdP+VodfxAbO amq2ro+dI6G9+uRFcBzZImandK+nfxHnwFky8u9e1x5sBYxpOb5kiOs6 X-Gm-Gg: AZFdTZeepYTjiR538o4jXdiusAmKW7OnrfVXA7ycgXZv683hghggtQR+Ve6nfcUL36F bqaIf5yZheILYGC1cYkOC6I44lw7tg57oIIAHZUneQC8zmyP3mfQhn883EifXvhIW+sT1GYEcSf In8OIBRmL78FiP12arfqPjx3fMdPRkVWKFIPS7dL818HGllUECOUAt+Nod+rj+1G+S2VqyH6jgO iWCRD2rkbfM0/NqhFUzZddcgRHq3ik6SdltKCGjf9rIuRcFb+lUAfFRlTpYNL+/2xKfoWTZazKT cam8L1Gi/fihGgDPrO2JTxPYLIvw9hg022XoBMQOC0deuoZVkYVWdNcdXuQhkaPdbZlZYbOJaFX VqnwSJfOfTsYs8UZ54K7iSihEBQkiDv53BLtwt/hc1qca+Eb3EHGGshGeGh1KtKWffAp+a00gi4 YFhi7DgflxbdO8w7IgWizs09doiiCQoSwR/WI6wO832vI9DDT6rby/R5D2jky9tgRVyc0Ec4J61 9eAf7msSr4iQQAYt8uypP4xbH3Y4nMnem3F5VF33KwrxW37qiIQu7rYEhMeUykr56PAJI/qlZ+Y NHiIMyCzMx8YcFP5//VHrrgPd1+mTXQoNQ0U6dS3p8qNt9Y+3ObDUR18PwL8S30/6EpnhHvChL0 rKMLM7jDiLocdfW14opAqoMkide3gLev47nVa3Qw= 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: netdev@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