[PATCH v4 4/4] net/af_packet: add software checksum offload support
Stephen Hemminger
stephen at networkplumber.org
Mon Feb 2 18:00:44 CET 2026
On Mon, 2 Feb 2026 00:14:56 -0800
scott.k.mitch1 at gmail.com 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.
More information about the dev
mailing list