🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24852

Re: [PATCH net-next v23 12/15] net: phylink: add .pcs_link_down PCS OP

#24852
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 23:47
112 lines
12627 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The comment in rtl8365mb_phylink_mac_link_down()
  (drivers/net/dsa/realtek/rtl8365mb_main.c, lines 1839-1843) is now…
- [Low] The new pcs_link_down() kernel-doc
  (include/linux/phylink.h:698-706) copies the mac_link_down() contract…

--

net: phylink: add .pcs_link_down PCS OP

This commit adds an optional .pcs_link_down operation to struct
phylink_pcs_ops. phylink_link_down() calls it right after
.mac_link_down, so a PCS driver can tear down the link between the MAC
and the PCS.

> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 3471ba8d5ba6f..b57a7de058b8f 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c

[ ... ]

> @@ -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");
>  }

[Severity: Low]
With this hook added, the comment in rtl8365mb_phylink_mac_link_down()
in drivers/net/dsa/realtek/rtl8365mb_main.c is no longer accurate:

	/* phylink has no pcs_link_down callback, so on the SerDes path only the
	 * MAC external interface force is reset here. Clearing the MAC force is
	 * enough to bring the link down; the SerDes keeps presenting its last
	 * forced state until the next pcs_link_up() reprograms it.
	 */

rtl8365mb_pcs_ops does not set .pcs_link_down, so runtime behaviour does
not change. The comment still says phylink lacks this callback, and it
uses that to explain the stale SerDes state. The comment is unchanged at
the end of the series.

Should this comment be updated in this series? Another option would be
to move the SerDes teardown into a .pcs_link_down implementation.

> diff --git a/include/linux/phylink.h b/include/linux/phylink.h
> index 9ce66b0344370..d53319e67f776 100644
> --- a/include/linux/phylink.h
> +++ b/include/linux/phylink.h

[ ... ]

> @@ -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);

[Severity: Low]
This text follows the mac_link_down() contract but leaves out its
in-band caveat:

 * If @mode is %MLO_AN_INBAND, then this function must not prevent the
 * link coming up.

Should pcs_link_down() have the same caveat? With MLO_AN_INBAND,
phylink_resolve() gets link state from pcs_get_state(). The only call
that reverses pcs_link_down() is pcs_link_up(), and phylink_link_up()
calls it only after pcs_get_state() has reported link up:

phylink_link_down()
  phylink_pcs_link_down()        <- PCS stops RX/AN, as this doc allows
phylink_resolve()
  phylink_mac_pcs_get_state()    <- link stays false
  phylink_link_up()->pcs_link_up() is never reached

phylink_link_down() calls the hook on every link-down, including the
latched link-fail retrigger path. Could a PCS driver that follows this
doc literally and stops its receive or AN logic here leave an in-band
port down for good?

Unlike pcs_link_up(), the new callback gets no neg_mode or interface
argument. A driver cannot tell from the call alone whether in-band
detection has to stay active.

The only implementation in the series is airoha_pcs_link_down() in "net:
pcs: airoha: add PCS driver for Airoha AN7581 SoC". It is not affected.
It only sets the XFI MAC RX/TX MPI/MBI STOP bits, which
airoha_pcs_pre_config() also sets before link-up. airoha_pcs_get_state()
reads the hsgmii_an and usxgmii_pcs registers.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129230558.612526-1-ansuelsmth%40gmail.com
Technical Details
Message-ID: <179608247377.3146.11725760694388618130@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374537-linux-kernel-netdev=dewy.ru
References: <20261129230558.612526-13-ansuelsmth@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374537-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v23 12/15] net: phylink: add .pcs_link_down PCS OP
Date: Mon, 30 Nov 2026 23:47:53 +0000
Organization: Usenet Network
Message-ID: <179608247377.3146.11725760694388618130@kernel.org>
References: <20261129230558.612526-13-ansuelsmth@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1568995"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:U4nnwuYEu56lmEK3Ug+VXeE4+5o= sha256:PWahYAlvrmzjpw7d9euL4rLlCaMxVKECZQ6PxM4G8MI=
	sha1:eNrNmmuzCDRZAJRy0zv/52Omt1I= sha256:Wfo82VWRc9POitTf0B1XQ5MbEdLDiG8tbnyoO6WsY8s=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id D007412600C; Tue,  1 Dec 2026 02:49:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.301
X-Spam-Status: No, score=-2.301 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Lv_4RHU7L80s;
	Tue,  1 Dec 2026 02:49:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374537-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 344EE126013; Tue,  1 Dec 2026 02:49:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id E2A1D32E90; Mon, 30 Nov 2026 23:48:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796082477;
	b=jLMahbmnem/t+XfbV6h4QDHLNCnbTbDC34s4//AnDmyfovHWFZgDsIlZCPegVGRdApuP
	 pNdZCwlpRJT1VXmzhPQdQ1ByJKlk/3HwyEcgZ/ArUymK9w3pIhWuh0K/WgaVUq2CWd8b9
	 UC/8XxYjw+zTPc1DwntK+arejT7wWGCqvBPRzlbzvAugJ6GND6tR/cOD0WKI2apLdorm9
	 dDEgyRWUTyrHGRA9YS2Ey9VqCRGdCufp2lxYTkwl9TSARg2enkUuYnCTvNEDPgzwNrasu
	 VtNsjE9oe/UBFcPzVTQVA+1Jkgl0OQE4KzZRjuvSatkUEflghr1mTM5k1m1CRT4IPtA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796082477;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=pKV8WXb0qjnWoBDHn+cQjl//uOwfucbOLsU6Ms1mxV4=;
	b=BHGh0Yn3L7JeNlfB/Er4a0QkiDre/izcC86qErgAH2hK8OWDl+AUPhav7zl86CpQ+e7V
	 pw9lVc0MGShJAjqmeFAkihrOt+n3YGq1vfb660rV3euPXd15yBx5iljRgpuBUxvtJInjy
	 AOIOuxC26ZvrtjVMAVOynpyHgB7pdafOYz7GD1WMn6HP1cuKrAjedliZJdRF8wDDdHepG
	 DDLJGeOs/xhsSFH42NLYA5Yxr9ZhUxVB51iXjuP07AqDP7ICYk0xH9C2vloxcSVib43kH
	 evVtEYiLYJbt/LzmVq63T/EwIWzeOOAT4XK4cgu19jTwZSHv2IGS8mAX845k3wXKE8A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WadacLIn;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E4F1606A33F;
	Mon, 30 Nov 2026 23:47:57 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WadacLIn
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796082476;
	b=10EVjovNDtIl6o958eKSMXmUDTd81U8+RYw4ZvDgA2ER2MFTEolPoTIBAR3d1PZnLTU/
	 yRSk+MqO2Zv0g7sM6UCHsjjcf08pa0CbYj8vH8NZom8vSJ6BH+0gnq8NwsyRB6OA/I1Uy
	 DHR5oFyWdcSQCcFpcAfVhKRyvs6NrO7h/Lz8W24j2SKkwEdfaFoYrfOaRe0BH5nid2Gq4
	 VsgzjetEs8A1qzQByQoU0ZmSvs5TF1/Y2FFhjbJQCaYFQfUUeKAsIZuVg0u2kC3iPCNPW
	 zo7krVMjOCqYv1u6OSteorRUzHyhf0sc76v+2lZIA1QKNoZ0ZDgL65yoDt2WB32xTUA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796082476;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=pKV8WXb0qjnWoBDHn+cQjl//uOwfucbOLsU6Ms1mxV4=;
	b=TxfQz8HDZ2Uc2ORdwolSfhl0citjQ/sxcIFZLbD0wRG1dFj83oTPrXLQhLszonhs7h2G
	 O5luAmkaHYeJTke8UjD91l6jRglaGsAn7NRDexGlQfd4TgeMMUfOxRYx8MPBTkZ2OMe+w
	 y27U0dwO984RbunLO3nSQZNIj/4IMQDY3TMK2kndauovogQ5uhEhRRdq/351DLXyrKJtx
	 urOPB34FmWIEI5N1wH6QJd406DixnupkBpNvahgdNDAIX81h9AUoyl6LYrzpxxofP8/fv
	 /T+2xNp3XjhSHgZ+1o37+j+tMZRzYV8I2l2WmnyCz8qcv3l5rUkbzsf/7DKeKbxOQIA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WadacLIn;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B597606A31A;
	Mon, 30 Nov 2026 23:47:56 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 405DC1F00933;
	Mon, 30 Nov 2026 23:47:54 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796082476;
	bh=pKV8WXb0qjnWoBDHn+cQjl//uOwfucbOLsU6Ms1mxV4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=WadacLInfcnT613db47eeD7FPQqXBsKjNeGEC66h6/0FVBpi9Q1wpaA0jNwVZE4Ol
	 q96kuG4TfwJFmDgHf7BeWAZv3wFCb4ijancZnpAsH4CEUWJvbWmvtAtMmn7YWnn/KL
	 38u5OaFoxoLUqH89oadI17KlqXomOGZQAUDE3g9NP2ylSkLT7ytlpr0AkCPd1v1NvS
	 JDUaCyFTaP1Q+RsEnAt00MQggnVVWsafvS4oWAn9DNOjPbZT071/rTyBbwp600U4Ll
	 jyCmH+DfKS5Oa+UP0cnPTnu7qVsEe+RQB+v5VnPesqew6m1wnaRuZ3BqdBFU8M8rUR
	 20HSfqEozAt4A==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
 conor+dt@kernel.org, willemb@google.com, horms@kernel.org, corbet@lwn.net,
 skhan@linuxfoundation.org, rdunlap@infradead.org, lorenzo@kernel.org,
 hkallweit1@gmail.com, linux@armlinux.org.uk, maxime.chevallier@bootlin.com,
 p.zabel@pengutronix.de, nathan@kernel.org, ndesaulniers@google.com,
 morbo@google.com, justinstitt@google.com, rmk+kernel@armlinux.org.uk,
 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,
 zhengping.zhang@airoha.com
X-In-Reply-To: <20261129230558.612526-13-ansuelsmth@gmail.com>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list