get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 129801,
    "url": "http://patchwork.dpdk.org/api/patches/129801/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230802031600.23631-5-lihuisong@huawei.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20230802031600.23631-5-lihuisong@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230802031600.23631-5-lihuisong@huawei.com",
    "date": "2023-08-02T03:15:59",
    "name": "[RESEND,v6,4/5] app/testpmd: add attach and detach port for multiple process",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "75e0f7ceecc09de08777bd1c515e003c3d013e4d",
    "submitter": {
        "id": 2085,
        "url": "http://patchwork.dpdk.org/api/people/2085/?format=api",
        "name": "lihuisong (C)",
        "email": "lihuisong@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230802031600.23631-5-lihuisong@huawei.com/mbox/",
    "series": [
        {
            "id": 29084,
            "url": "http://patchwork.dpdk.org/api/series/29084/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29084",
            "date": "2023-08-02T03:15:58",
            "name": "app/testpmd: support multiple process attach and detach port",
            "version": 6,
            "mbox": "http://patchwork.dpdk.org/series/29084/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/129801/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/129801/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 B0C7042FB3;\n\tWed,  2 Aug 2023 05:19:02 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DF5134325E;\n\tWed,  2 Aug 2023 05:18:49 +0200 (CEST)",
            "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id 5D845410DC\n for <dev@dpdk.org>; Wed,  2 Aug 2023 05:18:45 +0200 (CEST)",
            "from kwepemm600004.china.huawei.com (unknown [172.30.72.56])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RFxtZ32bpzNmhK;\n Wed,  2 Aug 2023 11:15:18 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.27; Wed, 2 Aug 2023 11:18:43 +0800"
        ],
        "From": "Huisong Li <lihuisong@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<thomas@monjalon.net>, <ferruh.yigit@amd.com>,\n <andrew.rybchenko@oktetlabs.ru>, <fengchengwen@huawei.com>,\n <liudongdong3@huawei.com>, <liuyonglong@huawei.com>, <lihuisong@huawei.com>",
        "Subject": "[PATCH RESEND v6 4/5] app/testpmd: add attach and detach port for\n multiple process",
        "Date": "Wed, 2 Aug 2023 11:15:59 +0800",
        "Message-ID": "<20230802031600.23631-5-lihuisong@huawei.com>",
        "X-Mailer": "git-send-email 2.33.0",
        "In-Reply-To": "<20230802031600.23631-1-lihuisong@huawei.com>",
        "References": "<20220825024425.10534-1-lihuisong@huawei.com>\n <20230802031600.23631-1-lihuisong@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.69.192.56]",
        "X-ClientProxiedBy": "dggems704-chm.china.huawei.com (10.3.19.181) To\n kwepemm600004.china.huawei.com (7.193.23.242)",
        "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": "The port information needs to be updated due to attaching and detaching\nport. Currently, it is done in the same thread as removing or probing\ndevice, which doesn't satisfy the operation of attaching and detaching\ndevice in multiple process.\n\nIf this operation is performed in one process, the other process can\nreceive 'new' or 'destroy' event. So we can move updating port information\nto event callback to support attaching and detaching port in primary and\nsecondary process.\n\nThe reason for adding an alarm callback in 'destroy' event is that the\nethdev state is changed from 'ATTACHED' to 'UNUSED' only after the event\ncallback finished. But the remove_invalid_ports() function removes invalid\nport only if ethdev state is 'UNUSED'. If we don't add alarm callback, this\ndetached port information can not be removed.\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Dongdong Liu <liudongdong3@huawei.com>\nAcked-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n app/test-pmd/testpmd.c                | 38 ++++++++++++++++-----------\n app/test-pmd/testpmd.h                |  1 -\n drivers/net/bonding/bonding_testpmd.c |  1 -\n 3 files changed, 22 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex f934f6b418..a5124c3231 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -3610,15 +3610,12 @@ attach_port(char *identifier)\n \t\treturn;\n \t}\n \n-\t/* first attach mode: event */\n-\tif (setup_on_probe_event) {\n-\t\t/* new ports are detected on RTE_ETH_EVENT_NEW event */\n-\t\tfor (pi = 0; pi < RTE_MAX_ETHPORTS; pi++)\n-\t\t\tif (ports[pi].port_status == RTE_PORT_HANDLING &&\n-\t\t\t\t\tports[pi].need_setup != 0)\n-\t\t\t\tsetup_attached_port(pi);\n+\t/*\n+\t * first attach mode: event, setting up attached port is done in\n+\t * probing callback.\n+\t */\n+\tif (setup_on_probe_event)\n \t\treturn;\n-\t}\n \n \t/* second attach mode: iterator */\n \tRTE_ETH_FOREACH_MATCHING_DEV(pi, identifier, &iterator) {\n@@ -3649,7 +3646,6 @@ setup_attached_port(portid_t pi)\n \tports_ids[nb_ports++] = pi;\n \tfwd_ports_ids[nb_fwd_ports++] = pi;\n \tnb_cfg_ports = nb_fwd_ports;\n-\tports[pi].need_setup = 0;\n \tports[pi].port_status = RTE_PORT_STOPPED;\n \n \tprintf(\"Port %d is attached. Now total ports is %d\\n\", pi, nb_ports);\n@@ -3683,10 +3679,8 @@ detach_device(struct rte_device *dev)\n \t\tTESTPMD_LOG(ERR, \"Failed to detach device %s\\n\", rte_dev_name(dev));\n \t\treturn;\n \t}\n-\tremove_invalid_ports();\n \n \tprintf(\"Device is detached\\n\");\n-\tprintf(\"Now total ports is %d\\n\", nb_ports);\n \tprintf(\"Done\\n\");\n \treturn;\n }\n@@ -3753,11 +3747,9 @@ detach_devargs(char *identifier)\n \t\treturn;\n \t}\n \n-\tremove_invalid_ports();\n-\n \tprintf(\"Device %s is detached\\n\", identifier);\n-\tprintf(\"Now total ports is %d\\n\", nb_ports);\n \tprintf(\"Done\\n\");\n+\n \trte_devargs_reset(&da);\n }\n \n@@ -3921,11 +3913,22 @@ rmv_port_callback(void *arg)\n \t\tstruct rte_device *device = dev_info.device;\n \t\tclose_port(port_id);\n \t\tdetach_device(device); /* might be already removed or have more ports */\n+\t\tremove_invalid_ports();\n+\t\tprintf(\"Now total ports is %d\\n\", nb_ports);\n \t}\n \tif (need_to_start)\n \t\tstart_packet_forwarding(0);\n }\n \n+static void\n+remove_invalid_ports_callback(void *arg)\n+{\n+\tRTE_SET_USED(arg);\n+\n+\tremove_invalid_ports();\n+\tprintf(\"Now total ports is %d\\n\", nb_ports);\n+}\n+\n /* This function is used by the interrupt thread */\n static int\n eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,\n@@ -3950,8 +3953,8 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,\n \n \tswitch (type) {\n \tcase RTE_ETH_EVENT_NEW:\n-\t\tports[port_id].need_setup = 1;\n-\t\tports[port_id].port_status = RTE_PORT_HANDLING;\n+\t\tif (setup_on_probe_event)\n+\t\t\tsetup_attached_port(port_id);\n \t\tbreak;\n \tcase RTE_ETH_EVENT_INTR_RMV:\n \t\tif (rte_eal_alarm_set(100000,\n@@ -3962,6 +3965,9 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,\n \tcase RTE_ETH_EVENT_DESTROY:\n \t\tports[port_id].port_status = RTE_PORT_CLOSED;\n \t\tprintf(\"Port %u is closed\\n\", port_id);\n+\t\tif (rte_eal_alarm_set(100000, remove_invalid_ports_callback,\n+\t\t\t(void *)(intptr_t)port_id))\n+\t\t\tfprintf(stderr, \"Could not set up deferred device released\\n\");\n \t\tbreak;\n \tcase RTE_ETH_EVENT_RX_AVAIL_THRESH: {\n \t\tuint16_t rxq_id;\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex f1df6a8faf..daacdd7ee4 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -324,7 +324,6 @@ struct rte_port {\n \tuint16_t                tx_vlan_id;/**< The tag ID */\n \tuint16_t                tx_vlan_id_outer;/**< The outer tag ID */\n \tvolatile uint16_t        port_status;    /**< port started or not */\n-\tuint8_t                 need_setup;     /**< port just attached */\n \tuint8_t                 need_reconfig;  /**< need reconfiguring port or not */\n \tuint8_t                 need_reconfig_queues; /**< need reconfiguring queues or not */\n \tuint8_t                 rss_flag;   /**< enable rss or not */\ndiff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c\nindex b3c12cada0..160f638e3a 100644\n--- a/drivers/net/bonding/bonding_testpmd.c\n+++ b/drivers/net/bonding/bonding_testpmd.c\n@@ -493,7 +493,6 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,\n \n \tports[port_id].update_conf = 1;\n \tports[port_id].bond_flag = 1;\n-\tports[port_id].need_setup = 0;\n \tports[port_id].port_status = RTE_PORT_STOPPED;\n }\n \n",
    "prefixes": [
        "RESEND",
        "v6",
        "4/5"
    ]
}