get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 107677,
    "url": "https://patches.dpdk.org/api/patches/107677/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220216070417.9597-3-xuan.ding@intel.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": "<20220216070417.9597-3-xuan.ding@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220216070417.9597-3-xuan.ding@intel.com",
    "date": "2022-02-16T07:04:17",
    "name": "[RFC,2/2] examples/vhost: use API to check inflight packets",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e9ec0f9cead5fa4a6d3ad4535f3053b2fcd464a0",
    "submitter": {
        "id": 1401,
        "url": "https://patches.dpdk.org/api/people/1401/?format=api",
        "name": "Ding, Xuan",
        "email": "xuan.ding@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220216070417.9597-3-xuan.ding@intel.com/mbox/",
    "series": [
        {
            "id": 21690,
            "url": "https://patches.dpdk.org/api/series/21690/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=21690",
            "date": "2022-02-16T07:04:15",
            "name": "add unsafe API to get inflight packets",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/21690/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/107677/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/107677/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 2FC61A034C;\n\tWed, 16 Feb 2022 08:05:42 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 66C4A41152;\n\tWed, 16 Feb 2022 08:05:32 +0100 (CET)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id 4EFA24013F\n for <dev@dpdk.org>; Wed, 16 Feb 2022 08:05:30 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 15 Feb 2022 23:05:28 -0800",
            "from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.110.228])\n by fmsmga001.fm.intel.com with ESMTP; 15 Feb 2022 23:05:26 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1644995130; x=1676531130;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=F6TYgvAXz5PWcyau88xOkTGYQS8y/0NV3SNpfEwmyXs=;\n b=ORIdfU/R1x0COThAO12OCvNGgx2s40PM1+xpdquz+zisWbTKHgxgo5td\n xXiMTgZDI1Rkb3BVBtslfxluR2BIe2HWfT0h6smxhc2f8xLMmI7yLCQl4\n L6XWDUrzkK7YovGbBfQ7ZQRCD49TsXUpqdl9tGsenZA6goMjpcJiJUL2w\n b+BaI4dTKU6Y6wp35J4d+U4RR/9T+gFFBNAVZQlhLs041gHzixXYIF01K\n WvvkIx0dIIijGFcSMtFshDiX1M/wKO1p2fXUsjGaJsmHT66XyB1GqwitP\n pi+IYqBXT/xrwjLWi88KzlWCFqdcbr0pJpyXtZnyX6DrITVs3igL0Gr6g g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10259\"; a=\"249370812\"",
            "E=Sophos;i=\"5.88,373,1635231600\"; d=\"scan'208\";a=\"249370812\"",
            "E=Sophos;i=\"5.88,373,1635231600\"; d=\"scan'208\";a=\"681388013\""
        ],
        "X-ExtLoop1": "1",
        "From": "xuan.ding@intel.com",
        "To": "maxime.coquelin@redhat.com,\n\tchenbo.xia@intel.com",
        "Cc": "dev@dpdk.org, jiayu.hu@intel.com, sunil.pai.g@intel.com,\n Xuan Ding <xuan.ding@intel.com>",
        "Subject": "[RFC 2/2] examples/vhost: use API to check inflight packets",
        "Date": "Wed, 16 Feb 2022 07:04:17 +0000",
        "Message-Id": "<20220216070417.9597-3-xuan.ding@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20220216070417.9597-1-xuan.ding@intel.com>",
        "References": "<20220216070417.9597-1-xuan.ding@intel.com>",
        "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": "From: Xuan Ding <xuan.ding@intel.com>\n\nIn async data path, call rte_vhost_async_get_inflight_thread_unsafe()\nAPI to directly return the number of inflight packets instead of\nmaintaining a local variable.\n\nSigned-off-by: Xuan Ding <xuan.ding@intel.com>\n---\n examples/vhost/main.c | 28 +++++++++++++++-------------\n examples/vhost/main.h |  1 -\n 2 files changed, 15 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/examples/vhost/main.c b/examples/vhost/main.c\nindex 3e784f5c6f..ba7ab23f4e 100644\n--- a/examples/vhost/main.c\n+++ b/examples/vhost/main.c\n@@ -972,10 +972,8 @@ complete_async_pkts(struct vhost_dev *vdev)\n \n \tcomplete_count = rte_vhost_poll_enqueue_completed(vdev->vid,\n \t\t\t\t\tVIRTIO_RXQ, p_cpl, MAX_PKT_BURST, dma_id, 0);\n-\tif (complete_count) {\n+\tif (complete_count)\n \t\tfree_pkts(p_cpl, complete_count);\n-\t\t__atomic_sub_fetch(&vdev->pkts_inflight, complete_count, __ATOMIC_SEQ_CST);\n-\t}\n \n }\n \n@@ -1017,7 +1015,6 @@ drain_vhost(struct vhost_dev *vdev)\n \n \t\tcomplete_async_pkts(vdev);\n \t\tret = rte_vhost_submit_enqueue_burst(vdev->vid, VIRTIO_RXQ, m, nr_xmit, dma_id, 0);\n-\t\t__atomic_add_fetch(&vdev->pkts_inflight, ret, __ATOMIC_SEQ_CST);\n \n \t\tenqueue_fail = nr_xmit - ret;\n \t\tif (enqueue_fail)\n@@ -1346,7 +1343,6 @@ drain_eth_rx(struct vhost_dev *vdev)\n \t\tcomplete_async_pkts(vdev);\n \t\tenqueue_count = rte_vhost_submit_enqueue_burst(vdev->vid,\n \t\t\t\t\tVIRTIO_RXQ, pkts, rx_count, dma_id, 0);\n-\t\t__atomic_add_fetch(&vdev->pkts_inflight, enqueue_count, __ATOMIC_SEQ_CST);\n \n \t\tenqueue_fail = rx_count - enqueue_count;\n \t\tif (enqueue_fail)\n@@ -1518,14 +1514,17 @@ destroy_device(int vid)\n \n \tif (dma_bind[vid].dmas[VIRTIO_RXQ].async_enabled) {\n \t\tuint16_t n_pkt = 0;\n+\t\tint pkts_inflight;\n \t\tint16_t dma_id = dma_bind[vid].dmas[VIRTIO_RXQ].dev_id;\n-\t\tstruct rte_mbuf *m_cpl[vdev->pkts_inflight];\n+\t\tpkts_inflight = rte_vhost_async_get_inflight_thread_unsafe(vid, VIRTIO_RXQ);\n+\t\tstruct rte_mbuf *m_cpl[pkts_inflight];\n \n-\t\twhile (vdev->pkts_inflight) {\n+\t\twhile (pkts_inflight) {\n \t\t\tn_pkt = rte_vhost_clear_queue_thread_unsafe(vid, VIRTIO_RXQ,\n-\t\t\t\t\t\tm_cpl, vdev->pkts_inflight, dma_id, 0);\n+\t\t\t\t\t\tm_cpl, pkts_inflight, dma_id, 0);\n \t\t\tfree_pkts(m_cpl, n_pkt);\n-\t\t\t__atomic_sub_fetch(&vdev->pkts_inflight, n_pkt, __ATOMIC_SEQ_CST);\n+\t\t\tpkts_inflight = rte_vhost_async_get_inflight_thread_unsafe(vid,\n+\t\t\t\t\t\t\t\t\t\tVIRTIO_RXQ);\n \t\t}\n \n \t\trte_vhost_async_channel_unregister(vid, VIRTIO_RXQ);\n@@ -1629,14 +1628,17 @@ vring_state_changed(int vid, uint16_t queue_id, int enable)\n \tif (dma_bind[vid].dmas[queue_id].async_enabled) {\n \t\tif (!enable) {\n \t\t\tuint16_t n_pkt = 0;\n+\t\t\tint pkts_inflight;\n+\t\t\tpkts_inflight = rte_vhost_async_get_inflight_thread_unsafe(vid, queue_id);\n \t\t\tint16_t dma_id = dma_bind[vid].dmas[VIRTIO_RXQ].dev_id;\n-\t\t\tstruct rte_mbuf *m_cpl[vdev->pkts_inflight];\n+\t\t\tstruct rte_mbuf *m_cpl[pkts_inflight];\n \n-\t\t\twhile (vdev->pkts_inflight) {\n+\t\t\twhile (pkts_inflight) {\n \t\t\t\tn_pkt = rte_vhost_clear_queue_thread_unsafe(vid, queue_id,\n-\t\t\t\t\t\t\tm_cpl, vdev->pkts_inflight, dma_id, 0);\n+\t\t\t\t\t\t\tm_cpl, pkts_inflight, dma_id, 0);\n \t\t\t\tfree_pkts(m_cpl, n_pkt);\n-\t\t\t\t__atomic_sub_fetch(&vdev->pkts_inflight, n_pkt, __ATOMIC_SEQ_CST);\n+\t\t\t\tpkts_inflight = rte_vhost_async_get_inflight_thread_unsafe(vid,\n+\t\t\t\t\t\t\t\t\t\t\tqueue_id);\n \t\t\t}\n \t\t}\n \t}\ndiff --git a/examples/vhost/main.h b/examples/vhost/main.h\nindex b4a453e77e..e7f395c3c9 100644\n--- a/examples/vhost/main.h\n+++ b/examples/vhost/main.h\n@@ -52,7 +52,6 @@ struct vhost_dev {\n \tuint64_t features;\n \tsize_t hdr_len;\n \tuint16_t nr_vrings;\n-\tuint16_t pkts_inflight;\n \tstruct rte_vhost_memory *mem;\n \tstruct device_statistics stats;\n \tTAILQ_ENTRY(vhost_dev) global_vdev_entry;\n",
    "prefixes": [
        "RFC",
        "2/2"
    ]
}