On Mon,  2 Feb 2026 00:14:56 -0800
[email protected] wrote:

> +     if (copy) {
> +             /*
> +              * Copy headers to new segment to handle indirect mbufs.
> +              * This ensures we can safely modify checksums without
> +              * corrupting shared/read-only data.
> +              */
> +             struct rte_mbuf *seg = rte_pktmbuf_copy(mbuf, mbuf->pool, 0, 
> hdrlens);
> +             if (!seg)
> +                     return NULL;
> +
> +             rte_pktmbuf_adj(mbuf, hdrlens);
> +             rte_pktmbuf_chain(seg, mbuf);
> +             mbuf = seg;
> +     } else if (unlikely(!RTE_MBUF_DIRECT(mbuf) || 
> rte_mbuf_refcnt_read(mbuf) > 1))
> +             return NULL;

Maybe just rte_pkmbuf_read() helper that already handles the case of getting
the header if needed.

Reply via email to