From: Jeff Guo <jia.guo@intel.com>
To: stephen@networkplumber.org, bruce.richardson@intel.com,
ferruh.yigit@intel.com, konstantin.ananyev@intel.com,
gaetan.rivet@6wind.com, jingjing.wu@intel.com,
thomas@monjalon.net, motih@mellanox.com, matan@mellanox.com,
harry.van.haaren@intel.com, qi.z.zhang@intel.com,
shaopeng.he@intel.com, bernard.iremonger@intel.com
Cc: jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org,
jia.guo@intel.com, helin.zhang@intel.com
Subject: [dpdk-dev] [PATCH V4 9/9] app/testpmd: enable device hotplug monitoring
Date: Fri, 29 Jun 2018 18:24:31 +0800 [thread overview]
Message-ID: <1530267871-7161-10-git-send-email-jia.guo@intel.com> (raw)
In-Reply-To: <1530267871-7161-1-git-send-email-jia.guo@intel.com>
As we know, there 2 different hotplug mechanisms in dpdk, the one is
ethdev event + kernel driver hotplug solution, while the other one is
eal device event + pci uio driver hotplug solution, each of them have
different configure and callback process in testpmd. In oder to avoid
the race between them, this patch aim to use a new parameter
"--hotplug-mode" to replace the previous "--hot-plug" command parameter,
to identify these different mode.
There are 3 modes on hotplug mode: disable, eal, or ethdev(default).
If user want to use eal device event monitor mode, could use below
command when start testpmd. If not set this parameter, ethdev hotplug
mode is default to be used.
E.g. ./build/app/testpmd -c 0x3 --n 4 -- -i --hotplug-mode=eal
Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
v4->v3:
change to use new parameter "--hotplug-mode" in testpmd
to identify the eal hotplug and ethdev hotplug
---
app/test-pmd/parameters.c | 20 ++++++++++++++++----
app/test-pmd/testpmd.c | 18 +++++++++++-------
app/test-pmd/testpmd.h | 8 +++++++-
doc/guides/testpmd_app_ug/run_app.rst | 10 ++++++++--
4 files changed, 42 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 7580762..601e13e 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -186,7 +186,8 @@ usage(char* progname)
printf(" --flow-isolate-all: "
"requests flow API isolated mode on all ports at initialization time.\n");
printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n");
- printf(" --hot-plug: enable hot plug for device.\n");
+ printf(" --hotplug-mode=N: set hotplug mode for device "
+ "(N: disable (default) or eal or ethdev.\n");
printf(" --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\n");
printf(" --mlockall: lock all memory\n");
printf(" --no-mlockall: do not lock all memory\n");
@@ -621,7 +622,7 @@ launch_args_parse(int argc, char** argv)
{ "print-event", 1, 0, 0 },
{ "mask-event", 1, 0, 0 },
{ "tx-offloads", 1, 0, 0 },
- { "hot-plug", 0, 0, 0 },
+ { "hotplug-mode", 1, 0, 0 },
{ "vxlan-gpe-port", 1, 0, 0 },
{ "mlockall", 0, 0, 0 },
{ "no-mlockall", 0, 0, 0 },
@@ -1139,8 +1140,19 @@ launch_args_parse(int argc, char** argv)
rte_exit(EXIT_FAILURE,
"invalid mask-event argument\n");
}
- if (!strcmp(lgopts[opt_idx].name, "hot-plug"))
- hot_plug = 1;
+ if (!strcmp(lgopts[opt_idx].name, "hotplug-mode")) {
+ if (!strcmp(optarg, "disable"))
+ hotplug_mode = HOTPLUG_MODE_DISABLE;
+ else if (!strcmp(optarg, "eal"))
+ hotplug_mode = HOTPLUG_MODE_EAL;
+ else if (!strcmp(optarg, "ethdev"))
+ hotplug_mode = HOTPLUG_MODE_ETHDEV;
+ else
+ rte_exit(EXIT_FAILURE,
+ "hotplug-mode %s invalid - must be: "
+ "disable, eal, ethdev.\n",
+ optarg);
+ }
if (!strcmp(lgopts[opt_idx].name, "mlockall"))
do_mlockall = 1;
if (!strcmp(lgopts[opt_idx].name, "no-mlockall"))
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 42ed196..9269400 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -286,7 +286,7 @@ uint8_t lsc_interrupt = 1; /* enabled by default */
*/
uint8_t rmv_interrupt = 1; /* enabled by default */
-uint8_t hot_plug = 0; /**< hotplug disabled by default. */
+uint8_t hotplug_mode = HOTPLUG_MODE_ETHDEV; /**< hotplug disabled by default. */
/*
* Display or mask ether events
@@ -2043,7 +2043,7 @@ pmd_test_exit(void)
}
}
- if (hot_plug) {
+ if (hotplug_mode == HOTPLUG_MODE_EAL) {
ret = rte_dev_event_monitor_stop();
if (ret)
RTE_LOG(ERR, EAL,
@@ -2181,9 +2181,13 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
switch (type) {
case RTE_ETH_EVENT_INTR_RMV:
- if (rte_eal_alarm_set(100000,
- rmv_event_callback, (void *)(intptr_t)port_id))
- fprintf(stderr, "Could not set up deferred device removal\n");
+ if (hotplug_mode == HOTPLUG_MODE_ETHDEV) {
+ if (rte_eal_alarm_set(100000,
+ rmv_event_callback,
+ (void *)(intptr_t)port_id))
+ fprintf(stderr, "Could not set up deferred "
+ "device removal\n");
+ }
break;
default:
break;
@@ -2734,8 +2738,8 @@ main(int argc, char** argv)
init_config();
- if (hot_plug) {
- /* enable hot plug monitoring */
+ if (hotplug_mode == HOTPLUG_MODE_EAL) {
+ /* enable hotplug event monitoring */
ret = rte_dev_event_monitor_start();
if (ret) {
rte_errno = EINVAL;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index f51cd9d..e29ee2a 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -69,6 +69,12 @@ enum {
PORT_TOPOLOGY_LOOP,
};
+enum {
+ HOTPLUG_MODE_DISABLE,
+ HOTPLUG_MODE_EAL,
+ HOTPLUG_MODE_ETHDEV,
+};
+
#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
/**
* The data structure associated with RX and TX packet burst statistics
@@ -335,7 +341,7 @@ extern uint8_t lsc_interrupt; /**< disabled by "--no-lsc-interrupt" parameter */
extern uint8_t rmv_interrupt; /**< disabled by "--no-rmv-interrupt" parameter */
extern uint32_t event_print_mask;
/**< set by "--print-event xxxx" and "--mask-event xxxx parameters */
-extern uint8_t hot_plug; /**< enable by "--hot-plug" parameter */
+extern uint8_t hotplug_mode; /**< set by "--hotplug-mode" parameter */
extern int do_mlockall; /**< set by "--mlockall" or "--no-mlockall" parameter */
#ifdef RTE_LIBRTE_IXGBE_BYPASS
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index f301c2b..09e2716 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -482,9 +482,15 @@ The commandline options are:
Set the hexadecimal bitmask of TX queue offloads.
The default value is 0.
-* ``--hot-plug``
+* ``--hotplug-mode``
- Enable device event monitor machenism for hotplug.
+ Set the hotplug handle mode, that is ``disable`` or ``eal`` or ``ethdev`` (the default).
+
+ In ``disable`` mode, it will not handle the hotplug for device.
+
+ In ``eal`` mode, it will start device event monitor and register eth_dev_event_callback for hotplug process.
+
+ In ``ethdev`` mode, it will process RTE_ETH_EVENT_INTR_RMV event which is detected from ethdev.
* ``--vxlan-gpe-port=N``
--
2.7.4
next prev parent reply other threads:[~2018-06-29 10:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 10:24 [dpdk-dev] [PATCH V4 0/9] hot plug failure handle mechanism Jeff Guo
2018-06-29 10:24 ` [dpdk-dev] [PATCH V4 1/9] bus: introduce hotplug failure handler Jeff Guo
2018-06-29 10:24 ` [dpdk-dev] [PATCH V4 2/9] bus/pci: implement hotplug handler operation Jeff Guo
2018-06-29 10:24 ` [dpdk-dev] [PATCH V4 3/9] bus: introduce sigbus handler Jeff Guo
2018-06-29 10:24 ` [dpdk-dev] [PATCH V4 4/9] bus/pci: implement sigbus handler operation Jeff Guo
2018-06-29 10:24 ` [dpdk-dev] [PATCH V4 5/9] bus: add helper to handle sigbus Jeff Guo
2018-06-29 10:24 ` [dpdk-dev] [PATCH V4 6/9] eal: add failure handle mechanism for hot plug Jeff Guo
2018-06-29 10:24 ` [dpdk-dev] [PATCH V4 7/9] igb_uio: fix uio release issue when hot unplug Jeff Guo
2018-06-29 10:24 ` [dpdk-dev] [PATCH V4 8/9] app/testpmd: show example to handle " Jeff Guo
2018-06-29 10:24 ` Jeff Guo [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-06-29 4:37 [dpdk-dev] [PATCH v3 0/2] add uevent api for hot plug Jeff Guo
2018-06-29 10:30 ` [dpdk-dev] [PATCH V4 0/9] hot plug failure handle mechanism Jeff Guo
2018-06-29 10:30 ` [dpdk-dev] [PATCH V4 9/9] app/testpmd: enable device hotplug monitoring Jeff Guo
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=1530267871-7161-10-git-send-email-jia.guo@intel.com \
--to=jia.guo@intel.com \
--cc=bernard.iremonger@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=gaetan.rivet@6wind.com \
--cc=harry.van.haaren@intel.com \
--cc=helin.zhang@intel.com \
--cc=jblunck@infradead.org \
--cc=jingjing.wu@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=matan@mellanox.com \
--cc=motih@mellanox.com \
--cc=qi.z.zhang@intel.com \
--cc=shaopeng.he@intel.com \
--cc=shreyansh.jain@nxp.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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).