All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
To: "Morten Brørup" <mb@smartsharesystems.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH] mbuf: fix packet copy
Date: Sun, 11 Jan 2026 15:19:43 +0000	[thread overview]
Message-ID: <212f88e700fa4a6a97a421cb3b84e03a@huawei.com> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35F6561A@smartserver.smartshare.dk>



> 
> PING for review.
> 
> > From: Morten Brørup [mailto:mb@smartsharesystems.com]
> > Sent: Wednesday, 19 November 2025 13.04
> >
> > Requests for copying the at the end of a packet incorrectly returned
> > NULL,
> > as if copying past the end of a packet.
> >
> > When allocating copies from a mempool using pinned external buffers,
> > the
> > external flag was not preserved in these mbufs.
> >
> > Fixes: c3a90c381daa ("mbuf: add a copy routine")
> >
> > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > ---
> >  lib/mbuf/rte_mbuf.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c
> > index 0d931c7a15..e639aff03e 100644
> > --- a/lib/mbuf/rte_mbuf.c
> > +++ b/lib/mbuf/rte_mbuf.c
> > @@ -675,7 +675,7 @@ rte_pktmbuf_copy(const struct rte_mbuf *m, struct
> > rte_mempool *mp,
> >  	__rte_mbuf_sanity_check(m, 1);
> >
> >  	/* check for request to copy at offset past end of mbuf */
> > -	if (unlikely(off >= m->pkt_len))
> > +	if (unlikely(off > m->pkt_len))
> >  		return NULL;

So, when off= m->pkt_len, what do we want it to return?
New mbuf with pkt_len == 0?
Any point of such copying then? 

> >  	mc = rte_pktmbuf_alloc(mp);
> > @@ -688,8 +688,8 @@ rte_pktmbuf_copy(const struct rte_mbuf *m, struct
> > rte_mempool *mp,
> >
> >  	__rte_pktmbuf_copy_hdr(mc, m);
> >
> > -	/* 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, and preserve flags of
> > newly allocated mbuf */
> > +	mc->ol_flags |= m->ol_flags &
> > ~(RTE_MBUF_F_INDIRECT|RTE_MBUF_F_EXTERNAL);

Which flags in the new mbuf we want to preserve?
AFAIK mbuf_alloc() doesn't set any flags.
BTW, if there are some flags that we would like to preserve,
wouldn't that be a  change in public API behavior?

> >
> >  	prev = &mc->next;
> >  	m_last = mc;
> > --
> > 2.43.0


  reply	other threads:[~2026-01-11 15:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 12:04 [PATCH] mbuf: fix packet copy Morten Brørup
2025-11-24 13:35 ` Morten Brørup
2025-11-28 10:50 ` Morten Brørup
2025-12-18 16:12 ` Morten Brørup
2026-01-03 17:46 ` Morten Brørup
2026-01-11 15:19   ` Konstantin Ananyev [this message]
2026-01-11 17:43     ` Morten Brørup
2026-01-12 10:56       ` Konstantin Ananyev
2026-01-12 10:58   ` Konstantin Ananyev
2026-01-16 11:16 ` [PATCH v2] " Morten Brørup
2026-01-16 17:06   ` Stephen Hemminger
2026-01-16 17:16     ` Morten Brørup
2026-01-16 17:18       ` Stephen Hemminger
2026-01-20  7:24 ` [PATCH v3] " Morten Brørup
2026-02-10 17:21   ` Thomas Monjalon
2026-02-25 15:58     ` Kevin Traynor
2026-02-25 17:17       ` Morten Brørup
2026-02-26 10:01         ` Kevin Traynor
  -- strict thread matches above, loose matches on Subject: below --
2026-01-15 10:53 FW: [PATCH] " Morten Brørup
2026-01-15 13:27 ` Morten Brørup
2026-01-16  5:55 ` Stephen Hemminger
2026-01-16  6:12   ` 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=212f88e700fa4a6a97a421cb3b84e03a@huawei.com \
    --to=konstantin.ananyev@huawei.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=stable@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.