Re: [PATCH net-next v3 3/5] net: rnpgbe: Support copper link configuration
From: Yibo Dong
Date: Wed Nov 25 2026 - 02:32:21 EST
On Wed, Nov 25, 2026 at 06:36:03AM +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] This patch adds kernel-doc to mucse_mbx_set_link()
> (drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c, lines 216-218):…
>
> --
>
> net: rnpgbe: Support copper link configuration
>
> This commit adds set_link_ksettings support for copper ports in the
> rnpgbe driver. Copper ports can now configure autonegotiation, advertised
> modes, forced 10/100 Mb/s speed and duplex, and MDI/MDI-X selection.
> Requests to change the media type reported by firmware are rejected, and
> PHY_LINK_SET now uses the event-coalescing mailbox transport.
>
> > diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c
> > index 469818b83d70f..70eef8ed7f5cc 100644
> > --- a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c
> > +++ b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c
> > @@ -210,7 +210,12 @@ int mucse_mbx_get_macaddr(struct mucse_hw *hw, int pfvfnum,
> > * @duplex: forced duplex mode when autonegotiation is disabled
> > * @mdix_ctrl: MDI/MDI-X control mode
> > *
> > - * Firmware ignores @speed, @duplex when @autoneg is true.
> > + * Firmware ignores @speed and @duplex when @autoneg is true, and
> > + * @advertising when @autoneg is false.
> > + *
> > + * Firmware acknowledges the request when it consumes it. If the ACK
> > + * wait times out, firmware will not apply the request later, so the
> > + * previous link configuration remains valid.
>
> [Severity: Medium]
> Does anything on the driver side enforce this guarantee?
>
> The request is already fully posted to firmware before the ACK wait
> starts. In 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);
>
> mucse_write_mbx_coalesce_event() then calls mucse_poll_for_ack(), which
> gives up after mbx->timeout_us (4 seconds).
>
> On -ETIMEDOUT, neither mucse_write_mbx_coalesce_event() nor
> mucse_mbx_set_link() clears the SHM payload, rolls back the PF request
> counter or withdraws the request.
>
> What stops slow firmware from seeing the incremented request counter and
> applying PHY_LINK_SET after the poll has already returned an error?
>
> The new runtime caller relies on this comment. rnpgbe_set_link_ksettings()
> updates the cached configuration only on success:
>
> 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;
> ...
>
> Suppose firmware applies the request late. ethtool -s would have returned
> an error, but the PHY would be running the new autoneg, forced
> speed/duplex or MDI-X setting. rnpgbe_get_link_ksettings() would keep
> reporting the old advertising, speed, duplex, autoneg and
> eth_tp_mdix_ctrl values.
Firmware not 'applies the request late'.
The firmware does not queue mailbox requests for deferred consumption.
When it handles a mailbox notification, it ACKs it after takes the command.
If no ACK arrives within four seconds, firmware has not consumed the
command. It does not subsequently revisit that unhandled notification
and consume the request.
>
> There is also a related case. The late ACK for the timed-out request
> could arrive after the next PF command has sampled hw->mbx.fw_ack. Could
> mucse_check_for_ack_pf() then count it as the ACK for that new command?
>
> Before this patch, PHY_LINK_SET was only sent from probe through
> rnpgbe_setup_default_link(), and a failure there aborts probe. With this
> patch it can be sent at runtime while firmware is busy with link events.
That is why now use mucse_write_mbx_pf_coalesce_event for mucse_mbx_set_link.
>
> The kernel-doc for rnpgbe_init_link_config() already says that firmware
> can be held up completing forced 10 Mb/s link setup. A slow ACK seems
> most likely in that window.
>
> [ ... ]
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/6C54E9FB2E95869E%2B20261124060436.410989-1-dong100%40mucse.com
>