From: eric zhang <eric.zhang@windriver.com>
To: <anatoly.burakov@intel.com>, <santosh.shukla@caviumnetworks.com>
Cc: <dev@dpdk.org>, <Allain.Legacy@windriver.com>,
<Matt.Peters@windriver.com>
Subject: [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode
Date: Tue, 18 Sep 2018 15:10:06 -0400 [thread overview]
Message-ID: <1537297807-19584-1-git-send-email-eric.zhang@windriver.com> (raw)
From: Santosh Shukla <santosh.shukla@caviumnetworks.com>
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>
---
lib/librte_eal/common/eal_common_options.c | 30 ++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_internal_cfg.h | 1 +
lib/librte_eal/common/eal_options.h | 2 ++
3 files changed, 33 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 996a034..ab2a28c 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -82,6 +82,7 @@
{OPT_HELP, 0, NULL, OPT_HELP_NUM },
{OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_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_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM },
{OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
@@ -218,6 +219,7 @@ struct device_option {
#endif
internal_cfg->vmware_tsc_map = 0;
internal_cfg->create_uio_dev = 0;
+ internal_cfg->iova_mode = -1;
internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
}
@@ -994,6 +996,25 @@ static int xdigit2val(unsigned char c)
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
eal_parse_common_option(int opt, const char *optarg,
struct internal_config *conf)
@@ -1158,6 +1179,13 @@ static int xdigit2val(unsigned char c)
}
core_parsed = 1;
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 */
default:
@@ -1306,6 +1334,8 @@ static int xdigit2val(unsigned char c)
" -h, --help This help\n"
"\nEAL options for DEBUG use only:\n"
" --"OPT_HUGE_UNLINK" Unlink hugepage files after init\n"
+ " --"OPT_IOVA_MODE" Set iova mode. 'pa' for IOVA_PA\n"
+ " 'va' for IOVA_VA\n"
" --"OPT_NO_HUGE" Use malloc instead of hugetlbfs\n"
" --"OPT_NO_PCI" Disable PCI\n"
" --"OPT_NO_HPET" Disable HPET\n"
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index fa6ccbe..29bf53f 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -83,6 +83,7 @@ struct internal_config {
const char *hugepage_dir; /**< specific hugetlbfs directory to use */
const char *mbuf_pool_ops_name; /**< mbuf pool ops name */
unsigned num_hugepage_sizes; /**< how many sizes on this system */
+ enum rte_iova_mode iova_mode ; /**< Set iova mode on this system */
struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
};
extern struct internal_config internal_config; /**< Global EAL configuration. */
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index 30e6bb4..7786189 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -83,6 +83,8 @@ enum {
OPT_VFIO_INTR_NUM,
#define OPT_VMWARE_TSC_MAP "vmware-tsc-map"
OPT_VMWARE_TSC_MAP_NUM,
+#define OPT_IOVA_MODE "iova-mode"
+ OPT_IOVA_MODE_NUM,
OPT_LONG_MAX_NUM
};
--
1.8.3.1
next reply other threads:[~2018-09-18 19:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 19:10 eric zhang [this message]
2018-09-18 19:10 ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode eric zhang
2018-09-24 20:42 ` Zhang, Qing Long (Eric)
2018-09-25 7:16 ` Santosh Shukla
2018-09-25 20:11 ` Zhang, Qing Long (Eric)
2018-09-26 7:11 ` Hemant
2018-09-26 12:43 ` Burakov, Anatoly
2018-09-26 7:10 ` [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode Hemant
2018-09-26 12:42 ` Burakov, Anatoly
2018-10-01 16:00 ` Eric Zhang
2018-10-02 8:30 ` Ferruh Yigit
-- strict thread matches above, loose matches on Subject: below --
2018-09-18 19:09 eric zhang
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=1537297807-19584-1-git-send-email-eric.zhang@windriver.com \
--to=eric.zhang@windriver.com \
--cc=Allain.Legacy@windriver.com \
--cc=Matt.Peters@windriver.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=santosh.shukla@caviumnetworks.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).