Show a patch.

GET /api/patches/41947/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 41947,
    "url": "http://patches.dpdk.org/api/patches/41947/?format=api",
    "web_url": "http://patches.dpdk.org/patch/41947/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<1530267871-7161-10-git-send-email-jia.guo@intel.com>",
    "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": "http://patches.dpdk.org/api/people/507/?format=api",
        "name": "Guo, Jia",
        "email": "jia.guo@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/41947/mbox/",
    "series": [
        {
            "id": 314,
            "url": "http://patches.dpdk.org/api/series/314/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=314",
            "date": "2018-06-29T10:24:22",
            "name": "hot plug failure handle mechanism",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/314/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41947/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/41947/checks/",
    "tags": {},
    "headers": {
        "X-Mailer": "git-send-email 2.7.4",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Date": "Fri, 29 Jun 2018 18:24:31 +0800",
        "X-Mailman-Version": "2.1.15",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "Cc": "jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org,\n\tjia.guo@intel.com, helin.zhang@intel.com",
        "To": "stephen@networkplumber.org, bruce.richardson@intel.com,\n\tferruh.yigit@intel.com, konstantin.ananyev@intel.com,\n\tgaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net,\n\tmotih@mellanox.com, matan@mellanox.com, harry.van.haaren@intel.com,\n\tqi.z.zhang@intel.com, shaopeng.he@intel.com, bernard.iremonger@intel.com",
        "Errors-To": "dev-bounces@dpdk.org",
        "References": "<1530267871-7161-1-git-send-email-jia.guo@intel.com>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "From": "Jeff Guo <jia.guo@intel.com>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,285,1526367600\"; d=\"scan'208\";a=\"241324473\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1A5F41B566;\n\tFri, 29 Jun 2018 12:27:20 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 6A66A1B562\n\tfor <dev@dpdk.org>; Fri, 29 Jun 2018 12:27:18 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jun 2018 03:27:18 -0700",
            "from jeffguo-z170x-ud5.sh.intel.com (HELO localhost.localdomain)\n\t([10.67.104.10])\n\tby fmsmga005.fm.intel.com with ESMTP; 29 Jun 2018 03:27:15 -0700"
        ],
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Amp-File-Uploaded": "False",
        "Subject": "[dpdk-dev] [PATCH V4 9/9] app/testpmd: enable device hotplug\n\tmonitoring",
        "In-Reply-To": "<1530267871-7161-1-git-send-email-jia.guo@intel.com>",
        "Message-Id": "<1530267871-7161-10-git-send-email-jia.guo@intel.com>",
        "X-ExtLoop1": "1",
        "X-BeenThere": "dev@dpdk.org",
        "X-Original-To": "patchwork@dpdk.org"
    },
    "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 <jia.guo@intel.com>\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": [
        "V4",
        "9/9"
    ]
}