git: f74b20db1354 - stable/14 - ixgbe: Drain events for inactive VFs
Kevin Bowling <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src |
|---|---|
| Message-ID | <6a88f18a.240ec.1664c967__47146.0042566591$1787359664$gmane$org@gitrepo.freebsd.org> |
The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=f74b20db135499e1e419274cb0af155df5c075b3 commit f74b20db135499e1e419274cb0af155df5c075b3 Author: Kevin Bowling <[email protected]> AuthorDate: 2026-08-06 06:42:55 +0000 Commit: Kevin Bowling <[email protected]> CommitDate: 2026-08-22 00:43:20 +0000 ixgbe: Drain events for inactive VFs The aggregate VF mailbox poll includes only VFs whose driver configuration completed. A configured VF slot whose vf_add callback failed can nevertheless report reset, request, or acknowledgement events. Because the mailbox handler skips inactive entries, such an event remains latched and can retrigger administrative work indefinitely. Build the poll masks from every configured VF index and consume reset, message, and acknowledgement events for inactive entries without treating them as usable VFs. Use the index rather than the pool because early vf_add errors precede pool initialization. Also include E610 PFVFLREC in aggregate reset sampling. (cherry picked from commit 5017a241b987d365beb2c35faf0017b6afef2b64) --- sys/dev/ixgbe/if_sriov.c | 119 ++++++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index 8611f2685611..ff873d4652f8 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -1560,51 +1560,54 @@ ixgbe_handle_mbx(void *context) for (i = 0; i < sc->num_vfs; i++) { vf = &sc->vfs[i]; mbx_activity = false; + reset_seen = hw->mbx.ops[i].check_for_rst(hw, i) == 0; - if (vf->flags & IXGBE_VF_ACTIVE) { - reset_seen = hw->mbx.ops[vf->pool].check_for_rst(hw, - vf->pool) == 0; - if (reset_seen) { - /* A reset does not prove recovery succeeded. */ - recovering = (vf->flags & - IXGBE_VF_DMA_ABORT_PENDING) != 0; - vf->flags |= IXGBE_VF_MBX_CLEANUP; - vf->mbx_cleanup_deadline = getsbinuptime() + - IXGBE_VF_MBX_CLEANUP_GRACE; - ixgbe_process_vf_reset(sc, vf); - if (!recovering) { - vf->flags &= ~(IXGBE_VF_DMA_ABORT_PENDING | - IXGBE_VF_PCI_STATE_SAVED); - vf->pci_saved_command = 0; - } - } - reset_pending = - (vf->flags & IXGBE_VF_MBX_CLEANUP) != 0; - - if (hw->mbx.ops[vf->pool].check_for_msg(hw, - vf->pool) == 0) { - mbx_activity = true; - if (ixgbe_process_vf_msg(ctx, vf, reset_pending)) - vf->flags &= ~IXGBE_VF_MBX_CLEANUP; - } - if (reset_pending && - (vf->flags & IXGBE_VF_MBX_CLEANUP) != 0) - ixgbe_cleanup_vf_mbx(sc, vf); - - if (hw->mbx.ops[vf->pool].check_for_ack(hw, - vf->pool) == 0) { - mbx_activity = true; - ixgbe_process_vf_ack(sc, vf); + if (!(vf->flags & IXGBE_VF_ACTIVE)) { + if (hw->mbx.ops[i].check_for_msg(hw, i) == 0 || + reset_seen) + ixgbe_clear_mbx(hw, i); + (void)hw->mbx.ops[i].check_for_ack(hw, i); + continue; + } + + if (reset_seen) { + /* A reset does not prove recovery succeeded. */ + recovering = (vf->flags & + IXGBE_VF_DMA_ABORT_PENDING) != 0; + vf->flags |= IXGBE_VF_MBX_CLEANUP; + vf->mbx_cleanup_deadline = getsbinuptime() + + IXGBE_VF_MBX_CLEANUP_GRACE; + ixgbe_process_vf_reset(sc, vf); + if (!recovering) { + vf->flags &= ~(IXGBE_VF_DMA_ABORT_PENDING | + IXGBE_VF_PCI_STATE_SAVED); + vf->pci_saved_command = 0; } + } + reset_pending = (vf->flags & IXGBE_VF_MBX_CLEANUP) != 0; - /* Do not overwrite a response from this mailbox pass. */ - if (!mbx_activity && - (vf->flags & IXGBE_VF_MDD_NOTIFY_PENDING) != 0) - ixgbe_notify_vf_mdd_reset(sc, vf); + if (hw->mbx.ops[vf->pool].check_for_msg(hw, + vf->pool) == 0) { + mbx_activity = true; + if (ixgbe_process_vf_msg(ctx, vf, reset_pending)) + vf->flags &= ~IXGBE_VF_MBX_CLEANUP; + } + if (reset_pending && + (vf->flags & IXGBE_VF_MBX_CLEANUP) != 0) + ixgbe_cleanup_vf_mbx(sc, vf); - if (vf->flags & IXGBE_VF_MBX_CLEANUP) - cleanup_pending = true; + if (hw->mbx.ops[vf->pool].check_for_ack(hw, vf->pool) == 0) { + mbx_activity = true; + ixgbe_process_vf_ack(sc, vf); } + + /* Do not overwrite a response produced by this mailbox pass. */ + if (!mbx_activity && + (vf->flags & IXGBE_VF_MDD_NOTIFY_PENDING) != 0) + ixgbe_notify_vf_mdd_reset(sc, vf); + + if (vf->flags & IXGBE_VF_MBX_CLEANUP) + cleanup_pending = true; } sc->iov_mbx_cleanup_pending = cleanup_pending; } /* ixgbe_handle_mbx */ @@ -1620,41 +1623,38 @@ bool ixgbe_mbx_pending(struct ixgbe_softc *sc) { struct ixgbe_hw *hw; - uint32_t active_mbx[4], active_rst[2], events, vf_mdd[2]; + uint32_t events, vf_mbx[4], vf_mdd[2], vf_rst[2]; int i, index; if (sc->num_vfs == 0) return (false); - bzero(active_mbx, sizeof(active_mbx)); - bzero(active_rst, sizeof(active_rst)); + bzero(vf_mbx, sizeof(vf_mbx)); bzero(vf_mdd, sizeof(vf_mdd)); + bzero(vf_rst, sizeof(vf_rst)); for (i = 0; i < sc->num_vfs; i++) { - if ((sc->vfs[i].flags & IXGBE_VF_ACTIVE) == 0) - continue; if ((sc->vfs[i].flags & IXGBE_VF_MDD_NOTIFY_PENDING) != 0) return (true); - index = IXGBE_PFMBICR_INDEX(sc->vfs[i].pool); - active_mbx[index] |= + index = IXGBE_PFMBICR_INDEX(i); + vf_mbx[index] |= IXGBE_PFMBICR_VFREQ_VF1 << - IXGBE_PFMBICR_SHIFT(sc->vfs[i].pool); - active_mbx[index] |= + IXGBE_PFMBICR_SHIFT(i); + vf_mbx[index] |= IXGBE_PFMBICR_VFACK_VF1 << - IXGBE_PFMBICR_SHIFT(sc->vfs[i].pool); - index = IXGBE_PFVFLRE_INDEX(sc->vfs[i].pool); - active_rst[index] |= - 1U << IXGBE_PFVFLRE_SHIFT(sc->vfs[i].pool); + IXGBE_PFMBICR_SHIFT(i); + index = IXGBE_PFVFLRE_INDEX(i); + vf_rst[index] |= 1U << IXGBE_PFVFLRE_SHIFT(i); } hw = &sc->hw; - for (index = 0; index < nitems(active_mbx); index++) { - if (active_mbx[index] != 0 && + for (index = 0; index < nitems(vf_mbx); index++) { + if (vf_mbx[index] != 0 && (IXGBE_READ_REG(hw, IXGBE_PFMBICR(index)) & - active_mbx[index]) != 0) + vf_mbx[index]) != 0) return (true); } - for (index = 0; index < nitems(active_rst); index++) { - if (active_rst[index] == 0) + for (index = 0; index < nitems(vf_rst); index++) { + if (vf_rst[index] == 0) continue; switch (hw->mac.type) { case ixgbe_mac_82599EB: @@ -1664,12 +1664,13 @@ ixgbe_mbx_pending(struct ixgbe_softc *sc) case ixgbe_mac_X550: case ixgbe_mac_X550EM_x: case ixgbe_mac_X550EM_a: + case ixgbe_mac_E610: events = IXGBE_READ_REG(hw, IXGBE_PFVFLREC(index)); break; default: return (false); } - if ((events & active_rst[index]) != 0) + if ((events & vf_rst[index]) != 0) return (true); } ixgbe_mdd_event(hw, vf_mdd);