ixgbevf: fix link speed reporting for Hyper-V E610 VFs
Subsystems (3)
PATCH v4 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.
---
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; + +/* E610 Hyper-V VFs: read current link speed from PCI config space +* on every link speed query. +*/ +if (hw->mac.type == ixgbe_mac_e610_vf) { +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