On 8/26/26 16:39, Tomasz Lichwala wrote:
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.

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]>

---

next time please add something like "Notes for AI reviewer:" before such
notes :)

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

Reply via email to