Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: anthony.l.nguyen@intel.com
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@kernel.org, andrew+netdev@lunn.ch, willemb@google.com,
	netdev@vger.kernel.org, adiyenga@cisco.com,
	jedrzej.jagielski@intel.com, jacob.e.keller@intel.com,
	aleksandr.loktionov@intel.com, rafal.romanowski@intel.com
Subject: Re: [PATCH net-next 1/5] ixgbe: E610: force phy link to get down when interface is down
Date: Sat, 05 Dec 2026 22:47:37 +0000	[thread overview]
Message-ID: <179651085718.3148.12600844740230253219@kernel.org> (raw)
In-Reply-To: <20261204223807.3920143-2-anthony.l.nguyen@intel.com>

Thank you for your contribution! Sashiko AI review found 9 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 5 · Low: 4

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] The driver calls ixgbe_close() for internal reconfiguration,
  not just as ndo_stop.
- [Medium] Other driver paths can turn the PHY link back on while the
  netdev is administratively down, which silently undoes link-down-on-…
- [Medium] On a WoL-capable E610, link-down-on-close silently breaks
  Wake-on-LAN once the interface has been closed.
- [Medium] ixgbe_close() now writes PHY state (ixgbe_disable_phy_link)
  with nothing ordering it against a service task already in flight.
- [Medium] ixgbe: ixgbe_set_priv_flags() zeroes VF abort counts before
  -EOPNOTSUPP
- [Low] In ixgbe_set_priv_flags(), toggling link-down-on-close on a
  running interface triggers a full ixgbe_reinit_locked(), i.e.…
- [Low] In ixgbe_close(), the netif_device_present() check covers only
  ixgbe_close_suspend().
- [Low] When ixgbe_disable_phy_link() fails, ixgbe_close() only logs
  e_err("Cannot set PHY link down") and then calls…
- [Low] The patch adds a user-visible ethtool private flag, "link-down-
  on-close" (ixgbe_priv_flags_strings, ixgbe_ethtool.c:143).

--

ixgbe: E610: force phy link to get down when interface is down

This adds an E610-only ethtool private flag, link-down-on-close. When it is
set, ixgbe_close() clears IXGBE_ACI_PHY_ENA_LINK through a new
ixgbe_disable_phy_link() helper, and ixgbe_setup_phy_link_e610() turns the
link back on when it finds the bit cleared. Part of
ixgbe_watchdog_link_is_down() is split out into ixgbe_handle_link_down() so
that ixgbe_close() can reuse it.

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
> index da8519065d818..1be7014543176 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
> @@ -1823,6 +1823,33 @@ void ixgbe_fc_autoneg_e610(struct ixgbe_hw *hw)
>  	hw->fc.current_mode = hw->fc.requested_mode;
>  }
>  
> +/**
> + * ixgbe_disable_phy_link - force phy link to get down
> + * @hw: pointer to hardware structure
> + *
> + * Send 0x0601 with the IXGBE_ACI_PHY_ENA_LINK bit set down.
> + *
> + * Return: the exit code of the operation.
> + */
> +int ixgbe_disable_phy_link(struct ixgbe_hw *hw)
> +{
> +	struct ixgbe_aci_cmd_get_phy_caps_data pcaps = {};
> +	struct ixgbe_aci_cmd_set_phy_cfg_data pcfg = {};
> +	int err;
> +
> +	err = ixgbe_aci_get_phy_caps(hw, false, IXGBE_ACI_REPORT_ACTIVE_CFG,
> +				     &pcaps);
> +	if (err)
> +		return err;
> +
> +	ixgbe_copy_phy_caps_to_cfg(&pcaps, &pcfg);
> +
> +	pcfg.caps &= ~IXGBE_ACI_PHY_ENA_LINK;
> +	pcfg.caps |= IXGBE_ACI_PHY_ENA_AUTO_LINK_UPDT;
> +
> +	return ixgbe_aci_set_phy_cfg(hw, &pcfg);
> +}

[Severity: Medium]
Can this read-modify-write race with the service task and leave the PHY
link enabled after close?

ixgbe_down() sets __IXGBE_DOWN and calls
timer_delete_sync(&adapter->service_timer). Nothing cancels or flushes
adapter->service_task, though. A service task queued before __IXGBE_DOWN
can still be running when ixgbe_close() gets here.

On E610 the service task calls ixgbe_check_media_subtask(), which has no
__IXGBE_DOWN check. When IXGBE_FLAG2_NO_MEDIA is set and media appears,
the call chain is:

ixgbe_check_media_subtask()
  ixgbe_non_sfp_link_config()
    hw->mac.ops.setup_link()
      ...
        ixgbe_setup_phy_link_e610()

ixgbe_setup_phy_link_e610() and ixgbe_disable_phy_link() both issue
get_phy_caps(ACTIVE_CFG) and then set_phy_cfg as two separate ACI
commands. hw->aci.lock covers each command on its own, not the pair.

Suppose the service task reads ENA_LINK=1, and close then reads and
writes ENA_LINK=0. The service task's later set_phy_cfg writes
ENA_LINK=1 back.

Suppose instead close writes first. ixgbe_setup_phy_link_e610() then
sees ENA_LINK clear, takes the new force_on_required branch and sets
ENA_LINK=1.

In either order, could the port be left with the physical link up after
ixgbe_close() returns?

> +
>  /**
>   * ixgbe_disable_rx_e610 - Disable RX unit
>   * @hw: pointer to hardware structure

[ ... ]

> @@ -2172,6 +2200,11 @@ int ixgbe_setup_phy_link_e610(struct ixgbe_hw *hw)
>  		phy_type_high |= IXGBE_PHY_TYPE_HIGH_10G_USXGMII;
>  	}
>  
> +	/* If IXGBE_ACI_PHY_ENA_LINK has been explicitly disabled that means
> +	 * we need to force PHY link UP state during PHY link setup
> +	 */
> +	force_on_required = !(pcfg.caps & IXGBE_ACI_PHY_ENA_LINK);

[Severity: Medium]
Will this undo link-down-on-close when setup_link runs while the
interface is administratively down?

For copper and multispeed fiber PHYs, ixgbe_set_link_ksettings() calls
setup_link without checking netif_running():

	err = hw->mac.ops.setup_link(hw, advertised, true);

On E610 this goes through ixgbe_setup_link_e610() and setup_link_speed
to ixgbe_setup_phy_link_e610(). Once ixgbe_close() has cleared
IXGBE_ACI_PHY_ENA_LINK, force_on_required is true here. ENA_LINK is set
again and set_phy_cfg is sent.

ethtool --set-eee does the same thing through ixgbe_set_eee_e610() and
ixgbe_setup_eee_e610(), which sets the bit unconditionally:

	phy_cfg.caps |= (IXGBE_ACI_PHY_ENA_LINK |
			IXGBE_ACI_PHY_ENA_AUTO_LINK_UPDT);

After either command, the PHY link can come up while the netdev is down,
and get_priv_flags still reports link-down-on-close as on.

On copper with WoL disabled the PHY may already be in low power at this
point. Fiber and backplane E610 (no set_phy_power) and WoL-enabled copper
don't have that mitigation.

Should these paths honor IXGBE_FLAG2_LINK_DOWN_ON_CLOSE when the
interface is not running?

> +
>  	/* Mask the set values to avoid requesting unsupported link types. */
>  	phy_type_low &= sup_phy_type_low;
>  	pcfg.phy_type_low = cpu_to_le64(phy_type_low);

[ ... ]

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> index c98c440ccb206..ff34aacf12d5c 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> @@ -139,6 +139,8 @@ static const char ixgbe_priv_flags_strings[][ETH_GSTRING_LEN] = {
>  	"vf-ipsec",
>  #define IXGBE_PRIV_FLAGS_AUTO_DISABLE_VF	BIT(2)
>  	"mdd-disable-vf",
> +#define IXGBE_PRIV_LINK_DOWN_ON_CLOSE	BIT(3)
> +	"link-down-on-close",

[Severity: Low]
This isn't a bug, but should
Documentation/networking/device_drivers/ethernet/intel/ixgbe.rst
describe the new link-down-on-close flag?

ethtool --show-priv-flags lists it on every ixgbe MAC.
ixgbe_set_priv_flags() returns -EOPNOTSUPP on anything other than
ixgbe_mac_e610, so users have no way to see that it is E610-only.

i40e documents its flag of the same name in i40e.rst. ixgbe.rst does not
document legacy-rx or mdd-disable-vf either.

>  };
>  
>  #define IXGBE_PRIV_FLAGS_STR_LEN ARRAY_SIZE(ixgbe_priv_flags_strings)

[ ... ]

> @@ -3847,6 +3852,16 @@ static int ixgbe_set_priv_flags(struct net_device *netdev, u32 priv_flags)
>  		}
>  	}
>  
> +	flags2 &= ~IXGBE_FLAG2_LINK_DOWN_ON_CLOSE;
> +	if (priv_flags & IXGBE_PRIV_LINK_DOWN_ON_CLOSE) {
> +		if (adapter->hw.mac.type == ixgbe_mac_e610) {
> +			flags2 |= IXGBE_FLAG2_LINK_DOWN_ON_CLOSE;
> +		} else {
> +			e_info(probe, "Cannot set private flags: Feature supported only for E610 devices\n");
> +			return -EOPNOTSUPP;
> +		}
> +	}
> +
>  	if (flags2 != adapter->flags2) {
>  		adapter->flags2 = flags2;
>  

[Severity: Medium]
On an 82599EB PF, can a request that this check rejects still change
VF state?

ixgbe_probe() sets IXGBE_FLAG2_AUTO_DISABLE_VF by default on
ixgbe_mac_82599EB, so ixgbe_get_priv_flags() reports mdd-disable-vf as
on. ethtool --set-priv-flags is a read-modify-write. A request to turn
on link-down-on-close therefore arrives here with both
IXGBE_PRIV_FLAGS_AUTO_DISABLE_VF and IXGBE_PRIV_LINK_DOWN_ON_CLOSE
set.

The mdd-disable-vf branch above runs first. It clears
adapter->vfinfo[i].primary_abort_count for every VF. Only after that
does this new block see that the MAC is not ixgbe_mac_e610 and return
-EOPNOTSUPP.

adapter->flags2 is left untouched. The per-VF MDD abort counters,
though, have been reset by an operation that reported failure to the
user.

Could the E610 check be done before any side effects happen? For
example, validate all requested flags up front, or move this block
above the mdd-disable-vf one.

[Severity: Low]
Is a full reset needed when only link-down-on-close changes?

The new bit goes through the existing block:

		/* reset interface to repopulate queues */
		if (netif_running(netdev))
			ixgbe_reinit_locked(adapter);

Toggling the flag on a running interface therefore causes an
ixgbe_down()/ixgbe_up() cycle and interrupts traffic. The flag only
changes what ixgbe_close() does later.

ice does not reset when this flag changes. The existing vf-ipsec and
mdd-disable-vf flags do behave the same way here.

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 6458cb2e511e7..9266a920d279a 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

[ ... ]

> @@ -7526,6 +7540,16 @@ int ixgbe_close(struct net_device *netdev)
>  
>  	ixgbe_fdir_filter_exit(adapter);
>  
> +	if (adapter->flags2 & IXGBE_FLAG2_LINK_DOWN_ON_CLOSE) {

[Severity: Medium]
ixgbe_close() is reached from more than ndo_stop. With this block here,
won't every internal close/open cycle on a running E610 with the flag
set drop the physical link?

For example, ixgbe_setup_tc() does:

	if (netif_running(dev))
		ixgbe_close(dev);
	else
		ixgbe_reset(adapter);

ixgbe_setup_tc() is reached from:

  - ixgbe_set_channels() (ethtool -L)
  - mqprio
  - the DCB netlink handlers
  - macvlan offload
  - XDP program attach
  - the SR-IOV configuration paths

Two more paths do the same: ixgbe_dcb_nl.c and the FCoE enable/disable
code call ndo_stop() and then ndo_open(). The offline self-test in
ixgbe_diag_test() also calls ixgbe_close().

Each time, ixgbe_disable_phy_link() clears IXGBE_ACI_PHY_ENA_LINK. The
reopen then goes:

ixgbe_open()
  ixgbe_up_complete()
    ixgbe_non_sfp_link_config()
      ixgbe_setup_phy_link_e610()

There force_on_required turns the link back on. That forces a full
autonegotiation, which the link partner sees.

ice only forces the link down in ice_stop(). Should this be limited to
the administrative down path?

[Severity: Low]
This block sits outside the netif_device_present() check that guards
the rest of the hardware teardown:

	if (netif_device_present(netdev))
		ixgbe_close_suspend(adapter);

ixgbe_io_error_detected() calls netif_device_detach(),
ixgbe_close_suspend() and pci_disable_device(), but leaves IFF_UP set.
A later ip link set down, or ixgbe_remove() -> unregister_netdev(), still
reaches ixgbe_close().

In that case, would this send get_phy_caps and set_phy_cfg ACI commands
to a device in PCI error recovery and log "Cannot set PHY link down"?

It would also still call ixgbe_handle_link_down(), which writes the VF
mailbox registers through ixgbe_ping_all_vfs().

> +		int err;
> +
> +		err = ixgbe_disable_phy_link(&adapter->hw);

[Severity: Medium]
Does this break Wake-on-LAN on E610 once the interface has been closed?

On the close path ixgbe_reset() runs with netif_running() false. With
adapter->wol set, it keeps the PHY powered:

	if (hw->phy.ops.set_phy_power) {
		if (!netif_running(adapter->netdev) && !adapter->wol)
			hw->phy.ops.set_phy_power(hw, false);
		else
			hw->phy.ops.set_phy_power(hw, true);

ixgbe_close_suspend() then calls ixgbe_enter_lplu_e610(), which needs
link to enter LPLU. Right after that, ixgbe_disable_phy_link() clears
IXGBE_ACI_PHY_ENA_LINK and the firmware drops the link.

On a later suspend or shutdown, __ixgbe_shutdown() sees !netif_running()
and skips ixgbe_close_suspend(). With wufc set it programs WUFC and calls
pci_wake_from_d3(). Nothing restores ENA_LINK on E610, where
enable_tx_laser and stop_link_on_d3 are NULL.

Would the device then be armed to wake on magic or pattern packets that
it cannot receive? Should adapter->wol be checked here, or the link be
re-enabled when wake is armed?

> +		if (err)
> +			e_err(drv, "Cannot set PHY link down\n");
> +
> +		ixgbe_handle_link_down(adapter);

[Severity: Low]
If ixgbe_disable_phy_link() fails, this still logs "NIC Link is Down"
and pings every VF about a link change. That comes right after the log
says the PHY link could not be brought down. Should the error path skip
ixgbe_handle_link_down()?

The netif_carrier_off() in the helper also does nothing here, because
ixgbe_down() has already turned the carrier off.

Separately, only the tail of ixgbe_watchdog_link_is_down() moved into
the helper. This state reset stays in the watchdog:

	adapter->link_up = false;
	adapter->link_speed = 0;

After this close path, adapter->link_up and adapter->link_speed still
say the link is up. ixgbe_send_vf_link_status() returns these values to
E610 VFs:

	msgbuf[1] = adapter->link_speed;
	msgbuf[2] = adapter->link_up;

VF mailbox handling runs from the ixgbe_msix_other() interrupt, which is
freed on close. So the stale values only matter in the window after
reopen, before the first watchdog run.

Should the helper reset link_up and link_speed as well?

> +	}
> +
>  	ixgbe_release_hw_control(adapter);
>  
>  	return 0;

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204223807.3920143-1-anthony.l.nguyen%40intel.com

  reply	other threads:[~2026-12-05 22:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 22:38 [PATCH net-next 0/5][pull request] Intel Wired LAN Driver Updates 2026-12-04 (ixgbe, ixgbevf) Tony Nguyen
2026-12-04 22:38 ` [PATCH net-next 1/5] ixgbe: E610: force phy link to get down when interface is down Tony Nguyen
2026-12-05 22:47   ` netdev-bot+sashiko [this message]
2026-12-04 22:38 ` [PATCH net-next 2/5] ixgbe: use ktime_get_real_ns() in ixgbe_ptp_reset() Tony Nguyen
2026-12-04 22:38 ` [PATCH net-next 3/5] ixgbe: use int instead of u32 for error code variables Tony Nguyen
2026-12-05 22:47   ` netdev-bot+sashiko
2026-12-04 22:38 ` [PATCH net-next 4/5] ixgbe: LinkSec deprecated macros cleanup Tony Nguyen
2026-12-04 22:38 ` [PATCH net-next 5/5] ixgbevf: Warn when mailbox API negotiation fails Tony Nguyen
2026-12-05 22:47   ` 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=179651085718.3148.12600844740230253219@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=adiyenga@cisco.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jedrzej.jagielski@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rafal.romanowski@intel.com \
    --cc=willemb@google.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