The branch main has been updated by markj:

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

commit 46fce000843215ff3d574d1c24fc24771975973e
Author:     Jasper Tran O'Leary <jtranole...@google.com>
AuthorDate: 2025-06-05 17:21:06 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2025-06-05 21:48:57 +0000

    gve: Fix timestamp invalidation for DQO queue formats
    
    We need to invalidate timestamps when a TX queue is cleared so that the
    TX timeout detection callout does not mistakenly fire for cleared
    packets. When using DQO queue formats, timestamps are set on the pending
    packet array whose length is not the same as the length of the
    descriptor ring itself. This commit fixes logic which invalidated the
    wrong number of pending packets.
    
    Signed-off-by: Jasper Tran O'Leary <jtranole...@google.com>
    
    Fixes:          3d2957336c7d ("gve: Add callout to detect and handle TX 
timeouts")
    Reviewed by:    markj
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D50688
---
 sys/dev/gve/gve_tx_dqo.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/dev/gve/gve_tx_dqo.c b/sys/dev/gve/gve_tx_dqo.c
index bbf2ee1b0324..551a7e308d19 100644
--- a/sys/dev/gve/gve_tx_dqo.c
+++ b/sys/dev/gve/gve_tx_dqo.c
@@ -987,11 +987,8 @@ gve_tx_clear_desc_ring_dqo(struct gve_tx_ring *tx)
        struct gve_ring_com *com = &tx->com;
        int i;
 
-       for (i = 0; i < com->priv->tx_desc_cnt; i++) {
+       for (i = 0; i < com->priv->tx_desc_cnt; i++)
                tx->dqo.desc_ring[i] = (union gve_tx_desc_dqo){};
-               gve_invalidate_timestamp(
-                   &tx->dqo.pending_pkts[i].enqueue_time_sec);
-       }
 
        bus_dmamap_sync(tx->desc_ring_mem.tag, tx->desc_ring_mem.map,
            BUS_DMASYNC_PREWRITE);
@@ -1033,6 +1030,8 @@ gve_clear_tx_ring_dqo(struct gve_priv *priv, int i)
        for (j = 0; j < tx->dqo.num_pending_pkts; j++) {
                if (gve_is_qpl(tx->com.priv))
                        gve_clear_qpl_pending_pkt(&tx->dqo.pending_pkts[j]);
+               gve_invalidate_timestamp(
+                   &tx->dqo.pending_pkts[j].enqueue_time_sec);
                tx->dqo.pending_pkts[j].next =
                    (j == tx->dqo.num_pending_pkts - 1) ? -1 : j + 1;
                tx->dqo.pending_pkts[j].state = GVE_PACKET_STATE_FREE;

Reply via email to