From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2B14EA00C3;
	Wed, 21 Sep 2022 15:57:04 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id AA08C427F3;
	Wed, 21 Sep 2022 15:56:59 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 0C44A42836
 for <dev@dpdk.org>; Wed, 21 Sep 2022 15:56:57 +0200 (CEST)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28L9oUE1019243;
 Wed, 21 Sep 2022 06:56:53 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=YNeUeH30tkr+BRq4AuIddvsTQcmFFaTITsQkblIdMqI=;
 b=kl3eJ2knzoJ7SF8jxvlIwXGqYkNxat4M5IlpSnbH8J0T47rHl3l+iiSiRb/FruDkCd6p
 iGcG6N+4way4r3+Px4gm1dofYZeVilhSCyDN9F28XOyqf0FIn9d37weWCPgG5IJpmRZf
 Rc2bfNvsv+HcdCifKULsSSVQJVgY2zkksRlQJA7Q0WfLPK2uI9Yv7MhiQc09bxhINL1t
 5K165tAYEkDe5IGPzYSW1WugvxaQM42hFf7xrBzqWASBAn0CU8zd9j7YgIzXbuFLHeBL
 ZLBhqHGZ4+Ys0PgbSJ4AQmdecbzo9/W30k8JvvHCgd1hPCu5yPOEYasT5+vGqGDqglWp yg== 
Received: from dc5-exch02.marvell.com ([199.233.59.182])
 by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3jr0b70s6t-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Wed, 21 Sep 2022 06:56:53 -0700
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;
 Wed, 21 Sep 2022 06:56:52 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Wed, 21 Sep 2022 06:56:52 -0700
Received: from localhost.localdomain (unknown [10.28.34.29])
 by maili.marvell.com (Postfix) with ESMTP id E2A603F7041;
 Wed, 21 Sep 2022 06:56:48 -0700 (PDT)
From: Shijith Thotton <sthotton@marvell.com>
To: <dev@dpdk.org>
CC: <pbhagavatula@marvell.com>, Shijith Thotton <sthotton@marvell.com>,
 <Honnappa.Nagarahalli@arm.com>, <bruce.richardson@intel.com>,
 <jerinj@marvell.com>, <mb@smartsharesystems.com>,
 <olivier.matz@6wind.com>, <stephen@networkplumber.org>,
 <thomas@monjalon.net>, <david.marchand@redhat.com>
Subject: [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build
Date: Wed, 21 Sep 2022 19:26:18 +0530
Message-ID: <cc80e7e37896d5076f6e73f1515558b11dfd7e9c.1663767715.git.sthotton@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <cover.1663767715.git.sthotton@marvell.com>
References: <20220907134340.3629224-1-sthotton@marvell.com>
 <cover.1663767715.git.sthotton@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: DKE44qZ4fg7oIW5m8V0YufjU8qvO3EsL
X-Proofpoint-GUID: DKE44qZ4fg7oIW5m8V0YufjU8qvO3EsL
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1
 definitions=2022-09-21_08,2022-09-20_02,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

mbuf physical address field is not used in builds which only uses VA. It
is used to expand the dynamic field area.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 lib/mbuf/rte_mbuf_core.h | 26 +++++++++++++++++---------
 lib/mbuf/rte_mbuf_dyn.c  |  2 ++
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index c6292e7252..94907f301d 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -579,15 +579,23 @@ struct rte_mbuf {
 	RTE_MARKER cacheline0;
 
 	void *buf_addr;           /**< Virtual address of segment buffer. */
-	/**
-	 * Physical address of segment buffer.
-	 * This field is invalid if the build is configured to use only
-	 * virtual address as IOVA (i.e. RTE_IOVA_AS_VA is 1).
-	 * Force alignment to 8-bytes, so as to ensure we have the exact
-	 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
-	 * working on vector drivers easier.
-	 */
-	rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
+	RTE_STD_C11
+	union {
+		/**
+		 * Physical address of segment buffer.
+		 * This field is invalid if the build is configured to use only
+		 * virtual address as IOVA (i.e. RTE_IOVA_AS_VA is 1).
+		 * Force alignment to 8-bytes, so as to ensure we have the exact
+		 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
+		 * working on vector drivers easier.
+		 */
+		rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
+		/**
+		 * Reserved for dynamic field in builds where physical address
+		 * field is invalid.
+		 */
+		uint64_t dynfield2;
+	};
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
 	RTE_MARKER64 rearm_data;
diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index 4ae79383b5..6a4cf96897 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -128,6 +128,8 @@ init_shared_mem(void)
 		 */
 		memset(shm, 0, sizeof(*shm));
 		mark_free(dynfield1);
+		if (RTE_IOVA_AS_VA)
+			mark_free(dynfield2);
 
 		/* init free_flags */
 		for (mask = RTE_MBUF_F_FIRST_FREE; mask <= RTE_MBUF_F_LAST_FREE; mask <<= 1)
-- 
2.25.1