mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Dong Yibo <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: Mon, 16 Nov 2026 05:19:35 +0100	[thread overview]
Message-ID: <d7351f56-d4fa-4ba0-a0c6-c7bdf7aac460@lunn.ch> (raw)
In-Reply-To: <66AFF2810AB647C8+20261116031020.1330219-1-dong100@mucse.com>

> +static int rnpgbe_get_link_ksettings(struct net_device *netdev,
> +				     struct ethtool_link_ksettings *cmd)
> +{
> +	struct mucse *mucse = netdev_priv(netdev);
> +	struct mucse_hw *hw = &mucse->hw;
> +	u32 supported, advertising;
> +	unsigned long flags;
> +	u16 status;
> +	int mode;
> +
> +	status = hw->link_config.status;
> +	supported = hw->link_config.supported;
> +	advertising = hw->link_config.advertising;

These are accessed without a lock,

> +	ethtool_link_ksettings_zero_link_mode(cmd, supported);
> +	ethtool_link_ksettings_zero_link_mode(cmd, advertising);
> +	ethtool_link_ksettings_zero_link_mode(cmd, lp_advertising);
> +	cmd->base.autoneg = AUTONEG_DISABLE;
> +	cmd->base.speed = SPEED_UNKNOWN;
> +	cmd->base.duplex = DUPLEX_UNKNOWN;
> +	cmd->base.eth_tp_mdix = ETH_TP_MDI_INVALID;
> +	spin_lock_irqsave(&mucse->link_lock, flags);
> +	if (netif_carrier_ok(netdev) && hw->link) {
> +		cmd->base.speed = hw->speed;
> +		cmd->base.duplex = hw->duplex ?
> +				   DUPLEX_FULL : DUPLEX_HALF;
> +		if (status & MUCSE_LINK_TP)
> +			cmd->base.eth_tp_mdix = hw->mdix;

Yet these need a lock?

> +	}
> +	spin_unlock_irqrestore(&mucse->link_lock, flags);
> +
> +	if (status & MUCSE_LINK_TP) {
> +		rnpgbe_link_modes(cmd->link_modes.supported, supported);
> +		rnpgbe_link_modes(cmd->link_modes.advertising, advertising);
> +		ethtool_link_ksettings_add_link_mode(cmd, supported, TP);
> +		ethtool_link_ksettings_add_link_mode(cmd, advertising, TP);

Advertising TP? Can you point to some part of 802.3 to support
advertising TP to the link partner.

	Andrew

  reply	other threads:[~2026-11-16  4:19 UTC|newest]

Thread overview: 8+ 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 [this message]
2026-11-16  4:47     ` Yibo Dong
2026-11-16  3:10 ` [PATCH net-next v2 3/5] net: rnpgbe: Support copper link configuration Dong Yibo
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

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=d7351f56-d4fa-4ba0-a0c6-c7bdf7aac460@lunn.ch \
    --to=andrew@lunn.ch \
    --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®