get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 136215,
    "url": "https://patches.dpdk.org/api/patches/136215/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240130063648.32131-5-lihuisong@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": "<20240130063648.32131-5-lihuisong@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240130063648.32131-5-lihuisong@huawei.com",
    "date": "2024-01-30T06:36:47",
    "name": "[v7,4/5] app/testpmd: add attach and detach port for multiple process",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "75e0f7ceecc09de08777bd1c515e003c3d013e4d",
    "submitter": {
        "id": 2085,
        "url": "https://patches.dpdk.org/api/people/2085/?format=api",
        "name": "lihuisong (C)",
        "email": "lihuisong@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/20240130063648.32131-5-lihuisong@huawei.com/mbox/",
    "series": [
        {
            "id": 30937,
            "url": "https://patches.dpdk.org/api/series/30937/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=30937",
            "date": "2024-01-30T06:36:43",
            "name": "app/testpmd: support multiple process attach and detach port",
            "version": 7,
            "mbox": "https://patches.dpdk.org/series/30937/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/136215/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/136215/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 926A543A06;\n\tTue, 30 Jan 2024 07:38:10 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 86246410E4;\n\tTue, 30 Jan 2024 07:37:44 +0100 (CET)",
            "from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189])\n by mails.dpdk.org (Postfix) with ESMTP id 8949440DFD\n for <dev@dpdk.org>; Tue, 30 Jan 2024 07:37:38 +0100 (CET)",
            "from mail.maildlp.com (unknown [172.19.163.174])\n by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4TPFnK2QR4zNlrd;\n Tue, 30 Jan 2024 14:36:37 +0800 (CST)",
            "from kwepemm600004.china.huawei.com (unknown [7.193.23.242])\n by mail.maildlp.com (Postfix) with ESMTPS id 72D7014040F;\n Tue, 30 Jan 2024 14:37:36 +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.35; Tue, 30 Jan 2024 14:37:35 +0800"
        ],
        "From": "Huisong Li <lihuisong@huawei.com>",
        "To": "<dev@dpdk.org>, Aman Singh <aman.deep.singh@intel.com>, Yuying Zhang\n <yuying.zhang@intel.com>, Chas Williams <chas3@att.com>, \"Min Hu (Connor)\"\n <humin29@huawei.com>",
        "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 v7 4/5] app/testpmd: add attach and detach port for multiple\n process",
        "Date": "Tue, 30 Jan 2024 14:36:47 +0800",
        "Message-ID": "<20240130063648.32131-5-lihuisong@huawei.com>",
        "X-Mailer": "git-send-email 2.33.0",
        "In-Reply-To": "<20240130063648.32131-1-lihuisong@huawei.com>",
        "References": "<20220825024425.10534-1-lihuisong@huawei.com>\n <20240130063648.32131-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": "dggems705-chm.china.huawei.com (10.3.19.182) To\n kwepemm600004.china.huawei.com (7.193.23.242)",
        "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 859d4aad7d..db985d33a3 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -3625,15 +3625,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@@ -3664,7 +3661,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@@ -3698,10 +3694,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@@ -3768,11 +3762,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@@ -3936,11 +3928,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@@ -3965,8 +3968,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@@ -3977,6 +3980,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 9b10a9ea1c..0e860c2e67 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -326,7 +326,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 8fcd6cadd0..f4845206ad 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_bonding_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": [
        "v7",
        "4/5"
    ]
}