From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A93FDA0524; Thu, 4 Feb 2021 09:52:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3415F2405BE; Thu, 4 Feb 2021 09:52:44 +0100 (CET) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mails.dpdk.org (Postfix) with ESMTP id 69B912405BA for ; Thu, 4 Feb 2021 09:52:43 +0100 (CET) Received: by mail-lj1-f180.google.com with SMTP id v15so2386179ljk.13 for ; Thu, 04 Feb 2021 00:52:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FGjNkDW+C3TOseQVxDaWFySXgTSFlY60q7F1m4RTlK4=; b=wgQMeVDAULKXhQvV1xtkL76beV9Q6q+bgPgzEJPzW9TGoTRevU/oQuNoK8xkIOe7rs xlKus5DEw2aCfk1EC82HnpH0dbkTwlLSioqfyu4keguPYVEOqZcYxDTIrY/CW/cpCbzF xNM3YL+MeQ2c9qLrppddb+/xjSgFsqGDIMJgciSv6rNXKew7oGbVypDXi+yump7p5uKD +Lvb+h2k6aRlNhBttIIzgbZ2GL6pn+iYn6xvVjcOftU7vHnxqrurdKJl5z7Wsn702n4Z uszbU4CkcWR8yvOzSsgTpwmnCeG0xerh7u4oGzC6N7VUtIcvWtEWmE7IA+D2QeXoOoQR FgYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FGjNkDW+C3TOseQVxDaWFySXgTSFlY60q7F1m4RTlK4=; b=drNUtgPm+2bA0/m3C9zVZ1sFMA8+4sBFaFnPxUBqcJsQwrHzxHK74qzHVsOPMk0f1S 5T+om0jiKo73bRWD6IopK7DdItaHcW/BdzFCcD8wUEvyVO4FKrEfHOXjOXVrQcepjpc5 5uLHIhPvoEu6kMGeBNJuegYd5mNz/eHU5zQC0MS1bygVdRXpYZ7hEQXdFphTd8WELtF9 2ejatbi9xofmu0UFJXuWP6S7f8FtjGh9TdkIYTIzCZgB1qS7XEfD912HhGb6l+JrIksg DJNBTpw91Hmym5iWFETXdFC94FpALlYh4nFgubcPagjl7zoJEPlViiz3h21KFOSa0Po+ FZlA== X-Gm-Message-State: AOAM530umj4E9akOGSdJrFtOvCupLU9S7de6iDbrlarl223Uj/zgA7vm 9yKL6c++Ly6GMHp2WXNk43H26HeOfWLMqA== X-Google-Smtp-Source: ABdhPJy4yO6/wFbIYEzFzzHEmunzZvmKxOSQWUbVJlfBSY+e8umuweZAPFnESBbT4c0FOOKBgEAXlw== X-Received: by 2002:a2e:b04e:: with SMTP id d14mr4198886ljl.414.1612428762518; Thu, 04 Feb 2021 00:52:42 -0800 (PST) Received: from mkPC.int.semihalf.com (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id l6sm578235lje.6.2021.02.04.00.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 00:52:41 -0800 (PST) From: Michal Krawczyk To: dev@dpdk.org, keith.wiles@intel.com Cc: igorch@amazon.com, Michal Krawczyk Date: Thu, 4 Feb 2021 09:52:09 +0100 Message-Id: <20210204085209.2716232-1-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] Fix loss of data stored in udata64 mbuf field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Igor Chauskin --- 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