get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 88493,
    "url": "http://patches.dpdk.org/api/patches/88493/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1614906276-34293-1-git-send-email-oulijun@huawei.com/",
    "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1614906276-34293-1-git-send-email-oulijun@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1614906276-34293-1-git-send-email-oulijun@huawei.com",
    "date": "2021-03-05T01:04:36",
    "name": "app/testpmd: support multi-process",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e0e8c31f76d9e346a5d53a62e12087aed4c8d5ba",
    "submitter": {
        "id": 1675,
        "url": "http://patches.dpdk.org/api/people/1675/?format=api",
        "name": "Lijun Ou",
        "email": "oulijun@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1614906276-34293-1-git-send-email-oulijun@huawei.com/mbox/",
    "series": [
        {
            "id": 15495,
            "url": "http://patches.dpdk.org/api/series/15495/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15495",
            "date": "2021-03-05T01:04:36",
            "name": "app/testpmd: support multi-process",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/15495/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/88493/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/88493/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 318A3A0561;\n\tFri,  5 Mar 2021 02:03:56 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D21394069F;\n\tFri,  5 Mar 2021 02:03:55 +0100 (CET)",
            "from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35])\n by mails.dpdk.org (Postfix) with ESMTP id 1F93D40692\n for <dev@dpdk.org>; Fri,  5 Mar 2021 02:03:54 +0100 (CET)",
            "from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58])\n by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Ds8b51Vm4z7sMf;\n Fri,  5 Mar 2021 09:02:09 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id\n 14.3.498.0; Fri, 5 Mar 2021 09:03:51 +0800"
        ],
        "From": "Lijun Ou <oulijun@huawei.com>",
        "To": "<ferruh.yigit@intel.com>",
        "CC": "<dev@dpdk.org>, <linuxarm@openeuler.org>",
        "Date": "Fri, 5 Mar 2021 09:04:36 +0800",
        "Message-ID": "<1614906276-34293-1-git-send-email-oulijun@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1611151575-10095-1-git-send-email-oulijun@huawei.com>",
        "References": "<1611151575-10095-1-git-send-email-oulijun@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.69.192.56]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH] app/testpmd: support multi-process",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch adds multi-process support for testpmd.\nThe test cmd example as follows:\nthe primary cmd:\n./testpmd -w xxx --file-prefix=xx -l 0-1 -n 2 -- -i\\\n--rxq=16 --txq=16 --num-procs=2 --proc-id=0\nthe secondary cmd:\n./testpmd -w xxx --file-prefix=xx -l 2-3 -n 2 -- -i\\\n--rxq=16 --txq=16 --num-procs=2 --proc-id=1\n\nSigned-off-by: Min Hu (Connor) <humin29@huawei.com>\nSigned-off-by: Lijun Ou <oulijun@huawei.com>\n---\n app/test-pmd/cmdline.c    |  12 +++-\n app/test-pmd/config.c     |   9 ++-\n app/test-pmd/parameters.c |  11 ++++\n app/test-pmd/testpmd.c    | 138 ++++++++++++++++++++++++++++++----------------\n app/test-pmd/testpmd.h    |   7 +++\n 5 files changed, 127 insertions(+), 50 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 8b0f7d5..610e850 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -72,8 +72,6 @@\n #include \"cmdline_tm.h\"\n #include \"bpf_cmd.h\"\n \n-static struct cmdline *testpmd_cl;\n-\n static void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue);\n \n /* *** Help command with introduction. *** */\n@@ -5353,6 +5351,12 @@ cmd_set_flush_rx_parsed(void *parsed_result,\n \t\t__rte_unused void *data)\n {\n \tstruct cmd_set_flush_rx *res = parsed_result;\n+\n+\tif (num_procs > 1 && (strcmp(res->mode, \"on\") == 0)) {\n+\t\tprintf(\"multi-process doesn't support to flush rx queues.\\n\");\n+\t\treturn;\n+\t}\n+\n \tno_flush_rx = (uint8_t)((strcmp(res->mode, \"on\") == 0) ? 0 : 1);\n }\n \n@@ -17316,6 +17320,10 @@ prompt(void)\n \t\tprintf(\"Cannot set exit function for cmdline\\n\");\n \n \tcmdline_interact(testpmd_cl);\n+\tif (unlikely(f_quit == 1)) {\n+\t\tdup2(testpmd_fd_copy, testpmd_cl->s_in);\n+\t\tclose(testpmd_fd_copy);\n+\t}\n \tif (ret != 0)\n \t\tcmdline_stdin_exit(testpmd_cl);\n }\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 2435c26..8ab8153 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2827,6 +2827,8 @@ rss_fwd_config_setup(void)\n \tqueueid_t  rxq;\n \tqueueid_t  nb_q;\n \tstreamid_t  sm_id;\n+\tint start;\n+\tint end;\n \n \tnb_q = nb_rxq;\n \tif (nb_q > nb_txq)\n@@ -2844,7 +2846,10 @@ rss_fwd_config_setup(void)\n \tinit_fwd_streams();\n \n \tsetup_fwd_config_of_each_lcore(&cur_fwd_config);\n-\trxp = 0; rxq = 0;\n+\tstart = proc_id * nb_q / num_procs;\n+\tend = start + nb_q / num_procs;\n+\trxp = 0;\n+\trxq = start;\n \tfor (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) {\n \t\tstruct fwd_stream *fs;\n \n@@ -2861,6 +2866,8 @@ rss_fwd_config_setup(void)\n \t\t\tcontinue;\n \t\trxp = 0;\n \t\trxq++;\n+\t\tif (rxq >= end)\n+\t\t\trxq = start;\n \t}\n }\n \ndiff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex c8acd5d..1a5bf25 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -45,6 +45,8 @@\n #include <rte_flow.h>\n \n #include \"testpmd.h\"\n+#define PARAM_PROC_ID \"proc-id\"\n+#define PARAM_NUM_PROCS \"num-procs\"\n \n static void\n usage(char* progname)\n@@ -605,6 +607,8 @@ launch_args_parse(int argc, char** argv)\n \t\t{ \"rx-mq-mode\",                 1, 0, 0 },\n \t\t{ \"record-core-cycles\",         0, 0, 0 },\n \t\t{ \"record-burst-stats\",         0, 0, 0 },\n+\t\t{ PARAM_NUM_PROCS,              1, 0, 0 },\n+\t\t{ PARAM_PROC_ID,                1, 0, 0 },\n \t\t{ 0, 0, 0, 0 },\n \t};\n \n@@ -1366,6 +1370,13 @@ launch_args_parse(int argc, char** argv)\n \t\t\t\trecord_core_cycles = 1;\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"record-burst-stats\"))\n \t\t\t\trecord_burst_stats = 1;\n+\n+\t\t\tif (strncmp(lgopts[opt_idx].name,\n+\t\t\t\t    PARAM_NUM_PROCS, 8) == 0)\n+\t\t\t\tnum_procs = atoi(optarg);\n+\t\t\tif (strncmp(lgopts[opt_idx].name,\n+\t\t\t\t    PARAM_PROC_ID, 7) == 0)\n+\t\t\t\tproc_id = atoi(optarg);\n \t\t\tbreak;\n \t\tcase 'h':\n \t\t\tusage(argv[0]);\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 1a57324..bbd45d9 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -63,6 +63,8 @@\n \n #include \"testpmd.h\"\n \n+int testpmd_fd_copy = 500; /* the copy of STDIN_FILENO */\n+\n #ifndef MAP_HUGETLB\n /* FreeBSD may not have MAP_HUGETLB (in fact, it probably doesn't) */\n #define HUGE_FLAG (0x40000)\n@@ -125,6 +127,9 @@ uint8_t port_numa[RTE_MAX_ETHPORTS];\n  */\n uint8_t rxring_numa[RTE_MAX_ETHPORTS];\n \n+int proc_id;\n+unsigned int num_procs = 1;\n+\n /*\n  * Store specified sockets on which TX ring to be used by ports\n  * is allocated.\n@@ -982,16 +987,26 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \t\t\t/* wrapper to rte_mempool_create() */\n \t\t\tTESTPMD_LOG(INFO, \"preferred mempool ops selected: %s\\n\",\n \t\t\t\t\trte_mbuf_best_mempool_ops());\n-\t\t\trte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,\n-\t\t\t\tmb_mempool_cache, 0, mbuf_seg_size, socket_id);\n+\t\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\t\trte_mp = rte_pktmbuf_pool_create(pool_name,\n+\t\t\t\t\t nb_mbuf, mb_mempool_cache, 0,\n+\t\t\t\t\t mbuf_seg_size, socket_id);\n+\t\t\telse\n+\t\t\t\trte_mp = rte_mempool_lookup(pool_name);\n+\n \t\t\tbreak;\n \t\t}\n \tcase MP_ALLOC_ANON:\n \t\t{\n-\t\t\trte_mp = rte_mempool_create_empty(pool_name, nb_mbuf,\n-\t\t\t\tmb_size, (unsigned int) mb_mempool_cache,\n-\t\t\t\tsizeof(struct rte_pktmbuf_pool_private),\n-\t\t\t\tsocket_id, mempool_flags);\n+\t\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\t\trte_mp = rte_mempool_create_empty(pool_name,\n+\t\t\t\t\tnb_mbuf, mb_size,\n+\t\t\t\t\t(unsigned int)mb_mempool_cache,\n+\t\t\t\t\tsizeof(struct rte_pktmbuf_pool_private),\n+\t\t\t\t\tsocket_id, mempool_flags);\n+\t\t\telse\n+\t\t\t\trte_mp = rte_mempool_lookup(pool_name);\n+\n \t\t\tif (rte_mp == NULL)\n \t\t\t\tgoto err;\n \n@@ -1021,9 +1036,13 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \n \t\t\tTESTPMD_LOG(INFO, \"preferred mempool ops selected: %s\\n\",\n \t\t\t\t\trte_mbuf_best_mempool_ops());\n-\t\t\trte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,\n-\t\t\t\t\tmb_mempool_cache, 0, mbuf_seg_size,\n-\t\t\t\t\theap_socket);\n+\t\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\t\trte_mp = rte_pktmbuf_pool_create(pool_name,\n+\t\t\t\t\t nb_mbuf, mb_mempool_cache, 0,\n+\t\t\t\t\t mbuf_seg_size, heap_socket);\n+\t\t\telse\n+\t\t\t\trte_mp = rte_mempool_lookup(pool_name);\n+\n \t\t\tbreak;\n \t\t}\n \tcase MP_ALLOC_XBUF:\n@@ -1994,6 +2013,12 @@ flush_fwd_rx_queues(void)\n \tuint64_t prev_tsc = 0, diff_tsc, cur_tsc, timer_tsc = 0;\n \tuint64_t timer_period;\n \n+\tif (num_procs > 1) {\n+\t\tprintf(\"multi-process not support for flushing fwd rx \"\n+\t\t       \"queues, skip the below lines and return.\\n\");\n+\t\treturn;\n+\t}\n+\n \t/* convert to number of cycles */\n \ttimer_period = rte_get_timer_hz(); /* 1 second timeout */\n \n@@ -2503,21 +2528,28 @@ start_port(portid_t pid)\n \t\t\t\treturn -1;\n \t\t\t}\n \t\t\t/* configure port */\n-\t\t\tdiag = rte_eth_dev_configure(pi, nb_rxq + nb_hairpinq,\n+\t\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\t\t\tdiag = rte_eth_dev_configure(pi,\n+\t\t\t\t\t\t     nb_rxq + nb_hairpinq,\n \t\t\t\t\t\t     nb_txq + nb_hairpinq,\n \t\t\t\t\t\t     &(port->dev_conf));\n-\t\t\tif (diag != 0) {\n-\t\t\t\tif (rte_atomic16_cmpset(&(port->port_status),\n-\t\t\t\tRTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0)\n-\t\t\t\t\tprintf(\"Port %d can not be set back \"\n-\t\t\t\t\t\t\t\"to stopped\\n\", pi);\n-\t\t\t\tprintf(\"Fail to configure port %d\\n\", pi);\n-\t\t\t\t/* try to reconfigure port next time */\n-\t\t\t\tport->need_reconfig = 1;\n-\t\t\t\treturn -1;\n+\t\t\t\tif (diag != 0) {\n+\t\t\t\t\tif (rte_atomic16_cmpset(\n+\t\t\t\t\t\t\t&(port->port_status),\n+\t\t\t\t\t\t\tRTE_PORT_HANDLING,\n+\t\t\t\t\t\t\tRTE_PORT_STOPPED) == 0)\n+\t\t\t\t\t\tprintf(\"Port %d can not be set \"\n+\t\t\t\t\t\t       \"back to stopped\\n\", pi);\n+\t\t\t\t\tprintf(\"Fail to configure port %d\\n\",\n+\t\t\t\t\t\tpi);\n+\t\t\t\t\t/* try to reconfigure port next time */\n+\t\t\t\t\tport->need_reconfig = 1;\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n \t\t\t}\n \t\t}\n-\t\tif (port->need_reconfig_queues > 0) {\n+\t\tif (port->need_reconfig_queues > 0 &&\n+\t\t    rte_eal_process_type() == RTE_PROC_PRIMARY) {\n \t\t\tport->need_reconfig_queues = 0;\n \t\t\t/* setup tx queues */\n \t\t\tfor (qi = 0; qi < nb_txq; qi++) {\n@@ -2618,15 +2650,18 @@ start_port(portid_t pid)\n \t\tcnt_pi++;\n \n \t\t/* start port */\n-\t\tif (rte_eth_dev_start(pi) < 0) {\n-\t\t\tprintf(\"Fail to start port %d\\n\", pi);\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\t\tdiag = rte_eth_dev_start(pi);\n+\t\t\tif (diag < 0) {\n+\t\t\t\tprintf(\"Fail to start port %d\\n\", pi);\n \n-\t\t\t/* Fail to setup rx queue, return */\n-\t\t\tif (rte_atomic16_cmpset(&(port->port_status),\n-\t\t\t\tRTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0)\n-\t\t\t\tprintf(\"Port %d can not be set back to \"\n+\t\t\t\t/* Fail to setup rx queue, return */\n+\t\t\t\tif (rte_atomic16_cmpset(&(port->port_status),\n+\t\t\t\t    RTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0)\n+\t\t\t\t\tprintf(\"Port %d can not be set back to \"\n \t\t\t\t\t\t\t\"stopped\\n\", pi);\n-\t\t\tcontinue;\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t}\n \n \t\tif (rte_atomic16_cmpset(&(port->port_status),\n@@ -2755,7 +2790,8 @@ stop_port(portid_t pid)\n \t\tif (port->flow_list)\n \t\t\tport_flow_flush(pi);\n \n-\t\tif (rte_eth_dev_stop(pi) != 0)\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY &&\n+\t\t    rte_eth_dev_stop(pi) != 0)\n \t\t\tRTE_LOG(ERR, EAL, \"rte_eth_dev_stop failed for port %u\\n\",\n \t\t\t\tpi);\n \n@@ -2824,8 +2860,10 @@ close_port(portid_t pid)\n \t\t\tcontinue;\n \t\t}\n \n-\t\tport_flow_flush(pi);\n-\t\trte_eth_dev_close(pi);\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\tport_flow_flush(pi);\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\trte_eth_dev_close(pi);\n \t}\n \n \tremove_invalid_ports();\n@@ -3089,7 +3127,7 @@ pmd_test_exit(void)\n \t\t}\n \t}\n \tfor (i = 0 ; i < RTE_DIM(mempools) ; i++) {\n-\t\tif (mempools[i])\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY && mempools[i])\n \t\t\trte_mempool_free(mempools[i]);\n \t}\n \n@@ -3611,6 +3649,10 @@ init_port_dcb_config(portid_t pid,\n \tint retval;\n \tuint16_t i;\n \n+\tif (num_procs > 1) {\n+\t\tprintf(\"The multi-process feature doesn't support dcb.\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n \trte_port = &ports[pid];\n \n \tmemset(&port_conf, 0, sizeof(struct rte_eth_conf));\n@@ -3709,13 +3751,6 @@ init_port(void)\n }\n \n static void\n-force_quit(void)\n-{\n-\tpmd_test_exit();\n-\tprompt_exit();\n-}\n-\n-static void\n print_stats(void)\n {\n \tuint8_t i;\n@@ -3746,12 +3781,16 @@ signal_handler(int signum)\n \t\tif (latencystats_enabled != 0)\n \t\t\trte_latencystats_uninit();\n #endif\n-\t\tforce_quit();\n \t\t/* Set flag to indicate the force termination. */\n \t\tf_quit = 1;\n-\t\t/* exit with the expected status */\n-\t\tsignal(signum, SIG_DFL);\n-\t\tkill(getpid(), signum);\n+\t\tif (interactive == 1) {\n+\t\t\tdup2(testpmd_cl->s_in, testpmd_fd_copy);\n+\t\t\tclose(testpmd_cl->s_in);\n+\t\t} else {\n+\t\t\tdup2(0, testpmd_fd_copy);\n+\t\t\tclose(0);\n+\t\t}\n+\n \t}\n }\n \n@@ -3776,10 +3815,6 @@ main(int argc, char** argv)\n \t\trte_exit(EXIT_FAILURE, \"Cannot init EAL: %s\\n\",\n \t\t\t rte_strerror(rte_errno));\n \n-\tif (rte_eal_process_type() == RTE_PROC_SECONDARY)\n-\t\trte_exit(EXIT_FAILURE,\n-\t\t\t \"Secondary process type not supported.\\n\");\n-\n \tret = register_eth_event_callback();\n \tif (ret != 0)\n \t\trte_exit(EXIT_FAILURE, \"Cannot register for ethdev events\");\n@@ -3875,8 +3910,10 @@ main(int argc, char** argv)\n \t\t}\n \t}\n \n-\tif (!no_device_start && start_port(RTE_PORT_ALL) != 0)\n+\tif (!no_device_start && start_port(RTE_PORT_ALL) != 0) {\n+\t\tpmd_test_exit();\n \t\trte_exit(EXIT_FAILURE, \"Start ports failed\\n\");\n+\t}\n \n \t/* set all ports to promiscuous mode by default */\n \tRTE_ETH_FOREACH_DEV(port_id) {\n@@ -3922,6 +3959,8 @@ main(int argc, char** argv)\n \t\t}\n \t\tprompt();\n \t\tpmd_test_exit();\n+\t\tif (unlikely(f_quit == 1))\n+\t\t\tprompt_exit();\n \t} else\n #endif\n \t{\n@@ -3957,6 +3996,11 @@ main(int argc, char** argv)\n \t\tprintf(\"Press enter to exit\\n\");\n \t\trc = read(0, &c, 1);\n \t\tpmd_test_exit();\n+\t\tif (unlikely(f_quit == 1)) {\n+\t\t\tdup2(testpmd_fd_copy, 0);\n+\t\t\tclose(testpmd_fd_copy);\n+\t\t\tprompt_exit();\n+\t\t}\n \t\tif (rc < 0)\n \t\t\treturn 1;\n \t}\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex ce83f31..6d13417 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -13,6 +13,7 @@\n #include <rte_gso.h>\n #include <cmdline.h>\n #include <sys/queue.h>\n+#include  \"cmdline.h\"\n \n #define RTE_PORT_ALL            (~(portid_t)0x0)\n \n@@ -24,6 +25,10 @@\n #define RTE_PORT_CLOSED         (uint16_t)2\n #define RTE_PORT_HANDLING       (uint16_t)3\n \n+uint8_t f_quit;\n+int testpmd_fd_copy;\n+struct cmdline *testpmd_cl;\n+\n /*\n  * It is used to allocate the memory for hash key.\n  * The hash key size is NIC dependent.\n@@ -422,6 +427,8 @@ extern uint64_t noisy_lkup_mem_sz;\n extern uint64_t noisy_lkup_num_writes;\n extern uint64_t noisy_lkup_num_reads;\n extern uint64_t noisy_lkup_num_reads_writes;\n+extern int proc_id;\n+extern unsigned int num_procs;\n \n extern uint8_t dcb_config;\n extern uint8_t dcb_test;\n",
    "prefixes": []
}