From d5a62c4abad4087b67276c50a066c38a21a32a98 Mon Sep 17 00:00:00 2001 From: Carsten Beckmann Date: Thu, 1 Oct 2026 14:41:59 +0200 Subject: [PATCH 6/8] iavf: clear stale data in scratch buffer All messages in the admin transmit queue reuse the same scratch buffer. For some messages not all fields were initialized which means that they could contain stale data from older messages. In some cases this lead to configuration errors. Explicitly initialize all fields for messages were this could happen to fix this problem. --- sys/dev/pci/if_iavf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/pci/if_iavf.c b/sys/dev/pci/if_iavf.c index dced9e1269a..c484cc68c61 100644 --- a/sys/dev/pci/if_iavf.c +++ b/sys/dev/pci/if_iavf.c @@ -1278,6 +1278,8 @@ iavf_config_vsi_queues(struct iavf_softc *sc) iavf_aq_dva(&iaq, IAVF_DMA_DVA(&sc->sc_scratch)); config = IAVF_DMA_KVA(&sc->sc_scratch); + memset(config, 0, sizeof(*config) + + iavf_nqueues(sc) * sizeof(struct iavf_vc_queue_pair_info)); config->vsi_id = htole16(sc->sc_vsi_id); config->num_queue_pairs = htole16(iavf_nqueues(sc)); @@ -1427,6 +1429,7 @@ iavf_queue_select(struct iavf_softc *sc, int opcode) qsel = IAVF_DMA_KVA(&sc->sc_scratch); qsel->vsi_id = htole16(sc->sc_vsi_id); + qsel->pad = 0; qsel->rx_queues = htole32(iavf_allqueues(sc)); qsel->tx_queues = htole32(iavf_allqueues(sc)); @@ -1594,6 +1597,7 @@ iavf_add_del_addr(struct iavf_softc *sc, uint8_t *addr, int add) iavf_aq_dva(&iaq, IAVF_DMA_DVA(&sc->sc_scratch)); addrs = IAVF_DMA_KVA(&sc->sc_scratch); + memset(addrs, 0, sizeof(*addrs) + sizeof(*vcaddr)); addrs->vsi_id = htole16(sc->sc_vsi_id); addrs->num_elements = htole16(1); @@ -3007,6 +3011,7 @@ iavf_config_irq_map(struct iavf_softc *sc) iavf_aq_dva(&iaq, IAVF_DMA_DVA(&sc->sc_scratch)); map = IAVF_DMA_KVA(&sc->sc_scratch); + memset(map, 0, sizeof(*map) + sizeof(*vec) * sc->sc_nintrs); vec = map->vecmap; if (sc->sc_nintrs == 1) { -- 2.53.0