Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/44361/?format=api
http://patches.dpdk.org/api/patches/44361/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180906181947.20646-8-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-8-jfreimann@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180906181947.20646-8-jfreimann@redhat.com", "date": "2018-09-06T18:19:43", "name": "[v5,07/11] net/virtio: implement transmit path for packed queues", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "1716bdc0f112b8fa9df14088633dcb03e0dca65c", "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-8-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/44361/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/44361/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 AA4BC58EC;\n\tThu, 6 Sep 2018 20:20:30 +0200 (CEST)", "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id 0185F56A3\n\tfor <dev@dpdk.org>; Thu, 6 Sep 2018 20:20:29 +0200 (CEST)", "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])\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 81B2B77886;\n\tThu, 6 Sep 2018 18:20:28 +0000 (UTC)", "from localhost (ovpn-116-129.ams2.redhat.com [10.36.116.129])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 5F451112D169;\n\tThu, 6 Sep 2018 18:20:24 +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:43 +0100", "Message-Id": "<20180906181947.20646-8-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.3", "X-Greylist": [ "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.1]); Thu, 06 Sep 2018 18:20:28 +0000 (UTC)", "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.1]); \n\tThu, 06 Sep 2018 18:20:28 +0000 (UTC) for IP:'10.11.54.3'\n\tDOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'jfreimann@redhat.com' RCPT:''" ], "Subject": "[dpdk-dev] [PATCH v5 07/11] net/virtio: implement transmit path for\n\tpacked queues", "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": "This implements the transmit path for devices with\nsupport for packed virtqueues.\n\nAdd the feature bit and enable code to\nadd buffers to vring and mark descriptors as available.\n\nSigned-off-by: Jens Freiman <jfreimann@redhat.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 8 +-\n drivers/net/virtio/virtio_ethdev.h | 2 +\n drivers/net/virtio/virtio_rxtx.c | 113 ++++++++++++++++++++++++++++-\n 3 files changed, 121 insertions(+), 2 deletions(-)", "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex ad91f7f82..d2c5755bb 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -384,6 +384,8 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)\n \tvq->hw = hw;\n \tvq->vq_queue_index = vtpci_queue_idx;\n \tvq->vq_nentries = vq_size;\n+\tif (vtpci_packed_queue(hw))\n+\t\tvq->vq_ring.avail_wrap_counter = 1;\n \n \t/*\n \t * Reserve a memzone for vring elements\n@@ -1338,7 +1340,11 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)\n \t\teth_dev->rx_pkt_burst = &virtio_recv_pkts;\n \t}\n \n-\tif (hw->use_inorder_tx) {\n+\tif (vtpci_packed_queue(hw)) {\n+\t\tPMD_INIT_LOG(INFO, \"virtio: using virtio 1.1 Tx path on port %u\",\n+\t\t\teth_dev->data->port_id);\n+\t\teth_dev->tx_pkt_burst = virtio_xmit_pkts_packed;\n+\t} else if (hw->use_inorder_tx) {\n \t\tPMD_INIT_LOG(INFO, \"virtio: using inorder Tx path on port %u\",\n \t\t\teth_dev->data->port_id);\n \t\teth_dev->tx_pkt_burst = virtio_xmit_pkts_inorder;\ndiff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h\nindex b726ad108..04161b461 100644\n--- a/drivers/net/virtio/virtio_ethdev.h\n+++ b/drivers/net/virtio/virtio_ethdev.h\n@@ -79,6 +79,8 @@ uint16_t virtio_recv_mergeable_pkts_inorder(void *rx_queue,\n \n uint16_t virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\tuint16_t nb_pkts);\n+uint16_t virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,\n+\t\tuint16_t nb_pkts);\n \n uint16_t virtio_xmit_pkts_inorder(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\tuint16_t nb_pkts);\ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex eb891433e..12787070e 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -38,6 +38,112 @@\n #define VIRTIO_DUMP_PACKET(m, len) do { } while (0)\n #endif\n \n+\n+/* Cleanup from completed transmits. */\n+static void\n+virtio_xmit_cleanup_packed(struct virtqueue *vq)\n+{\n+\tuint16_t idx;\n+\tuint16_t size = vq->vq_nentries;\n+\tstruct vring_desc_packed *desc = vq->vq_ring.desc_packed;\n+\tstruct vq_desc_extra *dxp;\n+\n+\tidx = vq->vq_used_cons_idx;\n+\twhile (desc_is_used(&desc[idx], &vq->vq_ring) &&\n+\t vq->vq_free_cnt < size) {\n+\t\tdxp = &vq->vq_descx[idx];\n+\t\tvq->vq_free_cnt += dxp->ndescs;\n+\t\tidx = dxp->ndescs;\n+\t\tidx = idx >= size ? idx - size : idx;\n+\t}\n+}\n+\n+uint16_t\n+virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,\n+\t\t uint16_t nb_pkts)\n+{\n+\tstruct virtnet_tx *txvq = tx_queue;\n+\tstruct virtqueue *vq = txvq->vq;\n+\tuint16_t i;\n+\tstruct vring_desc_packed *desc = vq->vq_ring.desc_packed;\n+\tuint16_t idx, prev;\n+\tstruct vq_desc_extra *dxp;\n+\n+\tif (unlikely(nb_pkts < 1))\n+\t\treturn nb_pkts;\n+\n+\tPMD_TX_LOG(DEBUG, \"%d packets to xmit\", nb_pkts);\n+\n+\tif (likely(vq->vq_free_cnt < vq->vq_free_thresh))\n+\t\tvirtio_xmit_cleanup_packed(vq);\n+\n+\tfor (i = 0; i < nb_pkts; i++) {\n+\t\tstruct rte_mbuf *txm = tx_pkts[i];\n+\t\tstruct virtio_tx_region *txr = txvq->virtio_net_hdr_mz->addr;\n+\t\tuint16_t head_idx;\n+\t\tint wrap_counter;\n+\t\tint descs_used;\n+\n+\t\tif (unlikely(txm->nb_segs + 1 > vq->vq_free_cnt)) {\n+\t\t\tvirtio_xmit_cleanup_packed(vq);\n+\n+\t\t\tif (unlikely(txm->nb_segs + 1 > vq->vq_free_cnt)) {\n+\t\t\t\tPMD_TX_LOG(ERR,\n+\t\t\t\t\t \"No free tx descriptors to transmit\");\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\ttxvq->stats.bytes += txm->pkt_len;\n+\n+\t\tvq->vq_free_cnt -= txm->nb_segs + 1;\n+\n+\t\twrap_counter = vq->vq_ring.avail_wrap_counter;\n+\t\tidx = vq->vq_avail_idx; \n+\t\thead_idx = idx;\n+\n+\t\tdxp = &vq->vq_descx[idx];\n+\t\tif (dxp->cookie != NULL)\n+\t\t\trte_pktmbuf_free(dxp->cookie);\n+\t\tdxp->cookie = txm;\n+\n+\t\tdesc[idx].addr = txvq->virtio_net_hdr_mem +\n+\t\t\t\t RTE_PTR_DIFF(&txr[idx].tx_hdr, txr);\n+\t\tdesc[idx].len = vq->hw->vtnet_hdr_size;\n+\t\tdesc[idx].flags = VRING_DESC_F_NEXT |\n+\t\t\tVRING_DESC_F_AVAIL(vq->vq_ring.avail_wrap_counter) |\n+\t\t\tVRING_DESC_F_USED(!vq->vq_ring.avail_wrap_counter);\n+\t\tdescs_used = 1;\n+\n+\t\tdo {\n+\t\t\tidx = update_pq_avail_index(vq);\n+\t\t\tdesc[idx].addr = VIRTIO_MBUF_DATA_DMA_ADDR(txm, vq);\n+\t\t\tdesc[idx].len = txm->data_len;\n+\t\t\tdesc[idx].flags = VRING_DESC_F_NEXT |\n+\t\t\t\tVRING_DESC_F_AVAIL(vq->vq_ring.avail_wrap_counter) |\n+\t\t\t\tVRING_DESC_F_USED(!vq->vq_ring.avail_wrap_counter);\n+\t\t\tdescs_used++;\n+\t\t} while ((txm = txm->next) != NULL);\n+\n+\t\tdesc[idx].flags &= ~VRING_DESC_F_NEXT;\n+\n+\t\trte_smp_wmb();\n+\t\tprev = (idx > 0 ? idx : vq->vq_nentries) - 1;\n+\t\tdesc[prev].index = head_idx; //FIXME\n+\t\tdesc[head_idx].flags =\n+\t\t\t(VRING_DESC_F_AVAIL(wrap_counter) |\n+\t\t\t VRING_DESC_F_USED(!wrap_counter));\n+\n+\t\tvq->vq_descx[head_idx].ndescs = descs_used;\n+\t\tidx = update_pq_avail_index(vq);\n+\t}\n+\n+\ttxvq->stats.packets += i;\n+\ttxvq->stats.errors += nb_pkts - i;\n+\n+\treturn i;\n+}\n+\n int\n virtio_dev_rx_queue_done(void *rxq, uint16_t offset)\n {\n@@ -736,7 +842,12 @@ virtio_dev_tx_queue_setup_finish(struct rte_eth_dev *dev,\n \tif (hw->use_inorder_tx)\n \t\tvq->vq_ring.desc[vq->vq_nentries - 1].next = 0;\n \n-\tVIRTQUEUE_DUMP(vq);\n+\tif (vtpci_packed_queue(hw)) {\n+\t\tvq->vq_ring.avail_wrap_counter = 1;\n+\t}\n+\n+\tif (!vtpci_packed_queue(hw))\n+\t\tVIRTQUEUE_DUMP(vq);\n \n \treturn 0;\n }\n", "prefixes": [ "v5", "07/11" ] }{ "id": 44361, "url": "