build: add option to configure IOVA mode as PA
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 option is disabled, only drivers which support it are enabled. 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). 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>
This commit is contained in:
parent
396839128b
commit
a986c2b797
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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',
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
|
@ -38,6 +38,8 @@ option('max_lcores', type: 'string', value: 'default', description:
|
||||
'Set maximum number of cores/threads supported by EAL; "default" is different per-arch, "detect" detects the number of cores on the build machine.')
|
||||
option('max_numa_nodes', type: 'string', value: 'default', description:
|
||||
'Set the highest NUMA node supported by EAL; "default" is different per-arch, "detect" detects the highest NUMA node on the build machine.')
|
||||
option('enable_iova_as_pa', type: 'boolean', value: true, description:
|
||||
'Support for IOVA as physical address. Disabling removes the buf_iova field of mbuf.')
|
||||
option('mbuf_refcnt_atomic', type: 'boolean', value: true, description:
|
||||
'Atomically access the mbuf refcnt.')
|
||||
option('platform', type: 'string', value: 'native', description:
|
||||
|
Loading…
x
Reference in New Issue
Block a user