DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michal Krawczyk <mk@semihalf.com>
To: dev@dpdk.org, keith.wiles@intel.com
Cc: igorch@amazon.com, Michal Krawczyk <mk@semihalf.com>
Subject: [dpdk-dev] [PATCH] Fix loss of data stored in udata64 mbuf field
Date: Thu,  4 Feb 2021 09:52:09 +0100	[thread overview]
Message-ID: <20210204085209.2716232-1-mk@semihalf.com> (raw)

DPDK v20.11 removed udata64 field, and changed type of the dynfield1 to
uint32_t.

Due to define:
  lib/common/pg_compat.h:#define udata64                 dynfield1[0]
the copy of udata64 was in fact copying only the first 32 bits.

Using udata64 as an address is ok, as it will point to the beginning of
the dynfield1 array.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
---
 lib/common/mbuf.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/common/mbuf.h b/lib/common/mbuf.h
index 2951454..07d97ad 100644
--- a/lib/common/mbuf.h
+++ b/lib/common/mbuf.h
@@ -30,7 +30,11 @@ pktmbuf_reset(struct rte_mbuf *m)
 {
 	union pktgen_data d;
 
-	d.udata = m->udata64;	/* Save the original value */
+	/* Save the original value. As udata64 can be either single field or the
+	 * first value of the 32-bit elements array, the whole memory chunk must
+	 * be converted directly to 64-bit.
+	 */
+	d.udata = *(uint64_t *)(&m->udata64);
 
 	rte_pktmbuf_reset(m);
 
-- 
2.25.1


             reply	other threads:[~2021-02-04  8:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04  8:52 Michal Krawczyk [this message]
2021-02-04  9:01 ` David Marchand
2021-02-04  9:17   ` Michał Krawczyk
2021-02-04  9:35     ` Thomas Monjalon
2021-02-04 12:24 ` [dpdk-dev] [PATCH v2] " Michal Krawczyk

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=20210204085209.2716232-1-mk@semihalf.com \
    --to=mk@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=igorch@amazon.com \
    --cc=keith.wiles@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).