get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131301,
    "url": "https://patches.dpdk.org/api/patches/131301/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230908112901.1169869-37-haijie1@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": "<20230908112901.1169869-37-haijie1@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230908112901.1169869-37-haijie1@huawei.com",
    "date": "2023-09-08T11:29:01",
    "name": "[36/36] app/testpmd: fix primary process not polling all queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "4270fb80f116aa7ef4bcea4a08dc89249804a862",
    "submitter": {
        "id": 2935,
        "url": "https://patches.dpdk.org/api/people/2935/?format=api",
        "name": "Jie Hai",
        "email": "haijie1@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/20230908112901.1169869-37-haijie1@huawei.com/mbox/",
    "series": [
        {
            "id": 29461,
            "url": "https://patches.dpdk.org/api/series/29461/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=29461",
            "date": "2023-09-08T11:28:25",
            "name": "fix Rx and Tx queue state",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/29461/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/131301/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/131301/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 7001842547;\n\tFri,  8 Sep 2023 13:37:01 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3661C42D6A;\n\tFri,  8 Sep 2023 13:32:57 +0200 (CEST)",
            "from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255])\n by mails.dpdk.org (Postfix) with ESMTP id 24BD840E36\n for <dev@dpdk.org>; Fri,  8 Sep 2023 13:32:34 +0200 (CEST)",
            "from kwepemi500020.china.huawei.com (unknown [172.30.72.57])\n by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv756X7gz1M9Hn;\n Fri,  8 Sep 2023 19:30:41 +0800 (CST)",
            "from localhost.localdomain (10.67.165.2) by\n kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.31; Fri, 8 Sep 2023 19:32:31 +0800"
        ],
        "From": "Jie Hai <haijie1@huawei.com>",
        "To": "<dev@dpdk.org>, Aman Singh <aman.deep.singh@intel.com>, Yuying Zhang\n <yuying.zhang@intel.com>, Anatoly Burakov <anatoly.burakov@intel.com>, Matan\n Azrad <matan@nvidia.com>, Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>",
        "CC": "<haijie1@huawei.com>, <lihuisong@huawei.com>",
        "Subject": "[PATCH 36/36] app/testpmd: fix primary process not polling all queues",
        "Date": "Fri, 8 Sep 2023 19:29:01 +0800",
        "Message-ID": "<20230908112901.1169869-37-haijie1@huawei.com>",
        "X-Mailer": "git-send-email 2.30.0",
        "In-Reply-To": "<20230908112901.1169869-1-haijie1@huawei.com>",
        "References": "<20230908112901.1169869-1-haijie1@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.67.165.2]",
        "X-ClientProxiedBy": "dggems702-chm.china.huawei.com (10.3.19.179) To\n kwepemi500020.china.huawei.com (7.221.188.8)",
        "X-CFilter-Loop": "Reflected",
        "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"
    },
    "content": "Here's how the problem arises.\nstep1: Start the app.\n    dpdk-testpmd -a 0000:35:00.0 -l 0-3 -- -i --rxq=10 --txq=10\n\nstep2: Perform the following steps and send traffic. As expected,\nqueue 7 does not send or receive packets, and other queues do.\n    port 0 rxq 7 stop\n    port 0 txq 7 stop\n    set fwd mac\n    start\n\nstep3: Perform the following steps and send traffic. All queues\nare expected to send and receive packets normally, but that's not\nthe case for queue 7.\n    stop\n    port stop all\n    port start all\n    start\n    show port xstats all\n\nIn fact, only the value of rx_q7_packets for queue 7 is not zero,\nwhich means queue 7 is enabled for the driver but is not involved\nin packet receiving and forwarding by software. If we check queue\nstate by command 'show rxq info 0 7' and 'show txq info 0 7',\nwe see queue 7 is started as other queues are.\n    Rx queue state: started\n    Tx queue state: started\nThe queue 7 is started but cannot forward. That's the problem.\n\nWe know that each stream has a read-only \"disabled\" field that\ncontrol if this stream should be used to forward. This field\ndepends on testpmd local queue state, please see\ncommit 3c4426db54fc (\"app/testpmd: do not poll stopped queues\").\nDPDK framework maintains ethdev queue state that drivers reported,\nwhich indicates the real state of queues.\n\nThere are commands that update these two kind queue state such as\n'port X rxq|txq start|stop'. But these operations take effect only\nin one stop-start round. In the following stop-start round, the\npreceding operations do not take effect anymore. However, only\nthe ethdev queue state is updated, causing the testpmd and ethdev\nstate information to diverge and causing unexpected side effects\nas above problem.\n\nThere was a similar problem for the secondary process, please see\ncommit 5028f207a4fa (\"app/testpmd: fix secondary process packet\nforwarding\").\n\nThis patch applies its workaround with some difference to the\nprimary process. Not all PMDs implement rte_eth_rx_queue_info_get and\nrte_eth_tx_queue_info_get, however they may support deferred_start\nwith primary process. To not break their behavior, retain the original\ntestpmd local queue state for those PMDs.\n\nFixes: 3c4426db54fc (\"app/testpmd: do not poll stopped queues\")\nCc: stable@dpdk.org\n\nSigned-off-by: Jie Hai <haijie1@huawei.com>\nAcked-by: Ferruh Yigit <ferruh.yigit@amd.com>\n---\n app/test-pmd/testpmd.c | 25 ++++++++++++++++++++-----\n 1 file changed, 20 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 938ca035d4f8..079ef3392014 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -2424,6 +2424,13 @@ update_rx_queue_state(uint16_t port_id, uint16_t queue_id)\n \t\tports[port_id].rxq[queue_id].state =\n \t\t\trx_qinfo.queue_state;\n \t} else if (rc == -ENOTSUP) {\n+\t\t/*\n+\t\t * Do not change the rxq state for primary process\n+\t\t * to ensure that the PMDs do not implement\n+\t\t * rte_eth_rx_queue_info_get can forward as before.\n+\t\t */\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\treturn;\n \t\t/*\n \t\t * Set the rxq state to RTE_ETH_QUEUE_STATE_STARTED\n \t\t * to ensure that the PMDs do not implement\n@@ -2449,6 +2456,13 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id)\n \t\tports[port_id].txq[queue_id].state =\n \t\t\ttx_qinfo.queue_state;\n \t} else if (rc == -ENOTSUP) {\n+\t\t/*\n+\t\t * Do not change the txq state for primary process\n+\t\t * to ensure that the PMDs do not implement\n+\t\t * rte_eth_tx_queue_info_get can forward as before.\n+\t\t */\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\treturn;\n \t\t/*\n \t\t * Set the txq state to RTE_ETH_QUEUE_STATE_STARTED\n \t\t * to ensure that the PMDs do not implement\n@@ -2463,12 +2477,15 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id)\n }\n \n static void\n-update_queue_state(void)\n+update_queue_state(portid_t pid)\n {\n \tportid_t pi;\n \tqueueid_t qi;\n \n \tRTE_ETH_FOREACH_DEV(pi) {\n+\t\tif (pid != pi && pid != (portid_t)RTE_PORT_ALL)\n+\t\t\tcontinue;\n+\n \t\tfor (qi = 0; qi < nb_rxq; qi++)\n \t\t\tupdate_rx_queue_state(pi, qi);\n \t\tfor (qi = 0; qi < nb_txq; qi++)\n@@ -2516,8 +2533,7 @@ start_packet_forwarding(int with_tx_first)\n \t\treturn;\n \n \tif (stream_init != NULL) {\n-\t\tif (rte_eal_process_type() == RTE_PROC_SECONDARY)\n-\t\t\tupdate_queue_state();\n+\t\tupdate_queue_state(RTE_PORT_ALL);\n \t\tfor (i = 0; i < cur_fwd_config.nb_fwd_streams; i++)\n \t\t\tstream_init(fwd_streams[i]);\n \t}\n@@ -3280,8 +3296,7 @@ start_port(portid_t pid)\n \t\tpl[cfg_pi++] = pi;\n \t}\n \n-\tif (rte_eal_process_type() == RTE_PROC_SECONDARY)\n-\t\tupdate_queue_state();\n+\tupdate_queue_state(pi);\n \n \tif (at_least_one_port_successfully_started && !no_link_check)\n \t\tcheck_all_ports_link_status(RTE_PORT_ALL);\n",
    "prefixes": [
        "36/36"
    ]
}