public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: bhargava.marreddy@broadcom.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	andrew+netdev@lunn.ch, ajit.khaparde@broadcom.com,
	pabeni@redhat.com, netdev@vger.kernel.org,
	rajashekar.hudumula@broadcom.com, linux-kernel@vger.kernel.org,
	davem@davemloft.net, horms@kernel.org,
	rahul-rg.gupta@broadcom.com, edumazet@google.com,
	michael.chan@broadcom.com, vikas.gupta@broadcom.com,
	vsrama-krishna.nemani@broadcom.com, pavan.chebbi@broadcom.com
Subject: Re: [net-next,v6,02/10] bng_en: query PHY capabilities and report link status
Date: Thu, 12 Mar 2026 19:18:00 -0700	[thread overview]
Message-ID: <20260313021800.1546107-1-kuba@kernel.org> (raw)
In-Reply-To: <20260310144044.21672-3-bhargava.marreddy@broadcom.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
bng_en: query PHY capabilities and report link status

This commit queries PHY capabilities and supported speeds from firmware,
retrieves current link state (speed, duplex, pause, FEC), logs the
information, and seeds initial link state during probe.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_link.c b/drivers/net/ethernet/broadcom/bnge/bnge_link.c
> new file mode 100644
> index 000000000000..0c76cbc794f7
> --- /dev/null
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_link.c

[ ... ]

> +void bnge_init_ethtool_link_settings(struct bnge_net *bn)
> +{
> +	struct bnge_ethtool_link_info *elink_info = &bn->eth_link_info;
> +	struct bnge_link_info *link_info;
> +	struct bnge_dev *bd = bn->bd;
> +
> +	link_info = &bd->link_info;
> +
> +	if (BNGE_AUTO_MODE(link_info->auto_mode)) {
> +		elink_info->autoneg = BNGE_AUTONEG_SPEED;
> +		if (link_info->auto_pause_setting &
> +		    PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE)
> +			elink_info->autoneg |= BNGE_AUTONEG_FLOW_CTRL;
> +		bnge_set_auto_speed(bn);
> +	} else {
> +		bnge_set_force_speed(bn);
> +		elink_info->req_duplex = link_info->duplex_setting;
> +	}

Does the forced-speed (else) branch need to clear elink_info->autoneg?

When called only at probe time on a zero-initialized struct, leaving
autoneg uninitialized is harmless. However, commit f833dbb3f7ab
('bng_en: add support for link async events') in this same series adds
a re-init call path from bnge_sp_task() in response to
BNGE_LINK_CFG_CHANGE_SP_EVENT async firmware events.

If the PHY transitions from auto-negotiation to forced-speed mode (e.g.,
via BMC/management configuration change), the stale BNGE_AUTONEG_SPEED
and BNGE_AUTONEG_FLOW_CTRL bits in elink_info->autoneg persist. This
causes:

bnge_hwrm_set_link_common() to send auto-negotiation configuration to
firmware instead of forced-speed:

    if (elink_info->autoneg & BNGE_AUTONEG_SPEED) {
        req->auto_mode |= PORT_PHY_CFG_REQ_AUTO_MODE_SPEED_MASK;
        ...

bnge_hwrm_set_pause_common() to configure auto-negotiation pause
instead of forced pause:

    if (bn->eth_link_info.autoneg & BNGE_AUTONEG_FLOW_CTRL) {
        req->auto_pause = PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE;
        ...

bnge_update_phy_setting() to make incorrect speed-change decisions:

    if (!(elink_info->autoneg & BNGE_AUTONEG_SPEED)) {
        if (BNGE_AUTO_MODE(link_info->auto_mode))
            update_link = true;

The bnxt reference driver (bnxt_init_ethtool_link_settings) has the same
pattern, but this doesn't excuse introducing it in a new driver.

No fix was found later in the series (checked through 2d7643a78ddb).

> +	if (elink_info->autoneg & BNGE_AUTONEG_FLOW_CTRL)
> +		elink_info->req_flow_ctrl =
> +			link_info->auto_pause_setting & BNGE_LINK_PAUSE_BOTH;
> +	else
> +		elink_info->req_flow_ctrl = link_info->force_pause_setting;
> +}

[ ... ]

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> index edbb42efb70b..db3a19bbf75a 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c

[ ... ]

> @@ -2532,6 +2562,14 @@ static int bnge_open_core(struct bnge_net *bn)
>
> 	bnge_enable_napi(bn);
>
> +	rc = bnge_update_phy_setting(bn);
> +	if (rc) {
> +		netdev_warn(bn->netdev, "failed to update PHY settings (rc: %d)\n",
> +			    rc);
> +		bd->link_info.phy_retry = true;
> +		bd->link_info.phy_retry_expires = jiffies + 5 * HZ;
> +	}
> +

Does stale phy_retry state from a previous open/close cycle cause spurious
warnings?

When bnge_update_phy_setting() fails during bnge_open_core(),
bd->link_info.phy_retry is set to true and phy_retry_expires is set to
jiffies + 5*HZ. Neither bnge_close_core() nor bnge_close() clears
phy_retry.

If the interface is closed and then reopened with a successful
bnge_update_phy_setting() call (rc=0), the stale phy_retry remains true
with an expired phy_retry_expires. On the next timer tick, bnge_timer()
sees:

    if (bd->link_info.phy_retry) {
        if (time_after(jiffies, bd->link_info.phy_retry_expires)) {
            bd->link_info.phy_retry = false;
            netdev_warn(bn->netdev, "failed to update PHY settings after maximum retries.\n");

and logs a spurious warning even though the PHY update succeeded on reopen.

No later fix was found in the series (searched git range
f342d5af0695..2d7643a78ddb).

> 	set_bit(BNGE_STATE_OPEN, &bd->state);
>
> 	bnge_enable_int(bn);

[ ... ]
-- 
pw-bot: cr

  parent reply	other threads:[~2026-03-13  2:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 14:40 [PATCH net-next v6 00/10] bng_en: add link management and statistics support Bhargava Marreddy
2026-03-10 14:40 ` [PATCH net-next v6 01/10] bng_en: add per-PF workqueue, timer, and slow-path task Bhargava Marreddy
2026-03-10 14:40 ` [PATCH net-next v6 02/10] bng_en: query PHY capabilities and report link status Bhargava Marreddy
2026-03-11 15:44   ` ALOK TIWARI
2026-03-13  2:18   ` Jakub Kicinski [this message]
2026-03-10 14:40 ` [PATCH net-next v6 03/10] bng_en: add ethtool link settings, get_link, and nway_reset Bhargava Marreddy
2026-03-10 14:40 ` [PATCH net-next v6 04/10] bng_en: implement ethtool pauseparam operations Bhargava Marreddy
2026-03-10 14:40 ` [PATCH net-next v6 05/10] bng_en: add support for link async events Bhargava Marreddy
2026-03-10 14:40 ` [PATCH net-next v6 06/10] bng_en: add HW stats infra and structured ethtool ops Bhargava Marreddy
2026-03-18  7:47   ` Dan Carpenter
2026-03-10 14:40 ` [PATCH net-next v6 07/10] bng_en: periodically fetch and accumulate hardware statistics Bhargava Marreddy
2026-03-10 14:40 ` [PATCH net-next v6 08/10] bng_en: implement ndo_get_stats64 Bhargava Marreddy
2026-03-10 14:40 ` [PATCH net-next v6 09/10] bng_en: implement netdev_stat_ops Bhargava Marreddy
2026-03-10 14:40 ` [PATCH net-next v6 10/10] bng_en: add support for ethtool -S stats display Bhargava Marreddy
2026-03-12  7:01   ` ALOK TIWARI
2026-03-13  2:22   ` Jakub Kicinski

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=20260313021800.1546107-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bhargava.marreddy@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=rahul-rg.gupta@broadcom.com \
    --cc=rajashekar.hudumula@broadcom.com \
    --cc=vikas.gupta@broadcom.com \
    --cc=vsrama-krishna.nemani@broadcom.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