From 1268811f218612658b21006e0e6cc25c569433f5 Mon Sep 17 00:00:00 2001 From: Carsten Beckmann Date: Wed, 16 Sep 2026 14:49:58 +0200 Subject: [PATCH 1/8] iavf: reset atq indices on VF reset On a VF reset the hardware registers atq_head and atq_tail are reset to 0, but sc_atq_cons and sc_atq_prod keep their old value. If something is posted to the admin queue the new descriptor is put at whatever position the driver left off before the reset and atq_tail is updated to that value. To the PF on the host that looks like the VF just resend all the previous descriptors which is obviously wrong. Resetting sc_atq_cons and sc_atq_prod on a VF reset fixes this issue. While there also initialize atq_head_mask using the correct define. Both defines have the same value, so this is no functional change. --- sys/dev/pci/if_iavf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/if_iavf.c b/sys/dev/pci/if_iavf.c index b6e7f681993..e41396e7873 100644 --- a/sys/dev/pci/if_iavf.c +++ b/sys/dev/pci/if_iavf.c @@ -758,7 +758,7 @@ static const struct iavf_aq_regs iavf_aq_regs = { .atq_tail = I40E_VF_ATQT1, .atq_tail_mask = I40E_VF_ATQT1_ATQT_MASK, .atq_head = I40E_VF_ATQH1, - .atq_head_mask = I40E_VF_ARQH1_ARQH_MASK, + .atq_head_mask = I40E_VF_ATQH1_ATQH_MASK, .atq_len = I40E_VF_ATQLEN1, .atq_bal = I40E_VF_ATQBAL1, .atq_bah = I40E_VF_ATQBAH1, @@ -1746,6 +1746,11 @@ iavf_reset(void *xsc) goto failed; } + mtx_enter(&sc->sc_atq_mtx); + sc->sc_atq_cons = 0; + sc->sc_atq_prod = 0; + mtx_leave(&sc->sc_atq_mtx); + iavf_arq_unfill(sc); sc->sc_arq_cons = 0; sc->sc_arq_prod = 0; -- 2.53.0