Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/7990/?format=api
https://patches.dpdk.org/api/patches/7990/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445787304-18267-7-git-send-email-huawei.xie@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": "<1445787304-18267-7-git-send-email-huawei.xie@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1445787304-18267-7-git-send-email-huawei.xie@intel.com", "date": "2015-10-25T15:35:03", "name": "[dpdk-dev,v5,6/7] virtio: simple tx routine", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "a256bfd2fe459671d226ef8f8622eb71faa2a7f5", "submitter": { "id": 16, "url": "https://patches.dpdk.org/api/people/16/?format=api", "name": "Huawei Xie", "email": "huawei.xie@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445787304-18267-7-git-send-email-huawei.xie@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/7990/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/7990/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 C8B0A8D8D;\n\tSun, 25 Oct 2015 16:35:30 +0100 (CET)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 0ECF38DA5\n\tfor <dev@dpdk.org>; Sun, 25 Oct 2015 16:35:27 +0100 (CET)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga103.jf.intel.com with ESMTP; 25 Oct 2015 08:35:27 -0700", "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga003.jf.intel.com with ESMTP; 25 Oct 2015 08:35:27 -0700", "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id t9PFZOYX016127;\n\tSun, 25 Oct 2015 23:35:24 +0800", "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid t9PFZLpQ018347; Sun, 25 Oct 2015 23:35:23 +0800", "(from hxie5@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t9PFZLAA018343; \n\tSun, 25 Oct 2015 23:35:21 +0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.20,196,1444719600\"; d=\"scan'208\";a=\"671378280\"", "From": "Huawei Xie <huawei.xie@intel.com>", "To": "dev@dpdk.org", "Date": "Sun, 25 Oct 2015 23:35:03 +0800", "Message-Id": "<1445787304-18267-7-git-send-email-huawei.xie@intel.com>", "X-Mailer": "git-send-email 1.7.4.1", "In-Reply-To": "<1445787304-18267-1-git-send-email-huawei.xie@intel.com>", "References": "<1443537953-23917-1-git-send-email-huawei.xie@intel.com>\n\t<1445787304-18267-1-git-send-email-huawei.xie@intel.com>", "Subject": "[dpdk-dev] [PATCH v5 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": "Changes in v5:\n- call __rte_pktmbuf_prefree_seg to check refcnt when free mbufs\n\nChanges in v4:\n- move virtio_xmit_cleanup ahead to free descriptors earlier\n\nChanges in v3:\n- Remove return at the end of void function\n- Remove always_inline attribute for virtio_xmit_cleanup\n\nbulk free of mbufs when clean used ring.\nshift operation of idx could be saved if vq_free_cnt means\nfree slots rather than free descriptors.\n\nTODO: rearrange vq data structure, pack the stats var together so that we\ncould use one vec instruction to update all of them.\n\nSigned-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 | 106 ++++++++++++++++++++++++++++++++\n 2 files changed, 109 insertions(+)", "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h\nindex 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\ndiff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c\nindex ef17562..624e789 100644\n--- a/drivers/net/virtio/virtio_rxtx_simple.c\n+++ b/drivers/net/virtio/virtio_rxtx_simple.c\n@@ -288,6 +288,112 @@ 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+\tm = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;\n+\tm = __rte_pktmbuf_prefree_seg(m);\n+\tif (likely(m != NULL)) {\n+\t\tfree[0] = m;\n+\t\tnb_free = 1;\n+\t\tfor (i = 1; i < VIRTIO_TX_FREE_NR; i++) {\n+\t\t\tm = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;\n+\t\t\tm = __rte_pktmbuf_prefree_seg(m);\n+\t\t\tif (likely(m != NULL)) {\n+\t\t\t\tif (likely(m->pool == free[0]->pool))\n+\t\t\t\t\tfree[nb_free++] = m;\n+\t\t\t\telse {\n+\t\t\t\t\trte_mempool_put_bulk(free[0]->pool,\n+\t\t\t\t\t\t(void **)free, nb_free);\n+\t\t\t\t\tfree[0] = m;\n+\t\t\t\t\tnb_free = 1;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t\trte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free);\n+\t} else {\n+\t\tfor (i = 1; i < VIRTIO_TX_FREE_NR; i++) {\n+\t\t\tm = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;\n+\t\t\tm = __rte_pktmbuf_prefree_seg(m);\n+\t\t\tif (m != NULL)\n+\t\t\t\trte_mempool_put(m->pool, m);\n+\t\t}\n+\t}\n+\n+\tvq->vq_used_cons_idx += VIRTIO_TX_FREE_NR;\n+\tvq->vq_free_cnt += (VIRTIO_TX_FREE_NR << 1);\n+}\n+\n+uint16_t\n+virtio_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,\n+\tuint16_t nb_pkts)\n+{\n+\tstruct virtqueue *txvq = tx_queue;\n+\tuint16_t nb_used;\n+\tuint16_t desc_idx;\n+\tstruct vring_desc *start_dp;\n+\tuint16_t nb_tail, nb_commit;\n+\tint i;\n+\tuint16_t desc_idx_max = (txvq->vq_nentries >> 1) - 1;\n+\n+\tnb_used = VIRTQUEUE_NUSED(txvq);\n+\trte_compiler_barrier();\n+\n+\tif (nb_used >= VIRTIO_TX_FREE_THRESH)\n+\t\tvirtio_xmit_cleanup(tx_queue);\n+\n+\tnb_commit = nb_pkts = RTE_MIN((txvq->vq_free_cnt >> 1), nb_pkts);\n+\tdesc_idx = (uint16_t) (txvq->vq_avail_idx & desc_idx_max);\n+\tstart_dp = txvq->vq_ring.desc;\n+\tnb_tail = (uint16_t) (desc_idx_max + 1 - desc_idx);\n+\n+\tif (nb_commit >= nb_tail) {\n+\t\tfor (i = 0; i < nb_tail; i++)\n+\t\t\ttxvq->vq_descx[desc_idx + i].cookie = tx_pkts[i];\n+\t\tfor (i = 0; i < nb_tail; i++) {\n+\t\t\tstart_dp[desc_idx].addr =\n+\t\t\t\tRTE_MBUF_DATA_DMA_ADDR(*tx_pkts);\n+\t\t\tstart_dp[desc_idx].len = (*tx_pkts)->pkt_len;\n+\t\t\ttx_pkts++;\n+\t\t\tdesc_idx++;\n+\t\t}\n+\t\tnb_commit -= nb_tail;\n+\t\tdesc_idx = 0;\n+\t}\n+\tfor (i = 0; i < nb_commit; i++)\n+\t\ttxvq->vq_descx[desc_idx + i].cookie = tx_pkts[i];\n+\tfor (i = 0; i < nb_commit; i++) {\n+\t\tstart_dp[desc_idx].addr = RTE_MBUF_DATA_DMA_ADDR(*tx_pkts);\n+\t\tstart_dp[desc_idx].len = (*tx_pkts)->pkt_len;\n+\t\ttx_pkts++;\n+\t\tdesc_idx++;\n+\t}\n+\n+\trte_compiler_barrier();\n+\n+\ttxvq->vq_free_cnt -= (uint16_t)(nb_pkts << 1);\n+\ttxvq->vq_avail_idx += nb_pkts;\n+\ttxvq->vq_ring.avail->idx = txvq->vq_avail_idx;\n+\ttxvq->packets += nb_pkts;\n+\n+\tif (likely(nb_pkts)) {\n+\t\tif (unlikely(virtqueue_kick_prepare(txvq)))\n+\t\t\tvirtqueue_notify(txvq);\n+\t}\n+\n+\treturn nb_pkts;\n+}\n+\n int __attribute__((cold))\n virtio_rxq_vec_setup(struct virtqueue *rxq)\n {\n", "prefixes": [ "dpdk-dev", "v5", "6/7" ] }{ "id": 7990, "url": "