On Thu,  3 Dec 2026 15:26:23 -0800
Joshua Washington <[email protected]> wrote:

> This patch series collects 11 bug fixes followed by DQO scattered Rx
> support for the GVE PMD:
> 
> Fixes (patches 01-11):
> - Disable per-queue start/stop ops until individual queue lifecycle
>   commands are supported, preventing device/driver ring desync.
> - Free partially received GQI Rx chains on queue teardown and avoid
>   allocating an extra unposted mbuf in GQI Rx queue setup.
> - Guard against integer underflow in GQI Rx when frag_size < GVE_RX_PAD
>   and against integer truncation / descriptor bounds violations in GQI
>   QPL Tx.
> - Stop counting normal ring-exhaustion backpressure as oerrors in DQO
>   Tx.
> - Disable unsupported TCP LRO/RSC offload and drop multi-segment Rx
>   packets when scatter is disabled in DQO.
> - Reject non-power-of-2 ring sizes in DQO Rx/Tx setup.
> - Handle RSS allocation failures cleanly without corrupting cached state.
> - Reject unsupported flow attributes and item masks.
> 
> Feature (patch 12):
> - Add scattered Rx offload support for the DQO descriptor format.

Lots of feedback from AI review pass.

Review of "net/gve" series (12 patches), applied on top of 27.03-rc0.
Patches 04, 07, 08 and 12 need next-net context; hunks were adjusted
to apply here.  All 12 commits build with -Dwerror=true.

Errors
======

Patch 07/12, 12/12: rxq->scatter is stale after reconfigure

rxq->scatter is latched at Rx queue setup:

  gve_rx.c:
        rxq->scatter = !!(offloads & RTE_ETH_RX_OFFLOAD_SCATTER);
  gve_rx_dqo.c:
        rxq->scatter = !!(offloads & RTE_ETH_RX_OFFLOAD_SCATTER);

rte_eth_dev_configure() may run again on a stopped port with
different Rx offloads, and eth_dev_rx_queue_config() only releases
queues above the new count, so queues set up earlier survive with
the old flag.  gve_dev_configure() updates dev->data->scattered_rx
from the new port offloads, but nothing updates rxq->scatter.

configure(no SCATTER), rx_queue_setup, configure(SCATTER), start:
the port has scatter on, rxq->scatter is false, and every chained
frame is dropped and counted as an Rx error:

  gve_rx_dqo.c, gve_rx_seg_invalid_dqo():
        bool unexpected_multiseg = is_first_seg && !is_eop && !rxq->scatter;
  gve_rx.c, gve_rx():
        if (unlikely(is_first_frag && !is_last_frag && !rxq->scatter)) {

gve_rx_check_scatter() returns 0 at its first test in this case, so
the mismatch is never noticed.  In the other order the flag stays
true and GQI hands multi-segment mbufs to an application that
disabled the offload, since that function only re-validates the
buffer size.

The comment 12/12 adds to gve_dev_start() already describes this
sequence ("keeps Rx queues already set up, so check them again"), so
refresh the flag there as well:

        for (i = 0; i < dev->data->nb_rx_queues; i++) {
                struct gve_rx_queue *rxq = dev->data->rx_queues[i];

                if (rxq != NULL)
                        rxq->scatter = !!(dev->data->dev_conf.rxmode.offloads &
                                          RTE_ETH_RX_OFFLOAD_SCATTER);
        }

Warnings
========

Patch 07/12: rxm dereferenced without the NULL check added alongside

        if (unlikely(rxq->ctx.drop_pkt)) {
                if (rxm != NULL)
                        rte_pktmbuf_free(rxm);
        ...
        frag_len = rte_le_to_cpu_16(rx_desc->packet_len);
        rxm->data_len = frag_len;

sw_ring[rx_buf_id] is cleared as soon as a completion consumes it and
is only repopulated by gve_rx_refill_dqo() at the end of the burst, so
a buf_id repeated within one burst yields rxm == NULL with drop_pkt
false.  gve_completed_buf_list_push() also runs twice for that id,
leaving completed_buf_list[id] == id, which makes
gve_completed_buf_list_pop() hand out the same id indefinitely.  Make
the two paths agree:

        } else {
                rxm = rxq->sw_ring[rx_buf_id];
                if (unlikely(rxm == NULL)) {
                        PMD_DRV_DP_LOG(ERR, "Duplicate rx_buf_id %u on queue 
%u",
                                       rx_buf_id, rxq->queue_id);
                        if (!rxq->ctx.drop_pkt) {
                                rxq->stats.errors++;
                                rxq->ctx.drop_pkt = true;
                        }
                } else {
                        ...
                }
        }

Patch 07/12: duplicate cleanup in gve_release_rxq_mbufs()

02/12 already adds the free and clear at the top of the function.
07/12 adds the same pair again after the loop, so the series ends with:

        rte_pktmbuf_free(rxq->ctx.mbuf_head);
        gve_rx_ctx_clear(&rxq->ctx);

        for (i = 0; i < rxq->nb_rx_desc; i++) {
        ...
        }

        if (rxq->ctx.mbuf_head != NULL)
                rte_pktmbuf_free(rxq->ctx.mbuf_head);
        gve_rx_ctx_clear(&rxq->ctx);

The first clear NULLs mbuf_head, so the second pair is dead rather
than a double free.  Drop the hunk from 07/12.

Patch 10/12: documented full-match restriction is still unenforced

gve_flow_mask_is_supported() only rejects bits outside the item's
default mask:

                if ((m[i] & ~s[i]) != 0)
                        return false;

A partial mask on a field gve does support passes.  Both port bytes of
rte_flow_item_udp_mask are set, so mask->hdr.src_port = 0x00ff is
accepted, and

                rule->mask.src_port = mask->hdr.src_port;

is copied verbatim into the AdminQ command by
gve_adminq_add_flow_rule().
gve.rst states "Masking is limited to full matches i.e. 0x00...0 or
0xFF...F" and the commit message says masks are validated against
each protocol's supported fields.  Either check each
supported field, e.g.

        if ((mask->hdr.src_port != 0 && mask->hdr.src_port != UINT16_MAX) ||
            (mask->hdr.dst_port != 0 && mask->hdr.dst_port != UINT16_MAX))
                return reject;

or drop the claim from the documentation.

Info
====

Patch 07/12: DQO Rx queue setup is unusable on a jumbo VPC until 12/12

        if (gve_rx_dqo_needs_scatter(hw->max_mtu, rx_buf_len)) {
                return -EINVAL;

With a 2 KB mbuf pool rx_buf_len is 1920, so any max_mtu above 1906
fails setup unconditionally.  12/12 makes the test conditional on the
scatter offload.  Both commits build, so bisect is safe, but a bisect
landing in 07..11 has no working DQO configuration on such a VPC.
Folding the condition into 07/12 avoids that.

Patch 12/12: RTE_MAX() is dead for DQO

        check_mtu = gve_is_gqi(priv) ? mtu : RTE_MAX(mtu, priv->max_mtu);

rte_eth_dev_configure() and gve_dev_mtu_set() both reject an MTU above
priv->max_mtu, so the DQO arm always yields priv->max_mtu and the mtu
argument is unused there.  Using priv->max_mtu directly also makes the
log line read as the device maximum rather than the requested MTU.

Patch 12/12: frag_len is not checked against rx_buf_len

        frag_len = rte_le_to_cpu_16(rx_desc->packet_len);
        rxm->data_len = frag_len;

packet_len is a 14-bit field, so it can exceed rx_buf_len, giving a
segment whose data_len is larger than its buffer; the head's pkt_len
then accumulates that across the chain.  Pre-existing for the single
segment case, but 12/12 extends it to chains.  Folding the test into
gve_rx_seg_invalid_dqo() would cover both.

Patch 07/12: DQO drop state needs an end-of-packet to clear

        if (is_eop)
                gve_rx_ctx_clear(&rxq->ctx);

drop_pkt now persists across bursts and is cleared only on an
end-of-packet completion, so a chain that never carries one leaves the
queue dropping every later completion until it is stopped and started.
Bounding it on the number of fragments dropped, rather than on EOP
alone, would make it self-recovering.

Patch 09/12: gve_init_rss_config() error path leaves a dangling key

        if (!gve_rss_conf->indir) {
                err = -ENOMEM;
                goto err_with_key;
        }
        ...
  err_with_key:
        rte_free(gve_rss_conf->key);
        return err;

key is freed but not NULLed, and key_size and indir_size keep the
values assigned above.  Every current caller lets the local struct die
on that path, so nothing dereferences it; pre-existing, not introduced
here, but it is the remaining hole in the area this patch tightens.

Reply via email to