mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: dong100@mucse.com
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
Subject: Re: [PATCH net-next v2 3/5] net: rnpgbe: Support copper link configuration
Date: Thu, 19 Nov 2026 15:09:45 +0000	[thread overview]
Message-ID: <179510098578.3136.17685116330600350297@kernel.org> (raw)
In-Reply-To: <E783BBD6D9CACAEF+20261116031032.1330270-1-dong100@mucse.com>

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

  reply	other threads:[~2026-11-19 15:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  3:09 [PATCH net-next v2 0/5] net: rnpgbe: Add basic management and statistics Dong Yibo
2026-11-16  3:10 ` [PATCH net-next v2 1/5] net: rnpgbe: Add basic ethtool support Dong Yibo
2026-11-16  3:10 ` [PATCH net-next v2 2/5] net: rnpgbe: Report link settings through ethtool Dong Yibo
2026-11-16  4:19   ` Andrew Lunn
2026-11-16  4:47     ` Yibo Dong
2026-11-16 13:18       ` Andrew Lunn
2026-11-17  1:49         ` Yibo Dong
2026-11-17  1:54           ` Andrew Lunn
2026-11-17  2:55             ` Yibo Dong
2026-11-17 13:21               ` Andrew Lunn
2026-11-18  1:17                 ` Yibo Dong
2026-11-19 15:09   ` netdev-bot+sashiko
2026-11-16  3:10 ` [PATCH net-next v2 3/5] net: rnpgbe: Support copper link configuration Dong Yibo
2026-11-19 15:09   ` netdev-bot+sashiko [this message]
2026-11-16  3:10 ` [PATCH net-next v2 4/5] net: rnpgbe: Allow changing the primary MAC address Dong Yibo
2026-11-16  3:10 ` [PATCH net-next v2 5/5] net: rnpgbe: Add hardware and queue statistics Dong Yibo
2026-11-19 15:09   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179510098578.3136.17685116330600350297@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yaojun@mucse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®