git: f589d1fc36ce - main - ixv: Recover E610 Hyper-V carrier without the PCI link query

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 02:08:29 UTC
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=f589d1fc36cebcc298eb708bf5eae57bd1d491d7

commit f589d1fc36cebcc298eb708bf5eae57bd1d491d7
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-14 23:51:01 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-15 02:07:11 +0000

    ixv: Recover E610 Hyper-V carrier without the PCI link query
    
    Current Windows PF drivers do not emulate the E610 link-status query at
    PCI configuration offset 0x209.  The installed Intel ixw 1.8.54.0 driver
    returns zero even with the physical port connected, leaving the VF at
    no carrier after an otherwise successful hn handoff.
    
    When the query returns zero, use VFLINKS for carrier only.  Its speed
    field is not the negotiated E610 line rate: the tested 1 Gb/s port
    reports the default 10 Gb/s encoding.  Publish an unknown speed instead,
    including in the verbose link-up diagnostic, and document this fallback.
    Keep nonzero PCI results authoritative and reject all-ones reads.  Other
    Hyper-V families and the native E610 mailbox path are unchanged.
    
    A zero result cannot distinguish an unsupported query from a down link;
    in either case this fallback relies on the legacy carrier indication.
    The connected and disconnected ports reported VFLINKS.UP set and clear,
    respectively, while both returned zero from the PCI query.
    
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
---
 share/man/man4/ixv.4        |  5 ++++-
 sys/dev/ixgbe/if_ixv.c      | 10 +++++++---
 sys/dev/ixgbe/ixgbe_hv_vf.c | 17 +++++++++++++++++
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/share/man/man4/ixv.4 b/share/man/man4/ixv.4
index 907ff30103ec..f49d3eb88aeb 100644
--- a/share/man/man4/ixv.4
+++ b/share/man/man4/ixv.4
@@ -28,7 +28,7 @@
 .\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 .\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 6, 2026
+.Dd September 14, 2026
 .Dt IXV 4
 .Os
 .Sh NAME
@@ -76,6 +76,9 @@ PCI configuration space instead of the Intel PF/VF mailbox.
 The driver uses one queue pair in this environment.
 MAC address, VLAN, multicast filter, and receive mode policies remain under
 host control.
+On E610, when the host does not support the PCI link-status query,
+the driver uses the virtual-function carrier indication and reports an
+unknown link speed.
 .Pp
 The virtual function cannot configure the physical media.
 Only automatic media selection is supported, and reported link state and
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c
index a5e8a9b39de1..c3d56e2ae913 100644
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -1370,9 +1370,13 @@ ixv_if_update_admin_status(if_ctx_t ctx)
 			if (bootverbose) {
 				baudrate = ixgbe_link_speed_to_baudrate(
 				    sc->link_speed);
-				device_printf(dev,
-				    "Link is up %ju Mbps Full Duplex\n",
-				    (uintmax_t)(baudrate / IF_Mbps(1)));
+				if (baudrate != 0)
+					device_printf(dev,
+					    "Link is up %ju Mbps Full Duplex\n",
+					    (uintmax_t)(baudrate / IF_Mbps(1)));
+				else
+					device_printf(dev,
+					    "Link is up (speed unknown)\n");
 			}
 			sc->link_active = true;
 			iflib_link_state_change(ctx, LINK_STATE_UP,
diff --git a/sys/dev/ixgbe/ixgbe_hv_vf.c b/sys/dev/ixgbe/ixgbe_hv_vf.c
index 6ce994ff06f1..b65a2438adee 100644
--- a/sys/dev/ixgbe/ixgbe_hv_vf.c
+++ b/sys/dev/ixgbe/ixgbe_hv_vf.c
@@ -148,6 +148,23 @@ ixgbevf_hv_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 		goto out;
 
 	links_reg = ixgbevf_hv_read_links(hw);
+	if (hw->mac.type == ixgbe_mac_E610_vf) {
+		*speed = IXGBE_LINK_SPEED_UNKNOWN;
+		if (links_reg == UINT32_MAX)
+			goto out;
+		if (links_reg == 0) {
+			/*
+			 * Some hosts do not emulate the PCI link-status query.
+			 * VFLINKS still reports carrier, but its speed is not the
+			 * negotiated line rate.  Do not report its default 10 Gb/s.
+			 */
+			links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);
+			if (links_reg != UINT32_MAX &&
+			    (links_reg & IXGBE_LINKS_UP) != 0)
+				mac->get_link_status = false;
+			goto out;
+		}
+	}
 	if (!(links_reg & IXGBE_LINKS_UP))
 		goto out;