net/gve: TSO descriptor count fixes for GVE DQO
v2 cover net/gve: TSO descriptor count fixes for GVE DQO
https://inbox.dpdk.org/dev/[email protected]/
introduced descriptor limit checks for TSO packets in DPDK. Unfortunately, a couple of bugs have been found in the implementation.
This patch series introduces fixes for those bugs while correcting the overly restrictive behavior recently introduced mandating that all headers be in the same buffer.
The final patch in the series introduces tx_pkt_prepare as an option to ensure that there is a way to get a clear signal of when packets violate hardware limitations. Before a recently introduced patch, the GVE behavior was to stop transmitting at the first invalid packet, which would allow the application to do any necessary linearization or packet modification before attempting to transmit again. It turns out that that behavior is considered incorrect, so offer tx_pkt_prepare as an alternative.
Depends-on: series-39707 ("net/gve: fix DQO Tx queue stalls")
Changes in v2:
- Rely on tx_pkt->nb_segs for descriptor limit calculation only as a precursor, falling back to the traditional gve_tx_pkt_nb_data_descs() if that optimization fails.
- Only call rte_net_intel_cksum_preapre on TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
- Introduce new patch to validate minimum header length.
Joshua Washington (4):
net/gve: fix TSO segment offset calculation net/gve: account for multi-mbuf headers when validating TSO net/gve: introduce Tx packet preparation for DQO format net/gve: validate minimum header length for TSO packets
drivers/net/gve/base/gve_desc_dqo.h | 2 + drivers/net/gve/gve_ethdev.h | 3 + drivers/net/gve/gve_tx_dqo.c | 121 +++++++++++++++++++++++++--- 3 files changed, 113 insertions(+), 13 deletions(-)
Signature · 1 line
2.56.0.317.g454f8302e1-goog
PATCH v2 1/4 net/gve: fix TSO segment offset calculation
The descriptor limit validation for TSO packets was erroneously computing the TSO segment offset at the end of an mbuf. The first bytes of any mbuf will be included as part of the previous TSO segment which has not yet been completed, as indicated by seg_remain. Subtract those seg_remain bytes from the mbuf length before computing the segment offset.
Visual representation:
Before:
------------------------------------------------------------------
| tso_ | tso_ | tso_ | tso_ | tso_ | | segsz | segsz | segsz | segsz | segsz |
------------------------------------------------------------------
| 16K | 16K | |
------------------------------------------------------------------
After:
------------------------------------------------------------------
|rem | tso_ | tso_ | tso_ | tso_ | seg_ |
|ain | segsz | segsz | segsz | segsz |offset |
------------------------------------------------------------------
| 16K | 16K | |
------------------------------------------------------------------
^
mbuf_remainIn this example, the original code would have found that tso_segsz evenly divides mbuf_len, and that there is no tail to be considered split across two mbufs. So the number of descriptors it would have found would be:
1 (for the headers) +
0 (no segment offset) +
0 (mbuf_remain cannot be less than 0)
For a total of one descriptor counted in num_descs for the start of the current TSO segment.
Meanwhile, the reality would be:
1 (for the headers) +
1 (seg_offset != 0) +
1 (mbuf_remain < seg_offset)
For a total of 3 descriptors counted against the descriptor limit.
This undercount can cause TSO segments to incorrectly cross up to two extra descriptors more than the hardware limit, leading to the datapath being disabled.
---
Depends-on: series-39707 ("net/gve: fix DQO Tx queue stalls")
--- drivers/net/gve/gve_tx_dqo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gve/gve_tx_dqo.c +1 -1
@@ -191,7 +191,7 @@ gve_tx_validate_descs(const struct gve_tx_queue *txq, struct rte_mbuf *tx_pkt,return false;if (seg_remain < mbuf_len) { - seg_offset = mbuf_len % tso_segsz; + seg_offset = (mbuf_len - seg_remain) % tso_segsz;/* The MSS is bound from above by 9728B, so a * single TSO segment in the middle of an mbuf * will be part of at most two descriptors, and
Signature · 1 line
2.56.0.317.g454f8302e1-goog
PATCH v2 2/4 net/gve: account for multi-mbuf headers when validating TSO
In reply to Joshua WashingtonThe DQ queue format allows TSO headers to span up to 3 descriptors. Before this patch, the TSO descriptor limit check logic assumed that headers would only be in a single descriptor. This can cause under counting when processing descriptors, which can lead to hardware failures.
As an example: suppose a header spans 3 mbufs. In that case, 3 descriptors will need to be reserved per TSO segment. Now imagine that there is a TSO segment whose payload spans 8 buffers. The previous logic would add one for the headers, making a total of 9, which would be considered valid. In actuality, since the header spans 3 descriptors themselves, there are actually 11 descriptors for the one wire segment, which is invalid.
Compute the number of descriptors needed for the TSO header, reject mbufs in which the headers span more than 3 buffers, and count the number of descriptors needed against the descriptor budget per wire packet/TSO segment.
Also, relax the strong restriction that all headers be in the same buffer, as this is not a requirement by the hardware.
---
Depends-on: series-39707 ("net/gve: fix DQO Tx queue stalls")
--- drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_tx_dqo.c | 38 ++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 9 deletions(-)
drivers/net/gve/base/gve_desc_dqo.h +1 -0
@@ -45,6 +45,7 @@ GVE_CHECK_STRUCT_LEN(16, gve_tx_pkt_desc_dqo);/* Maximum number of data descriptors allowed per packet, or per-TSO segment. */ #define GVE_TX_MAX_DATA_DESCS 10 +#define GVE_TX_MAX_HEADER_DESCS_TSO 3/* Min gap between tail and head to avoid cacheline overlap */ #define GVE_TX_MIN_DESC_PREVENT_CACHE_OVERLAP 4
drivers/net/gve/gve_tx_dqo.c +29 -9
@@ -138,7 +138,7 @@ gve_tx_validate_pkt(const struct rte_mbuf *tx_pkt, bool is_tso)*/ headlen = tx_pkt->l2_len + tx_pkt->l3_len + tx_pkt->l4_len;if (tx_pkt->l4_len ==0 || headlen >GVE_TX_MAX_HDR_SIZE_DQO || - tx_pkt->data_len < headlen || tx_pkt->pkt_len <= headlen) + tx_pkt->pkt_len <= headlen)return false; return tx_pkt->pkt_len - headlen <= GVE_TX_MAX_TSO_LEN_DQO &&
@@ -167,20 +167,41 @@ static inline bool gve_tx_validate_descs(const struct gve_tx_queue *txq, struct rte_mbuf *tx_pkt, uint16_t nb_descs, bool is_tso) { + int headlen = tx_pkt->l2_len + tx_pkt->l3_len + tx_pkt->l4_len; +int num_descs, seg_offset, mbuf_len; +int tso_segsz = tx_pkt->tso_segsz; +int header_remain = headlen; +uint16_t num_header_descs; +if (nb_descs >gve_tx_max_pkt_descs (txq))return false;if (!is_tso)return nb_descs <=GVE_TX_MAX_DATA_DESCS ; -int tso_segsz = tx_pkt->tso_segsz; -int num_descs, seg_offset, mbuf_len; -int headlen = tx_pkt->l2_len + tx_pkt->l3_len + tx_pkt->l4_len; +/* Process headers. Headers can span up to 3 descriptors. */ +if (headlen ==0 ) +return false; + + num_header_descs =1 ; +while (tx_pkt !=NULL ) { +if (header_remain <= tx_pkt->data_len) +break ; + +if (likely (tx_pkt->data_len >0 )) { + header_remain -= tx_pkt->data_len; + num_header_descs++; + } -/* Headers will be split into their own buffer. */ - num_descs =1 ; + tx_pkt = tx_pkt->next; + } + +if (tx_pkt ==NULL || num_header_descs >GVE_TX_MAX_HEADER_DESCS_TSO ) +return false; + + num_descs = num_header_descs; seg_offset =0 ; - mbuf_len = tx_pkt->data_len - headlen; + mbuf_len = tx_pkt->data_len - header_remain;while (tx_pkt) {if (!mbuf_len)
@@ -207,7 +228,7 @@ gve_tx_validate_descs(const struct gve_tx_queue *txq, struct rte_mbuf *tx_pkt,* segment in this mbuf is divided between two * descriptors, both must be counted. */ - num_descs =1 + !!(seg_offset) + + num_descs = num_header_descs + !!(seg_offset) + (mbuf_remain < seg_offset && mbuf_remain); }else { seg_offset += mbuf_len;
@@ -220,7 +241,6 @@ gve_tx_validate_descs(const struct gve_tx_queue *txq, struct rte_mbuf *tx_pkt, mbuf_len = tx_pkt->data_len; } -return true; }
Signature · 1 line
2.56.0.317.g454f8302e1-goog
PATCH v2 3/4 net/gve: introduce Tx packet preparation for DQO format
In reply to Joshua WashingtonBefore this patch, packets that are invalid in the DQO format with respect to offloads, descriptor limits, or packet size limits, are dropped by the driver without any form of recourse for the application, potentially leading to a disruption in traffic that can be hard to debug.
Introduce tx_pkt_prepare for the DQ queue format to avoid dropping packets without first giving the application a way to know that they are invalid. For TSO packets, this method also computes the TCP pseudo-header for packets with checksum offloading enabled. Note that in this case, such packets must have L2/L3/L4 headers in the same mbuf segment to pass tx_pkt_prepare.
---
Depends-on: series-39707 ("net/gve: fix DQO Tx queue stalls")
Changes in v2:
- Rely on tx_pkt->nb_segs for descriptor limit calculation only as a precursor, falling back to the traditional gve_tx_pkt_nb_data_descs() if that optimization fails.
- Only call rte_net_intel_cksum_preapre on TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
--- drivers/net/gve/gve_ethdev.h | 3 ++ drivers/net/gve/gve_tx_dqo.c | 79 +++++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-)
drivers/net/gve/gve_ethdev.h +3 -0
@@ -649,6 +649,9 @@ gve_rx_burst_dqo(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);uint16_t gve_tx_burst_dqo (void *txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t +gve_tx_pkt_prepare_dqo (void *txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +void gve_set_rx_function_dqo (struct rte_eth_dev *dev);
drivers/net/gve/gve_tx_dqo.c +77 -2
107 lines not on this page · raw message
Signature · 1 line
2.56.0.317.g454f8302e1-goog
PATCH v2 4/4 net/gve: validate minimum header length for TSO packets
In reply to Joshua WashingtonIn addition to the limits added in commit03b62d39c1c8 ("net/gve: enforce DQO TSO header and length limits"), TSO packets also have a minimum header length of 16B. Enforce this limit as well.
--- drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_tx_dqo.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/gve/base/gve_desc_dqo.h +1 -0
@@ -14,6 +14,7 @@#define GVE_TX_MIN_TSO_MSS_DQO 88#define GVE_TX_MIN_PKT_SIZE_DQO 17#define GVE_TX_MAX_PKT_SIZE_DQO 9728 +#define GVE_TX_MIN_TSO_HDR_LEN_DQO 16#define GVE_TX_MAX_TSO_LEN_DQO ((256 * 1024) - 1)/* Basic TX descriptor (DTYPE 0x0C) */
drivers/net/gve/gve_tx_dqo.c +2 -2
@@ -139,8 +139,8 @@ gve_tx_validate_pkt_limits(const struct rte_mbuf *tx_pkt, bool is_tso)* contained in the first segment; the payload must not be empty. */ headlen = tx_pkt->l2_len + tx_pkt->l3_len + tx_pkt->l4_len; -if (tx_pkt->l4_len ==0 || headlen >GVE_TX_MAX_HDR_SIZE_DQO || - tx_pkt->pkt_len <= headlen) +if (tx_pkt->l4_len ==0 || headlen <GVE_TX_MIN_TSO_HDR_LEN_DQO || + headlen >GVE_TX_MAX_HDR_SIZE_DQO || tx_pkt->pkt_len <= headlen)return false; return tx_pkt->pkt_len - headlen <= GVE_TX_MAX_TSO_LEN_DQO &&
Signature · 1 line
2.56.0.317.g454f8302e1-goog
Stephen Hemminger
AppliedQuoted 17 lines · On Fri, 30 Oct 2026 11:42:59 -0700 Joshua Washington <[email protected]>…
https://inbox.dpdk.org/dev/[email protected]/
introduced descriptor limit checks for TSO packets in DPDK. Unfortunately, a couple of bugs have been found in the implementation.This patch series introduces fixes for those bugs while correcting the overly restrictive behavior recently introduced mandating that all headers be in the same buffer.
The final patch in the series introduces
tx_pkt_prepareas an option to ensure that there is a way to get a clear signal of when packets violate hardware limitations. Before a recently introduced patch, the GVE behavior was to stop transmitting at the first invalid packet, which would allow the application to do any necessary linearization or packet modification before attempting to transmit again. It turns out that that behavior is considered incorrect, so offertx_pkt_prepareas an alternative.
Quoted 1 line
Depends-on: series-39707 ("net/gve: fix DQO Tx queue stalls")
You dont need Fixes for anything that changed during 26.11 development window. Only for changes that need backports.
AI review also mentioned.
Review: [PATCH v2 0/4] net/gve: DQO TSO validation fixes
Applied to next-net (339c992f25) with no conflicts. Each commit builds with -Dwerror=true.
Patches 1/4 and 4/4 look correct. The seg_offset change in 1/4 matches the descriptor layout: the first seg_remain bytes close out the open segment, and only the rest is divided by tso_segsz.
Patch 2/4: net/gve: account for multi-mbuf headers when validating TSO
Warning: stale comment in gve_tx_validate_pkt_limits().
The data_len < headlen check is gone, but the comment above it still says the headers must be "contained in the first segment". Update it:
/* TSO headers may span up to GVE_TX_MAX_HEADER_DESCS_TSO * buffers; the payload must not be empty. */
Patch 3/4: net/gve: introduce Tx packet preparation for DQO format
Warning: tx_prepare rejects every TSO packet whose headers span mbufs, which makes the relaxation in 2/4 unreachable for apps that call rte_eth_tx_prepare().
GVE_TX_CKSUM_OFFLOAD_MASK_DQO includes RTE_MBUF_F_TX_TCP_SEG through GVE_TX_CKSUM_OFFLOAD_MASK, so "csum && tso" is just "tso". Every TSO packet therefore goes through rte_net_intel_cksum_prepare(), and that returns -ENOTSUP when
rte_pktmbuf_data_len(m) < l2_len + l3_len + l4_len
The commit message says "in this case" as if some TSO packets skip the call. None do. Pick one of these:
- State it plainly: TSO packets that go through tx_prepare must have all headers in the first segment. Split headers are only accepted from apps that call tx_burst directly. Then drop the dead csum variable:
if (tso) {
err = rte_net_intel_cksum_prepare(tx_pkt);
if (err != 0) {
rte_errno = -err;
return i;
}
} - Or seed the pseudo-header for split headers too: read the L3/L4 headers with rte_pktmbuf_read() and write the TCP checksum field into whichever segment holds it.
Info: this adds a tx_pkt_prepare op and tags it Cc: stable. That is a new driver op, not a bug fix. Stable maintainers may want it dropped from the backport, or want the commit message to say why existing apps need it.
Quoted 21 lines · Stephen Hemminger
Quoted 17 lines · On Fri, 30 Oct 2026 11:42:59 -0700 Joshua Washington <[email protected]>…
https://inbox.dpdk.org/dev/[email protected]/
introduced descriptor limit checks for TSO packets in DPDK. Unfortunately, a couple of bugs have been found in the implementation.This patch series introduces fixes for those bugs while correcting the overly restrictive behavior recently introduced mandating that all headers be in the same buffer.
The final patch in the series introduces
tx_pkt_prepareas an option to ensure that there is a way to get a clear signal of when packets violate hardware limitations. Before a recently introduced patch, the GVE behavior was to stop transmitting at the first invalid packet, which would allow the application to do any necessary linearization or packet modification before attempting to transmit again. It turns out that that behavior is considered incorrect, so offertx_pkt_prepareas an alternative.
Quoted 4 lines
Quoted 1 line
Depends-on: series-39707 ("net/gve: fix DQO Tx queue stalls")
You dont need Fixes for anything that changed during 26.11 development window. Only for changes that need backports.
Which patch(es) does this refer to? I think some of these patches are fixing previous fixes. For those patches, should I just base the fix on the same patch that the original fix was addressing? Otherwise, they could be applied to next-net, but not as fixes, which would prevent backporting.
Quoted 55 lines
AI review also mentioned.
Review: [PATCH v2 0/4] net/gve: DQO TSO validation fixes
Applied to next-net (
339c992f25) with no conflicts. Each commit builds with -Dwerror=true.Patches 1/4 and 4/4 look correct. The
seg_offsetchange in 1/4 matches the descriptor layout: the firstseg_remainbytes close out the open segment, and only the rest is divided bytso_segsz.Patch 2/4: net/gve: account for multi-mbuf headers when validating TSO
Warning: stale comment in
gve_tx_validate_pkt_limits().The
data_len< headlen check is gone, but the comment above it still says the headers must be "contained in the first segment". Update it:/* TSO headers may span up to GVE_TX_MAX_HEADER_DESCS_TSO * buffers; the payload must not be empty. */Patch 3/4: net/gve: introduce Tx packet preparation for DQO format
Warning:
tx_preparerejects every TSO packet whose headers span mbufs, which makes the relaxation in 2/4 unreachable for apps that callrte_eth_tx_prepare().
GVE_TX_CKSUM_OFFLOAD_MASK_DQOincludesRTE_MBUF_F_TX_TCP_SEGthroughGVE_TX_CKSUM_OFFLOAD_MASK, so "csum && tso" is just "tso". Every TSO packet therefore goes throughrte_net_intel_cksum_prepare(), and that returns-ENOTSUPwhenrte_pktmbuf_data_len(m) < l2_len + l3_len + l4_lenThe commit message says "in this case" as if some TSO packets skip the call. None do. Pick one of these:
- State it plainly: TSO packets that go through
tx_preparemust have all headers in the first segment. Split headers are only accepted from apps that calltx_burstdirectly. Then drop the dead csum variable:if (tso) { err = rte_net_intel_cksum_prepare(tx_pkt); if (err != 0) { rte_errno = -err; return i; } }
Quoted 3 lines
- Or seed the pseudo-header for split headers too: read the L3/L4 headers with
rte_pktmbuf_read()and write the TCP checksum field into whichever segment holds it.
I will drop patch 2, since the driver requires checksum offloading for TSO packets.
Quoted 5 lines
Info: this adds a
tx_pkt_prepareop and tags it Cc: stable. That is a new driver op, not a bug fix. Stable maintainers may want it dropped from the backport, or want the commit message to say why existing apps need it.
--
Joshua Washington | Software Engineer | [email protected] | (414) 366-4423
v3 cover net/gve: TSO descriptor count fixes for GVE DQO
In reply to Joshua Washingtonhttps://inbox.dpdk.org/dev/[email protected]/
introduced descriptor limit checks for TSO packets in DPDK. Unfortunately, a couple of bugs have been found in the implementation.
This patch series introduces fixes for those bugs and adds support for the tx_pkt_prepare callback to reject potentially invalid packets before they are dropped in the transmission path. Before a recently introduced patch, the GVE behavior was to stop transmitting at the first invalid packet, which would allow the application to do any necessary linearization or packet modification before attempting to transmit again. It turns out that that behavior is considered incorrect, so offer tx_pkt_prepare as an alternative.
Changes in v3:
- Remove extraneous Fixes tags.
- Drop patch 2 allowing multi-segment HEADERS, since that conflicts with tx_pkt_prepare.
Changes in v2:
- Rely on tx_pkt->nb_segs for descriptor limit calculation only as a precursor, falling back to the traditional gve_tx_pkt_nb_data_descs() if that optimization fails.
- Only call rte_net_intel_cksum_preapre on TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
- Introduce new patch to validate minimum header length
Joshua Washington (3):
net/gve: fix TSO segment offset calculation net/gve: introduce Tx packet preparation for DQO format net/gve: validate minimum header length for TSO packets
drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_ethdev.h | 3 + drivers/net/gve/gve_tx_dqo.c | 86 +++++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 5 deletions(-)
Signature · 1 line
2.56.0.385.gac671c819a-goog
PATCH v3 1/3 net/gve: fix TSO segment offset calculation
The descriptor limit validation for TSO packets was erroneously computing the TSO segment offset at the end of an mbuf. The first bytes of any mbuf will be included as part of the previous TSO segment which has not yet been completed, as indicated by seg_remain. Subtract those seg_remain bytes from the mbuf length before computing the segment offset.
Visual representation:
Before:
------------------------------------------------------------------
| tso_ | tso_ | tso_ | tso_ | tso_ | | segsz | segsz | segsz | segsz | segsz |
------------------------------------------------------------------
| 16K | 16K | |
------------------------------------------------------------------
After:
------------------------------------------------------------------
|rem | tso_ | tso_ | tso_ | tso_ | seg_ |
|ain | segsz | segsz | segsz | segsz |offset |
------------------------------------------------------------------
| 16K | 16K | |
------------------------------------------------------------------
^
mbuf_remainIn this example, the original code would have found that tso_segsz evenly divides mbuf_len, and that there is no tail to be considered split across two mbufs. So the number of descriptors it would have found would be:
1 (for the headers) +
0 (no segment offset) +
0 (mbuf_remain cannot be less than 0)
For a total of one descriptor counted in num_descs for the start of the current TSO segment.
Meanwhile, the reality would be:
1 (for the headers) +
1 (seg_offset != 0) +
1 (mbuf_remain < seg_offset)
For a total of 3 descriptors counted against the descriptor limit.
This undercount can cause TSO segments to incorrectly cross up to two extra descriptors more than the hardware limit, leading to the datapath being disabled.
--- drivers/net/gve/gve_tx_dqo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gve/gve_tx_dqo.c +1 -1
@@ -191,7 +191,7 @@ gve_tx_validate_descs(const struct gve_tx_queue *txq, struct rte_mbuf *tx_pkt,return false;if (seg_remain < mbuf_len) { - seg_offset = mbuf_len % tso_segsz; + seg_offset = (mbuf_len - seg_remain) % tso_segsz;/* The MSS is bound from above by 9728B, so a * single TSO segment in the middle of an mbuf * will be part of at most two descriptors, and
Signature · 1 line
2.56.0.385.gac671c819a-goog
PATCH v3 2/3 net/gve: introduce Tx packet preparation for DQO format
In reply to Joshua WashingtonBefore this patch, packets that are invalid in the DQO format with respect to offloads, descriptor limits, or packet size limits, are dropped by the driver without any form of recourse for the application, potentially leading to a disruption in traffic that can be hard to debug.
Introduce tx_pkt_prepare for the DQ queue format to avoid dropping packets without first giving the application a way to know that they are invalid. For TSO packets, this method also computes the TCP pseudo-header for packets with checksum offloading enabled. Note that in this case, such packets must have L2/L3/L4 headers in the same mbuf segment to pass tx_pkt_prepare.
---
Changes in v2:
- Rely on tx_pkt->nb_segs for descriptor limit calculation only as a precursor, falling back to the traditional gve_tx_pkt_nb_data_descs() if that optimization fails.
- Only call rte_net_intel_cksum_preapre on TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
--- drivers/net/gve/gve_ethdev.h | 3 ++ drivers/net/gve/gve_tx_dqo.c | 79 +++++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-)
drivers/net/gve/gve_ethdev.h +3 -0
@@ -651,6 +651,9 @@ gve_rx_burst_dqo(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);uint16_t gve_tx_burst_dqo (void *txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t +gve_tx_pkt_prepare_dqo (void *txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +void gve_set_rx_function_dqo (struct rte_eth_dev *dev);
drivers/net/gve/gve_tx_dqo.c +77 -2
107 lines not on this page · raw message
Signature · 1 line
2.56.0.385.gac671c819a-goog
PATCH v3 3/3 net/gve: validate minimum header length for TSO packets
In reply to Joshua WashingtonIn addition to the limits added in commit03b62d39c1c8 ("net/gve: enforce DQO TSO header and length limits"), TSO packets also have a minimum header length of 16B. Enforce this limit as well.
--- drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_tx_dqo.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/gve/base/gve_desc_dqo.h +1 -0
@@ -14,6 +14,7 @@#define GVE_TX_MIN_TSO_MSS_DQO 88#define GVE_TX_MIN_PKT_SIZE_DQO 17#define GVE_TX_MAX_PKT_SIZE_DQO 9728 +#define GVE_TX_MIN_TSO_HDR_LEN_DQO 16#define GVE_TX_MAX_TSO_LEN_DQO ((256 * 1024) - 1)/* Basic TX descriptor (DTYPE 0x0C) */
drivers/net/gve/gve_tx_dqo.c +3 -2
@@ -139,8 +139,9 @@ gve_tx_validate_pkt_limits(const struct rte_mbuf *tx_pkt, bool is_tso)* contained in the first segment; the payload must not be empty. */ headlen = tx_pkt->l2_len + tx_pkt->l3_len + tx_pkt->l4_len; -if (tx_pkt->l4_len ==0 || headlen >GVE_TX_MAX_HDR_SIZE_DQO || - tx_pkt->data_len < headlen || tx_pkt->pkt_len <= headlen) +if (tx_pkt->l4_len ==0 || headlen <GVE_TX_MIN_TSO_HDR_LEN_DQO || + headlen >GVE_TX_MAX_HDR_SIZE_DQO || tx_pkt->data_len < headlen || + tx_pkt->pkt_len <= headlen)return false; return tx_pkt->pkt_len - headlen <= GVE_TX_MAX_TSO_LEN_DQO &&
Signature · 1 line
2.56.0.385.gac671c819a-goog
Quoted 32 lines · On Tue, 3 Nov 2026 10:14:39 -0800 Joshua Washington <[email protected]>…
https://inbox.dpdk.org/dev/[email protected]/
introduced descriptor limit checks for TSO packets in DPDK. Unfortunately, a couple of bugs have been found in the implementation.This patch series introduces fixes for those bugs and adds support for the
tx_pkt_preparecallback to reject potentially invalid packets before they are dropped in the transmission path. Before a recently introduced patch, the GVE behavior was to stop transmitting at the first invalid packet, which would allow the application to do any necessary linearization or packet modification before attempting to transmit again. It turns out that that behavior is considered incorrect, so offertx_pkt_prepareas an alternative.Changes in v3:
- Remove extraneous Fixes tags.
- Drop patch 2 allowing multi-segment HEADERS, since that conflicts withtx_pkt_prepare.Changes in v2:
- Rely ontx_pkt->nb_segsfor descriptor limit calculation only as a precursor, falling back to the traditionalgve_tx_pkt_nb_data_descs()if that optimization fails.
- Only callrte_net_intel_cksum_preapreon TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
- Introduce new patch to validate minimum header lengthJoshua Washington (3):
net/gve: fix TSO segment offset calculation net/gve: introduce Tx packet preparation for DQO format net/gve: validate minimum header length for TSO packets
Quoted 4 lines
drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_ethdev.h | 3 + drivers/net/gve/gve_tx_dqo.c | 86 +++++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 5 deletions(-)
Looks good will pick it up next week.
AI found some dead code.
Review: [PATCH v3 0/3] net/gve: DQO TSO validation fixes
Applied to next-net (339c992f25) with no conflicts. Each commit builds with -Dwerror=true.
v3 drops the multi-mbuf header patch and keeps the data_len >= headlen check. That resolves both v2 warnings.
Patch 2/3: net/gve: introduce Tx packet preparation for DQO format
Info: the csum test is dead code. GVE_TX_CKSUM_OFFLOAD_MASK_DQO includes RTE_MBUF_F_TX_TCP_SEG through GVE_TX_CKSUM_OFFLOAD_MASK, so "csum && tso" is just "tso". Simplify to:
if (tso) {
err = rte_net_intel_cksum_prepare(tx_pkt);
if (err != 0) {
rte_errno = -err;
return i;
}
}The commit message should then say that the pseudo-header is seeded for all TSO packets, not "for packets with checksum offloading enabled".
Quoted 32 lines · On Tue, 3 Nov 2026 10:14:39 -0800 Joshua Washington <[email protected]>…
https://inbox.dpdk.org/dev/[email protected]/
introduced descriptor limit checks for TSO packets in DPDK. Unfortunately, a couple of bugs have been found in the implementation.This patch series introduces fixes for those bugs and adds support for the
tx_pkt_preparecallback to reject potentially invalid packets before they are dropped in the transmission path. Before a recently introduced patch, the GVE behavior was to stop transmitting at the first invalid packet, which would allow the application to do any necessary linearization or packet modification before attempting to transmit again. It turns out that that behavior is considered incorrect, so offertx_pkt_prepareas an alternative.Changes in v3:
- Remove extraneous Fixes tags.
- Drop patch 2 allowing multi-segment HEADERS, since that conflicts withtx_pkt_prepare.Changes in v2:
- Rely ontx_pkt->nb_segsfor descriptor limit calculation only as a precursor, falling back to the traditionalgve_tx_pkt_nb_data_descs()if that optimization fails.
- Only callrte_net_intel_cksum_preapreon TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
- Introduce new patch to validate minimum header lengthJoshua Washington (3):
net/gve: fix TSO segment offset calculation net/gve: introduce Tx packet preparation for DQO format net/gve: validate minimum header length for TSO packets
Quoted 4 lines
drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_ethdev.h | 3 + drivers/net/gve/gve_tx_dqo.c | 86 +++++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 5 deletions(-)
Ready for next-net but AI review found some dead code. Could you test that assumption and send new version.
Review: [PATCH v3 0/3] net/gve: DQO TSO validation fixes
Applied to next-net (339c992f25) with no conflicts. Each commit builds with -Dwerror=true.
v3 drops the multi-mbuf header patch and keeps the data_len >= headlen check. That resolves both v2 warnings.
Patch 2/3: net/gve: introduce Tx packet preparation for DQO format
Info: the csum test is dead code. GVE_TX_CKSUM_OFFLOAD_MASK_DQO includes RTE_MBUF_F_TX_TCP_SEG through GVE_TX_CKSUM_OFFLOAD_MASK, so "csum && tso" is just "tso". Simplify to:
if (tso) {
err = rte_net_intel_cksum_prepare(tx_pkt);
if (err != 0) {
rte_errno = -err;
return i;
}
}The commit message should then say that the pseudo-header is seeded for all TSO packets, not "for packets with checksum offloading enabled".
Quoted 36 lines · Stephen Hemminger
Quoted 32 lines · On Tue, 3 Nov 2026 10:14:39 -0800 Joshua Washington <[email protected]>…
https://inbox.dpdk.org/dev/[email protected]/
introduced descriptor limit checks for TSO packets in DPDK. Unfortunately, a couple of bugs have been found in the implementation.This patch series introduces fixes for those bugs and adds support for the
tx_pkt_preparecallback to reject potentially invalid packets before they are dropped in the transmission path. Before a recently introduced patch, the GVE behavior was to stop transmitting at the first invalid packet, which would allow the application to do any necessary linearization or packet modification before attempting to transmit again. It turns out that that behavior is considered incorrect, so offertx_pkt_prepareas an alternative.Changes in v3:
- Remove extraneous Fixes tags.
- Drop patch 2 allowing multi-segment HEADERS, since that conflicts withtx_pkt_prepare.Changes in v2:
- Rely ontx_pkt->nb_segsfor descriptor limit calculation only as a precursor, falling back to the traditionalgve_tx_pkt_nb_data_descs()if that optimization fails.
- Only callrte_net_intel_cksum_preapreon TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
- Introduce new patch to validate minimum header lengthJoshua Washington (3):
net/gve: fix TSO segment offset calculation net/gve: introduce Tx packet preparation for DQO format net/gve: validate minimum header length for TSO packets
Quoted 7 lines
Quoted 4 lines
drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_ethdev.h | 3 + drivers/net/gve/gve_tx_dqo.c | 86 +++++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 5 deletions(-)Ready for next-net but AI review found some dead code. Could you test that assumption and send new version.
Ah, I had confirmed that the code was dead, but was under the impression that the patch would be merge as-is given that the issue is mostly cosmetic, so I didn't send a new revision. I can send up a new revision now.
Quoted 30 lines
Review: [PATCH v3 0/3] net/gve: DQO TSO validation fixes
Applied to next-net (
339c992f25) with no conflicts. Each commit builds with -Dwerror=true.v3 drops the multi-mbuf header patch and keeps the
data_len>= headlen check. That resolves both v2 warnings.Patch 2/3: net/gve: introduce Tx packet preparation for DQO format
Info: the csum test is dead code.
GVE_TX_CKSUM_OFFLOAD_MASK_DQOincludesRTE_MBUF_F_TX_TCP_SEGthroughGVE_TX_CKSUM_OFFLOAD_MASK, so "csum && tso" is just "tso". Simplify to:if (tso) { err = rte_net_intel_cksum_prepare(tx_pkt); if (err != 0) { rte_errno = -err; return i; } }The commit message should then say that the pseudo-header is seeded for all TSO packets, not "for packets with checksum offloading enabled".
Reviewed-by Stephen Hemminger <[email protected]>
v4 cover net/gve: TSO descriptor count fixes for GVE DQO
In reply to Joshua Washingtonhttps://inbox.dpdk.org/dev/[email protected]/
introduced descriptor limit checks for TSO packets in DPDK. Unfortunately, a couple of bugs have been found in the implementation.
This patch series introduces fixes for those bugs and adds support for the tx_pkt_prepare callback to reject potentially invalid packets before they are dropped in the transmission path. Before a recently introduced patch, the GVE behavior was to stop transmitting at the first invalid packet, which would allow the application to do any necessary linearization or packet modification before attempting to transmit again. It turns out that that behavior is considered incorrect, so offer tx_pkt_prepare as an alternative.
Changes in v4:
- Remove unnecessary checksum check when TSO is enabled.
Changes in v3:
- Remove extraneous Fixes tags.
- Drop patch 2 allowing multi-segment HEADERS, since that conflicts with tx_pkt_prepare.
Changes in v2:
- Rely on tx_pkt->nb_segs for descriptor limit calculation only as a precursor, falling back to the traditional gve_tx_pkt_nb_data_descs() if that optimization fails.
- Only call rte_net_intel_cksum_preapre on TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
- Introduce new patch to validate minimum header length
Joshua Washington (3):
net/gve: fix TSO segment offset calculation net/gve: introduce Tx packet preparation for DQO format net/gve: validate minimum header length for TSO packets
drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_ethdev.h | 3 ++ drivers/net/gve/gve_tx_dqo.c | 84 +++++++++++++++++++++++++++-- 3 files changed, 83 insertions(+), 5 deletions(-)
Signature · 1 line
2.56.0.542.g3ef89b7020-goog
PATCH v4 1/3 net/gve: fix TSO segment offset calculation
The descriptor limit validation for TSO packets was erroneously computing the TSO segment offset at the end of an mbuf. The first bytes of any mbuf will be included as part of the previous TSO segment which has not yet been completed, as indicated by seg_remain. Subtract those seg_remain bytes from the mbuf length before computing the segment offset.
Visual representation:
Before:
------------------------------------------------------------------
| tso_ | tso_ | tso_ | tso_ | tso_ | | segsz | segsz | segsz | segsz | segsz |
------------------------------------------------------------------
| 16K | 16K | |
------------------------------------------------------------------
After:
------------------------------------------------------------------
|rem | tso_ | tso_ | tso_ | tso_ | seg_ |
|ain | segsz | segsz | segsz | segsz |offset |
------------------------------------------------------------------
| 16K | 16K | |
------------------------------------------------------------------
^
mbuf_remainIn this example, the original code would have found that tso_segsz evenly divides mbuf_len, and that there is no tail to be considered split across two mbufs. So the number of descriptors it would have found would be:
1 (for the headers) +
0 (no segment offset) +
0 (mbuf_remain cannot be less than 0)
For a total of one descriptor counted in num_descs for the start of the current TSO segment.
Meanwhile, the reality would be:
1 (for the headers) +
1 (seg_offset != 0) +
1 (mbuf_remain < seg_offset)
For a total of 3 descriptors counted against the descriptor limit.
This undercount can cause TSO segments to incorrectly cross up to two extra descriptors more than the hardware limit, leading to the datapath being disabled.
--- drivers/net/gve/gve_tx_dqo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gve/gve_tx_dqo.c +1 -1
@@ -191,7 +191,7 @@ gve_tx_validate_descs(const struct gve_tx_queue *txq, struct rte_mbuf *tx_pkt,return false;if (seg_remain < mbuf_len) { - seg_offset = mbuf_len % tso_segsz; + seg_offset = (mbuf_len - seg_remain) % tso_segsz;/* The MSS is bound from above by 9728B, so a * single TSO segment in the middle of an mbuf * will be part of at most two descriptors, and
Signature · 1 line
2.56.0.542.g3ef89b7020-goog
PATCH v4 2/3 net/gve: introduce Tx packet preparation for DQO format
In reply to Joshua WashingtonBefore this patch, packets that are invalid in the DQO format with respect to offloads, descriptor limits, or packet size limits, are dropped by the driver without any form of recourse for the application, potentially leading to a disruption in traffic that can be hard to debug.
Introduce tx_pkt_prepare for the DQ queue format to avoid dropping packets without first giving the application a way to know that they are invalid. For TSO packets, this method also computes the TCP pseudo-header for packets with checksum offloading enabled. Note that in this case, such packets must have L2/L3/L4 headers in the same mbuf segment to pass tx_pkt_prepare.
---
Changes in v4:
- Remove dead checksum check, as checksum offloading is enabled by default when TSO is enabled.
Changes in v2:
- Rely on tx_pkt->nb_segs for descriptor limit calculation only as a precursor, falling back to the traditional gve_tx_pkt_nb_data_descs() if that optimization fails.
- Only call rte_net_intel_cksum_preapre on TSO packets that request checksum offloading. This enforces the additional requirement that headers are all in the same mbuf segment.
--- drivers/net/gve/gve_ethdev.h | 3 ++ drivers/net/gve/gve_tx_dqo.c | 77 +++++++++++++++++++++++++++++++++++- 2 files changed, 78 insertions(+), 2 deletions(-)
drivers/net/gve/gve_ethdev.h +3 -0
@@ -651,6 +651,9 @@ gve_rx_burst_dqo(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);uint16_t gve_tx_burst_dqo (void *txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t +gve_tx_pkt_prepare_dqo (void *txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +void gve_set_rx_function_dqo (struct rte_eth_dev *dev);
drivers/net/gve/gve_tx_dqo.c +75 -2
105 lines not on this page · raw message
Signature · 1 line
2.56.0.542.g3ef89b7020-goog
PATCH v4 3/3 net/gve: validate minimum header length for TSO packets
In reply to Joshua WashingtonIn addition to the limits added in commit03b62d39c1c8 ("net/gve: enforce DQO TSO header and length limits"), TSO packets also have a minimum header length of 16B. Enforce this limit as well.
--- drivers/net/gve/base/gve_desc_dqo.h | 1 + drivers/net/gve/gve_tx_dqo.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/gve/base/gve_desc_dqo.h +1 -0
@@ -14,6 +14,7 @@#define GVE_TX_MIN_TSO_MSS_DQO 88#define GVE_TX_MIN_PKT_SIZE_DQO 17#define GVE_TX_MAX_PKT_SIZE_DQO 9728 +#define GVE_TX_MIN_TSO_HDR_LEN_DQO 16#define GVE_TX_MAX_TSO_LEN_DQO ((256 * 1024) - 1)/* Basic TX descriptor (DTYPE 0x0C) */
drivers/net/gve/gve_tx_dqo.c +3 -2
@@ -139,8 +139,9 @@ gve_tx_validate_pkt_limits(const struct rte_mbuf *tx_pkt, bool is_tso)* contained in the first segment; the payload must not be empty. */ headlen = tx_pkt->l2_len + tx_pkt->l3_len + tx_pkt->l4_len; -if (tx_pkt->l4_len ==0 || headlen >GVE_TX_MAX_HDR_SIZE_DQO || - tx_pkt->data_len < headlen || tx_pkt->pkt_len <= headlen) +if (tx_pkt->l4_len ==0 || headlen <GVE_TX_MIN_TSO_HDR_LEN_DQO || + headlen >GVE_TX_MAX_HDR_SIZE_DQO || tx_pkt->data_len < headlen || + tx_pkt->pkt_len <= headlen)return false; return tx_pkt->pkt_len - headlen <= GVE_TX_MAX_TSO_LEN_DQO &&
Signature · 1 line
2.56.0.542.g3ef89b7020-goog