Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/7916/?format=api
https://patches.dpdk.org/api/patches/7916/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20151022095730.5a3c742b@xeon-e3/", "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": "<20151022095730.5a3c742b@xeon-e3>", "list_archive_url": "https://inbox.dpdk.org/dev/20151022095730.5a3c742b@xeon-e3", "date": "2015-10-22T16:57:30", "name": "[dpdk-dev,v4,6/7] virtio: simple tx routine", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "9cd2638490e70ff4c70eefaa3cf1f9fcfab32b62", "submitter": { "id": 27, "url": "https://patches.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20151022095730.5a3c742b@xeon-e3/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/7916/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/7916/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 8EBCD9A81;\n\tThu, 22 Oct 2015 18:57:26 +0200 (CEST)", "from mail-pa0-f48.google.com (mail-pa0-f48.google.com\n\t[209.85.220.48]) by dpdk.org (Postfix) with ESMTP id 488289655\n\tfor <dev@dpdk.org>; Thu, 22 Oct 2015 18:57:25 +0200 (CEST)", "by pabrc13 with SMTP id rc13so91245975pab.0\n\tfor <dev@dpdk.org>; Thu, 22 Oct 2015 09:57:24 -0700 (PDT)", "from xeon-e3 (static-50-53-82-155.bvtn.or.frontiernet.net.\n\t[50.53.82.155]) by smtp.gmail.com with ESMTPSA id\n\tpu5sm14717130pbc.58.2015.10.22.09.57.23\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 22 Oct 2015 09:57:24 -0700 (PDT)" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to\n\t:references:mime-version:content-type:content-transfer-encoding;\n\tbh=3Gwrn3C5VNrWuegraGcqCwzyW9jtNVjAlI0oG20Ro5U=;\n\tb=aTeTx6n7TkGKwio/cwmiwT+4Msp5kUixCVKL/1zt93P/JwnhXjJ1ciLidh0ur626UQ\n\t6sak+21rXjsp9ffGBKNH7y+p3WfW4U0tyK/TUCG0JkwTfDrXRh04MpWN+TsJfWmHZbQI\n\tb++kOy0wbRXhwzuod28xU570A16rpgCt/7FYX0L1+iTpETpgENv5nj6oM7Rah2TPtnV4\n\tmk0rC+yEKuFSHQ5zZDgUJKUaNSpZI7/nXi7qvcBMq4vAPZKomAqfln3cDERFO+potwsz\n\t1KRfhA1pIqL7hwblxZl+b6K+o2rb0m7dASYdLZSvpAY7UFIZFc4RTKvYjzU9866g8d5S\n\tHltg==", "X-Gm-Message-State": "ALoCoQkdhB/iUiG8JJOjfZQqWqbCkokoU8K2sG8iycaQyfbW42haVbnBBWXg1h61HPhnozpDlNSC", "X-Received": "by 10.67.15.100 with SMTP id fn4mr19093967pad.120.1445533044624; \n\tThu, 22 Oct 2015 09:57:24 -0700 (PDT)", "Date": "Thu, 22 Oct 2015 09:57:30 -0700", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "Huawei Xie <huawei.xie@intel.com>", "Message-ID": "<20151022095730.5a3c742b@xeon-e3>", "In-Reply-To": "<1445515791-25909-7-git-send-email-huawei.xie@intel.com>", "References": "<1443537953-23917-1-git-send-email-huawei.xie@intel.com>\n\t<1445515791-25909-1-git-send-email-huawei.xie@intel.com>\n\t<1445515791-25909-7-git-send-email-huawei.xie@intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=US-ASCII", "Content-Transfer-Encoding": "7bit", "Cc": "dev@dpdk.org", "Subject": "Re: [dpdk-dev] [PATCH v4 6/7] virtio: simple tx routine", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "On Thu, 22 Oct 2015 20:09:50 +0800\nHuawei Xie <huawei.xie@intel.com> wrote:\n\n> Changes in v4:\n> - move virtio_xmit_cleanup ahead to free descriptors earlier\n> \n> Changes in v3:\n> - Remove return at the end of void function\n> - Remove always_inline attribute for virtio_xmit_cleanup\n> bulk free of mbufs when clean used ring.\n> shift operation of idx could be saved if vq_free_cnt means\n> free slots rather than free descriptors.\n> \n> TODO: rearrange vq data structure, pack the stats var together so that we\n> could use one vec instruction to update all of them.\n> \n> Signed-off-by: Huawei Xie <huawei.xie@intel.com>\n> ---\n> drivers/net/virtio/virtio_ethdev.h | 3 ++\n> drivers/net/virtio/virtio_rxtx_simple.c | 93 +++++++++++++++++++++++++++++++++\n> 2 files changed, 96 insertions(+)\n> \n> diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h\n> index d7797ab..ae2d47d 100644\n> --- a/drivers/net/virtio/virtio_ethdev.h\n> +++ b/drivers/net/virtio/virtio_ethdev.h\n> @@ -111,6 +111,9 @@ uint16_t virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n> uint16_t virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,\n> \t\tuint16_t nb_pkts);\n> \n> +uint16_t virtio_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,\n> +\t\tuint16_t nb_pkts);\n> +\n> /*\n> * The VIRTIO_NET_F_GUEST_TSO[46] features permit the host to send us\n> * frames larger than 1514 bytes. We do not yet support software LRO\n> diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c\n> index ef17562..79b4f7f 100644\n> --- a/drivers/net/virtio/virtio_rxtx_simple.c\n> +++ b/drivers/net/virtio/virtio_rxtx_simple.c\n> @@ -288,6 +288,99 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,\n> \treturn nb_pkts_received;\n> }\n> \n> +#define VIRTIO_TX_FREE_THRESH 32\n> +#define VIRTIO_TX_MAX_FREE_BUF_SZ 32\n> +#define VIRTIO_TX_FREE_NR 32\n> +/* TODO: vq->tx_free_cnt could mean num of free slots so we could avoid shift */\n> +static inline void\n> +virtio_xmit_cleanup(struct virtqueue *vq)\n> +{\n> +\tuint16_t i, desc_idx;\n> +\tint nb_free = 0;\n> +\tstruct rte_mbuf *m, *free[VIRTIO_TX_MAX_FREE_BUF_SZ];\n> +\n> +\tdesc_idx = (uint16_t)(vq->vq_used_cons_idx &\n> +\t\t((vq->vq_nentries >> 1) - 1));\n> +\tfree[0] = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;\n> +\tnb_free = 1;\n> +\n> +\tfor (i = 1; i < VIRTIO_TX_FREE_NR; i++) {\n> +\t\tm = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;\n> +\t\tif (likely(m->pool == free[0]->pool))\n> +\t\t\tfree[nb_free++] = m;\n> +\t\telse {\n> +\t\t\trte_mempool_put_bulk(free[0]->pool, (void **)free,\n> +\t\t\t\tnb_free);\n> +\t\t\tfree[0] = m;\n> +\t\t\tnb_free = 1;\n> +\t\t}\n> +\t}\n> +\n> +\trte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free);\n> +\tvq->vq_used_cons_idx += VIRTIO_TX_FREE_NR;\n> +\tvq->vq_free_cnt += (VIRTIO_TX_FREE_NR << 1);\n> +}\n\nI think you need to handle refcount, here is a similar patch\nfor ixgbe.\n\nSubject: ixgbe: speed up transmit\n\nCoalesce transmit buffers and put them back into the pool\nin one burst.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>", "diff": "--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c\n+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c\n@@ -120,12 +120,16 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)\n * Check for descriptors with their DD bit set and free mbufs.\n * Return the total number of buffers freed.\n */\n+#define TX_FREE_BULK 32\n+\n static inline int __attribute__((always_inline))\n ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq)\n {\n \tstruct ixgbe_tx_entry *txep;\n \tuint32_t status;\n-\tint i;\n+\tint i, n = 0;\n+\tstruct rte_mempool *txpool = NULL;\n+\tstruct rte_mbuf *free_list[TX_FREE_BULK];\n \n \t/* check DD bit on threshold descriptor */\n \tstatus = txq->tx_ring[txq->tx_next_dd].wb.status;\n@@ -138,20 +142,26 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue\n \t */\n \ttxep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]);\n \n-\t/* free buffers one at a time */\n-\tif ((txq->txq_flags & (uint32_t)ETH_TXQ_FLAGS_NOREFCOUNT) != 0) {\n-\t\tfor (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {\n-\t\t\ttxep->mbuf->next = NULL;\n-\t\t\trte_mempool_put(txep->mbuf->pool, txep->mbuf);\n-\t\t\ttxep->mbuf = NULL;\n-\t\t}\n-\t} else {\n-\t\tfor (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {\n-\t\t\trte_pktmbuf_free_seg(txep->mbuf);\n-\t\t\ttxep->mbuf = NULL;\n+\tfor (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {\n+\t\tstruct rte_mbuf *m;\n+\n+\t\t/* free buffers one at a time */\n+\t\tm = __rte_pktmbuf_prefree_seg(txep->mbuf);\n+\t\ttxep->mbuf = NULL;\n+\n+\t\tif (n >= TX_FREE_BULK ||\n+\t\t (n > 0 && m->pool != txpool)) {\n+\t\t\trte_mempool_put_bulk(txpool, (void **)free_list, n);\n+\t\t\tn = 0;\n \t\t}\n+\n+\t\ttxpool = m->pool;\n+\t\tfree_list[n++] = m;\n \t}\n \n+\tif (n > 0)\n+\t\trte_mempool_put_bulk(txpool, (void **)free_list, n);\n+\n \t/* buffers were freed, update counters */\n \ttxq->nb_tx_free = (uint16_t)(txq->nb_tx_free + txq->tx_rs_thresh);\n \ttxq->tx_next_dd = (uint16_t)(txq->tx_next_dd + txq->tx_rs_thresh);\n", "prefixes": [ "dpdk-dev", "v4", "6/7" ] }{ "id": 7916, "url": "