Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/7729/?format=api
https://patches.dpdk.org/api/patches/7729/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445231772-17467-2-git-send-email-stephen@networkplumber.org/", "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": "<1445231772-17467-2-git-send-email-stephen@networkplumber.org>", "list_archive_url": "https://inbox.dpdk.org/dev/1445231772-17467-2-git-send-email-stephen@networkplumber.org", "date": "2015-10-19T05:16:08", "name": "[dpdk-dev,1/5] virtio: clean up space checks on xmit", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "a18e9c402bdf3ca54fd62019e54d70b2ccb16d9f", "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/1445231772-17467-2-git-send-email-stephen@networkplumber.org/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/7729/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/7729/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 AFE3D8E85;\n\tMon, 19 Oct 2015 07:16:09 +0200 (CEST)", "from mail-pa0-f42.google.com (mail-pa0-f42.google.com\n\t[209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 366488E7E\n\tfor <dev@dpdk.org>; Mon, 19 Oct 2015 07:16:06 +0200 (CEST)", "by pasz6 with SMTP id z6so18714765pas.2\n\tfor <dev@dpdk.org>; Sun, 18 Oct 2015 22:16:05 -0700 (PDT)", "from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net.\n\t[50.53.82.155]) by smtp.gmail.com with ESMTPSA id\n\tk10sm33681035pbq.78.2015.10.18.22.16.04\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSun, 18 Oct 2015 22:16:04 -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:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=WDKeC8I3ZkkhvXLC47DZIHZ/LFKWzF2RQ5fc4gq8p98=;\n\tb=WcEKhRg70GlrXpcFxOo9o+JQaiuHeJ2vunapCBmmEljaRqRuymvNf+M74n840oQec+\n\t0cX+0/i3jZra/nm0GFzfGxgTQLojYy/3VL9ZcYBlnNFNXZlmNvFAYqHKMIA6ekaJM456\n\teAlp9k2yyqmjoYzCfx1h1MgI6bAPgBUFpwfCzjXkcI47NPqIU91eSzs97RDsJ/4f53qQ\n\tGCJfLCWzhXuu2yIR3sgK6Rc987HfZUTgwmjLmp5tFVO6l6bOo2QkdZKwM1gyBuynKSkf\n\tz3yqAdzll/AkG7FOfGRIGARR+ycLVJouru/SyBRuh0aNJn0Jt5+Fzy0yxSJQ6FCCWivL\n\tgPJA==", "X-Gm-Message-State": "ALoCoQmC+WuhKPEBK5qe+ZnRm4MRf5hoGqcAE71bUWbiUWeAHHg3k0ACqkdqK0qy1J1fZSOWaeCy", "X-Received": "by 10.68.91.193 with SMTP id cg1mr32300289pbb.98.1445231765653; \n\tSun, 18 Oct 2015 22:16:05 -0700 (PDT)", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "huawei.xie@intel.com,\n\tchangchun.ouyang@intel.com", "Date": "Sun, 18 Oct 2015 22:16:08 -0700", "Message-Id": "<1445231772-17467-2-git-send-email-stephen@networkplumber.org>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1445231772-17467-1-git-send-email-stephen@networkplumber.org>", "References": "<1445231772-17467-1-git-send-email-stephen@networkplumber.org>", "Cc": "dev@dpdk.org", "Subject": "[dpdk-dev] [PATCH 1/5] virtio: clean up space checks on xmit", "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": "The space check for transmit ring only needs a single conditional.\nI.e only need to recheck for space if there was no space in first check.\n\nThis can help performance and simplifies loop.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n drivers/net/virtio/virtio_rxtx.c | 66 ++++++++++++++++------------------------\n 1 file changed, 27 insertions(+), 39 deletions(-)", "diff": "diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex c5b53bb..5b50ed0 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -745,7 +745,6 @@ uint16_t\n virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n {\n \tstruct virtqueue *txvq = tx_queue;\n-\tstruct rte_mbuf *txm;\n \tuint16_t nb_used, nb_tx;\n \tint error;\n \n@@ -759,57 +758,46 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n \tif (likely(nb_used > txvq->vq_nentries - txvq->vq_free_thresh))\n \t\tvirtio_xmit_cleanup(txvq, nb_used);\n \n-\tnb_tx = 0;\n+\tfor (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {\n+\t\tstruct rte_mbuf *txm = tx_pkts[nb_tx];\n+\t\tint need = txm->nb_segs - txvq->vq_free_cnt + 1;\n \n-\twhile (nb_tx < nb_pkts) {\n-\t\t/* Need one more descriptor for virtio header. */\n-\t\tint need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;\n-\n-\t\t/*Positive value indicates it need free vring descriptors */\n+\t\t/* Positive value indicates it need free vring descriptors */\n \t\tif (unlikely(need > 0)) {\n \t\t\tnb_used = VIRTQUEUE_NUSED(txvq);\n \t\t\tvirtio_rmb();\n \t\t\tneed = RTE_MIN(need, (int)nb_used);\n \n \t\t\tvirtio_xmit_cleanup(txvq, need);\n-\t\t\tneed = (int)tx_pkts[nb_tx]->nb_segs -\n-\t\t\t\ttxvq->vq_free_cnt + 1;\n-\t\t}\n-\n-\t\t/*\n-\t\t * Zero or negative value indicates it has enough free\n-\t\t * descriptors to use for transmitting.\n-\t\t */\n-\t\tif (likely(need <= 0)) {\n-\t\t\ttxm = tx_pkts[nb_tx];\n-\n-\t\t\t/* Do VLAN tag insertion */\n-\t\t\tif (unlikely(txm->ol_flags & PKT_TX_VLAN_PKT)) {\n-\t\t\t\terror = rte_vlan_insert(&txm);\n-\t\t\t\tif (unlikely(error)) {\n-\t\t\t\t\trte_pktmbuf_free(txm);\n-\t\t\t\t\t++nb_tx;\n-\t\t\t\t\tcontinue;\n-\t\t\t\t}\n+\t\t\tneed = txm->nb_segs - txvq->vq_free_cnt + 1;\n+\t\t\tif (unlikely(need > 0)) {\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\t\t/* Enqueue Packet buffers */\n-\t\t\terror = virtqueue_enqueue_xmit(txvq, txm);\n+\t\t/* Do VLAN tag insertion */\n+\t\tif (unlikely(txm->ol_flags & PKT_TX_VLAN_PKT)) {\n+\t\t\terror = rte_vlan_insert(&txm);\n \t\t\tif (unlikely(error)) {\n-\t\t\t\tif (error == ENOSPC)\n-\t\t\t\t\tPMD_TX_LOG(ERR, \"virtqueue_enqueue Free count = 0\");\n-\t\t\t\telse if (error == EMSGSIZE)\n-\t\t\t\t\tPMD_TX_LOG(ERR, \"virtqueue_enqueue Free count < 1\");\n-\t\t\t\telse\n-\t\t\t\t\tPMD_TX_LOG(ERR, \"virtqueue_enqueue error: %d\", error);\n-\t\t\t\tbreak;\n+\t\t\t\trte_pktmbuf_free(txm);\n+\t\t\t\tcontinue;\n \t\t\t}\n-\t\t\tnb_tx++;\n-\t\t\ttxvq->bytes += txm->pkt_len;\n-\t\t} else {\n-\t\t\tPMD_TX_LOG(ERR, \"No free tx descriptors to transmit\");\n+\t\t}\n+\n+\t\t/* Enqueue Packet buffers */\n+\t\terror = virtqueue_enqueue_xmit(txvq, txm);\n+\t\tif (unlikely(error)) {\n+\t\t\tif (error == ENOSPC)\n+\t\t\t\tPMD_TX_LOG(ERR, \"virtqueue_enqueue Free count = 0\");\n+\t\t\telse if (error == EMSGSIZE)\n+\t\t\t\tPMD_TX_LOG(ERR, \"virtqueue_enqueue Free count < 1\");\n+\t\t\telse\n+\t\t\t\tPMD_TX_LOG(ERR, \"virtqueue_enqueue error: %d\", error);\n \t\t\tbreak;\n \t\t}\n+\t\ttxvq->bytes += txm->pkt_len;\n \t}\n \n \ttxvq->packets += nb_tx;\n", "prefixes": [ "dpdk-dev", "1/5" ] }{ "id": 7729, "url": "