From: Shijith Thotton <sthotton@marvell.com>
To: <dev@dpdk.org>
Cc: 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>, Dongdong Liu <liudongdong3@huawei.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>
Subject: [PATCH v5 3/7] build: add meson option to configure IOVA mode as PA
Date: Sat, 8 Oct 2022 02:32:07 +0530 [thread overview]
Message-ID: <7b28d7c3ae3470d44336748d97e5ad55d951d0a7.1665176094.git.sthotton@marvell.com> (raw)
In-Reply-To: <cover.1665176094.git.sthotton@marvell.com>
IOVA mode in DPDK is either PA or VA. The new build option
enable_iova_as_pa configures the mode to PA at compile time. By default,
this option is enabled. If the options is disabled, only drivers which
supports it are enabled during build. Supported driver can set the flag
pmd_supports_disable_iova_as_pa in its build file.
mbuf structure holds the physical (PA) and virtual address (VA) of a
buffer. if IOVA as PA is disabled at compile time, PA field (buf_iova)
of mbuf is redundant as it is the same as VA and is replaced by a dummy
field.
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
app/test/test_mbuf.c | 12 +++++++-----
config/meson.build | 1 +
drivers/meson.build | 6 ++++++
drivers/net/hns3/meson.build | 6 ++++++
lib/eal/linux/eal.c | 6 ++++++
lib/mbuf/rte_mbuf.c | 2 +-
lib/mbuf/rte_mbuf.h | 9 +++++++++
lib/mbuf/rte_mbuf_core.h | 6 ++++++
lib/meson.build | 3 +++
meson_options.txt | 2 ++
10 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index f94d33f212..53fe898a38 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -1232,11 +1232,13 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)
return -1;
}
- badbuf = *buf;
- rte_mbuf_iova_set(&badbuf, 0);
- if (verify_mbuf_check_panics(&badbuf)) {
- printf("Error with bad-physaddr mbuf test\n");
- return -1;
+ if (RTE_IOVA_AS_PA) {
+ badbuf = *buf;
+ rte_mbuf_iova_set(&badbuf, 0);
+ if (verify_mbuf_check_panics(&badbuf)) {
+ printf("Error with bad-physaddr mbuf test\n");
+ return -1;
+ }
}
badbuf = *buf;
diff --git a/config/meson.build b/config/meson.build
index 7f7b6c92fd..0fc209db01 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -309,6 +309,7 @@ endif
if get_option('mbuf_refcnt_atomic')
dpdk_conf.set('RTE_MBUF_REFCNT_ATOMIC', true)
endif
+dpdk_conf.set10('RTE_IOVA_AS_PA', get_option('enable_iova_as_pa'))
compile_time_cpuflags = []
subdir(arch_subdir)
diff --git a/drivers/meson.build b/drivers/meson.build
index f6ba5ba4fb..2a29c210b5 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -106,6 +106,7 @@ foreach subpath:subdirs
ext_deps = []
pkgconfig_extra_libs = []
testpmd_sources = []
+ pmd_supports_disable_iova_as_pa = false
if not enable_drivers.contains(drv_path)
build = false
@@ -123,6 +124,11 @@ foreach subpath:subdirs
# pull in driver directory which should update all the local variables
subdir(drv_path)
+ if dpdk_conf.get('RTE_IOVA_AS_PA') == 0 and not pmd_supports_disable_iova_as_pa and not always_enable.contains(drv_path)
+ build = false
+ reason = 'driver does not support disabling IOVA as PA mode'
+ endif
+
# get dependency objs from strings
shared_deps = ext_deps
static_deps = ext_deps
diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build
index f2aede94ed..39d426f232 100644
--- a/drivers/net/hns3/meson.build
+++ b/drivers/net/hns3/meson.build
@@ -13,6 +13,12 @@ if arch_subdir != 'x86' and arch_subdir != 'arm' or not dpdk_conf.get('RTE_ARCH_
subdir_done()
endif
+if dpdk_conf.get('RTE_IOVA_AS_PA') == 0
+ build = false
+ reason = 'driver does not support disabling IOVA as PA mode'
+ subdir_done()
+endif
+
sources = files(
'hns3_cmd.c',
'hns3_dcb.c',
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index e74542fc71..8c118d0d9f 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1128,6 +1128,12 @@ rte_eal_init(int argc, char **argv)
return -1;
}
+ if (rte_eal_iova_mode() == RTE_IOVA_PA && !RTE_IOVA_AS_PA) {
+ rte_eal_init_alert("Cannot use IOVA as 'PA' as it is disabled during build");
+ rte_errno = EINVAL;
+ return -1;
+ }
+
RTE_LOG(INFO, EAL, "Selected IOVA mode '%s'\n",
rte_eal_iova_mode() == RTE_IOVA_PA ? "PA" : "VA");
diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c
index 16f6ed6731..cfd8062f1e 100644
--- a/lib/mbuf/rte_mbuf.c
+++ b/lib/mbuf/rte_mbuf.c
@@ -388,7 +388,7 @@ int rte_mbuf_check(const struct rte_mbuf *m, int is_header,
*reason = "bad mbuf pool";
return -1;
}
- if (rte_mbuf_iova_get(m) == 0) {
+ if (RTE_IOVA_AS_PA && rte_mbuf_iova_get(m) == 0) {
*reason = "bad IO addr";
return -1;
}
diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index c9f74586c3..ea0c5e16a0 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -146,7 +146,11 @@ static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
static inline rte_iova_t
rte_mbuf_iova_get(const struct rte_mbuf *m)
{
+#if RTE_IOVA_AS_PA
return m->buf_iova;
+#else
+ return (rte_iova_t)m->buf_addr;
+#endif
}
/**
@@ -160,7 +164,12 @@ rte_mbuf_iova_get(const struct rte_mbuf *m)
static inline void
rte_mbuf_iova_set(struct rte_mbuf *m, rte_iova_t iova)
{
+#if RTE_IOVA_AS_PA
m->buf_iova = iova;
+#else
+ RTE_SET_USED(m);
+ RTE_SET_USED(iova);
+#endif
}
/**
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 51a12a1fb9..91c2211b44 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -467,13 +467,19 @@ struct rte_mbuf {
RTE_MARKER cacheline0;
void *buf_addr; /**< Virtual address of segment buffer. */
+#if RTE_IOVA_AS_PA
/**
* Physical address of segment buffer.
+ * This field is undefined if the build is configured to use only
+ * virtual address as IOVA (i.e. RTE_IOVA_AS_PA is 0).
* 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));
+#else
+ uint64_t dummy;
+#endif
/* next 8 bytes are initialised on RX descriptor rearm */
RTE_MARKER64 rearm_data;
diff --git a/lib/meson.build b/lib/meson.build
index c648f7d800..c071a6c8e0 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -88,6 +88,9 @@ optional_libs = [
disabled_libs = []
opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
check: true).stdout().split()
+if dpdk_conf.get('RTE_IOVA_AS_PA') == 0
+ opt_disabled_libs += ['kni']
+endif
foreach l:opt_disabled_libs
if not optional_libs.contains(l)
warning('Cannot disable mandatory library "@0@"'.format(l))
diff --git a/meson_options.txt b/meson_options.txt
index 8640f599ae..54d504fab2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -44,6 +44,8 @@ option('platform', type: 'string', value: 'native', description:
'Platform to build, either "native", "generic" or a SoC. Please refer to the Linux build guide for more information.')
option('enable_trace_fp', type: 'boolean', value: false, description:
'enable fast path trace points.')
+option('enable_iova_as_pa', type: 'boolean', value: true, description:
+ 'Enable or disable support for IOVA as PA mode. Disabling this option removes the buf_iova field of mbuf.')
option('tests', type: 'boolean', value: true, description:
'build unit tests')
option('use_hpet', type: 'boolean', value: false, description:
--
2.25.1
next prev parent reply other threads:[~2022-10-07 21:02 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 16:25 [PATCH] mbuf: add mbuf physical address field to dynamic field Shijith Thotton
2022-06-30 16:45 ` Stephen Hemminger
2022-07-01 12:16 ` Shijith Thotton
2022-07-01 12:24 ` Shijith Thotton
2022-07-03 7:31 ` Morten Brørup
2022-07-04 14:00 ` Bruce Richardson
2022-08-03 15:34 ` [EXT] " Shijith Thotton
2022-08-29 15:16 ` [PATCH v1 0/4] mbuf dynamic field expansion Shijith Thotton
2022-09-07 13:43 ` [PATCH v2 0/5] " Shijith Thotton
2022-09-21 9:43 ` David Marchand
2022-09-21 14:01 ` [EXT] " Shijith Thotton
2022-09-21 13:56 ` [PATCH v3 " Shijith Thotton
2022-09-21 13:56 ` [PATCH v3 1/5] build: add meson option to configure IOVA mode as VA Shijith Thotton
2022-09-28 12:52 ` Olivier Matz
2022-09-29 5:48 ` [EXT] " Shijith Thotton
2022-09-21 13:56 ` [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build Shijith Thotton
2022-09-28 7:24 ` Thomas Monjalon
2022-09-28 12:52 ` Olivier Matz
2022-09-28 19:33 ` Thomas Monjalon
2022-09-28 19:48 ` Stephen Hemminger
2022-09-29 6:13 ` [EXT] " Shijith Thotton
2022-09-28 12:52 ` Olivier Matz
2022-09-21 13:56 ` [PATCH v3 3/5] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-09-21 14:07 ` Morten Brørup
2022-09-28 12:52 ` Olivier Matz
2022-09-29 6:14 ` [EXT] " Shijith Thotton
2022-09-21 13:56 ` [PATCH v3 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA Shijith Thotton
2022-09-28 12:53 ` Olivier Matz
2022-09-29 6:19 ` [EXT] " Shijith Thotton
2022-09-29 7:44 ` Olivier Matz
2022-09-29 8:10 ` Shijith Thotton
2022-10-07 20:17 ` Olivier Matz
2022-10-07 20:22 ` [EXT] " Shijith Thotton
2022-09-21 13:56 ` [PATCH v3 5/5] drivers: mark software " Shijith Thotton
2022-09-28 5:41 ` [PATCH v3 0/5] mbuf dynamic field expansion Shijith Thotton
2022-09-28 12:52 ` Olivier Matz
2022-09-29 4:51 ` [EXT] " Shijith Thotton
2022-10-07 13:50 ` Thomas Monjalon
2022-10-07 19:35 ` [EXT] " Shijith Thotton
2022-10-07 19:30 ` [PATCH v4 0/7] " Shijith Thotton
2022-10-07 19:30 ` [PATCH v4 1/7] mbuf: add API to get and set mbuf physical address Shijith Thotton
2022-10-07 20:16 ` Olivier Matz
2022-10-07 20:20 ` [EXT] " Shijith Thotton
2022-10-07 19:30 ` [PATCH v4 2/7] test/dma: use API to get mbuf data " Shijith Thotton
2022-10-07 20:17 ` Olivier Matz
2022-10-07 19:30 ` [PATCH v4 3/7] build: add meson option to configure IOVA mode as PA Shijith Thotton
2022-10-07 19:30 ` [PATCH v4 4/7] mbuf: add second dynamic field member Shijith Thotton
2022-10-07 19:30 ` [PATCH v4 5/7] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-10-07 19:30 ` [PATCH v4 6/7] drivers: mark cnxk PMDs work with IOVA as PA disabled Shijith Thotton
2022-10-07 19:30 ` [PATCH v4 7/7] drivers: mark software " Shijith Thotton
2022-10-07 20:19 ` [PATCH v4 0/7] mbuf dynamic field expansion Olivier Matz
2022-10-07 21:02 ` [PATCH v5 " Shijith Thotton
2022-10-07 21:02 ` [PATCH v5 1/7] mbuf: add API to get and set mbuf physical address Shijith Thotton
2022-10-07 21:20 ` Stephen Hemminger
2022-10-07 21:02 ` [PATCH v5 2/7] test/dma: use API to get mbuf data " Shijith Thotton
2022-10-07 21:02 ` Shijith Thotton [this message]
2022-10-07 21:02 ` [PATCH v5 4/7] mbuf: add second dynamic field member Shijith Thotton
2022-10-07 21:02 ` [PATCH v5 5/7] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-10-07 21:22 ` Stephen Hemminger
2022-10-07 21:30 ` [EXT] " Shijith Thotton
2022-10-07 21:02 ` [PATCH v5 6/7] drivers: mark cnxk PMDs work with IOVA as PA disabled Shijith Thotton
2022-10-07 21:02 ` [PATCH v5 7/7] drivers: mark software " Shijith Thotton
2022-10-09 9:34 ` [PATCH v5 0/7] mbuf dynamic field expansion Thomas Monjalon
2022-09-07 13:43 ` [PATCH v2 1/5] build: add meson option to configure IOVA mode as VA Shijith Thotton
2022-09-07 15:31 ` Stephen Hemminger
2022-09-07 15:38 ` Bruce Richardson
2022-09-07 21:33 ` Morten Brørup
2022-09-07 13:43 ` [PATCH v2 2/5] mbuf: add second dynamic field member for VA only build Shijith Thotton
2022-09-07 13:43 ` [PATCH v2 3/5] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-09-07 13:43 ` [PATCH v2 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA Shijith Thotton
2022-09-07 13:43 ` [PATCH v2 5/5] drivers: mark software " Shijith Thotton
2022-08-29 15:16 ` [PATCH v1 1/4] build: add meson option to configure IOVA mode " Shijith Thotton
2022-08-29 18:18 ` Morten Brørup
2022-08-30 8:32 ` Bruce Richardson
2022-08-29 15:16 ` [PATCH v1 2/4] mbuf: add second dynamic field member for VA only build Shijith Thotton
2022-08-29 18:32 ` Morten Brørup
2022-08-30 8:35 ` Bruce Richardson
2022-08-30 8:41 ` [EXT] " Pavan Nikhilesh Bhagavatula
2022-08-30 13:22 ` Honnappa Nagarahalli
2022-09-07 13:55 ` Shijith Thotton
2022-08-29 15:16 ` [PATCH v1 3/4] drivers: mark Marvell cnxk PMDs work with IOVA as VA Shijith Thotton
2022-08-29 15:16 ` [PATCH v1 4/4] drivers: mark software " Shijith Thotton
2022-08-30 13:07 ` [PATCH] mbuf: add mbuf physical address field to dynamic field Ferruh Yigit
2022-09-12 13:19 ` [EXT] " Shijith Thotton
2022-06-30 16:55 ` Bruce Richardson
2022-07-01 9:48 ` Olivier Matz
2022-07-01 11:53 ` Slava Ovsiienko
2022-07-01 12:01 ` [EXT] " Shijith Thotton
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=7b28d7c3ae3470d44336748d97e5ad55d951d0a7.1665176094.git.sthotton@marvell.com \
--to=sthotton@marvell.com \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=liudongdong3@huawei.com \
--cc=mb@smartsharesystems.com \
--cc=olivier.matz@6wind.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=yisen.zhuang@huawei.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).