get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 95214,
    "url": "https://patches.dpdk.org/api/patches/95214/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210702120906.705007-1-Andrew.Rybchenko@oktetlabs.ru/",
    "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": "<20210702120906.705007-1-Andrew.Rybchenko@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210702120906.705007-1-Andrew.Rybchenko@oktetlabs.ru",
    "date": "2021-07-02T12:09:05",
    "name": "[v15] app/testpmd: support multi-process",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ccae4d30d9f27dfa6e97dd301a211ad02d5b6b11",
    "submitter": {
        "id": 2013,
        "url": "https://patches.dpdk.org/api/people/2013/?format=api",
        "name": "Andrew Rybchenko",
        "email": "Andrew.Rybchenko@oktetlabs.ru"
    },
    "delegate": {
        "id": 3961,
        "url": "https://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210702120906.705007-1-Andrew.Rybchenko@oktetlabs.ru/mbox/",
    "series": [
        {
            "id": 17596,
            "url": "https://patches.dpdk.org/api/series/17596/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17596",
            "date": "2021-07-02T12:09:05",
            "name": "[v15] app/testpmd: support multi-process",
            "version": 15,
            "mbox": "https://patches.dpdk.org/series/17596/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/95214/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/95214/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 362BBA0A0C;\n\tFri,  2 Jul 2021 14:09:56 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id AD72241353;\n\tFri,  2 Jul 2021 14:09:55 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id 6242F40686\n for <dev@dpdk.org>; Fri,  2 Jul 2021 14:09:54 +0200 (CEST)",
            "by shelob.oktetlabs.ru (Postfix, from userid 122)\n id E048B7F52A; Fri,  2 Jul 2021 15:09:53 +0300 (MSK)",
            "from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17])\n by shelob.oktetlabs.ru (Postfix) with ESMTP id 6305D7F4DA;\n Fri,  2 Jul 2021 15:09:49 +0300 (MSK)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.8 required=5.0 tests=ALL_TRUSTED,\n DKIM_ADSP_DISCARD,\n URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2",
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 6305D7F4DA",
        "Authentication-Results": "shelob.oktetlabs.ru/6305D7F4DA; dkim=none;\n dkim-atps=neutral",
        "From": "Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru>",
        "To": "Xiaoyun Li <xiaoyun.li@intel.com>,\n Anatoly Burakov <anatoly.burakov@intel.com>",
        "Cc": "dev@dpdk.org, \"Min Hu (Connor)\" <humin29@huawei.com>,\n Lijun Ou <oulijun@huawei.com>, Ajit Khaparde <ajit.khaparde@broadcom.com>,\n Ferruh Yigit <ferruh.yigit@intel.com>",
        "Date": "Fri,  2 Jul 2021 15:09:05 +0300",
        "Message-Id": "<20210702120906.705007-1-Andrew.Rybchenko@oktetlabs.ru>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<1615430867-29992-1-git-send-email-humin29@huawei.com>",
        "References": "<1615430867-29992-1-git-send-email-humin29@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v15] 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: \"Min Hu (Connor)\" <humin29@huawei.com>\n\nFor example the following commands run two testpmd processes:\n\n * the primary process:\n\n./dpdk-testpmd --proc-type=auto -l 0-1 -- -i \\\n   --rxq=4 --txq=4 --num-procs=2 --proc-id=0\n\n * the secondary process:\n\n./dpdk-testpmd --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>\nSigned-off-by: Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru>\nAcked-by: Xiaoyun Li <xiaoyun.li@intel.com>\nAcked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\nReviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>\n---\nv15:\n* Fixed release notes.\n* Cleanup documentation.\n\nv14:\n* Fixed comments by Andrew Rybchenko.\n\nv13:\n* Modified the doc syntax.\n\nv12:\n* Updated doc info.\n\nv11:\n* Fixed some minor syntax.\n\nv10:\n* Hid process type checks behind new functions.\n* Added comments.\n\nv9:\n* Updated release notes and rst doc.\n* Deleted deprecated codes.\n* move macro and variable.\n\nv8:\n* Added warning info about queue numbers and process numbers.\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                 |   6 ++\n app/test-pmd/config.c                  |  20 +++-\n app/test-pmd/parameters.c              |   9 ++\n app/test-pmd/testpmd.c                 | 121 ++++++++++++++++++++-----\n app/test-pmd/testpmd.h                 |   9 ++\n doc/guides/rel_notes/release_21_08.rst |   5 +\n doc/guides/testpmd_app_ug/run_app.rst  |  82 +++++++++++++++++\n 7 files changed, 228 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 8468018cf..5b9880dde 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -5459,6 +5459,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 \ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 04ae0feb5..9e4d86b4a 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2976,6 +2976,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@@ -2993,7 +2995,21 @@ 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+\n+\tif (proc_id > 0 && nb_q % num_procs != 0)\n+\t\tprintf(\"Warning! queue numbers should be multiple of processes, or packet loss will happen.\\n\");\n+\n+\t/**\n+\t * In multi-process, All queues are allocated to different\n+\t * processes based on num_procs and proc_id. For example:\n+\t * if supports 4 queues(nb_q), 2 processes(num_procs),\n+\t * the 0~1 queue for primary process.\n+\t * the 2~3 queue for secondary process.\n+\t */\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@@ -3010,6 +3026,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 5e69d2aa8..925fca562 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -509,6 +509,9 @@ parse_link_speed(int n)\n void\n launch_args_parse(int argc, char** argv)\n {\n+#define PARAM_PROC_ID \"proc-id\"\n+#define PARAM_NUM_PROCS \"num-procs\"\n+\n \tint n, opt;\n \tchar **argvopt;\n \tint opt_idx;\n@@ -628,6 +631,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@@ -1394,6 +1399,10 @@ 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+\t\t\tif (!strcmp(lgopts[opt_idx].name, PARAM_NUM_PROCS))\n+\t\t\t\tnum_procs = atoi(optarg);\n+\t\t\tif (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))\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 1cdd3cdd1..a5da0c272 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -520,6 +520,62 @@ enum rte_eth_rx_mq_mode rx_mq_mode = ETH_MQ_RX_VMDQ_DCB_RSS;\n  */\n uint32_t eth_link_speed;\n \n+/*\n+ * ID of the current process in multi-process, used to\n+ * configure the queues to be polled.\n+ */\n+int proc_id;\n+\n+/*\n+ * Number of processes in multi-process, used to\n+ * configure the queues to be polled.\n+ */\n+unsigned int num_procs = 1;\n+\n+static int\n+eth_dev_configure_mp(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n+\t\t      const struct rte_eth_conf *dev_conf)\n+{\n+\tif (is_proc_primary())\n+\t\treturn rte_eth_dev_configure(port_id, nb_rx_q, nb_tx_q,\n+\t\t\t\t\tdev_conf);\n+\treturn 0;\n+}\n+\n+static int\n+eth_dev_start_mp(uint16_t port_id)\n+{\n+\tif (is_proc_primary())\n+\t\treturn rte_eth_dev_start(port_id);\n+\n+\treturn 0;\n+}\n+\n+static int\n+eth_dev_stop_mp(uint16_t port_id)\n+{\n+\tif (is_proc_primary())\n+\t\treturn rte_eth_dev_stop(port_id);\n+\n+\treturn 0;\n+}\n+\n+static void\n+mempool_free_mp(struct rte_mempool *mp)\n+{\n+\tif (is_proc_primary())\n+\t\trte_mempool_free(mp);\n+}\n+\n+static int\n+eth_dev_set_mtu_mp(uint16_t port_id, uint16_t mtu)\n+{\n+\tif (is_proc_primary())\n+\t\treturn rte_eth_dev_set_mtu(port_id, mtu);\n+\n+\treturn 0;\n+}\n+\n /* Forward function declarations */\n static void setup_attached_port(portid_t pi);\n static void check_all_ports_link_status(uint32_t port_mask);\n@@ -983,6 +1039,15 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n #endif\n \tmbuf_poolname_build(socket_id, pool_name, sizeof(pool_name), size_idx);\n \n+\tif (!is_proc_primary()) {\n+\t\trte_mp = rte_mempool_lookup(pool_name);\n+\t\tif (rte_mp == NULL)\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\treturn rte_mp;\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@@ -2008,6 +2073,11 @@ 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 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@@ -2495,21 +2565,24 @@ 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\t\t\t\t     nb_txq + nb_hairpinq,\n-\t\t\t\t\t\t     &(port->dev_conf));\n+\t\t\tdiag = eth_dev_configure_mp(pi,\n+\t\t\t\t\t     nb_rxq + nb_hairpinq,\n+\t\t\t\t\t     nb_txq + nb_hairpinq,\n+\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\tif (rte_atomic16_cmpset(\n+\t\t\t\t\t\t&(port->port_status),\n+\t\t\t\t\t\tRTE_PORT_HANDLING,\n+\t\t\t\t\t\tRTE_PORT_STOPPED) == 0)\n+\t\t\t\t\tprintf(\"Port %d cannot be set back to stopped\\n\",\n+\t\t\t\t\t\tpi);\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}\n \t\t}\n-\t\tif (port->need_reconfig_queues > 0) {\n+\t\tif (port->need_reconfig_queues > 0 && is_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@@ -2532,8 +2605,8 @@ start_port(portid_t pid)\n \t\t\t\tif (rte_atomic16_cmpset(&(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\tprintf(\"Port %d can not be set back \"\n-\t\t\t\t\t\t\t\"to stopped\\n\", pi);\n+\t\t\t\t\tprintf(\"Port %d cannot be set back to stopped\\n\",\n+\t\t\t\t\t\tpi);\n \t\t\t\tprintf(\"Fail to configure port %d tx queues\\n\",\n \t\t\t\t       pi);\n \t\t\t\t/* try to reconfigure queues next time */\n@@ -2610,16 +2683,16 @@ 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\tdiag = eth_dev_start_mp(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 \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\t\t\t\"stopped\\n\", pi);\n+\t\t\tRTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0)\n+\t\t\t\tprintf(\"Port %d cannot be set back to stopped\\n\",\n+\t\t\t\t       pi);\n \t\t\tcontinue;\n \t\t}\n \n@@ -2744,7 +2817,7 @@ 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 (eth_dev_stop_mp(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@@ -2813,8 +2886,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 (is_proc_primary()) {\n+\t\t\tport_flow_flush(pi);\n+\t\t\trte_eth_dev_close(pi);\n+\t\t}\n \t}\n \n \tremove_invalid_ports();\n@@ -3082,7 +3157,7 @@ pmd_test_exit(void)\n \t}\n \tfor (i = 0 ; i < RTE_DIM(mempools) ; i++) {\n \t\tif (mempools[i])\n-\t\t\trte_mempool_free(mempools[i]);\n+\t\t\tmempool_free_mp(mempools[i]);\n \t}\n \n \tprintf(\"\\nBye...\\n\");\n@@ -3413,7 +3488,7 @@ update_jumbo_frame_offload(portid_t portid)\n \t * if unset do it here\n \t */\n \tif ((rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) == 0) {\n-\t\tret = rte_eth_dev_set_mtu(portid,\n+\t\tret = eth_dev_set_mtu_mp(portid,\n \t\t\t\tport->dev_conf.rxmode.max_rx_pkt_len - eth_overhead);\n \t\tif (ret)\n \t\t\tprintf(\"Failed to set MTU to %u for port %u\\n\",\n@@ -3603,6 +3678,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@@ -3771,10 +3850,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\");\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex d61a055bd..11b9451b0 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -632,6 +632,15 @@ extern enum rte_eth_rx_mq_mode rx_mq_mode;\n \n extern struct rte_flow_action_conntrack conntrack_context;\n \n+extern int proc_id;\n+extern unsigned int num_procs;\n+\n+static inline bool\n+is_proc_primary(void)\n+{\n+\treturn rte_eal_process_type() == RTE_PROC_PRIMARY;\n+}\n+\n static inline unsigned int\n lcore_num(void)\n {\ndiff --git a/doc/guides/rel_notes/release_21_08.rst b/doc/guides/rel_notes/release_21_08.rst\nindex a6ecfdf3c..8ba0bfb83 100644\n--- a/doc/guides/rel_notes/release_21_08.rst\n+++ b/doc/guides/rel_notes/release_21_08.rst\n@@ -55,6 +55,11 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =======================================================\n \n+   * **Added multi-process support to testpmd.**\n+\n+     Added command-line options to specify total number of processes and\n+     current process ID. Each process owns subset of Rx and Tx queues.\n+\n \n Removed Items\n -------------\ndiff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst\nindex eb4831835..348e5fcac 100644\n--- a/doc/guides/testpmd_app_ug/run_app.rst\n+++ b/doc/guides/testpmd_app_ug/run_app.rst\n@@ -545,3 +545,85 @@ The command line options are:\n \tbit 0 - two hairpin ports loop\n \n     The default value is 0. Hairpin will use single port mode and implicit Tx flow mode.\n+\n+\n+Testpmd Multi-Process Command-line Options\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+The following are the command-line options for testpmd multi-process support:\n+\n+*   primary process:\n+\n+.. code-block:: console\n+\n+       sudo ./dpdk-testpmd --proc-type=auto -l 0-1 -- -i --rxq=4 --txq=4 \\\n+            --num-procs=2 --proc-id=0\n+\n+*   secondary process:\n+\n+.. code-block:: console\n+\n+       sudo ./dpdk-testpmd --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+*   ``--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\n+    primary process and secondary process, which starts from '0'.\n+\n+Calculation rule for queue:\n+All queues are allocated to different processes based on ``proc_num`` and\n+``proc_id``.\n+Calculation rule for the testpmd to allocate queues to each process:\n+\n+* start(queue start id) = proc_id * nb_q / num_procs\n+\n+* end(queue end id) = start + nb_q / num_procs\n+\n+For example, if testpmd is configured to have 4 Tx and Rx queues,\n+queues 0 and 1 will be used by the primary process and\n+queues 2 and 3 will be used by the secondary process.\n+\n+The number of queues should be a multiple of the number of processes. If not,\n+redundant queues will exist after queues are allocated to processes. If RSS\n+is enabled, packet loss occurs when traffic is sent to all processes at the same\n+time. Some traffic goes to redundant queues and cannot be forwarded.\n+\n+All the dev ops is supported in primary process. While secondary process is\n+not permitted to allocate or release shared memory, so some ops are not supported\n+as follows:\n+\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\n+secondary process, like:\n+\n+.. code-block:: console\n+\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+\n+etc.\n+\n+Stats is supported, stats will not change when one quits and starts, as they\n+share the same buffer to store the stats. Flow rules are maintained in process\n+level: primary and secondary has its own flow list (but one flow list in HW).\n+The two can see all the queues, so setting the flow rules for the other is OK.\n+But in the testpmd primary process receiving or transmitting packets from the\n+queue allocated for secondary process is not permitted, and same for secondary\n+process.\n+\n+Flow API and RSS are supported.\n",
    "prefixes": [
        "v15"
    ]
}