Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/118122/?format=api
https://patches.dpdk.org/api/patches/118122/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20221013092708.4922-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": "<20221013092708.4922-3-xuan.ding@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20221013092708.4922-3-xuan.ding@intel.com", "date": "2022-10-13T09:27:08", "name": "[v5,2/2] examples/vhost: unconfigure DMA vchannel", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2a3806cc4d3dcf1797cb3182d17f8af8489a6fd1", "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/20221013092708.4922-3-xuan.ding@intel.com/mbox/", "series": [ { "id": 25203, "url": "https://patches.dpdk.org/api/series/25203/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=25203", "date": "2022-10-13T09:27:06", "name": "vhost: introduce DMA vchannel unconfiguration", "version": 5, "mbox": "https://patches.dpdk.org/series/25203/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/118122/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/118122/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 73343A00C2;\n\tThu, 13 Oct 2022 11:29:33 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6692D42E18;\n\tThu, 13 Oct 2022 11:29:31 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 0714442E17\n for <dev@dpdk.org>; Thu, 13 Oct 2022 11:29:29 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Oct 2022 02:29:29 -0700", "from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.111.102])\n by fmsmga001.fm.intel.com with ESMTP; 13 Oct 2022 02:29:27 -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=1665653370; x=1697189370;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=xb19iKann7wcACjv0jg0UXPgpDxW3lS/f2czKBOFujo=;\n b=fTNxjXlJny+lJDptC7kaKmK+cBO4PxdYDtndOs4yqF9at7KAGOE2+6R4\n +KP9Ea3PubNtk6fV2j2SjEYw/my9YRs7h9/IEMstTtgjeP3f3djc+ZRg6\n f6xlc/G8rJiI5GNyf/VfmtW/B5fjQvEiK3fC9fOmIGj9uCCv9DORPKb+U\n mZRpAMGdVU+Ex6DBmSH4pLbAIEGqU6Do5m+qTo7LVICZqe6XgTPR1ig8S\n ZzJkpn/3nvRy1QzAeVTWOIYZep0cteiHGPEcoNPw9GDW+78PoBM/GbxXi\n yOjqcK00229eVC/6VSJlLwIQav48eIXYLusCU0oRmMQwOSymnazOGFQc5 w==;", "X-IronPort-AV": [ "E=McAfee;i=\"6500,9779,10498\"; a=\"305022269\"", "E=Sophos;i=\"5.95,180,1661842800\"; d=\"scan'208\";a=\"305022269\"", "E=McAfee;i=\"6500,9779,10498\"; a=\"769547393\"", "E=Sophos;i=\"5.95,180,1661842800\"; d=\"scan'208\";a=\"769547393\"" ], "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 v5 2/2] examples/vhost: unconfigure DMA vchannel", "Date": "Thu, 13 Oct 2022 09:27:08 +0000", "Message-Id": "<20221013092708.4922-3-xuan.ding@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20221013092708.4922-1-xuan.ding@intel.com>", "References": "<20220814140442.82525-1-xuan.ding@intel.com>\n <20221013092708.4922-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() to manually free\nDMA vchannels. Before unconfiguration, make sure the specified DMA\ndevice is no longer used by any vhost ports.\n\nSigned-off-by: Xuan Ding <xuan.ding@intel.com>\n---\n examples/vhost/main.c | 40 +++++++++++++++++++++++++++-------------\n 1 file changed, 27 insertions(+), 13 deletions(-)", "diff": "diff --git a/examples/vhost/main.c b/examples/vhost/main.c\nindex ac78704d79..baf7d49116 100644\n--- a/examples/vhost/main.c\n+++ b/examples/vhost/main.c\n@@ -73,6 +73,7 @@ static int total_num_mbufs = NUM_MBUFS_DEFAULT;\n \n struct dma_for_vhost dma_bind[RTE_MAX_VHOST_DEVICE];\n int16_t dmas_id[RTE_DMADEV_DEFAULT_MAX];\n+int16_t dma_ref_count[RTE_DMADEV_DEFAULT_MAX];\n static int dma_count;\n \n /* mask of enabled ports */\n@@ -371,6 +372,7 @@ open_dma(const char *value)\n done:\n \t\t(dma_info + socketid)->dmas[vring_id].dev_id = dev_id;\n \t\t(dma_info + socketid)->async_flag |= async_flag;\n+\t\tdma_ref_count[dev_id]++;\n \t\ti++;\n \t}\n out:\n@@ -1562,6 +1564,29 @@ 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+\n+\tif (!dma_bind[vid].dmas[queue_id].async_enabled)\n+\t\treturn;\n+\n+\tvhost_clear_queue(vdev, queue_id);\n+\trte_vhost_async_channel_unregister(vid, queue_id);\n+\tdma_bind[vid].dmas[queue_id].async_enabled = false;\n+\n+\tdma_id = dma_bind[vid2socketid[vdev->vid]].dmas[queue_id].dev_id;\n+\tdma_ref_count[dma_id]--;\n+\n+\tif (dma_ref_count[dma_id] > 0)\n+\t\treturn;\n+\n+\tif (rte_vhost_async_dma_unconfigure(dma_id, 0) < 0)\n+\t\tRTE_LOG(ERR, VHOST_CONFIG,\n+\t\t\t\"Failed to unconfigure DMA %d in vhost.\\n\", dma_id);\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@@ -1618,17 +1643,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@@ -1690,8 +1706,6 @@ vhost_async_channel_register(int vid)\n \treturn rx_ret | tx_ret;\n }\n \n-\n-\n /*\n * A new device is added to a data core. First the device is added to the main linked list\n * and then allocated to a specific data core.\n", "prefixes": [ "v5", "2/2" ] }{ "id": 118122, "url": "