Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/109517/?format=api
https://patches.dpdk.org/api/patches/109517/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220408102214.11994-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": "<20220408102214.11994-3-xuan.ding@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220408102214.11994-3-xuan.ding@intel.com", "date": "2022-04-08T10:22:14", "name": "[v1,2/2] examples/vhost: use API to check inflight packets", "commit_ref": null, "pull_url": null, "state": "accepted", "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/20220408102214.11994-3-xuan.ding@intel.com/mbox/", "series": [ { "id": 22438, "url": "https://patches.dpdk.org/api/series/22438/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=22438", "date": "2022-04-08T10:22:12", "name": "vhost: add unsafe API to get DMA inflight packets", "version": 1, "mbox": "https://patches.dpdk.org/series/22438/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/109517/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/109517/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 34CA6A0501;\n\tFri, 8 Apr 2022 12:22:30 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 48FFE427EA;\n\tFri, 8 Apr 2022 12:22:27 +0200 (CEST)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id 50DD3427EA\n for <dev@dpdk.org>; Fri, 8 Apr 2022 12:22:25 +0200 (CEST)", "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Apr 2022 03:22:25 -0700", "from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.110.228])\n by orsmga006.jf.intel.com with ESMTP; 08 Apr 2022 03:22:22 -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=1649413345; x=1680949345;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=x3DbmVq+HWyhjHstE4XuTaXEllR1ttB2rsVet2NyoRI=;\n b=Bv+ningMtsfj70+CEVVTQpeoFvgy230n2JEEsKZ1U3qDdA60bQFjRXHx\n 0M26LBqPhJoC4nNjg0J0ljfVaGHGrwz2NxcXPuuoWkmbgLZ9R1gFx3MUj\n lvGbQhvCWYvm05MxvyTkJSBAawbmmsQYX+IqJaSO2kCQnhZDYacb7Yuv8\n O/XQfZJXrRm25f1ieI02azobJUR9kZjHbZtuhF8lp1OMFqE3iA+V7CF1P\n vzuVZrbgy2yCbHTP8CFQAeu3HSDKjE6SibYbrSMU/Q7diQCR7hXKoAI+U\n 8fXc/i7vpOcMj2HTELqPbrIZJW5TyuHSG/o3WwKM4z6rAwDD7TbayD8Ls A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6400,9594,10310\"; a=\"261253253\"", "E=Sophos;i=\"5.90,244,1643702400\"; d=\"scan'208\";a=\"261253253\"", "E=Sophos;i=\"5.90,244,1643702400\"; d=\"scan'208\";a=\"525324795\"" ], "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, cheng1.jiang@intel.com,\n sunil.pai.g@intel.com, Xuan Ding <xuan.ding@intel.com>", "Subject": "[PATCH v1 2/2] examples/vhost: use API to check inflight packets", "Date": "Fri, 8 Apr 2022 10:22:14 +0000", "Message-Id": "<20220408102214.11994-3-xuan.ding@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20220408102214.11994-1-xuan.ding@intel.com>", "References": "<20220408102214.11994-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>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.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 d94fabb060..c4d46de1c5 100644\n--- a/examples/vhost/main.c\n+++ b/examples/vhost/main.c\n@@ -994,10 +994,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@@ -1039,7 +1037,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@@ -1368,7 +1365,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@@ -1540,14 +1536,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@@ -1651,14 +1650,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": [ "v1", "2/2" ] }{ "id": 109517, "url": "