Show a patch.

GET /api/patches/41947/?format=api
Content-Type: application/json
Vary: Accept

    "id": 41947,
    "url": "",
    "web_url": "",
    "project": {
        "id": 1,
        "url": "",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "",
        "list_email": "",
        "web_url": "",
        "scm_url": "git://",
        "webscm_url": ""
    "msgid": "<>",
    "date": "2018-06-29T10:24:31",
    "name": "[V4,9/9] app/testpmd: enable device hotplug monitoring",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d29fee62fbebb418eddd933e546ee84e244a0ea7",
    "submitter": {
        "id": 507,
        "url": "",
        "name": "Guo, Jia",
        "email": ""
    "delegate": null,
    "mbox": "",
    "series": [
            "id": 314,
            "url": "",
            "web_url": "",
            "date": "2018-06-29T10:24:22",
            "name": "hot plug failure handle mechanism",
            "version": 4,
            "mbox": ""
    "comments": "",
    "check": "success",
    "checks": "",
    "tags": {},
    "headers": {
        "X-Mailer": "git-send-email 2.7.4",
        "List-Id": "DPDK patches and discussions <>",
        "Precedence": "list",
        "List-Help": "<>",
        "Date": "Fri, 29 Jun 2018 18:24:31 +0800",
        "X-Mailman-Version": "2.1.15",
        "Delivered-To": "",
        "List-Unsubscribe": "<>,\n\t<>",
        "List-Subscribe": "<>,\n\t<>",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "Cc": ",,,\n\,",
        "To": ",,\n\,,\n\,,,\n\,,,\n\,,",
        "Errors-To": "",
        "References": "<>",
        "Sender": "\"dev\" <>",
        "From": "Jeff Guo <>",
        "Return-Path": "<>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,285,1526367600\"; d=\"scan'208\";a=\"241324473\"",
        "List-Post": "<>",
        "Received": [
            "from [] (localhost [])\n\tby (Postfix) with ESMTP id 1A5F41B566;\n\tFri, 29 Jun 2018 12:27:20 +0200 (CEST)",
            "from ( [])\n\tby (Postfix) with ESMTP id 6A66A1B562\n\tfor <>; Fri, 29 Jun 2018 12:27:18 +0200 (CEST)",
            "from ([])\n\tby with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jun 2018 03:27:18 -0700",
            "from (HELO localhost.localdomain)\n\t([])\n\tby with ESMTP; 29 Jun 2018 03:27:15 -0700"
        "List-Archive": "<>",
        "X-Amp-File-Uploaded": "False",
        "Subject": "[dpdk-dev] [PATCH V4 9/9] app/testpmd: enable device hotplug\n\tmonitoring",
        "In-Reply-To": "<>",
        "Message-Id": "<>",
        "X-ExtLoop1": "1",
        "X-BeenThere": "",
        "X-Original-To": ""
    "content": "As we know, there 2 different hotplug mechanisms in dpdk, the one is\nethdev event + kernel driver hotplug solution, while the other one is\neal device event + pci uio driver hotplug solution, each of them have\ndifferent configure and callback process in testpmd. In oder to avoid\nthe race between them, this patch aim to use a new parameter\n\"--hotplug-mode\" to replace the previous \"--hot-plug\" command parameter,\nto identify these different mode.\n\nThere are 3 modes on hotplug mode: disable, eal, or ethdev(default).\n\nIf user want to use eal device event monitor mode, could use below\ncommand when start testpmd. If not set this parameter, ethdev hotplug\nmode is default to be used.\n\nE.g. ./build/app/testpmd -c 0x3 --n 4 -- -i --hotplug-mode=eal\n\nSigned-off-by: Jeff Guo <>\n---\nv4->v3:\nchange to use new parameter \"--hotplug-mode\" in testpmd\nto identify the eal hotplug and ethdev hotplug\n---\n app/test-pmd/parameters.c             | 20 ++++++++++++++++----\n app/test-pmd/testpmd.c                | 18 +++++++++++-------\n app/test-pmd/testpmd.h                |  8 +++++++-\n doc/guides/testpmd_app_ug/run_app.rst | 10 ++++++++--\n 4 files changed, 42 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex 7580762..601e13e 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -186,7 +186,8 @@ usage(char* progname)\n \tprintf(\"  --flow-isolate-all: \"\n \t       \"requests flow API isolated mode on all ports at initialization time.\\n\");\n \tprintf(\"  --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\\n\");\n-\tprintf(\"  --hot-plug: enable hot plug for device.\\n\");\n+\tprintf(\"  --hotplug-mode=N: set hotplug mode for device \"\n+\t       \"(N: disable (default) or eal or ethdev.\\n\");\n \tprintf(\"  --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\\n\");\n \tprintf(\"  --mlockall: lock all memory\\n\");\n \tprintf(\"  --no-mlockall: do not lock all memory\\n\");\n@@ -621,7 +622,7 @@ launch_args_parse(int argc, char** argv)\n \t\t{ \"print-event\",\t\t1, 0, 0 },\n \t\t{ \"mask-event\",\t\t\t1, 0, 0 },\n \t\t{ \"tx-offloads\",\t\t1, 0, 0 },\n-\t\t{ \"hot-plug\",\t\t\t0, 0, 0 },\n+\t\t{ \"hotplug-mode\",\t\t1, 0, 0 },\n \t\t{ \"vxlan-gpe-port\",\t\t1, 0, 0 },\n \t\t{ \"mlockall\",\t\t\t0, 0, 0 },\n \t\t{ \"no-mlockall\",\t\t0, 0, 0 },\n@@ -1139,8 +1140,19 @@ launch_args_parse(int argc, char** argv)\n \t\t\t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\t \"invalid mask-event argument\\n\");\n \t\t\t\t}\n-\t\t\tif (!strcmp(lgopts[opt_idx].name, \"hot-plug\"))\n-\t\t\t\thot_plug = 1;\n+\t\t\tif (!strcmp(lgopts[opt_idx].name, \"hotplug-mode\")) {\n+\t\t\t\tif (!strcmp(optarg, \"disable\"))\n+\t\t\t\t\thotplug_mode = HOTPLUG_MODE_DISABLE;\n+\t\t\t\telse if (!strcmp(optarg, \"eal\"))\n+\t\t\t\t\thotplug_mode = HOTPLUG_MODE_EAL;\n+\t\t\t\telse if (!strcmp(optarg, \"ethdev\"))\n+\t\t\t\t\thotplug_mode = HOTPLUG_MODE_ETHDEV;\n+\t\t\t\telse\n+\t\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t\t \"hotplug-mode %s invalid - must be: \"\n+\t\t\t\t\t\t \"disable, eal, ethdev.\\n\",\n+\t\t\t\t\t\t optarg);\n+\t\t\t}\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"mlockall\"))\n \t\t\t\tdo_mlockall = 1;\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"no-mlockall\"))\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 42ed196..9269400 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -286,7 +286,7 @@ uint8_t lsc_interrupt = 1; /* enabled by default */\n  */\n uint8_t rmv_interrupt = 1; /* enabled by default */\n \n-uint8_t hot_plug = 0; /**< hotplug disabled by default. */\n+uint8_t hotplug_mode = HOTPLUG_MODE_ETHDEV; /**< hotplug disabled by default. */\n \n /*\n  * Display or mask ether events\n@@ -2043,7 +2043,7 @@ pmd_test_exit(void)\n \t\t}\n \t}\n \n-\tif (hot_plug) {\n+\tif (hotplug_mode == HOTPLUG_MODE_EAL) {\n \t\tret = rte_dev_event_monitor_stop();\n \t\tif (ret)\n \t\t\tRTE_LOG(ERR, EAL,\n@@ -2181,9 +2181,13 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,\n \n \tswitch (type) {\n \tcase RTE_ETH_EVENT_INTR_RMV:\n-\t\tif (rte_eal_alarm_set(100000,\n-\t\t\t\trmv_event_callback, (void *)(intptr_t)port_id))\n-\t\t\tfprintf(stderr, \"Could not set up deferred device removal\\n\");\n+\t\tif (hotplug_mode == HOTPLUG_MODE_ETHDEV) {\n+\t\t\tif (rte_eal_alarm_set(100000,\n+\t\t\t\t\trmv_event_callback,\n+\t\t\t\t\t(void *)(intptr_t)port_id))\n+\t\t\t\tfprintf(stderr, \"Could not set up deferred \"\n+\t\t\t\t\t\"device removal\\n\");\n+\t\t}\n \t\tbreak;\n \tdefault:\n \t\tbreak;\n@@ -2734,8 +2738,8 @@ main(int argc, char** argv)\n \n \tinit_config();\n \n-\tif (hot_plug) {\n-\t\t/* enable hot plug monitoring */\n+\tif (hotplug_mode == HOTPLUG_MODE_EAL) {\n+\t\t/* enable hotplug event monitoring */\n \t\tret = rte_dev_event_monitor_start();\n \t\tif (ret) {\n \t\t\trte_errno = EINVAL;\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex f51cd9d..e29ee2a 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -69,6 +69,12 @@ enum {\n \tPORT_TOPOLOGY_LOOP,\n };\n \n+enum {\n+\tHOTPLUG_MODE_DISABLE,\n+\tHOTPLUG_MODE_EAL,\n+\tHOTPLUG_MODE_ETHDEV,\n+};\n+\n #ifdef RTE_TEST_PMD_RECORD_BURST_STATS\n /**\n  * The data structure associated with RX and TX packet burst statistics\n@@ -335,7 +341,7 @@ extern uint8_t lsc_interrupt; /**< disabled by \"--no-lsc-interrupt\" parameter */\n extern uint8_t rmv_interrupt; /**< disabled by \"--no-rmv-interrupt\" parameter */\n extern uint32_t event_print_mask;\n /**< set by \"--print-event xxxx\" and \"--mask-event xxxx parameters */\n-extern uint8_t hot_plug; /**< enable by \"--hot-plug\" parameter */\n+extern uint8_t hotplug_mode; /**< set by \"--hotplug-mode\" parameter */\n extern int do_mlockall; /**< set by \"--mlockall\" or \"--no-mlockall\" parameter */\n \n #ifdef RTE_LIBRTE_IXGBE_BYPASS\ndiff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst\nindex f301c2b..09e2716 100644\n--- a/doc/guides/testpmd_app_ug/run_app.rst\n+++ b/doc/guides/testpmd_app_ug/run_app.rst\n@@ -482,9 +482,15 @@ The commandline options are:\n     Set the hexadecimal bitmask of TX queue offloads.\n     The default value is 0.\n \n-*   ``--hot-plug``\n+*   ``--hotplug-mode``\n \n-    Enable device event monitor machenism for hotplug.\n+    Set the hotplug handle mode, that is ``disable`` or ``eal`` or ``ethdev`` (the default).\n+\n+    In ``disable`` mode, it will not handle the hotplug for device.\n+\n+    In ``eal`` mode, it will start device event monitor and register eth_dev_event_callback for hotplug process.\n+\n+    In ``ethdev`` mode, it will process RTE_ETH_EVENT_INTR_RMV event which is detected from ethdev.\n \n *   ``--vxlan-gpe-port=N``\n \n",
    "prefixes": [