Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/44365/?format=api
http://patches.dpdk.org/api/patches/44365/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180906181947.20646-12-jfreimann@redhat.com/", "project": { "id": 1, "url": "http://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": "<20180906181947.20646-12-jfreimann@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180906181947.20646-12-jfreimann@redhat.com", "date": "2018-09-06T18:19:47", "name": "[v5,11/11] net/virtio: add support for event suppression", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2b698d7fabce4206df3a2ec5e26add7e35a8a57e", "submitter": { "id": 745, "url": "http://patches.dpdk.org/api/people/745/?format=api", "name": "Jens Freimann", "email": "jfreimann@redhat.com" }, "delegate": { "id": 2642, "url": "http://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180906181947.20646-12-jfreimann@redhat.com/mbox/", "series": [ { "id": 1215, "url": "http://patches.dpdk.org/api/series/1215/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1215", "date": "2018-09-06T18:19:36", "name": "implement packed virtqueues", "version": 5, "mbox": "http://patches.dpdk.org/series/1215/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/44365/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/44365/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BC5B25B2C;\n\tThu, 6 Sep 2018 20:20:49 +0200 (CEST)", "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id 6214F4C9F\n\tfor <dev@dpdk.org>; Thu, 6 Sep 2018 20:20:48 +0200 (CEST)", "from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 05D2940676C0;\n\tThu, 6 Sep 2018 18:20:48 +0000 (UTC)", "from localhost (ovpn-116-129.ams2.redhat.com [10.36.116.129])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id D8E472166BA2;\n\tThu, 6 Sep 2018 18:20:43 +0000 (UTC)" ], "From": "Jens Freimann <jfreimann@redhat.com>", "To": "dev@dpdk.org", "Cc": "tiwei.bie@intel.com,\n\tmaxime.coquelin@redhat.com", "Date": "Thu, 6 Sep 2018 19:19:47 +0100", "Message-Id": "<20180906181947.20646-12-jfreimann@redhat.com>", "In-Reply-To": "<20180906181947.20646-1-jfreimann@redhat.com>", "References": "<20180906181947.20646-1-jfreimann@redhat.com>", "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.6", "X-Greylist": [ "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.7]); Thu, 06 Sep 2018 18:20:48 +0000 (UTC)", "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.7]); \n\tThu, 06 Sep 2018 18:20:48 +0000 (UTC) for IP:'10.11.54.6'\n\tDOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'jfreimann@redhat.com' RCPT:''" ], "Subject": "[dpdk-dev] [PATCH v5 11/11] net/virtio: add support for event\n\tsuppression", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Signed-off-by: Jens Freimann <jfreimann@redhat.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 2 +-\n drivers/net/virtio/virtio_rxtx.c | 15 +++++-\n drivers/net/virtio/virtqueue.h | 77 ++++++++++++++++++++++++++++--\n 3 files changed, 89 insertions(+), 5 deletions(-)", "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex f2e515838..4249e52c7 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -730,7 +730,7 @@ virtio_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)\n \tstruct virtnet_rx *rxvq = dev->data->rx_queues[queue_id];\n \tstruct virtqueue *vq = rxvq->vq;\n \n-\tvirtqueue_enable_intr(vq);\n+\tvirtqueue_enable_intr(vq, 0, 0);\n \treturn 0;\n }\n \ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex 577786b7e..5dee3f12b 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -137,6 +137,10 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,\n \n \t\tvq->vq_descx[head_idx].ndescs = descs_used;\n \t\tidx = update_pq_avail_index(vq);\n+\t\tif (unlikely(virtqueue_kick_prepare_packed(vq))) {\n+\t\t\tvirtqueue_notify(vq);\n+\t\t\tPMD_RX_LOG(DEBUG, \"Notified\");\n+\t\t}\n \t}\n \n \ttxvq->stats.packets += i;\n@@ -1193,6 +1197,10 @@ virtio_recv_pkts_packed(void *rx_queue, struct rte_mbuf **rx_pkts,\n \t}\n \n \trxvq->stats.packets += nb_rx;\n+\tif (nb_rx > 0 && unlikely(virtqueue_kick_prepare_packed(vq))) {\n+\t\tvirtqueue_notify(vq);\n+\t\tPMD_RX_LOG(DEBUG, \"Notified\");\n+\t}\n \n \treturn nb_rx;\n }\n@@ -1648,8 +1656,13 @@ virtio_recv_mergeable_pkts(void *rx_queue,\n \n \trxvq->stats.packets += nb_rx;\n \n-\tif (vtpci_packed_queue(vq->hw))\n+\tif (vtpci_packed_queue(vq->hw)) {\n+\t\tif (unlikely(virtqueue_kick_prepare(vq))) {\n+\t\t\tvirtqueue_notify(vq);\n+\t\t\tPMD_RX_LOG(DEBUG, \"Notified\");\n+\t\t}\n \t\treturn nb_rx;\n+\t}\n \n \t/* Allocate new mbuf for the used descriptor */\n \twhile (likely(!virtqueue_full(vq))) {\ndiff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h\nindex 735066486..9d3e322a2 100644\n--- a/drivers/net/virtio/virtqueue.h\n+++ b/drivers/net/virtio/virtqueue.h\n@@ -176,6 +176,8 @@ struct virtqueue {\n \tuint16_t vq_free_cnt; /**< num of desc available */\n \tuint16_t vq_avail_idx; /**< sync until needed */\n \tuint16_t vq_free_thresh; /**< free threshold */\n+\tuint16_t vq_signalled_avail;\n+\tint vq_signalled_avail_valid;\n \n \tvoid *vq_ring_virt_mem; /**< linear address of vring*/\n \tunsigned int vq_ring_size;\n@@ -292,16 +294,37 @@ vring_desc_init(struct vring_desc *dp, uint16_t n)\n static inline void\n virtqueue_disable_intr(struct virtqueue *vq)\n {\n-\tvq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;\n+\tif (vtpci_packed_queue(vq->hw) && vtpci_with_feature(vq->hw,\n+\t\t\t\tVIRTIO_RING_F_EVENT_IDX))\n+\t\tvq->vq_ring.device_event->desc_event_flags =\n+\t\t\tRING_EVENT_FLAGS_DISABLE;\n+\telse\n+\t\tvq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;\n }\n \n /**\n * Tell the backend to interrupt us.\n */\n static inline void\n-virtqueue_enable_intr(struct virtqueue *vq)\n+virtqueue_enable_intr(struct virtqueue *vq, uint16_t off, uint16_t wrap_counter)\n {\n-\tvq->vq_ring.avail->flags &= (~VRING_AVAIL_F_NO_INTERRUPT);\n+\tuint16_t *flags = &vq->vq_ring.device_event->desc_event_flags;\n+\tuint16_t *event_off_wrap =\n+\t\t&vq->vq_ring.device_event->desc_event_off_wrap;\n+\tif (vtpci_packed_queue(vq->hw)) {\n+\t\t*flags = 0;\n+\t\t*event_off_wrap = 0;\n+\t\tif (*event_off_wrap & RING_EVENT_FLAGS_DESC) {\n+\t\t\t*event_off_wrap = off | 0x7FFF;\n+\t\t\t*event_off_wrap |= wrap_counter << 15;\n+\t\t\t*flags |= RING_EVENT_FLAGS_DESC;\n+\t\t} else {\n+\t\t\t*event_off_wrap = 0;\n+\t\t}\n+\t\t*flags |= RING_EVENT_FLAGS_ENABLE;\n+\t} else {\n+\t\tvq->vq_ring.avail->flags &= (~VRING_AVAIL_F_NO_INTERRUPT);\n+\t}\n }\n \n /**\n@@ -363,12 +386,60 @@ vq_update_avail_ring(struct virtqueue *vq, uint16_t desc_idx)\n \tvq->vq_avail_idx++;\n }\n \n+static int vhost_idx_diff(struct virtqueue *vq, uint16_t old, uint16_t new)\n+{\n+\tif (new > old)\n+\t\treturn new - old;\n+\treturn (new + vq->vq_nentries - old);\n+}\n+\n+static int vring_packed_need_event(struct virtqueue *vq,\n+\t\tuint16_t event_off, uint16_t new,\n+\t\tuint16_t old)\n+{\n+\treturn (uint16_t)(vhost_idx_diff(vq, new, event_off) - 1) <\n+\t\t(uint16_t)vhost_idx_diff(vq, new, old);\n+}\n+\n+\n static inline int\n virtqueue_kick_prepare(struct virtqueue *vq)\n {\n \treturn !(vq->vq_ring.used->flags & VRING_USED_F_NO_NOTIFY);\n }\n \n+static inline int\n+virtqueue_kick_prepare_packed(struct virtqueue *vq)\n+{\n+\tuint16_t notify_offset, flags, wrap;\n+\tuint16_t old, new;\n+\tint v;\n+\n+\tif (vtpci_packed_queue(vq->hw)) {\n+\t\tflags = vq->vq_ring.device_event->desc_event_flags;\n+\t\tif (!(flags & RING_EVENT_FLAGS_DESC))\n+\t\t\treturn flags & RING_EVENT_FLAGS_ENABLE;\n+\t\tvirtio_rmb();\n+\t\tnotify_offset = vq->vq_ring.device_event->desc_event_off_wrap;\n+\t\twrap = notify_offset & 0x1;\n+\t\tnotify_offset >>= 1;\n+\n+\t\told = vq->vq_signalled_avail;\n+\t\tv = vq->vq_signalled_avail_valid;\n+\t\tnew = vq->vq_avail_idx;\n+\t\tvq->vq_signalled_avail = vq->vq_avail_idx;\n+\t\tvq->vq_signalled_avail_valid = 1;\n+\n+\t\tif (unlikely(!v))\n+\t\t\treturn 0;\n+\n+\t\treturn (vring_packed_need_event(vq, new, old, notify_offset) &&\n+\t\t\twrap == vq->vq_ring.avail_wrap_counter);\n+\t} else {\n+\t\treturn !(vq->vq_ring.used->flags & VRING_USED_F_NO_NOTIFY);\n+\t}\n+}\n+\n static inline void\n virtqueue_notify(struct virtqueue *vq)\n {\n", "prefixes": [ "v5", "11/11" ] }{ "id": 44365, "url": "