On Thu, 5 Nov 2026 09:31:10 +0200
Maayan Kashani <[email protected]> wrote:
> The csum forwarding engine parses packets with rte_net_get_ptype(),
> which recognizes VXLAN-GPE and GENEVE tunnels only on their default UDP
> ports. Since the switch to that API, --vxlan-gpe-port and
> --geneve-parsed-port no longer take effect: a packet whose outer UDP
> destination port matches a configured non-default port is not detected
> as a tunnel, so tunnel Tx flags, outer checksum handling and tunnel TSO
> are skipped.
>
> When parse-tunnel is enabled and the outer UDP port matches one of those
> options, temporarily present the corresponding default port to
> rte_net_get_ptype() and restore the original port afterwards. This reuses
> the existing parser without a new library API. Plain VXLAN is unchanged:
> the csum engine has always recognized it only on RTE_VXLAN_DEFAULT_PORT,
> and rx_vxlan_port configures the device filter rather than this parser.
>
> Only process inner checksums when the parser identified an inner IP
> header and all declared inner headers fit in the packet. This preserves
> tunnel forwarding for valid non-IP payloads and avoids accessing
> truncated inner headers on both default and configured tunnel ports.
>
> Fixes: 76730c7b9b5a ("app/testpmd: use packet type parsing API")
> Cc: [email protected]
>
> Signed-off-by: Maayan Kashani <[email protected]>
> ---
AI review (run manually with claude) sees a problem here.
Subject: Re: [PATCH] app/testpmd: fix VXLAN-GPE and GENEVE custom port parsing
Applied to main (v26.11-rc2), testpmd builds with -Dwerror=true.
Fixes: tag checked, 76730c7b9b5a is in v25.03, so Cc stable is right.
Warning
can_process_inner_headers() checks the wrong length:
return rte_pktmbuf_pkt_len(m) >= headers_len;
Everything after this check reaches the inner headers through a pointer
into the first segment. l3_hdr is built from eth_hdr (mtod), and
process_inner_cksums() then reads and writes ipv4_hdr->hdr_checksum and
udp_hdr->dgram_cksum through it. For a multi-segment mbuf (scatter Rx)
whose first segment ends inside the inner headers, pkt_len passes and
the access still runs past the segment's data. The commit message says
this avoids accessing truncated inner headers. That is only true if
the check matches how the headers are accessed:
return rte_pktmbuf_data_len(m) >= headers_len;
Info
parse_tunnel_udp_custom_port() runs for every non-tunnel UDP packet
when parse-tunnel is on, even when both ports are at their defaults.
It only returns after it reads the UDP header. Bail out first:
if (vxlan_gpe_udp_port == RTE_VXLAN_GPE_DEFAULT_PORT &&
geneve_udp_port == RTE_GENEVE_DEFAULT_PORT)
return ptype;
Before 76730c7b9b5a, --geneve-parsed-port replaced 6081 (old
parse_geneve() compared against geneve_udp_port only), and run_app.rst
still says it "sets" the port. With this patch, 6081 is still parsed
as GENEVE in addition to the configured port. The same applies to
--vxlan-gpe-port and 4790. If additive is intended, update the
run_app.rst text to say so.
Review-Result: WARNING