* [PATCH] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell
@ 2026-11-15 14:00 Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 0/3] net/gve: fix GQI Tx cleanup and QPL FIFO reclaim Ryan Wolfe
2026-11-17 17:34 ` [PATCH] " Stephen Hemminger
0 siblings, 2 replies; 6+ messages in thread
From: Ryan Wolfe @ 2026-11-15 14:00 UTC (permalink / raw)
To: dev, Junfeng Guo, Joshua Washington
Cc: stable, Harshitha Ramamurthy, Rushil Gupta
In GQI Queue Page List (GQI_QPL) mode each Tx queue copies outgoing
frames into a fixed QPL bounce FIFO (512 pages = 2 MiB on GCE, ~236
8,832-byte cacheline-aligned jumbo frames) even when nb_tx_desc is
configured to 2048. Under sustained jumbo bursts three bugs cause
unnecessary packet drops and mbuf tracking hazards:
1. Entry cleanup in gve_tx_burst_qpl() only ran when nb_free < free_thresh
(32) or fifo_avail == 0. With 2048 descriptors, 236 jumbo frames leave
nb_free = 1811 and non-zero remainder bytes in fifo_avail, so entry
cleanup never ran and every QPL wrap stalled mid-burst. Reclaim when
fifo_avail drops below half of fifo_size, and do not count normal
FIFO/ring-full backpressure as hardware stats.errors.
2. When is_fifo_avail() failed mid-burst after queuing packets, the driver
polled gve_tx_clean() once before writing qtx_tail, so the device had
not yet started draining the newly queued frames, and a single
GVE_TX_MAX_FREE_SZ batch after many small frames could stop short of
freeing a jumbo slot. Flush qtx_tail first and loop gve_tx_clean()
while next_to_clean advances.
3. sw_ring[sw_id] and the first TSO header slice were allocated/written
before verifying total FIFO space, gve_free_bulk_mbuf() did not clear
the first freed slot, and gve_tx_burst_ra() skipped mid-burst ring
cleanup and wrote pkt_len instead of data_len into the first segment
descriptor of multi-segment non-TSO packets.
Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Ryan Wolfe <rnwolfe@google.com>
---
drivers/net/gve/gve_tx.c | 68 +++++++++++++++++++++++++++-------------
1 file changed, 47 insertions(+), 21 deletions(-)
diff --git a/drivers/net/gve/gve_tx.c b/drivers/net/gve/gve_tx.c
index 279669165f..2cf091f5be 100644
--- a/drivers/net/gve/gve_tx.c
+++ b/drivers/net/gve/gve_tx.c
@@ -19,6 +19,7 @@ gve_free_bulk_mbuf(struct rte_mbuf **txep, int num)
for (s = 0; s < num; s++) {
if (txep[s] != NULL) {
m = rte_pktmbuf_prefree_seg(txep[s]);
+ txep[s] = NULL;
if (m != NULL)
break;
}
@@ -200,7 +201,7 @@ gve_tx_fill_seg_desc(volatile union gve_tx_desc *desc, uint64_t ol_flags,
}
static inline bool
-is_fifo_avail(struct gve_tx_queue *txq, uint16_t len)
+is_fifo_avail(struct gve_tx_queue *txq, uint32_t len)
{
if (txq->fifo_avail < len)
return false;
@@ -210,6 +211,26 @@ is_fifo_avail(struct gve_tx_queue *txq, uint16_t len)
return false;
return true;
}
+
+static inline bool
+gve_tx_reclaim_fifo_qpl(struct gve_tx_queue *txq, uint32_t tx_tail,
+ uint32_t need)
+{
+ if (txq->tx_tail != tx_tail) {
+ rte_write32(rte_cpu_to_be_32(tx_tail), txq->qtx_tail);
+ txq->tx_tail = tx_tail;
+ }
+
+ do {
+ uint32_t prev_ntc = txq->next_to_clean;
+
+ gve_tx_clean(txq);
+ if (is_fifo_avail(txq, need))
+ return true;
+ if (txq->next_to_clean == prev_ntc)
+ return false;
+ } while (true);
+}
static inline uint64_t
gve_tx_alloc_from_fifo(struct gve_tx_queue *txq, uint16_t tx_id, uint16_t len)
{
@@ -266,7 +287,8 @@ gve_tx_burst_qpl(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
txr = txq->tx_desc_ring;
- if (txq->nb_free < txq->free_thresh || txq->fifo_avail == 0)
+ if (txq->nb_free < txq->free_thresh ||
+ txq->fifo_avail < (txq->fifo_size >> 1))
gve_tx_clean(txq);
if (txq->sw_nb_free < txq->free_thresh)
@@ -304,22 +326,23 @@ gve_tx_burst_qpl(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
(uint32_t)(tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len) :
tx_pkt->pkt_len;
- if (!is_fifo_avail(txq, hlen)) {
- gve_tx_clean(txq);
- if (!is_fifo_avail(txq, hlen))
+ if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
+ uint32_t data_len, need;
+
+ if (unlikely(tx_pkt->pkt_len <= hlen))
+ goto end_of_tx;
+ data_len = tx_pkt->pkt_len - hlen;
+ need = RTE_ALIGN(hlen, RTE_CACHE_LINE_SIZE) +
+ RTE_ALIGN(data_len, RTE_CACHE_LINE_SIZE);
+ if (!is_fifo_avail(txq, need) &&
+ !gve_tx_reclaim_fifo_qpl(txq, tx_tail, need))
goto end_of_tx;
+ } else if (!is_fifo_avail(txq, hlen) &&
+ !gve_tx_reclaim_fifo_qpl(txq, tx_tail, hlen)) {
+ goto end_of_tx;
}
fifo_addr = gve_tx_alloc_from_fifo(txq, tx_id, hlen);
- /* For TSO, check if there's enough fifo space for data first */
- if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
- if (!is_fifo_avail(txq, tx_pkt->pkt_len - hlen)) {
- gve_tx_clean(txq);
- if (!is_fifo_avail(txq, tx_pkt->pkt_len - hlen))
- goto end_of_tx;
- }
- }
-
qpl_write_addr = (void *)(size_t)(fifo_addr + txq->fifo_base);
mbuf_header_addr = rte_pktmbuf_read(tx_pkt, 0, hlen, qpl_write_addr);
@@ -370,13 +393,14 @@ gve_tx_burst_qpl(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
end_of_tx:
if (nb_tx) {
- rte_write32(rte_cpu_to_be_32(tx_tail), txq->qtx_tail);
- txq->tx_tail = tx_tail;
+ if (txq->tx_tail != tx_tail) {
+ rte_write32(rte_cpu_to_be_32(tx_tail), txq->qtx_tail);
+ txq->tx_tail = tx_tail;
+ }
txq->sw_tail = sw_id;
txq->stats.packets += nb_tx;
txq->stats.bytes += bytes;
- txq->stats.errors += nb_pkts - nb_tx;
}
return nb_tx;
@@ -411,8 +435,11 @@ gve_tx_burst_ra(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
nb_used++;
- if (txq->nb_free < nb_used)
- goto end_of_tx;
+ if (txq->nb_free < nb_used) {
+ gve_tx_clean(txq);
+ if (txq->nb_free < nb_used)
+ goto end_of_tx;
+ }
tx_offload.l2_len = tx_pkt->l2_len;
tx_offload.l3_len = tx_pkt->l3_len;
@@ -424,7 +451,7 @@ gve_tx_burst_ra(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
hlen = ol_flags & RTE_MBUF_F_TX_TCP_SEG ?
(uint32_t)(tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len) :
- tx_pkt->pkt_len;
+ tx_pkt->data_len;
/*
* if tso, the driver needs to fill 2 descs for 1 mbuf
* so only put this mbuf into the 1st tx entry in sw ring
@@ -465,7 +492,6 @@ gve_tx_burst_ra(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
txq->stats.packets += nb_tx;
txq->stats.bytes += bytes;
- txq->stats.errors += nb_pkts - nb_tx;
}
return nb_tx;
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 0/3] net/gve: fix GQI Tx cleanup and QPL FIFO reclaim
2026-11-15 14:00 [PATCH] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell Ryan Wolfe
@ 2026-11-17 14:11 ` Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 1/3] net/gve: clear first freed slot in bulk mbuf free Ryan Wolfe
` (2 more replies)
2026-11-17 17:34 ` [PATCH] " Stephen Hemminger
1 sibling, 3 replies; 6+ messages in thread
From: Ryan Wolfe @ 2026-11-17 14:11 UTC (permalink / raw)
To: dev, Junfeng Guo, Joshua Washington
Cc: stable, Harshitha Ramamurthy, Rushil Gupta
This series fixes three independent bugs in the GQI Tx paths of net/gve:
- 1/3 clears the first freed sw_ring entry in gve_free_bulk_mbuf() so
completed or refcounted segments do not leave stale mbuf pointers that
are freed a second time on queue stop or release.
- 2/3 fixes GQI_RDA multi-segment non-TSO packet descriptors to pass
data_len instead of pkt_len for the head segment, reclaims completed
descriptors when nb_free runs low mid-burst, and stops counting normal
ring-full backpressure as stats.errors.
- 3/3 fixes GQI_QPL jumbo Tx FIFO reclaim, TSO pre-allocation space
checks, malformed TSO mbuf handling, and doorbell flushing.
v2:
- split v1 into three atomic Fixes patches for stable backporting
- free and count malformed TSO mbufs (pkt_len <= hlen) in
gve_tx_burst_qpl() while tracking nb_sent separately from nb_tx so an
invalid TSO request cannot stall the queue at tx_pkts[0]
- use for (;;) and add the missing blank line after
gve_tx_reclaim_fifo_qpl()
Ryan Wolfe (3):
net/gve: clear first freed slot in bulk mbuf free
net/gve: fix GQI RDA multi-seg descriptor length and clean
net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell
drivers/net/gve/gve_tx.c | 78 ++++++++++++++++++++++++++++------------
1 file changed, 55 insertions(+), 23 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 1/3] net/gve: clear first freed slot in bulk mbuf free
2026-11-17 14:11 ` [PATCH v2 0/3] net/gve: fix GQI Tx cleanup and QPL FIFO reclaim Ryan Wolfe
@ 2026-11-17 14:11 ` Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 2/3] net/gve: fix GQI RDA multi-seg descriptor length and clean Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 3/3] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell Ryan Wolfe
2 siblings, 0 replies; 6+ messages in thread
From: Ryan Wolfe @ 2026-11-17 14:11 UTC (permalink / raw)
To: dev, Junfeng Guo, Joshua Washington
Cc: stable, Harshitha Ramamurthy, Rushil Gupta
In gve_free_bulk_mbuf(), the initial scan for the first segment ready
to return to its mempool calls rte_pktmbuf_prefree_seg(txep[s]) without
clearing txep[s]. Neither the early scan (including refcounted segments
where prefree returns NULL) nor the subsequent loop starting at s + 1
resets txep[s] to NULL, leaving stale mbuf pointers in sw_ring that
gve_release_txq_mbufs() frees a second time on queue stop or release.
Clear txep[s] immediately after rte_pktmbuf_prefree_seg(), matching the
cleanup loop for the remaining entries.
Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Ryan Wolfe <rnwolfe@google.com>
---
drivers/net/gve/gve_tx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/gve/gve_tx.c b/drivers/net/gve/gve_tx.c
index 279669165f..d344648d0f 100644
--- a/drivers/net/gve/gve_tx.c
+++ b/drivers/net/gve/gve_tx.c
@@ -19,6 +19,7 @@ gve_free_bulk_mbuf(struct rte_mbuf **txep, int num)
for (s = 0; s < num; s++) {
if (txep[s] != NULL) {
m = rte_pktmbuf_prefree_seg(txep[s]);
+ txep[s] = NULL;
if (m != NULL)
break;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 2/3] net/gve: fix GQI RDA multi-seg descriptor length and clean
2026-11-17 14:11 ` [PATCH v2 0/3] net/gve: fix GQI Tx cleanup and QPL FIFO reclaim Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 1/3] net/gve: clear first freed slot in bulk mbuf free Ryan Wolfe
@ 2026-11-17 14:11 ` Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 3/3] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell Ryan Wolfe
2 siblings, 0 replies; 6+ messages in thread
From: Ryan Wolfe @ 2026-11-17 14:11 UTC (permalink / raw)
To: dev, Junfeng Guo, Joshua Washington
Cc: stable, Harshitha Ramamurthy, Rushil Gupta
gve_tx_burst_ra() has three bugs on multi-segment bursts and ring wrap:
1. For non-TSO packets, hlen was set to tx_pkt->pkt_len instead of
tx_pkt->data_len and passed as the first descriptor's seg_len,
causing the device to overrun the head mbuf buffer on multi-segment
frames while also transmitting the trailing segment descriptors.
2. When txq->nb_free dropped below nb_used mid-burst, gve_tx_burst_ra()
aborted immediately without calling gve_tx_clean(txq) to reclaim
completed descriptors.
3. Unsent packets left for the caller on ring-full backpressure were
added to txq->stats.errors.
Use tx_pkt->data_len for the head segment of non-TSO frames, attempt
gve_tx_clean() before stopping when descriptors run low mid-burst, and
stop counting normal backpressure as Tx errors.
Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Ryan Wolfe <rnwolfe@google.com>
---
drivers/net/gve/gve_tx.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/gve/gve_tx.c b/drivers/net/gve/gve_tx.c
index d344648d0f..14495e3851 100644
--- a/drivers/net/gve/gve_tx.c
+++ b/drivers/net/gve/gve_tx.c
@@ -412,8 +412,11 @@ gve_tx_burst_ra(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
nb_used++;
- if (txq->nb_free < nb_used)
- goto end_of_tx;
+ if (txq->nb_free < nb_used) {
+ gve_tx_clean(txq);
+ if (txq->nb_free < nb_used)
+ goto end_of_tx;
+ }
tx_offload.l2_len = tx_pkt->l2_len;
tx_offload.l3_len = tx_pkt->l3_len;
@@ -425,7 +428,7 @@ gve_tx_burst_ra(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
hlen = ol_flags & RTE_MBUF_F_TX_TCP_SEG ?
(uint32_t)(tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len) :
- tx_pkt->pkt_len;
+ tx_pkt->data_len;
/*
* if tso, the driver needs to fill 2 descs for 1 mbuf
* so only put this mbuf into the 1st tx entry in sw ring
@@ -466,7 +469,6 @@ gve_tx_burst_ra(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
txq->stats.packets += nb_tx;
txq->stats.bytes += bytes;
- txq->stats.errors += nb_pkts - nb_tx;
}
return nb_tx;
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 3/3] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell
2026-11-17 14:11 ` [PATCH v2 0/3] net/gve: fix GQI Tx cleanup and QPL FIFO reclaim Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 1/3] net/gve: clear first freed slot in bulk mbuf free Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 2/3] net/gve: fix GQI RDA multi-seg descriptor length and clean Ryan Wolfe
@ 2026-11-17 14:11 ` Ryan Wolfe
2 siblings, 0 replies; 6+ messages in thread
From: Ryan Wolfe @ 2026-11-17 14:11 UTC (permalink / raw)
To: dev, Junfeng Guo, Joshua Washington
Cc: stable, Harshitha Ramamurthy, Rushil Gupta
In GQI Queue Page List (GQI_QPL) mode each Tx queue copies outgoing
frames into a fixed QPL bounce FIFO (for example 512 pages = 2 MiB, or
~236 8,832-byte cacheline-aligned jumbo frames) even when nb_tx_desc is
configured to 2048. Under sustained jumbo bursts three bugs cause
stalls, packet drops, and corrupted FIFO accounting:
1. Entry cleanup in gve_tx_burst_qpl() only ran when nb_free <
free_thresh (32) or fifo_avail == 0. With 2048 descriptors, 236 jumbo
frames leave nb_free = 1811 and non-zero remainder bytes in
fifo_avail, so entry cleanup never ran. Reclaim when fifo_avail drops
below half of fifo_size, and stop counting normal FIFO-full
backpressure as stats.errors.
2. When is_fifo_avail() failed mid-burst after queuing frames, the
driver polled gve_tx_clean() once before writing qtx_tail, so the
device had not begun draining the queued frames, and one
GVE_TX_MAX_FREE_SZ batch after small frames could stop short of a
jumbo slot. Flush qtx_tail first and loop gve_tx_clean() while
next_to_clean advances.
3. For TSO packets, the header FIFO slice was allocated before checking
payload FIFO space (leaking header FIFO space on mid-packet abort),
and a malformed TSO mbuf with pkt_len <= hlen jumped to end_of_tx
without consuming the mbuf, stalling the queue indefinitely. Verify
combined aligned header + payload space up front with a 32-bit length
check, and free and count malformed TSO mbufs while tracking nb_sent
separately from nb_tx.
Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Ryan Wolfe <rnwolfe@google.com>
---
drivers/net/gve/gve_tx.c | 67 ++++++++++++++++++++++++++++------------
1 file changed, 48 insertions(+), 19 deletions(-)
diff --git a/drivers/net/gve/gve_tx.c b/drivers/net/gve/gve_tx.c
index 14495e3851..bf778a86e6 100644
--- a/drivers/net/gve/gve_tx.c
+++ b/drivers/net/gve/gve_tx.c
@@ -201,7 +201,7 @@ gve_tx_fill_seg_desc(volatile union gve_tx_desc *desc, uint64_t ol_flags,
}
static inline bool
-is_fifo_avail(struct gve_tx_queue *txq, uint16_t len)
+is_fifo_avail(struct gve_tx_queue *txq, uint32_t len)
{
if (txq->fifo_avail < len)
return false;
@@ -211,6 +211,27 @@ is_fifo_avail(struct gve_tx_queue *txq, uint16_t len)
return false;
return true;
}
+
+static inline bool
+gve_tx_reclaim_fifo_qpl(struct gve_tx_queue *txq, uint32_t tx_tail,
+ uint32_t need)
+{
+ if (txq->tx_tail != tx_tail) {
+ rte_write32(rte_cpu_to_be_32(tx_tail), txq->qtx_tail);
+ txq->tx_tail = tx_tail;
+ }
+
+ for (;;) {
+ uint32_t prev_ntc = txq->next_to_clean;
+
+ gve_tx_clean(txq);
+ if (is_fifo_avail(txq, need))
+ return true;
+ if (txq->next_to_clean == prev_ntc)
+ return false;
+ }
+}
+
static inline uint64_t
gve_tx_alloc_from_fifo(struct gve_tx_queue *txq, uint16_t tx_id, uint16_t len)
{
@@ -261,13 +282,15 @@ gve_tx_burst_qpl(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
uint16_t sw_id = txq->sw_tail;
uint64_t ol_flags, fifo_addr;
uint16_t nb_used, i;
+ uint16_t nb_sent = 0;
uint64_t bytes = 0;
uint16_t nb_tx = 0;
uint32_t hlen;
txr = txq->tx_desc_ring;
- if (txq->nb_free < txq->free_thresh || txq->fifo_avail == 0)
+ if (txq->nb_free < txq->free_thresh ||
+ txq->fifo_avail < (txq->fifo_size >> 1))
gve_tx_clean(txq);
if (txq->sw_nb_free < txq->free_thresh)
@@ -305,21 +328,25 @@ gve_tx_burst_qpl(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
(uint32_t)(tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len) :
tx_pkt->pkt_len;
- if (!is_fifo_avail(txq, hlen)) {
- gve_tx_clean(txq);
- if (!is_fifo_avail(txq, hlen))
- goto end_of_tx;
- }
- fifo_addr = gve_tx_alloc_from_fifo(txq, tx_id, hlen);
-
- /* For TSO, check if there's enough fifo space for data first */
if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
- if (!is_fifo_avail(txq, tx_pkt->pkt_len - hlen)) {
- gve_tx_clean(txq);
- if (!is_fifo_avail(txq, tx_pkt->pkt_len - hlen))
- goto end_of_tx;
+ uint32_t data_len, need;
+
+ if (unlikely(tx_pkt->pkt_len <= hlen)) {
+ rte_pktmbuf_free(tx_pkt);
+ txq->stats.errors++;
+ continue;
}
+ data_len = tx_pkt->pkt_len - hlen;
+ need = RTE_ALIGN(hlen, RTE_CACHE_LINE_SIZE) +
+ RTE_ALIGN(data_len, RTE_CACHE_LINE_SIZE);
+ if (!is_fifo_avail(txq, need) &&
+ !gve_tx_reclaim_fifo_qpl(txq, tx_tail, need))
+ goto end_of_tx;
+ } else if (!is_fifo_avail(txq, hlen) &&
+ !gve_tx_reclaim_fifo_qpl(txq, tx_tail, hlen)) {
+ goto end_of_tx;
}
+ fifo_addr = gve_tx_alloc_from_fifo(txq, tx_id, hlen);
qpl_write_addr = (void *)(size_t)(fifo_addr + txq->fifo_base);
mbuf_header_addr = rte_pktmbuf_read(tx_pkt, 0, hlen, qpl_write_addr);
@@ -367,17 +394,19 @@ gve_tx_burst_qpl(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
tx_tail += nb_used;
bytes += first->pkt_len;
+ nb_sent++;
}
end_of_tx:
- if (nb_tx) {
- rte_write32(rte_cpu_to_be_32(tx_tail), txq->qtx_tail);
- txq->tx_tail = tx_tail;
+ if (nb_sent) {
+ if (txq->tx_tail != tx_tail) {
+ rte_write32(rte_cpu_to_be_32(tx_tail), txq->qtx_tail);
+ txq->tx_tail = tx_tail;
+ }
txq->sw_tail = sw_id;
- txq->stats.packets += nb_tx;
+ txq->stats.packets += nb_sent;
txq->stats.bytes += bytes;
- txq->stats.errors += nb_pkts - nb_tx;
}
return nb_tx;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell
2026-11-15 14:00 [PATCH] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 0/3] net/gve: fix GQI Tx cleanup and QPL FIFO reclaim Ryan Wolfe
@ 2026-11-17 17:34 ` Stephen Hemminger
1 sibling, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2026-11-17 17:34 UTC (permalink / raw)
To: Ryan Wolfe
Cc: dev, Junfeng Guo, Joshua Washington, stable, Harshitha Ramamurthy,
Rushil Gupta
On Sun, 15 Nov 2026 09:00:16 -0500
Ryan Wolfe <rnwolfe@google.com> wrote:
> In GQI Queue Page List (GQI_QPL) mode each Tx queue copies outgoing
> frames into a fixed QPL bounce FIFO (512 pages = 2 MiB on GCE, ~236
> 8,832-byte cacheline-aligned jumbo frames) even when nb_tx_desc is
> configured to 2048. Under sustained jumbo bursts three bugs cause
> unnecessary packet drops and mbuf tracking hazards:
>
> 1. Entry cleanup in gve_tx_burst_qpl() only ran when nb_free < free_thresh
> (32) or fifo_avail == 0. With 2048 descriptors, 236 jumbo frames leave
> nb_free = 1811 and non-zero remainder bytes in fifo_avail, so entry
> cleanup never ran and every QPL wrap stalled mid-burst. Reclaim when
> fifo_avail drops below half of fifo_size, and do not count normal
> FIFO/ring-full backpressure as hardware stats.errors.
> 2. When is_fifo_avail() failed mid-burst after queuing packets, the driver
> polled gve_tx_clean() once before writing qtx_tail, so the device had
> not yet started draining the newly queued frames, and a single
> GVE_TX_MAX_FREE_SZ batch after many small frames could stop short of
> freeing a jumbo slot. Flush qtx_tail first and loop gve_tx_clean()
> while next_to_clean advances.
> 3. sw_ring[sw_id] and the first TSO header slice were allocated/written
> before verifying total FIFO space, gve_free_bulk_mbuf() did not clear
> the first freed slot, and gve_tx_burst_ra() skipped mid-burst ring
> cleanup and wrote pkt_len instead of data_len into the first segment
> descriptor of multi-segment non-TSO packets.
>
> Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ryan Wolfe <rnwolfe@google.com>
> ---
The AI review spotted some changes needed.
[PATCH] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell
The FIFO fixes look right. Checking the TSO header and payload
together before allocating also fixes a real leak: the old code
allocated the header slice, then hit goto end_of_tx when the payload
check failed. iov_ring[tx_id] was overwritten on the next burst, so
that FIFO space was never returned to fifo_avail. The reclaim helper
rings the doorbell before polling, which is the right order.
Error
TSO packets with pkt_len <= hlen now goto end_of_tx. That is a
per-packet validation failure handled as backpressure. The app
retries the same mbuf forever and the queue stalls. Drop the packet
and move on:
if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
uint32_t data_len, need;
if (unlikely(tx_pkt->pkt_len <= hlen)) {
txq->stats.errors++;
rte_pktmbuf_free(tx_pkt);
nb_drop++;
continue;
}
Leave nb_drop out of stats.packets. A better long-term fix is a
tx_pkt_prepare callback that rejects these before tx_burst, since
gve has none today.
Warning
The commit message does not match the code. Item 3 says
sw_ring[sw_id] is written before the FIFO check, but commit
1299806a ("net/gve: delay adding mbuf head to software ring")
already moved it. This patch does not touch that ordering. Drop the
claim.
This patch makes six separate changes to two Tx paths, under one
Fixes tag, and is marked for stable:
- gve_free_bulk_mbuf() clears slot s
- QPL FIFO reclaim, doorbell flush and wider is_fifo_avail()
- QPL TSO check before allocating
- RA: clean the ring mid-burst
- RA: use data_len for the first descriptor
- stats.errors removal in both paths
Split it into at least three patches: the free_bulk fix, the QPL
FIFO changes, and the RA fixes. Give each one a Fixes: tag pointing
at the commit that added that bug. Not all of them date back to
a46583cf43c8. Splitting lets stable maintainers backport each fix
on its own.
Say in the commit message why the free_bulk fix matters. In RA
mode a TSO packet uses two descriptors, but sw_ring[] is set only
for the first one. The second slot can still hold a stale pointer
from a previous wrap. The old code did not clear slot s, or earlier
slots whose refcount was still held, so gve_tx_clean() could free
that stale mbuf a second time. That is a double free, not a vague
"mbuf tracking hazard". The RA data_len fix is the same kind of
bug: the device was told to read pkt_len bytes from the first
segment, past the end of that segment. Both deserve their own
patch and a clear description.
The commit message is long and reads like generated text. Make it
short and factual, and say how this was tested: which instance
type, which queue mode, and the traffic used to reproduce.
Info
Use for (;;) rather than do { } while (true) in
gve_tx_reclaim_fifo_qpl(). Add a blank line between it and
gve_tx_alloc_from_fifo().
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-18 9:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 14:00 [PATCH] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 0/3] net/gve: fix GQI Tx cleanup and QPL FIFO reclaim Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 1/3] net/gve: clear first freed slot in bulk mbuf free Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 2/3] net/gve: fix GQI RDA multi-seg descriptor length and clean Ryan Wolfe
2026-11-17 14:11 ` [PATCH v2 3/3] net/gve: fix GQI QPL jumbo Tx FIFO reclaim and doorbell Ryan Wolfe
2026-11-17 17:34 ` [PATCH] " Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox