🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19218

Re: [PATCH net-next v2 3/5] net: rnpgbe: Support copper link configuration

#19218
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 15:09
110 lines
11561 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] rnpgbe_set_link_ksettings()
  (drivers/net/ethernet/mucse/rnpgbe/rnpgbe_ethtool.c) only updates its…

--

net: rnpgbe: Support copper link configuration

This adds set_link_ksettings support for copper ports, covering
autonegotiation, advertised link modes, forced 10/100 speed/duplex and
MDI/MDI-X selection. Requests to change the firmware-reported port type
are rejected. PHY_LINK_SET is also switched to the event-coalescing
mailbox transport.

> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_ethtool.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_ethtool.c
> index 0afeda19f4ea9..d856b970e5a50 100644
> --- a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_ethtool.c
> +++ b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_ethtool.c

[ ... ]

> +static int rnpgbe_set_link_ksettings(struct net_device *netdev,
> +				     const struct ethtool_link_ksettings *cmd)
> +{

[ ... ]

> +	if (!mdix)
> +		mdix = mucse->hw.mdix_ctrl;
> +	if (mdix != ETH_TP_MDI && mdix != ETH_TP_MDI_X &&
> +	    mdix != ETH_TP_MDI_AUTO)
> +		return -EINVAL;

[ ... ]

> +	err = mucse_mbx_set_link(&mucse->hw, advertising, autoneg,
> +				 autoneg ? 0 : cmd->base.speed,
> +				 autoneg ? 0 : cmd->base.duplex, mdix);
> +	if (!err) {
> +		mucse->hw.mdix_ctrl = mdix;
> +		mucse->hw.link_config.advertising = advertising;
> +		mucse->hw.link_config.speed = autoneg ?
> +			SPEED_UNKNOWN : cmd->base.speed;
> +		mucse->hw.link_config.duplex = autoneg ?
> +			DUPLEX_UNKNOWN : cmd->base.duplex;
> +		if (autoneg)
> +			mucse->hw.link_config.status |= MUCSE_LINK_AUTONEG;
> +		else
> +			mucse->hw.link_config.status &= ~MUCSE_LINK_AUTONEG;
> +	}
> +
> +	return err;
> +}

[Severity: Medium]
What happens to the cached link settings if mucse_mbx_set_link() fails
only because the ack poll timed out?

By the time the poll starts, the PHY_LINK_SET request has already been
written to shared memory and the doorbell rung:

mucse_write_mbx_pf_coalesce_event() {
    ...
	for (int i = 0; i < size_in_words; i++)
		mbx_data_wr32(mbx, MUCSE_MBX_FWPF_SHM + i * 4,
			      le32_to_cpu(msg[i]));

	hw->mbx.fw_ack = mucse_mbx_get_fwack(mbx);
	mucse_mbx_inc_pf_req(hw);
	mucse_release_mbx_lock_pf(hw, true);
    ...
}

After that, mucse_write_mbx_coalesce_event() calls mucse_poll_for_ack(),
which can time out after mbx->timeout_us. The error goes straight back to
the ethtool caller.

If firmware still applies the request late, the driver keeps the old
hw.mdix_ctrl, link_config.advertising/speed/duplex and the
MUCSE_LINK_AUTONEG bit. Would rnpgbe_get_link_ksettings() then report
settings that differ from what the PHY is running?

A later set call that leaves eth_tp_mdix_ctrl at ETH_TP_MDI_INVALID falls
back to the cached value:

	if (!mdix)
		mdix = mucse->hw.mdix_ctrl;

Could that send the stale MDI/MDI-X setting back to firmware?

Before this patch, mucse_mbx_set_link() was only called during probe,
where a failure aborts probe. This patch makes it a runtime ethtool
operation, so the mismatch can now be reached.

Would it make sense to invalidate or re-sync the cached configuration
when the command was sent but no ack came back?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/BD205A7832D36E7D%2B20261116030917.1329989-1-dong100%40mucse.com
Technical Details
Message-ID: <179510098578.3136.17685116330600350297@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367104-linux-kernel-netdev=dewy.ru
References: <E783BBD6D9CACAEF+20261116031032.1330270-1-dong100@mucse.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367104-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 3/5] net: rnpgbe: Support copper link configuration
Date: Thu, 19 Nov 2026 15:09:45 +0000
Organization: Usenet Network
Message-ID: <179510098578.3136.17685116330600350297@kernel.org>
References: <E783BBD6D9CACAEF+20261116031032.1330270-1-dong100@mucse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2908516"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3jNLa+lOgZui7sXepPqu1BYkuj8= sha256:AKJWa2fTedTVLr2wW5DwqB+9enMP1f5R/8gqoLkNx88=
	sha1:JgauPN+Gp5C65e1aJbSq+0GscZI= sha256:1tiHSJmID17Tm7lPmtctBiV+V39TKZ/I3rrg80TtiPo=
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 74D251156B3; Thu, 19 Nov 2026 18:10:26 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[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, URIBL_BLOCKED=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 hlhluseaaoos;
	Thu, 19 Nov 2026 18:10:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-367104-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id C50521156B1; Thu, 19 Nov 2026 18:10:12 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id E2F80105D99; Thu, 19 Nov 2026 15:09:56 +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=1795100992;
	b=hI5Ggx/Tg6zYVKuEPfyNE3E9q+lspvH6nJtuo4fMJa0w33FIPQqjwBqWm1lJ0nVIYxxE
	 f/USOEu6A0ji2TZiVDViZPym9R06/HWWlRKcQpXHCMLzkue+AE5EAbScCZY3+ZtfP7ASx
	 GWKFN018NII+sp1bi9Mw5ENvkiWBLmB3NyDLXcgLsiuSIdFCgfcW7MySdp9WZhlsVW35r
	 nXiHIUpZzA6eKnlKeHWlfzaumIy4WAlObSlAGn6sUpkV0Q8NR6jgrS+l+VGQlpXTAeB3i
	 v2LTGtRQOjFB7tTFhe6RRVe7gLWUXESw5uOGEXxG0IabE5Vf5IC6khiQKhuKY8FJ9Eg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795100992;
	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=itmh28cvNAL6dJYtrjYa4fc1UlzlKqtHtZSTzw5oYKA=;
	b=YFi5/ghg6FGnn2qDAC1Y4x/vipLvcqiV+SKoxkW+/k76Za1+HsTchiCKYEJXY8TvQ/gl
	 b48j+c+xyc85c2JQDyH0n2HdkhDm1fLAHYh0xjOZkSmILRfT7II2QWtEtP+jyoFOTCZ/r
	 wKXDku82z5Cnd+RkFG6qoVNI0v7B2eDldOLXb2RWLCjqe0L5EkiDqXEqZeP7Bmimmyykj
	 kHRob0SwPCkM+tJJeXB7ZG/n0FQWIKwX5CJ8RtcRD50FT1WVajG6KTygf5+gSo8B/Y8oh
	 wjlr38LP6U62lW26xCipNKzJqnNiqkceEeSK6YSP/5kpx475D7nR2t055tNdWYIseBA==
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="Ri4qu/Oq";
	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 B3459606A33C;
	Thu, 19 Nov 2026 15:09:52 +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=Ri4qu/Oq
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=1795100986;
	b=TS/XfK0722+2BLvgnIqYYJD22ZEaBIQU2aIspDw/jyso8iYS9BnfHP1aLbm3Odf0snsQ
	 Nmc7nZLmA+1q+rTZtC8U6EyBo2HN/n05GLXBgnNY/F1mEdKqdhmRPGIuvw6RdyjA3Kohw
	 +9fj0DnGGHINtsS/sdVa0LwgzRLm/I+suzLp2FBs9H/BCZuat7I8417ghh2O0L42ib8HW
	 9XVRederWdfsANaOPF77vpIIH8cT2FSeoCqhJgICirRciBClBttjZt0cN51r3S+B2ShKE
	 W1qLhQdrda3qcxrKQ4N6N1Yhk5dCxKggenlN0nBJLFLNpgkDL15vg+5l423EoN06MGA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795100986;
	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=itmh28cvNAL6dJYtrjYa4fc1UlzlKqtHtZSTzw5oYKA=;
	b=GffyX4yhFwO455CFglEnEMMbZvFl1k0TeQHoQzLbJ2PsFrI33Fh+snUfTC+bJpKhkITD
	 ltUmuoZ0DheZwIjBXXwKwcoySMnqvJoxNf+yn1wXr9WYBRhGQOM+SsNRmI60WbeUjlFyT
	 YADGd4PCe9Mu7Qn8asr06ht4p/6b4aFgCbfSR6trsWgs7caqf6bIKwDLDQgxCYGX0FkNI
	 +RhndAqellfP1cAPiJVMU1aPJQQ5OUymLUv4gcRnOL4LI127LY+fA4HfRBf91/Cdq3Qo8
	 bXNAT1CzLmE1yliJo3j4raUGOcx9Z2w+d4ju1JzdCSLV5oDmNDhVJyd9Xam9/ntyYcw==
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="Ri4qu/Oq";
	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 D3846606A337;
	Thu, 19 Nov 2026 15:09:46 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3257D1F000C4;
	Thu, 19 Nov 2026 15:09:46 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795100986;
	bh=itmh28cvNAL6dJYtrjYa4fc1UlzlKqtHtZSTzw5oYKA=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Ri4qu/OqG5PS5v8xCg8IgrW60M+8TSO+n53JCNqUalLCP80H9gEIBcsMYf5y56OKL
	 NwkQpvmXKh9nb3x7qBEdJ8zBTpILVOExiphKWVaEm3AbinP4om8Ap2Mx4yOTNREyg7
	 6hqptaVoJLyUbN6zHY3bMQneJ64tWdwFMZV3+7AQ8PQy49b3IGN8w99bUgymk3FJ3Y
	 c7Vi8QtqN8cD9hlnODR+DeZttk+huNKeSa/x+3xKEcJRIZYLhi8+EEU13J1w43VDSq
	 n5NUQJ5oSgS+05imrTmaiB9nnjJCebsuQrc4JjixFsvtM8uHbihM+yqv5VR0xCENo9
	 dPapHp/4SpuYw==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
 linux-kernel@vger.kernel.org, netdev@vger.kernel.org, yaojun@mucse.com
X-In-Reply-To: <E783BBD6D9CACAEF+20261116031032.1330270-1-dong100@mucse.com>
X-sashiko-severity: Medium
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