ixgbevf: fix link speed reporting for Hyper-V E610 VFs
Subsystems (3)
PATCH v5 1/1 ixgbevf: fix link speed reporting for Hyper-V E610 VFs
When an E610 VF is running under Hyper-V, the VFLINKS register does not carry valid link speed. The existing code reads speed from VFLINKS, which does not reflect the actual negotiated speed. This results in ethtool reporting a stale or incorrect link speed.
The Hyper-V synthetic NIC exposes the actual link status through emulated PCI config space at offset 0x209 in VFLINKS register format. Read and decode link status from there when checking link on E610 VFs.
To avoid generating unnecessary VMBus transactions on every watchdog cycle, read the PCI config register on demand when ethtool or sysfs queries link speed, rather than polling it periodically. The cached value is used by the watchdog and link state notifications as before.
Guard the PCI config space read with IS_ENABLED(CONFIG_PCI_MMCONFIG), since accessing offsets above 256 requires MMCONFIG support.
---
Note on IS_ENABLED(CONFIG_PCI_MMCONFIG): this guard is kept intentionally for consistency with ixgbevf_hv_reset_hw_vf() which uses the same pattern to access emulated PCI config space at offset 0x201. Both functions read extended config space offsets (>256) that require MMCONFIG on x86. Hyper-V E610 VFs are currently only deployed on x86 where CONFIG_PCI_MMCONFIG is always enabled. If ARM64 Hyper-V support becomes relevant, both functions should be updated together.
Note on watchdog race: the mbx_lock serializes concurrent check_link calls so ethtool and watchdog cannot execute check_link simultaneously. The ethtool response reads adapter->link_speed immediately after check_link returns (same function, same thread) and always reports the fresh value. The watchdog's pre-existing pattern of caching adapter fields into locals before the lock applies to all HV VF types and is not introduced by this patch.
v5:
- Use subsystem device ID check instead of mac type to ensure the on-demand ethtool read only triggers for Hyper-V VFs, not bare-metal
v4:
- Read link speed on demand from ethtool/sysfs query instead of polling every watchdog cycle to avoid unnecessary VMBus transactions (ethtool.c)
- Restore get_link_status caching for E610 VFs in check_link
- Add IS_ENABLED(CONFIG_PCI_MMCONFIG) guard for PCI config reads above offset 256
- Add CC [email protected]
v3:
- Remove #if IS_ENABLED(CONFIG_PCI_MMCONFIG) preprocessor guard
- Replace goto decode label with if/else control flow
- Move get_link_status check into else branch (non-E610 path only)
- Expand commit message with problem description
v2:
- Simplify error path: return 0 with link_up=false instead of propagating PCI read error code
- Fix alignment in macro definitions
- Update comment describing Hyper-V PCI config offsets
drivers/net/ethernet/intel/ixgbevf/ethtool.c | 12 ++++ drivers/net/ethernet/intel/ixgbevf/vf.c | 68 +++++++++++++++++--- 2 files changed, 72 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/ixgbevf/ethtool.c +12 -0
@@ -83,6 +83,18 @@ static int ixgbevf_get_link_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd) {struct ixgbevf_adapter *adapter =netdev_priv (netdev); +struct ixgbe_hw *hw = &adapter->hw; + +/* Hyper-V E610 VFs: read current link speed from PCI config space +* on every link speed query. +*/ +if (adapter->pdev->subsystem_device ==IXGBE_SUBDEV_ID_E610_VF_HV ) { +spin_lock_bh (&adapter->mbx_lock); + hw->mac.get_link_status = true; + hw->mac.ops.check_link (hw, &adapter->link_speed, + &adapter->link_up, false); +spin_unlock_bh (&adapter->mbx_lock); + }ethtool_link_ksettings_zero_link_mode (cmd, supported); ethtool_link_ksettings_add_link_mode(cmd, supported, 10000baseT_Full);
drivers/net/ethernet/intel/ixgbevf/vf.c +60 -8
108 lines not on this page · raw message
Signature · 1 line
2.54.0
Quoted 14 lines · Tomasz Lichwala
When an E610 VF is running under Hyper-V, the VFLINKS register does not carry valid link speed. The existing code reads speed from VFLINKS, which does not reflect the actual negotiated speed. This results in ethtool reporting a stale or incorrect link speed.
The Hyper-V synthetic NIC exposes the actual link status through emulated PCI config space at offset
0x209in VFLINKS register format. Read and decode link status from there when checking link on E610 VFs.To avoid generating unnecessary VMBus transactions on every watchdog cycle, read the PCI config register on demand when ethtool or sysfs queries link speed, rather than polling it periodically. The cached value is used by the watchdog and link state notifications as before.
Quoted 6 lines
Guard the PCI config space read with
IS_ENABLED(CONFIG_PCI_MMCONFIG), since accessing offsets above 256 requires MMCONFIG support.Fixes 4c44b450c69b ("ixgbevf: Add support for Intel(R) E610 device")Reviewed-by Marcin Szycik <[email protected]>Signed-off-by Tomasz Lichwala <[email protected]>
Quoted 1 line
---
next time please add something like "Notes for AI reviewer:" before such notes :)
Quoted 19 lines
Note on
IS_ENABLED(CONFIG_PCI_MMCONFIG): this guard is kept intentionally for consistency withixgbevf_hv_reset_hw_vf()which uses the same pattern to access emulated PCI config space at offset0x201. Both functions read extended config space offsets (>256) that require MMCONFIG on x86. Hyper-V E610 VFs are currently only deployed on x86 whereCONFIG_PCI_MMCONFIGis always enabled. If ARM64 Hyper-V support becomes relevant, both functions should be updated together.Note on watchdog race: the
mbx_lockserializes concurrentcheck_linkcalls so ethtool and watchdog cannot executecheck_linksimultaneously. The ethtool response readsadapter->link_speedimmediately aftercheck_linkreturns (same function, same thread) and always reports the fresh value. The watchdog's pre-existing pattern of caching adapter fields into locals before the lock applies to all HV VF types and is not introduced by this patch.v5:
- Use subsystem device ID check instead of mac type to ensure the on-demand ethtool read only triggers for Hyper-V VFs, not bare-metal
Romanowski, Rafal
Tested-byQuoted 46 lines
-----Original Message-----
From: Przemek Kitszel <[email protected]>
Sent: Tuesday, September 1, 2026 1:34 PM
To: Tomasz Lichwala <[email protected]>; intel-wired- [email protected]
Cc: [email protected]; Marcin Szycik <[email protected]>
Subject: Re: [PATCH iwl-net v5] ixgbevf: fix link speed reporting for Hyper-V E610 VFsQuoted 14 lines · Tomasz Lichwala
When an E610 VF is running under Hyper-V, the VFLINKS register does not carry valid link speed. The existing code reads speed from VFLINKS, which does not reflect the actual negotiated speed. This results in ethtool reporting a stale or incorrect link speed.
The Hyper-V synthetic NIC exposes the actual link status through emulated PCI config space at offset
0x209in VFLINKS register format. Read and decode link status from there when checking link on E610 VFs.To avoid generating unnecessary VMBus transactions on every watchdog cycle, read the PCI config register on demand when ethtool or sysfs queries link speed, rather than polling it periodically. The cached value is used by the watchdog and link state notifications as before.
Quoted 6 lines
Guard the PCI config space read with
IS_ENABLED(CONFIG_PCI_MMCONFIG), since accessing offsets above 256 requires MMCONFIG support.Fixes 4c44b450c69b ("ixgbevf: Add support for Intel(R) E610 device")Reviewed-by Marcin Szycik <[email protected]>Signed-off-by Tomasz Lichwala <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Quoted 1 line
---
next time please add something like "Notes for AI reviewer:" before such notes :)
Quoted 9 lines
Note on
IS_ENABLED(CONFIG_PCI_MMCONFIG): this guard is kept intentionally for consistency withixgbevf_hv_reset_hw_vf()which uses the same pattern to access emulated PCI config space at offset0x201. Both functions read extended config space offsets (>256) that require MMCONFIG on x86. Hyper-V
E610 VFs are currently only deployed on x86 whereCONFIG_PCI_MMCONFIGis always enabled. If ARM64 Hyper-V support becomes relevant, both functions should be updated together.
Quoted 13 lines
Quoted 4 lines
Note on watchdog race: the
mbx_lockserializes concurrentcheck_linkcalls so ethtool and watchdog cannot executecheck_linksimultaneously. The ethtool response readsadapter->link_speedimmediately aftercheck_linkreturns (same function, same thread) and alwaysreports the fresh value.
Quoted 8 lines
The watchdog's pre-existing pattern of caching adapter fields into locals before the lock applies to all HV VF types and is not introduced by this patch.
v5:
- Use subsystem device ID check instead of mac type to ensure the on-demand ethtool read only triggers for Hyper-V VFs, not
bare-metal