Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jul 2025 19:16:15 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 21f339571328 - main - ice(4): Fix panic when VF uses less queues then available
Message-ID:  <202507181916.56IJGFj3000949@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit 21f33957132876c8a5815b793fd72e8310230caf
Author:     Krzysztof Galazka <krzysztof.galazka@intel.com>
AuthorDate: 2025-02-12 13:41:01 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-07-18 19:16:16 +0000

    ice(4): Fix panic when VF uses less queues then available
    
    VF driver may request to configure MSI-X vectors for less
    queues than assigned by PF. Don't try to configure
    unassigned vectors to avoid panic.
    
    While at that make the loop process whole array of vectors
    received in a VIRTCHNL_OP_CFG_IRQ_MAP message from a VF.
    It's not guarantied that vector '0', which is used for other
    interrupt causes and is not mapped to a queue, will be always
    on the last position. Condition inside the loop already
    handles that vector correctly.
    
    Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
---
 sys/dev/ice/ice_iov.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/dev/ice/ice_iov.c b/sys/dev/ice/ice_iov.c
index 0d04c06b3140..b11fb225f30a 100644
--- a/sys/dev/ice/ice_iov.c
+++ b/sys/dev/ice/ice_iov.c
@@ -1242,7 +1242,7 @@ ice_vc_cfg_irq_map_msg(struct ice_softc *sc, struct ice_vf *vf, u8 *msg_buf)
 
 	vvm = vimi->vecmap;
 	/* Save off information from message */
-	for (int i = 0; i < vimi->num_vectors - 1; i++, vvm++) {
+	for (int i = 0; i < vimi->num_vectors; i++, vvm++) {
 		struct ice_tx_queue *txq;
 		struct ice_rx_queue *rxq;
 		int bit;
@@ -1305,12 +1305,14 @@ ice_vc_cfg_irq_map_msg(struct ice_softc *sc, struct ice_vf *vf, u8 *msg_buf)
 
 	/* Write to T/RQCTL registers to actually map vectors to queues */
 	for (int i = 0; i < vf->vsi->num_rx_queues; i++)
-		ice_configure_rxq_interrupt(hw, vsi->rx_qmap[i],
-		    vsi->rx_queues[i].irqv->me, vsi->rx_queues[i].itr_idx);
+		if (vsi->rx_queues[i].irqv != NULL)
+			ice_configure_rxq_interrupt(hw, vsi->rx_qmap[i],
+			    vsi->rx_queues[i].irqv->me, vsi->rx_queues[i].itr_idx);
 
 	for (int i = 0; i < vf->vsi->num_tx_queues; i++)
-		ice_configure_txq_interrupt(hw, vsi->tx_qmap[i],
-		    vsi->tx_queues[i].irqv->me, vsi->tx_queues[i].itr_idx);
+		if (vsi->tx_queues[i].irqv != NULL)
+			ice_configure_txq_interrupt(hw, vsi->tx_qmap[i],
+			    vsi->tx_queues[i].irqv->me, vsi->tx_queues[i].itr_idx);
 
 	ice_flush(hw);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507181916.56IJGFj3000949>