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 2/5] net: rnpgbe: Report link settings through ethtool
Date: Thu, 19 Nov 2026 15:09:44 +0000	[thread overview]
Message-ID: <179510098459.3136.6099142715168518439@kernel.org> (raw)
In-Reply-To: <66AFF2810AB647C8+20261116031020.1330219-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] 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.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/BD205A7832D36E7D%2B20261116030917.1329989-1-dong100%40mucse.com

  parent 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 [this message]
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
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=179510098459.3136.6099142715168518439@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®