Re: [PATCH net-next v2 2/5] net: rnpgbe: Report link settings through ethtool
From: Yibo Dong
Date: Sun Nov 22 2026 - 21:49:14 EST
On Thu, Nov 19, 2026 at 03:09:44PM +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] In rnpgbe_setup_default_link()
> (drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c), the probe-time link…
>
> --
>
> net: rnpgbe: Report link settings through ethtool
>
> This adds get_link_ksettings support. It reports supported and advertised
> link modes, autoneg, port type and PHY address, using firmware data that
> is queried with GET_LANE_STATUS at probe. It also changes the probe-time
> default link setup: TP ports use autoneg, and fibre and backplane ports
> use fixed 1000/full.
>
> > diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c
> > index dcc8233e024e1..a6ab94bd1578a 100644
> > --- a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c
> > +++ b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c
> > @@ -68,8 +68,32 @@ int rnpgbe_reset_hw(struct mucse_hw *hw)
> > **/
> > int rnpgbe_setup_default_link(struct mucse_hw *hw)
> > {
> > - return mucse_mbx_set_link(hw, RNPGBE_DEFAULT_ADV, true, 0, 0,
> > - ETH_TP_MDI_AUTO);
> > + u32 advertising = hw->link_config.supported & RNPGBE_DEFAULT_ADV;
> > + bool autoneg = hw->link_config.status & MUCSE_LINK_TP;
> > + u8 duplex = DUPLEX_UNKNOWN;
> > + u32 speed = SPEED_UNKNOWN;
> > + int err;
> > +
> > + if (!autoneg) {
> > + advertising &= RNPGBE_FW_ADV_1000_FULL;
> > + speed = SPEED_1000;
> > + duplex = DUPLEX_FULL;
> > + }
> > +
> > + err = mucse_mbx_set_link(hw, advertising, autoneg,
> > + autoneg ? 0 : speed, autoneg ? 0 : duplex,
> > + ETH_TP_MDI_AUTO);
>
> [Severity: Medium]
> What happens here if advertising ends up as 0?
>
> Before this patch, probe always sent the fixed, non-empty
> RNPGBE_DEFAULT_ADV. Now hw->link_config.supported narrows the mask.
> rnpgbe_init_link_config() copies that value from the GET_LANE_STATUS
> reply without any check:
>
> hw->link_config.supported = le32_to_cpu(info.supported);
>
> Take a TP port whose supported mask has none of the RNPGBE_DEFAULT_ADV
> bits. This sends PHY_LINK_SET with autoneg enabled and an empty
> advertisement. Firmware only acks the message, so err is 0. The driver
> then caches advertising = 0 with MUCSE_LINK_AUTONEG set.
>
> Wouldn't the PHY then autonegotiate with nothing advertised, so the link
> never comes up?
>
> Later in the series, "net: rnpgbe: Support copper link configuration"
> adds rnpgbe_set_link_ksettings(), which rejects this exact configuration:
>
> if (autoneg) {
> if (!advertising)
> return -EINVAL;
>
> Ethtool can't recover from this state either. The requested
> advertisement has to be a subset of the same empty supported set, and
> forced 10/100 needs supported & mode. Both paths return -EINVAL. This
> probe path is still the same at the end of the series.
>
> On a fibre or backplane port, the code forces 1000/full without checking
> that supported contains RNPGBE_FW_ADV_1000_FULL.
> rnpgbe_get_link_ksettings() in this same patch seems to expect that bit
> can be missing:
>
> if (supported & RNPGBE_FW_ADV_1000_FULL)
> linkmode_set_bit(mode, cmd->link_modes.supported);
>
> However, its AUTONEG_DISABLE block always reports the cached SPEED_1000
> and DUPLEX_FULL. Ethtool would then show a forced speed that matches
> nothing in link_modes.supported.
>
> Elsewhere this driver checks firmware data and falls back: a random MAC
> when is_valid_ether_addr() fails, and ST_VALID_MAGIC and
> mucse_link_speed_valid() for link events.
>
> Could rnpgbe_setup_default_link() or rnpgbe_init_link_config() also
> check for an empty mask here? On an empty mask it could either fall back
> to RNPGBE_DEFAULT_ADV or fail the probe.
>
The driver relies on the capabilities reported by GET_LANE_STATUS
for the devices it supports:
- TP ports support 10/100 Mb/s half/full duplex and 1000 Mb/s full
duplex. The reported supported mask contains at least one mode
in RNPGBE_DEFAULT_ADV.
- Fibre and backplane ports support fixed 1000 Mb/s full duplex,
and their supported mask contains RNPGBE_FW_ADV_1000_FULL.
With this firmware contract, the TP default advertisement is
non-empty, and the fixed 1000/full configuration on fibre and
backplane ports is supported.
> [ ... ]
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/BD205A7832D36E7D%2B20261116030917.1329989-1-dong100%40mucse.com
>