git: a54f83544eea - main - ixv: Use host granted RSS queues on Hyper-V
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 15 Sep 2026 06:10:40 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=a54f83544eea2a9804ac7940d35b26ffcb34dfb3
commit a54f83544eea2a9804ac7940d35b26ffcb34dfb3
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-15 05:57:18 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-15 06:09:57 +0000
ixv: Use host granted RSS queues on Hyper-V
Discover the Hyper-V queue grant through PCI configuration space for
X550, X552, X553, and E610 VFs. The X550 family exposes a byte at 0x207;
0x208 is a separate DCB flag. E610 exposes a little-endian queue count
word at those offsets. Accept grants of one, two, or four and use at most
two symmetric queue sets, subject to the existing MSI-X resource limit.
Keep one queue for invalid grants and for 82599/X540 Hyper-V VFs.
The family gates and queue limits are snooped from Windows Intel VF bus
traffic.
Update the shared code queue max so stop disables every usable queue.
Also program the receive length limit on every usable RX queue instead
of only queue zero and retain the 82599 exception for that register field.
MFC after: 2 weeks
Sponsored by: BBOX.io
---
share/man/man4/ixv.4 | 15 ++++++++++++-
sys/dev/ixgbe/if_ixv.c | 2 +-
sys/dev/ixgbe/ixgbe_hv_vf.c | 54 ++++++++++++++++++++++++++++++++++++++++-----
sys/dev/ixgbe/ixgbe_hv_vf.h | 1 +
4 files changed, 64 insertions(+), 8 deletions(-)
diff --git a/share/man/man4/ixv.4 b/share/man/man4/ixv.4
index f49d3eb88aeb..55c64f501ca1 100644
--- a/share/man/man4/ixv.4
+++ b/share/man/man4/ixv.4
@@ -73,7 +73,20 @@ rejected by physical-function policy.
.Pp
On Hyper-V, the host provides reset and assigned-address information through
PCI configuration space instead of the Intel PF/VF mailbox.
-The driver uses one queue pair in this environment.
+The driver uses up to two queue pairs on X550, X552, X553, and E610
+when the host advertises multiple queues through PCI configuration space
+and sufficient MSI-X vectors are available.
+Otherwise, it uses one queue pair.
+To request two queue pairs, run the following from an elevated PowerShell
+prompt on the Hyper-V host, substituting the VM and network adapter names:
+.Bd -literal -offset indent
+Set-VMNetworkAdapter -VMName "vm-name" -Name "adapter-name" `
+ -IovQueuePairsRequested 2
+.Ed
+.Pp
+Changing this setting can detach and reattach the VF, so configure it before
+starting the guest when possible.
+.Pp
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,
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c
index c3d56e2ae913..62e92be75197 100644
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -1112,7 +1112,7 @@ ixv_queue_limit(struct ixgbe_softc *sc, bool mailbox_ready)
hw = &sc->hw;
if (ixv_is_hyperv(hw)) {
- limit = 1;
+ limit = ixgbevf_hv_get_queues(hw);
} else {
/* Preserve the current family limit as the mailbox fallback. */
switch (hw->mac.type) {
diff --git a/sys/dev/ixgbe/ixgbe_hv_vf.c b/sys/dev/ixgbe/ixgbe_hv_vf.c
index b65a2438adee..384db6a7e1c8 100644
--- a/sys/dev/ixgbe/ixgbe_hv_vf.c
+++ b/sys/dev/ixgbe/ixgbe_hv_vf.c
@@ -9,10 +9,50 @@
/* Reading these PCI configuration bytes resets a VF on Hyper-V. */
#define IXGBE_HV_RESET_OFFSET 0x201
+/* Hyper-V emulates the VF queue limit in PCI configuration space. */
+#define IXGBE_HV_QUEUE_COUNT_OFFSET 0x207
+
/* E610 exposes VFLINKS in four emulated PCI configuration bytes. */
#define IXGBE_HV_LINK_STATUS_OFFSET 0x209
#define IXGBE_HV_LINK_STATUS_SIZE 4
+/**
+ * ixgbevf_hv_get_queues - Discover supported Hyper-V RSS queues at attach
+ * @hw: pointer to hardware structure
+ */
+u32
+ixgbevf_hv_get_queues(struct ixgbe_hw *hw)
+{
+ u32 grant, queues = 1;
+
+ switch (hw->mac.type) {
+ case ixgbe_mac_X550_vf:
+ case ixgbe_mac_X550EM_x_vf:
+ case ixgbe_mac_X550EM_a_vf:
+ /* 0x208 is a separate DCB flag on these PFs, not count bits. */
+ grant = IXGBE_READ_PCIE_BYTE(hw, IXGBE_HV_QUEUE_COUNT_OFFSET);
+ break;
+ case ixgbe_mac_E610_vf:
+ /* E610 reports the assigned count as a little-endian word. */
+ grant = IXGBE_READ_PCIE_BYTE(hw, IXGBE_HV_QUEUE_COUNT_OFFSET);
+ grant |= (u32)IXGBE_READ_PCIE_BYTE(hw,
+ IXGBE_HV_QUEUE_COUNT_OFFSET + 1) << NBBY;
+ break;
+ default:
+ /* Older PFs do not provide VF-owned RSS on Hyper-V. */
+ grant = 1;
+ break;
+ }
+ /* Valid limits are 1, 2 and 4; use at most two symmetric RSS queues. */
+ if (grant == 2 || grant == 4)
+ queues = 2;
+
+ /* Shared stop must disable every queue that iflib can initialize. */
+ hw->mac.max_tx_queues = queues;
+ hw->mac.max_rx_queues = queues;
+ return (queues);
+}
+
/**
* ixgbevf_hv_update_mc_addr_list_vf - Hyper-V variant - just a stub.
* @hw: unused
@@ -234,17 +274,19 @@ ixgbevf_hv_get_link_state_vf(struct ixgbe_hw *hw, bool *link_state)
static s32
ixgbevf_hv_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)
{
- u32 reg;
+ u32 i, reg;
/* RLPML is not implemented by the 82599 VF. */
if (hw->mac.type == ixgbe_mac_82599_vf)
return (IXGBE_SUCCESS);
- reg = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(0));
- reg &= ~IXGBE_RXDCTL_RLPMLMASK;
- reg |= ((max_size + 4) & IXGBE_RXDCTL_RLPMLMASK) |
- IXGBE_RXDCTL_RLPML_EN;
- IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(0), reg);
+ for (i = 0; i < hw->mac.max_rx_queues; i++) {
+ reg = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i));
+ reg &= ~IXGBE_RXDCTL_RLPMLMASK;
+ reg |= ((max_size + 4) & IXGBE_RXDCTL_RLPMLMASK) |
+ IXGBE_RXDCTL_RLPML_EN;
+ IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), reg);
+ }
return (IXGBE_SUCCESS);
}
diff --git a/sys/dev/ixgbe/ixgbe_hv_vf.h b/sys/dev/ixgbe/ixgbe_hv_vf.h
index dd2e1eee4e9c..0d5ef863c657 100644
--- a/sys/dev/ixgbe/ixgbe_hv_vf.h
+++ b/sys/dev/ixgbe/ixgbe_hv_vf.h
@@ -8,5 +8,6 @@
#include "ixgbe_type.h"
s32 ixgbevf_hv_init_ops_vf(struct ixgbe_hw *hw);
+u32 ixgbevf_hv_get_queues(struct ixgbe_hw *hw);
#endif /* _IXGBE_HV_VF_H_ */