[PATCH dpdk v2] net/tap: use offsets provided by rte_net_get_ptype

Stephen Hemminger stephen at networkplumber.org
Tue Apr 28 15:36:06 CEST 2026


On Mon, 27 Apr 2026 12:41:53 +0200
Robin Jarry <rjarry at redhat.com> wrote:

> Instead of guessing what are the proper header lengths, pass
> a rte_net_hdr_lens struct to rte_net_get_ptype and use it to get the
> proper header lengths/offsets in tap_verify_csum.
> 
> This allows supporting stacked VLAN/QinQ tags and IPv6 extensions.
> 
> Signed-off-by: Robin Jarry <rjarry at redhat.com>
> ---

AI review spotted some things.
But it looks like more of a bug in rte_net_get_ptype

Now let me check the upstream source for the IPv6 header context:Found the bug. Let me verify the IPv6 payload_len semantics:That confirms the bug. `payload_len` is documented as "IP payload size, including ext. headers" — exactly what I needed.

---

**Review of [PATCH dpdk v2] net/tap: use offsets provided by rte_net_get_ptype**

Error:

The IPv6 packet length check double-counts extension header bytes.
`rte_ipv6_hdr.payload_len` is defined as "IP payload size, including
ext. headers" (rte_ip6.h:487), meaning it already includes extension
header bytes counted from just after the 40-byte fixed IPv6 header.
But `hlen->l3_len` for `RTE_PTYPE_L3_IPV6_EXT` is set by
`rte_net_get_ptype` to `40 + extension_headers_size` (rte_net.c:439).
Adding them together counts the extension bytes twice:

    if (hlen->l2_len + hlen->l3_len + rte_be_to_cpu_16(iph->payload_len) >
            rte_pktmbuf_data_len(mbuf))
        return;

For any IPv6 packet with extension headers this check will fire
spuriously, causing `tap_verify_csum` to return early without setting
checksum offload flags — the very case this patch is trying to fix.

The pre-existing code was correct: it used
`sizeof(struct rte_ipv6_hdr)` (40) as the L3 term, leaving
`payload_len` to account for extensions. The fix is to keep that
same constant here:

    if (hlen->l2_len + sizeof(struct rte_ipv6_hdr) +
            rte_be_to_cpu_16(iph->payload_len) >
            rte_pktmbuf_data_len(mbuf))
        return;


More information about the dev mailing list