eal: add --iova-mode option

In the case of user don't want to use bus iova scheme and want
to override.

For that, adding EAL option --iova-mode=<string> where valid input
string is 'pa' or 'va'.

Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Eric Zhang <eric.zhang@windriver.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
This commit is contained in:
Santosh Shukla 2018-10-03 16:53:12 -04:00 committed by Thomas Monjalon
parent 998c89f148
commit 783667c9f9
3 changed files with 33 additions and 0 deletions

View File

@ -58,6 +58,7 @@ eal_long_options[] = {
{OPT_HELP, 0, NULL, OPT_HELP_NUM }, {OPT_HELP, 0, NULL, OPT_HELP_NUM },
{OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_NUM }, {OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_NUM },
{OPT_HUGE_UNLINK, 0, NULL, OPT_HUGE_UNLINK_NUM }, {OPT_HUGE_UNLINK, 0, NULL, OPT_HUGE_UNLINK_NUM },
{OPT_IOVA_MODE, 1, NULL, OPT_IOVA_MODE_NUM },
{OPT_LCORES, 1, NULL, OPT_LCORES_NUM }, {OPT_LCORES, 1, NULL, OPT_LCORES_NUM },
{OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM }, {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM },
{OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM }, {OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
@ -205,6 +206,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
#endif #endif
internal_cfg->vmware_tsc_map = 0; internal_cfg->vmware_tsc_map = 0;
internal_cfg->create_uio_dev = 0; internal_cfg->create_uio_dev = 0;
internal_cfg->iova_mode = RTE_IOVA_DC;
internal_cfg->user_mbuf_pool_ops_name = NULL; internal_cfg->user_mbuf_pool_ops_name = NULL;
internal_cfg->init_complete = 0; internal_cfg->init_complete = 0;
} }
@ -1075,6 +1077,25 @@ eal_parse_proc_type(const char *arg)
return RTE_PROC_INVALID; return RTE_PROC_INVALID;
} }
static int
eal_parse_iova_mode(const char *name)
{
int mode;
if (name == NULL)
return -1;
if (!strcmp("pa", name))
mode = RTE_IOVA_PA;
else if (!strcmp("va", name))
mode = RTE_IOVA_VA;
else
return -1;
internal_config.iova_mode = mode;
return 0;
}
int int
eal_parse_common_option(int opt, const char *optarg, eal_parse_common_option(int opt, const char *optarg,
struct internal_config *conf) struct internal_config *conf)
@ -1281,6 +1302,13 @@ eal_parse_common_option(int opt, const char *optarg,
case OPT_SINGLE_FILE_SEGMENTS_NUM: case OPT_SINGLE_FILE_SEGMENTS_NUM:
conf->single_file_segments = 1; conf->single_file_segments = 1;
break; break;
case OPT_IOVA_MODE_NUM:
if (eal_parse_iova_mode(optarg) < 0) {
RTE_LOG(ERR, EAL, "invalid parameters for --"
OPT_IOVA_MODE "\n");
return -1;
}
break;
/* don't know what to do, leave this to caller */ /* don't know what to do, leave this to caller */
default: default:
@ -1434,6 +1462,8 @@ eal_common_usage(void)
" --"OPT_VDEV" Add a virtual device.\n" " --"OPT_VDEV" Add a virtual device.\n"
" The argument format is <driver><id>[,key=val,...]\n" " The argument format is <driver><id>[,key=val,...]\n"
" (ex: --vdev=net_pcap0,iface=eth2).\n" " (ex: --vdev=net_pcap0,iface=eth2).\n"
" --"OPT_IOVA_MODE" Set IOVA mode. 'pa' for IOVA_PA\n"
" 'va' for IOVA_VA\n"
" -d LIB.so|DIR Add a driver or driver directory\n" " -d LIB.so|DIR Add a driver or driver directory\n"
" (can be used multiple times)\n" " (can be used multiple times)\n"
" --"OPT_VMWARE_TSC_MAP" Use VMware TSC map instead of native RDTSC\n" " --"OPT_VMWARE_TSC_MAP" Use VMware TSC map instead of native RDTSC\n"

View File

@ -70,6 +70,7 @@ struct internal_config {
/**< user defined mbuf pool ops name */ /**< user defined mbuf pool ops name */
unsigned num_hugepage_sizes; /**< how many sizes on this system */ unsigned num_hugepage_sizes; /**< how many sizes on this system */
struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES]; struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
enum rte_iova_mode iova_mode ; /**< Set IOVA mode on this system */
volatile unsigned int init_complete; volatile unsigned int init_complete;
/**< indicates whether EAL has completed initialization */ /**< indicates whether EAL has completed initialization */
}; };

View File

@ -63,6 +63,8 @@ enum {
OPT_LEGACY_MEM_NUM, OPT_LEGACY_MEM_NUM,
#define OPT_SINGLE_FILE_SEGMENTS "single-file-segments" #define OPT_SINGLE_FILE_SEGMENTS "single-file-segments"
OPT_SINGLE_FILE_SEGMENTS_NUM, OPT_SINGLE_FILE_SEGMENTS_NUM,
#define OPT_IOVA_MODE "iova-mode"
OPT_IOVA_MODE_NUM,
OPT_LONG_MAX_NUM OPT_LONG_MAX_NUM
}; };