All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: <stephen@networkplumber.org>, <dev@dpdk.org>
Subject: bugs in rte_pktmbuf_copy
Date: Mon, 17 Nov 2025 12:51:51 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65567@smartserver.smartshare.dk> (raw)

While working on a rte_pktmbuf_copy_bulk() function, I noticed a couple of bugs in rte_pktmbuf_copy():

1. If the copy is allocated from a mempool using pinned external buffers, the copy's RTE_MBUF_F_EXTERNAL flag is lost.
This is simple to fix:

-	/* copied mbuf is not indirect or external */
-	mc->ol_flags = m->ol_flags & ~(RTE_MBUF_F_INDIRECT|RTE_MBUF_F_EXTERNAL);
+	/* copy flags except indirect and external */
+	mc->ol_flags |= m->ol_flags & ~(RTE_MBUF_F_INDIRECT|RTE_MBUF_F_EXTERNAL);

2. If the packet is copied with non-zero offset, much of the metadata do not apply to the copy, e.g. many of the offload flags and the packet_type field.
Maybe metadata should be reset when copying with a non-zero offset?
Or maybe rte_pktmbuf_copy() should be considered "payload copy", so the copy should have all metadata reset?


Venlig hilsen / Kind regards,
-Morten Brørup


             reply	other threads:[~2025-11-17 11:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 11:51 Morten Brørup [this message]
2025-11-17 23:43 ` bugs in rte_pktmbuf_copy Stephen Hemminger
2025-11-18  9:16   ` Morten Brørup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35F65567@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.