get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 117087,
    "url": "https://patches.dpdk.org/api/patches/117087/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220929013243.15889-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": "<20220929013243.15889-3-xuan.ding@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220929013243.15889-3-xuan.ding@intel.com",
    "date": "2022-09-29T01:32:43",
    "name": "[v3,2/2] examples/vhost: unconfigure DMA vchannel",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "dd4ab39abcc2700732dd4e03d11044385fe262bd",
    "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/20220929013243.15889-3-xuan.ding@intel.com/mbox/",
    "series": [
        {
            "id": 24892,
            "url": "https://patches.dpdk.org/api/series/24892/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24892",
            "date": "2022-09-29T01:32:41",
            "name": "vhost: introduce DMA vchannel unconfiguration",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/24892/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/117087/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/117087/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 BBA9BA00C4;\n\tThu, 29 Sep 2022 03:33:50 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 04D2142B72;\n\tThu, 29 Sep 2022 03:33:27 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id D522E42802\n for <dev@dpdk.org>; Thu, 29 Sep 2022 03:33:22 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Sep 2022 18:33:22 -0700",
            "from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.111.102])\n by orsmga004.jf.intel.com with ESMTP; 28 Sep 2022 18:33:19 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1664415203; x=1695951203;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=WSUAf38m9HT/I+nSHdAP2BGiUThgU1051kigLq/zHhA=;\n b=W51SyULCrgYCMCoP0ZvMRCYt0em+trc2dx1Di6N69WIsFpuowhf0h+kK\n CoTjBtubR++XahbCViGmCrXAMS6H4FmV3sLLR3g2iiq1rMWvgh4/92Tv/\n ++sntWoUbcv6ugZAf6oMzB4a67fk2yiYNAdvJpa4Toy0IIxbTAwz/7xBm\n KqPwKVIuu4h2AUhAl0FWVtnGfSTQxCbHIkoOb/wucZqD0S1K6I7gYelPI\n e0oo0ADD7FBfrq08JHS+054V8WqPMsnlbanSu8trhP7fFC278NLzR0/5N\n v6gAFOTDdw/qCWxqLzu58LYp6+KqO2/mALU7dzzSB9LNtO/SF1kfMCK9Q w==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10484\"; a=\"328135485\"",
            "E=Sophos;i=\"5.93,353,1654585200\"; d=\"scan'208\";a=\"328135485\"",
            "E=McAfee;i=\"6500,9779,10484\"; a=\"747638181\"",
            "E=Sophos;i=\"5.93,353,1654585200\"; d=\"scan'208\";a=\"747638181\""
        ],
        "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, xingguang.he@intel.com,\n yvonnex.yang@intel.com, cheng1.jiang@intel.com, yuanx.wang@intel.com,\n wenwux.ma@intel.com, Xuan Ding <xuan.ding@intel.com>",
        "Subject": "[PATCH v3 2/2] examples/vhost: unconfigure DMA vchannel",
        "Date": "Thu, 29 Sep 2022 01:32:43 +0000",
        "Message-Id": "<20220929013243.15889-3-xuan.ding@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20220929013243.15889-1-xuan.ding@intel.com>",
        "References": "<20220814140442.82525-1-xuan.ding@intel.com>\n <20220929013243.15889-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\nThis patch applies rte_vhost_async_dma_unconfigure() API\nto manually free DMA vchannels instead of waiting\nuntil the program ends to be released.\n\nSigned-off-by: Xuan Ding <xuan.ding@intel.com>\n---\n examples/vhost/main.c | 45 ++++++++++++++++++++++++++++++-------------\n examples/vhost/main.h |  1 +\n 2 files changed, 33 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/examples/vhost/main.c b/examples/vhost/main.c\nindex 0fa4753e70..32f396d88a 100644\n--- a/examples/vhost/main.c\n+++ b/examples/vhost/main.c\n@@ -1558,6 +1558,28 @@ vhost_clear_queue(struct vhost_dev *vdev, uint16_t queue_id)\n \t}\n }\n \n+static void\n+vhost_clear_async(struct vhost_dev *vdev, int vid, uint16_t queue_id)\n+{\n+\tint16_t dma_id;\n+\tuint16_t ref_count;\n+\n+\tif (dma_bind[vid].dmas[queue_id].async_enabled) {\n+\t\tvhost_clear_queue(vdev, queue_id);\n+\t\trte_vhost_async_channel_unregister(vid, queue_id);\n+\t\tdma_bind[vid].dmas[queue_id].async_enabled = false;\n+\t}\n+\n+\tdma_id = dma_bind[vid2socketid[vdev->vid]].dmas[queue_id].dev_id;\n+\tdma_bind[vid2socketid[vdev->vid]].dmas[queue_id].dma_ref_count--;\n+\tref_count = dma_bind[vid2socketid[vdev->vid]].dmas[queue_id].dma_ref_count;\n+\n+\tif (ref_count == 0 && dma_id != INVALID_DMA_ID) {\n+\t\tif (rte_vhost_async_dma_unconfigure(dma_id, 0) < 0)\n+\t\t\tRTE_LOG(ERR, VHOST_PORT, \"Failed to unconfigure DMA in vhost.\\n\");\n+\t}\n+}\n+\n /*\n  * Remove a device from the specific data core linked list and from the\n  * main linked list. Synchronization  occurs through the use of the\n@@ -1614,17 +1636,8 @@ destroy_device(int vid)\n \t\t\"(%d) device has been removed from data core\\n\",\n \t\tvdev->vid);\n \n-\tif (dma_bind[vid].dmas[VIRTIO_RXQ].async_enabled) {\n-\t\tvhost_clear_queue(vdev, VIRTIO_RXQ);\n-\t\trte_vhost_async_channel_unregister(vid, VIRTIO_RXQ);\n-\t\tdma_bind[vid].dmas[VIRTIO_RXQ].async_enabled = false;\n-\t}\n-\n-\tif (dma_bind[vid].dmas[VIRTIO_TXQ].async_enabled) {\n-\t\tvhost_clear_queue(vdev, VIRTIO_TXQ);\n-\t\trte_vhost_async_channel_unregister(vid, VIRTIO_TXQ);\n-\t\tdma_bind[vid].dmas[VIRTIO_TXQ].async_enabled = false;\n-\t}\n+\tvhost_clear_async(vdev, vid, VIRTIO_RXQ);\n+\tvhost_clear_async(vdev, vid, VIRTIO_TXQ);\n \n \trte_free(vdev);\n }\n@@ -1673,14 +1686,19 @@ vhost_async_channel_register(int vid)\n \n \tif (dma_bind[vid2socketid[vid]].dmas[VIRTIO_RXQ].dev_id != INVALID_DMA_ID) {\n \t\trx_ret = rte_vhost_async_channel_register(vid, VIRTIO_RXQ);\n-\t\tif (rx_ret == 0)\n+\t\tif (rx_ret == 0) {\n \t\t\tdma_bind[vid2socketid[vid]].dmas[VIRTIO_RXQ].async_enabled = true;\n+\t\t\tdma_bind[vid2socketid[vid]].dmas[VIRTIO_RXQ].dma_ref_count++;\n+\t\t}\n+\n \t}\n \n \tif (dma_bind[vid2socketid[vid]].dmas[VIRTIO_TXQ].dev_id != INVALID_DMA_ID) {\n \t\ttx_ret = rte_vhost_async_channel_register(vid, VIRTIO_TXQ);\n-\t\tif (tx_ret == 0)\n+\t\tif (tx_ret == 0) {\n \t\t\tdma_bind[vid2socketid[vid]].dmas[VIRTIO_TXQ].async_enabled = true;\n+\t\t\tdma_bind[vid2socketid[vid]].dmas[VIRTIO_TXQ].dma_ref_count++;\n+\t\t}\n \t}\n \n \treturn rx_ret | tx_ret;\n@@ -1886,6 +1904,7 @@ reset_dma(void)\n \t\tfor (j = 0; j < RTE_MAX_QUEUES_PER_PORT * 2; j++) {\n \t\t\tdma_bind[i].dmas[j].dev_id = INVALID_DMA_ID;\n \t\t\tdma_bind[i].dmas[j].async_enabled = false;\n+\t\t\tdma_bind[i].dmas[j].dma_ref_count = 0;\n \t\t}\n \t}\n \ndiff --git a/examples/vhost/main.h b/examples/vhost/main.h\nindex 2fcb8376c5..2b2cf828d3 100644\n--- a/examples/vhost/main.h\n+++ b/examples/vhost/main.h\n@@ -96,6 +96,7 @@ struct dma_info {\n \tstruct rte_pci_addr addr;\n \tint16_t dev_id;\n \tbool async_enabled;\n+\tuint16_t dma_ref_count;\n };\n \n struct dma_for_vhost {\n",
    "prefixes": [
        "v3",
        "2/2"
    ]
}