From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9355606A32C for ; Sun, 29 Nov 2026 23:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=C6E/D7+n; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=htJvT2hF; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=rUhYwfD5 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=7YzYkLmaKyXv95/SyuafeQe35PB5D6aeGsF3IsAY2Lg=; b=C6E/D7+nSSR/kG kQe5j4dlsi5YbOdjfUZna7ERVuW5my5jq3B+iqXjBukYRuvq1gv/a+4ws+bIxiEWXM11/LTLEIgbA qE7Ylvvxen+93Td0CVVh6gtA/GvjA9YKezF4Y+C3QgtxJV0T7vmGaiKqCvnsAdnI5h4SssqsM3ORm t+5ycocOH5EDVV/biU0+KDzMfkJumawu4wqBnIQc38fiT+hc9qyhNq5qGE61nCapEZAACQSgnp3Iq Th78AHK6JQJwr87cJhgFNM8pFpo0KSxSAOQbyDgqui0qZ2eCpkka6x+pvtijBJKUQ1HrBN438qrQn Jeki3MaHnW2VZyujmZOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXo0R-00000002aUj-25An; Sun, 29 Nov 2026 23:08:27 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXnys-00000002Zeh-2Lsj for linux-mediatek@bombadil.infradead.org; Sun, 29 Nov 2026 23:06:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description; bh=7YzYkLmaKyXv95/SyuafeQe35PB5D6aeGsF3IsAY2Lg=; b=htJvT2hFhKaeHTd0xExVLK2O0e 9TQdam08rHEPlqN3xsec68VUXWUr5IcNe6shrv+mABctwSGFwAMz+kq/3XI621UE2X2w6KgQ4czT4 hh2f1U1lRgOyikxRp465oBMJMV/zN8J5tsTYP/BuUdD+R4lafnRLStMWIRGGYtmtb2XjY9L53YzPM gurnQ6ElQytAMHRkIMRhuChy/vcSP8sZREiBc9PE/D5jtApeiFqMsst74zvnZM7cecjJVukVu8EJX b3wCd+I/rs93PGFp84EedOQQcf5a8ALgnEw32AlvG4UcLY/+lMYPrzKi0P6xOPCKaVUwi2X6yaMbo 0y7Ppe1g==; Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by casper.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXnyp-00000003doA-2Iny for linux-mediatek@lists.infradead.org; Sun, 29 Nov 2026 23:06:49 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4a9a8d6cea8so125106045e9.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=lists.infradead.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=rUhYwfD5S1L0Fch3C07dBMEa/gFmbM47B8RY22OtPIvCwuWiU7ug667jNTkirGMwDj z+MBlWselirpHSJcIDNol7ZmtE0a+enNycHvSkaN/juTOGhw20uokxAh93D5yXbAtzqz z8pwBssG3hTEPTxUaH9EglZY4jEXwjjdctZxalzlCpLKC4C5g+5on6SdVnWDIYZpBpIl b7HHZKGtiMeYBHfVcLJrzP/f+O8KPywhgNJHNY5OM9kLzfp60yxR2rEIt8eFixQ43EMy 842+Uk+hBU0XI8Lo31f9h0s/PZals/arDpmhtXJg+DTZe1bd5W6Q42VGYpRxhOm94bUq sLPA== 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=Z+KTZGlFtXhKGDddBni2uWVB0kNTjTxHH6qk2YOOtbcx33qWJ4nNs+PLUkkNnY0Nb6 xNmdu31RuOiGxbOG7JFk6B3n/QFA9konBoGpoKFw7ZKE0v3XctEJDffkeBsCFXAeQVo4 3dIZkHhasKK7Uv6D5UwIUmY30cYBEtRjD9O6BwsNCIZsQ6A3EynfNaBXPPt6AvcjzDy4 XW838QFe8H3/wtEAwm8YOgBBaOStLQRmvSVQi6so2VTLPESjC5XG0ez2zOYbvRaYBVwc PoZ6T8UImCEaEwH3Pah8/N1+0JcqXLVq+BMZJ4X3eUg/i8MTZyjneAQLpH7Jsql4FY+E PiCg== X-Forwarded-Encrypted: i=1; AL+hErHH8Lbmez+acwhYviiKekG/de/mwYrmTI9ca7pYfjEdJhPqAXMm0i8qKK76dGT2gzkkyaeHY4Yu/JGwXUQOTQ==@lists.infradead.org X-Gm-Message-State: APuU4Z+kx/9p+Xayy/YiG9FAaUV9shTGyD2OYO1+SjfE7tvAMG1f/3qz Aoe4r5uDtivqXbnlznTs8fw6jF8hlVA0fAmmT2+IxgexjRxrEsEs/9jj X-Gm-Gg: AZFdTZfDRzfdFkt+sy4FMZ5bwgl7dlJaYj6ZqDk3dXSxInNZV+SNc4+92dEYjabPO49 QGdYzb9ZKnyE3scpWMOUrFrdePI7ncROLp0Vv3WIRfSqTXm/iQQPysEaX8d5MjgZ6MhJz2WK5Ql 2cmfQWujU13BDJxkKVfPAJ0wbFgSwffwp3ZffEerw65f5QLf/UnUGPpehDfgyTItuvoV0n4WUFz fiA2Wlehooov2lw9nRu2prYkf9G5OwasTMFIEQ6nV1f43jp5lB//O8UnJJDOSOrxnwlcrAlpoTF fQcR0XXcLvwvvRtQOhEuU4r2ZBell4BAHSRdd8548S4zzIl49oLUfiPv8u6feZPoXnC1Yqzd2XQ tXg5T3m59Wv2m5f9QCsLcewLY+hwFwgmfTMWDt+VcvXVhZDx5hp2yQz67AjarPRj0q77dfogE5M nRZ+SxGzPWuJ9qGFIagj+hn9xQUI92IJeOJkqjKqiZL8Yc4SY71p6WFxuQQQuzvtM8zfN9hGyts 3+EmBJbuU3Dp00GT53K97b/MfZe9tlXNhd8nsUyJA61fyd6CmOLHbVA3uWU378Kw2VcGoW6JUy1 PfhkXP0wN1GEf3UcXGqY6PVbjTzRCTa5b0p9LRlzyU4UXoTMC6rMkVC+/SE8bWkNg6m9FCJ1+Li CvKkDOF2KED45lg+0YnrtTMTenW8hw+NLOP30hEU= 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-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_230647_681643_E0BAA153 X-CRM114-Status: GOOD ( 15.05 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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