git: cbaf3f1bc555 - main - ice: Use the absolute VF number when adding a VSI

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Sun, 01 Nov 2026 21:47:25 UTC
The branch main has been updated by kbowling:

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

commit cbaf3f1bc55524126182f63d09ed79ba8cf61cf2
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-11-01 21:09:57 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-11-01 21:47:18 +0000

    ice: Use the absolute VF number when adding a VSI
    
    The Add VSI AdminQ command requires an absolute hardware VF number, while
    vsi->vf_num is relative to its PF. Add the PF's vf_base_id, as the VF Tx
    queue context already does.
    
    On an E810 PF with vf_base_id 128, relative VFs 0 and 1 were associated
    with hardware VFs 0 and 1 instead of 128 and 129. Their receive queues
    became blocked and both native iavf and DPDK receivers dropped traffic.
    A PF whose VF base is zero hides the error.
    
    Validated the VSI-to-function mapping and receive traffic on that PF,
    including VF reset recovery and local PF/VF forwarding with VSI loopback
    enabled.
    
    Fixes:          bc761988b724 ("ice: Add host SR-IOV support")
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
---
 sys/dev/ice/ice_lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ice/ice_lib.c b/sys/dev/ice/ice_lib.c
index 8253f39f6d95..24685c896997 100644
--- a/sys/dev/ice/ice_lib.c
+++ b/sys/dev/ice/ice_lib.c
@@ -775,7 +775,8 @@ ice_initialize_vsi(struct ice_vsi *vsi)
 #ifdef PCI_IOV
 	case ICE_VSI_VF:
 		ctx.flags = ICE_AQ_VSI_TYPE_VF;
-		ctx.vf_num = vsi->vf_num;
+		/* Add VSI requires the absolute VF number. */
+		ctx.vf_num = hw->func_caps.vf_base_id + vsi->vf_num;
 		break;
 #endif
 	default: