get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 89902,
    "url": "https://patches.dpdk.org/api/patches/89902/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1616748778-10995-1-git-send-email-humin29@huawei.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1616748778-10995-1-git-send-email-humin29@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1616748778-10995-1-git-send-email-humin29@huawei.com",
    "date": "2021-03-26T08:52:58",
    "name": "[v7] app/testpmd: support multi-process",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f1f1c77f1d699d8064cfc88a089168609caac7c3",
    "submitter": {
        "id": 1944,
        "url": "https://patches.dpdk.org/api/people/1944/?format=api",
        "name": "humin (Q)",
        "email": "humin29@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1616748778-10995-1-git-send-email-humin29@huawei.com/mbox/",
    "series": [
        {
            "id": 15901,
            "url": "https://patches.dpdk.org/api/series/15901/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=15901",
            "date": "2021-03-26T08:52:58",
            "name": "[v7] app/testpmd: support multi-process",
            "version": 7,
            "mbox": "https://patches.dpdk.org/series/15901/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/89902/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/89902/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 7FD80A0A02;\n\tFri, 26 Mar 2021 09:52:38 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0691140685;\n\tFri, 26 Mar 2021 09:52:38 +0100 (CET)",
            "from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191])\n by mails.dpdk.org (Postfix) with ESMTP id B86EE4067B\n for <dev@dpdk.org>; Fri, 26 Mar 2021 09:52:35 +0100 (CET)",
            "from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58])\n by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F6FzB60ttzPmjr;\n Fri, 26 Mar 2021 16:49:58 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id\n 14.3.498.0; Fri, 26 Mar 2021 16:52:28 +0800"
        ],
        "From": "\"Min Hu (Connor)\" <humin29@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<ferruh.yigit@intel.com>, <ajit.khaparde@broadcom.com>,\n <xiaoyun.li@intel.com>",
        "Date": "Fri, 26 Mar 2021 16:52:58 +0800",
        "Message-ID": "<1616748778-10995-1-git-send-email-humin29@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1614906276-34293-1-git-send-email-oulijun@huawei.com>",
        "References": "<1614906276-34293-1-git-send-email-oulijun@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"UTF-8\"",
        "Content-Transfer-Encoding": "8bit",
        "X-Originating-IP": "[10.69.192.56]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH v7] 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": "From: Lijun Ou <oulijun@huawei.com>\n\nThis patch adds multi-process support for testpmd.\nThe test cmd example as follows:\nthe primary cmd:\n./dpdk-testpmd -a xxx --proc-type=auto -l 0-1 -- -i \\\n--rxq=4 --txq=4 --num-procs=2 --proc-id=0\n\nthe secondary cmd:\n./dpdk-testpmd -a xxx --proc-type=auto -l 2-3 -- -i \\\n--rxq=4 --txq=4 --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---\nv7:\n* Fixed compiling error for unexpected unindent.\n\nv6:\n* Add rte flow description for multiple process.\n\nv5:\n* Fixed run_app.rst for multiple process description.\n* Fix compiling error.\n\nv4:\n* Fixed minimum vlaue of Rxq or Txq in doc.\n\nv3:\n* Fixed compiling error using gcc10.0.\n\nv2:\n* Added document for this patch.\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                | 127 ++++++++++++++++++++++------------\n app/test-pmd/testpmd.h                |   7 ++\n doc/guides/testpmd_app_ug/run_app.rst |  99 ++++++++++++++++++++++++++\n 6 files changed, 219 insertions(+), 46 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 14110eb..287d7a0 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -71,8 +71,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@@ -5351,6 +5349,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@@ -17227,6 +17231,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 ef0b978..e48cbd9 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 a326c8c..ec3bc62 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@@ -644,6 +646,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@@ -1410,6 +1414,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 96d2e0f..c31234e 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -63,6 +63,9 @@\n \n #include \"testpmd.h\"\n \n+int testpmd_fd_copy; /* the copy of STDIN_FILENO */\n+struct cmdline *testpmd_cl;\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 +128,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@@ -977,6 +983,11 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \tmb_size = sizeof(struct rte_mbuf) + mbuf_seg_size;\n \tmbuf_poolname_build(socket_id, pool_name, sizeof(pool_name), size_idx);\n \n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY) {\n+\t\trte_mp = rte_mempool_lookup(pool_name);\n+\t\tgoto err;\n+\t}\n+\n \tTESTPMD_LOG(INFO,\n \t\t\"create a new mbuf pool <%s>: n=%u, size=%u, socket=%u\\n\",\n \t\tpool_name, nb_mbuf, mbuf_seg_size, socket_id);\n@@ -1059,9 +1070,14 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \n err:\n \tif (rte_mp == NULL) {\n-\t\trte_exit(EXIT_FAILURE,\n-\t\t\t\"Creation of mbuf pool for socket %u failed: %s\\n\",\n-\t\t\tsocket_id, rte_strerror(rte_errno));\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"Creation of mbuf pool for socket %u failed: %s\\n\",\n+\t\t\t\tsocket_id, rte_strerror(rte_errno));\n+\t\telse\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"Get mbuf pool for socket %u failed: %s\\n\",\n+\t\t\t\tsocket_id, rte_strerror(rte_errno));\n \t} else if (verbose_level > 0) {\n \t\trte_mempool_dump(stdout, rte_mp);\n \t}\n@@ -2002,6 +2018,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@@ -2511,21 +2533,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@@ -2626,17 +2655,20 @@ start_port(portid_t pid)\n \t\tcnt_pi++;\n \n \t\t/* start port */\n-\t\tdiag = rte_eth_dev_start(pi);\n-\t\tif (diag < 0) {\n-\t\t\tprintf(\"Fail to start port %d: %s\\n\", pi,\n-\t\t\t       rte_strerror(-diag));\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: %s\\n\", pi,\n+\t\t\t\t       rte_strerror(-diag));\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\t/* Fail to setup rx queue, return */\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\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\t\tprintf(\"Port %d can not be set back to \"\n+\t\t\t\t\t\t\t\t\"stopped\\n\",\n+\t\t\t\t\t\tpi);\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t}\n \n \t\tif (rte_atomic16_cmpset(&(port->port_status),\n@@ -2765,7 +2797,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@@ -2834,8 +2867,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@@ -3099,7 +3134,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@@ -3621,6 +3656,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@@ -3719,13 +3758,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@@ -3756,12 +3788,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@@ -3786,10 +3822,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@@ -3885,8 +3917,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@@ -3932,6 +3966,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@@ -3967,6 +4003,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 a87ccb0..640a377 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+extern uint8_t f_quit;\n+extern int testpmd_fd_copy;\n+extern 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@@ -423,6 +428,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;\ndiff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst\nindex ec1dc7d..ce85aa0 100644\n--- a/doc/guides/testpmd_app_ug/run_app.rst\n+++ b/doc/guides/testpmd_app_ug/run_app.rst\n@@ -551,3 +551,102 @@ The command line options are:\n     bit 1 - two hairpin ports paired\n     bit 0 - two hairpin ports loop\n     The default value is 0. Hairpin will use single port mode and implicit Tx flow mode.\n+\n+\n+Testpmd Support Multi Process Command-line Options\n+--------------------------------------------------\n+\n+The following are the command-line options for the testpmd applications(support\n+multi process).They must be separated from the EAL options, shown in the previous\n+section, with a ``--`` separator:\n+\n+.. code-block:: console\n+\n+\tprimary process:\n+\tsudo ./dpdk-testpmd -a xxx --proc-type=auto -l 0-1 -- -i --rxq=4 --txq=4 \\\n+        --num-procs=2 --proc-id=0\n+\n+\tsecondary process:\n+\tsudo ./dpdk-testpmd -a xxx --proc-type=auto -l 2-3 -- -i --rxq=4 --txq=4 \\\n+        --num-procs=2 --proc-id=1\n+\n+The command line options are:\n+\n+*   ``-a, --allow``\n+\n+    Add a device to the allow list. ``xxx`` means device used which should be the\n+    same in primary process and secondary process.\n+\n+*   ``--proc-type``\n+\n+    Specify a given process instance as the primary or secondary DPDK instance.\n+    ``auto`` set here is OK.\n+\n+*   ``-l CORELIST``\n+\n+    List of cores to run on. the corelist should be different in primary process and\n+    secondary process.\n+\n+*   ``--rxq=N``\n+\n+    Set the number of Rx queues per port to N. N is the sum of queues used by primary\n+    and secondary process. As primary process and secondary process should have separate\n+    queues, and each should occupy at least one queue.where N should be no less than two.\n+\n+*   ``--txq=N``\n+\n+    Set the number of Tx queues per port to N. N is the sum of queues used by primary\n+    and secondary process. As primary process and secondary process should have separate\n+    queues, and each should occupy at least one queue.where N should be no less than two.\n+\n+*   ``--num-procs=N``\n+\n+    The number of processes which will be used.\n+\n+*   ``--proc-id=id``\n+\n+    The id of the current process (id < num-procs). id should be different in primary\n+    process and secondary process.\n+\n+Calculation rule for queue:\n+All queues are allocated to different processes based on proc_num and proc_id.\n+Calculation rule for the Testpmd to allocate queues to each process:\n+start(queue start id) = proc_id * nb_q / num_procs;\n+end(queue end id) = start + nb_q / num_procs;\n+\n+For example, if supports 4 txq and rxq\n+the 0~1 for primary process\n+the 2~3 for secondary process\n+\n+The number of rings had better be a multiple of the number of processes. If not,\n+redundant queues will exist after queues are allocated to processes. After RSS is\n+enabled, packet loss occurs when traffic is sent to all processes at the same time.\n+Some traffic enters redundant queues and cannot be forwarded.\n+\n+Most dev ops is supported in primary and secondary process. While secondary process\n+is not permitted to allocate or release shared memory, so some ops are not supported\n+as follows:\n+``dev_configure``\n+``dev_start``\n+``dev_stop``\n+``rx_queue_setup``\n+``tx_queue_setup``\n+``rx_queue_release``\n+``tx_queue_release``\n+\n+So, any command from testpmd which calls those APIs will not be supported in secondary\n+process, like:\n+``port config all rxq|txq|rxd|txd <value>``\n+``port config <port_id> rx_offload xxx on/off ``\n+``port config <port_id> tx_offload xxx on/off``\n+etc.\n+\n+RTE_FLOW supported, it applies only on its own process on SW side, but all on HW size.\n+stats supported, stats will not change when one quit and start, As they share the same\n+buffer to store the stats. Flow rules are maintained in process level: primary and secondary\n+has its own flow list(but one flow list in HW). The two can see all the queues, so setting\n+the flow rules for the other is OK. Of course, io(receive or transmit packets) in the queue\n+from others is not permitted.\n+\n+RSS supported, Primary process and secondary process has separate queues to use, RSS\n+will work in their own queues whether primary and secondary process.\n",
    "prefixes": [
        "v7"
    ]
}