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

From: Yibo Dong

Date: Sun Nov 22 2026 - 21:44:01 EST


On Thu, Nov 19, 2026 at 03:09:45PM +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> 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?
>
Firmware acknowledges the mailbox request when it consumes it, before
applying the link settings. If the ACK wait times out, firmware has not
consumed the request and will not process it later. The previous link
settings therefore remain in effect, so the driver keeps the cached
configuration.
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/BD205A7832D36E7D%2B20261116030917.1329989-1-dong100%40mucse.com
>