get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/13184/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 13184,
    "url": "https://patches.dpdk.org/api/patches/13184/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1464913377-30879-10-git-send-email-johndale@cisco.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": "<1464913377-30879-10-git-send-email-johndale@cisco.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1464913377-30879-10-git-send-email-johndale@cisco.com",
    "date": "2016-06-03T00:22:53",
    "name": "[dpdk-dev,v3,09/13] enic: optimize the Tx function",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "3f4f57818e4ba8360a3a412be629550203aeb594",
    "submitter": {
        "id": 359,
        "url": "https://patches.dpdk.org/api/people/359/?format=api",
        "name": "John Daley (johndale)",
        "email": "johndale@cisco.com"
    },
    "delegate": {
        "id": 10,
        "url": "https://patches.dpdk.org/api/users/10/?format=api",
        "username": "bruce",
        "first_name": "Bruce",
        "last_name": "Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1464913377-30879-10-git-send-email-johndale@cisco.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/13184/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/13184/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 4D56769FE;\n\tFri,  3 Jun 2016 02:23:26 +0200 (CEST)",
            "from alln-iport-6.cisco.com (alln-iport-6.cisco.com\n\t[173.37.142.93]) by dpdk.org (Postfix) with ESMTP id 1FEF068F6\n\tfor <dev@dpdk.org>; Fri,  3 Jun 2016 02:23:22 +0200 (CEST)",
            "from alln-core-9.cisco.com ([173.36.13.129])\n\tby alln-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA;\n\t03 Jun 2016 00:23:21 +0000",
            "from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48])\n\tby alln-core-9.cisco.com (8.14.5/8.14.5) with ESMTP id u530NLOq029331;\n\tFri, 3 Jun 2016 00:23:21 GMT",
            "by cisco.com (Postfix, from userid 392789)\n\tid 78E413FAADEC; Thu,  2 Jun 2016 17:23:21 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n\td=cisco.com; i=@cisco.com; l=6743; q=dns/txt; s=iport;\n\tt=1464913402; x=1466123002;\n\th=from:to:cc:subject:date:message-id:in-reply-to: references;\n\tbh=bwq2e7sp9dvFYPOdT7oWRUrTSf3t9jmIOgst/OSz+S0=;\n\tb=MePJyi2u81C4K2tifpstLq+SIcjXrtvW8bRPl6X+D/fW5XWWsvbzrhTV\n\t+FiFahVQhjFA6OiS3B0jUfUUAG1whZYRgpIOXihUa09+BNrc8GB0mL4ra\n\tQwRo+KINOlyRa/q+K9LyYD5W2NwxZp2NlRQTdHofQEbGf1j1CuAcG1zsD I=;",
        "X-IronPort-AV": "E=Sophos;i=\"5.26,409,1459814400\"; d=\"scan'208\";a=\"281122822\"",
        "From": "John Daley <johndale@cisco.com>",
        "To": "dev@dpdk.org",
        "Cc": "bruce.richarsdon@intel.com, John Daley <johndale@cisco.com>,\n\tNelson Escobar <neescoba@cisco.com>",
        "Date": "Thu,  2 Jun 2016 17:22:53 -0700",
        "Message-Id": "<1464913377-30879-10-git-send-email-johndale@cisco.com>",
        "X-Mailer": "git-send-email 2.7.0",
        "In-Reply-To": "<1464913377-30879-1-git-send-email-johndale@cisco.com>",
        "References": "<1464071579-30072-1-git-send-email-johndale@cisco.com>\n\t<1464913377-30879-1-git-send-email-johndale@cisco.com>",
        "Subject": "[dpdk-dev] [PATCH v3 09/13] enic: optimize the Tx function",
        "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": "Reduce host CPU overhead of Tx packet processing:\n* Use local variables inside per packet loop instead of fields in structs.\n* Factor book keeping and conditionals out of the per packet loop where\n  possible.\n* Post buffers to the nic at a maximum of every 64 packets\n\nSigned-off-by: Nelson Escobar <neescoba@cisco.com>\nSigned-off-by: John Daley <johndale@cisco.com>\n---\n drivers/net/enic/base/vnic_wq.h |   1 +\n drivers/net/enic/enic_res.h     |   2 +-\n drivers/net/enic/enic_rxtx.c    | 167 +++++++++++++++++++---------------------\n 3 files changed, 83 insertions(+), 87 deletions(-)",
    "diff": "diff --git a/drivers/net/enic/base/vnic_wq.h b/drivers/net/enic/base/vnic_wq.h\nindex 689b81c..7a66813 100644\n--- a/drivers/net/enic/base/vnic_wq.h\n+++ b/drivers/net/enic/base/vnic_wq.h\n@@ -67,6 +67,7 @@ struct vnic_wq_ctrl {\n \n /* 16 bytes */\n struct vnic_wq_buf {\n+\tstruct rte_mempool *pool;\n \tvoid *mb;\n };\n \ndiff --git a/drivers/net/enic/enic_res.h b/drivers/net/enic/enic_res.h\nindex 955db71..3c8e303 100644\n--- a/drivers/net/enic/enic_res.h\n+++ b/drivers/net/enic/enic_res.h\n@@ -53,7 +53,7 @@\n \n #define ENIC_NON_TSO_MAX_DESC\t\t16\n #define ENIC_DEFAULT_RX_FREE_THRESH\t32\n-#define ENIC_TX_POST_THRESH\t\t(ENIC_MIN_WQ_DESCS / 2)\n+#define ENIC_TX_XMIT_MAX\t\t64\n \n #define ENIC_SETTING(enic, f) ((enic->config.flags & VENETF_##f) ? 1 : 0)\n \ndiff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c\nindex ec8d90a..ba15670 100644\n--- a/drivers/net/enic/enic_rxtx.c\n+++ b/drivers/net/enic/enic_rxtx.c\n@@ -374,114 +374,109 @@ unsigned int enic_cleanup_wq(__rte_unused struct enic *enic, struct vnic_wq *wq)\n \treturn 0;\n }\n \n-void enic_post_wq_index(struct vnic_wq *wq)\n-{\n-\tenic_vnic_post_wq_index(wq);\n-}\n-\n-void enic_send_pkt(struct enic *enic, struct vnic_wq *wq,\n-\t\t   struct rte_mbuf *tx_pkt, unsigned short len,\n-\t\t   uint8_t sop, uint8_t eop, uint8_t cq_entry,\n-\t\t   uint16_t ol_flags, uint16_t vlan_tag)\n-{\n-\tstruct wq_enet_desc *desc, *descs;\n-\tuint16_t mss = 0;\n-\tuint8_t vlan_tag_insert = 0;\n-\tuint64_t bus_addr = (dma_addr_t)\n-\t    (tx_pkt->buf_physaddr + tx_pkt->data_off);\n-\n-\tdescs = (struct wq_enet_desc *)wq->ring.descs;\n-\tdesc = descs + wq->head_idx;\n-\n-\tif (sop) {\n-\t\tif (ol_flags & PKT_TX_VLAN_PKT)\n-\t\t\tvlan_tag_insert = 1;\n-\n-\t\tif (enic->hw_ip_checksum) {\n-\t\t\tif (ol_flags & PKT_TX_IP_CKSUM)\n-\t\t\t\tmss |= ENIC_CALC_IP_CKSUM;\n-\n-\t\t\tif (ol_flags & PKT_TX_TCP_UDP_CKSUM)\n-\t\t\t\tmss |= ENIC_CALC_TCP_UDP_CKSUM;\n-\t\t}\n-\t}\n-\n-\twq_enet_desc_enc(desc,\n-\t\tbus_addr,\n-\t\tlen,\n-\t\tmss,\n-\t\t0 /* header_length */,\n-\t\t0 /* offload_mode WQ_ENET_OFFLOAD_MODE_CSUM */,\n-\t\teop,\n-\t\tcq_entry,\n-\t\t0 /* fcoe_encap */,\n-\t\tvlan_tag_insert,\n-\t\tvlan_tag,\n-\t\t0 /* loopback */);\n-\n-\tenic_vnic_post_wq(wq, (void *)tx_pkt, cq_entry);\n-}\n-\n uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n \tuint16_t nb_pkts)\n {\n \tuint16_t index;\n-\tunsigned int frags;\n-\tunsigned int pkt_len;\n-\tunsigned int seg_len;\n-\tunsigned int inc_len;\n+\tunsigned int pkt_len, data_len;\n \tunsigned int nb_segs;\n-\tstruct rte_mbuf *tx_pkt, *next_tx_pkt;\n+\tstruct rte_mbuf *tx_pkt;\n \tstruct vnic_wq *wq = (struct vnic_wq *)tx_queue;\n \tstruct enic *enic = vnic_dev_priv(wq->vdev);\n \tunsigned short vlan_id;\n \tunsigned short ol_flags;\n-\tuint8_t last_seg, eop;\n-\tunsigned int host_tx_descs = 0;\n+\tunsigned int wq_desc_avail;\n+\tint head_idx;\n+\tstruct vnic_wq_buf *buf;\n+\tunsigned int hw_ip_cksum_enabled;\n+\tunsigned int desc_count;\n+\tstruct wq_enet_desc *descs, *desc_p, desc_tmp;\n+\tuint16_t mss;\n+\tuint8_t vlan_tag_insert;\n+\tuint8_t eop;\n+\tuint64_t bus_addr;\n \n+\tenic_cleanup_wq(enic, wq);\n+\twq_desc_avail = vnic_wq_desc_avail(wq);\n+\thead_idx = wq->head_idx;\n+\tdesc_count = wq->ring.desc_count;\n+\n+\tnb_pkts = RTE_MIN(nb_pkts, ENIC_TX_XMIT_MAX);\n+\n+\thw_ip_cksum_enabled = enic->hw_ip_checksum;\n \tfor (index = 0; index < nb_pkts; index++) {\n \t\ttx_pkt = *tx_pkts++;\n-\t\tinc_len = 0;\n \t\tnb_segs = tx_pkt->nb_segs;\n-\t\tif (nb_segs > vnic_wq_desc_avail(wq)) {\n+\t\tif (nb_segs > wq_desc_avail) {\n \t\t\tif (index > 0)\n-\t\t\t\tenic_post_wq_index(wq);\n-\n-\t\t\t/* wq cleanup and try again */\n-\t\t\tif (!enic_cleanup_wq(enic, wq) ||\n-\t\t\t\t(nb_segs > vnic_wq_desc_avail(wq))) {\n-\t\t\t\treturn index;\n-\t\t\t}\n+\t\t\t\tgoto post;\n+\t\t\tgoto done;\n \t\t}\n \n \t\tpkt_len = tx_pkt->pkt_len;\n+\t\tdata_len = tx_pkt->data_len;\n \t\tvlan_id = tx_pkt->vlan_tci;\n \t\tol_flags = tx_pkt->ol_flags;\n-\t\tfor (frags = 0; inc_len < pkt_len; frags++) {\n-\t\t\tif (!tx_pkt)\n-\t\t\t\tbreak;\n-\t\t\tnext_tx_pkt = tx_pkt->next;\n-\t\t\tseg_len = tx_pkt->data_len;\n-\t\t\tinc_len += seg_len;\n-\n-\t\t\thost_tx_descs++;\n-\t\t\tlast_seg = 0;\n-\t\t\teop = 0;\n-\t\t\tif ((pkt_len == inc_len) || !next_tx_pkt) {\n-\t\t\t\teop = 1;\n-\t\t\t\t/* post if last packet in batch or > thresh */\n-\t\t\t\tif ((index == (nb_pkts - 1)) ||\n-\t\t\t\t   (host_tx_descs > ENIC_TX_POST_THRESH)) {\n-\t\t\t\t\tlast_seg = 1;\n-\t\t\t\t\thost_tx_descs = 0;\n-\t\t\t\t}\n+\n+\t\tmss = 0;\n+\t\tvlan_tag_insert = 0;\n+\t\tbus_addr = (dma_addr_t)\n+\t\t\t   (tx_pkt->buf_physaddr + tx_pkt->data_off);\n+\n+\t\tdescs = (struct wq_enet_desc *)wq->ring.descs;\n+\t\tdesc_p = descs + head_idx;\n+\n+\t\teop = (data_len == pkt_len);\n+\n+\t\tif (ol_flags & PKT_TX_VLAN_PKT)\n+\t\t\tvlan_tag_insert = 1;\n+\n+\t\tif (hw_ip_cksum_enabled && (ol_flags & PKT_TX_IP_CKSUM))\n+\t\t\tmss |= ENIC_CALC_IP_CKSUM;\n+\n+\t\tif (hw_ip_cksum_enabled && (ol_flags & PKT_TX_TCP_UDP_CKSUM))\n+\t\t\tmss |= ENIC_CALC_TCP_UDP_CKSUM;\n+\n+\t\twq_enet_desc_enc(&desc_tmp, bus_addr, data_len, mss, 0, 0, eop,\n+\t\t\t\t eop, 0, vlan_tag_insert, vlan_id, 0);\n+\n+\t\t*desc_p = desc_tmp;\n+\t\tbuf = &wq->bufs[head_idx];\n+\t\tbuf->mb = (void *)tx_pkt;\n+\t\thead_idx = enic_ring_incr(desc_count, head_idx);\n+\t\twq_desc_avail--;\n+\n+\t\tif (!eop) {\n+\t\t\tfor (tx_pkt = tx_pkt->next; tx_pkt; tx_pkt =\n+\t\t\t    tx_pkt->next) {\n+\t\t\t\tdata_len = tx_pkt->data_len;\n+\n+\t\t\t\tif (tx_pkt->next == NULL)\n+\t\t\t\t\teop = 1;\n+\t\t\t\tdesc_p = descs + head_idx;\n+\t\t\t\tbus_addr = (dma_addr_t)(tx_pkt->buf_physaddr\n+\t\t\t\t\t   + tx_pkt->data_off);\n+\t\t\t\twq_enet_desc_enc((struct wq_enet_desc *)\n+\t\t\t\t\t\t &desc_tmp, bus_addr, data_len,\n+\t\t\t\t\t\t mss, 0, 0, eop, eop, 0,\n+\t\t\t\t\t\t vlan_tag_insert, vlan_id, 0);\n+\n+\t\t\t\t*desc_p = desc_tmp;\n+\t\t\t\tbuf = &wq->bufs[head_idx];\n+\t\t\t\tbuf->mb = (void *)tx_pkt;\n+\t\t\t\thead_idx = enic_ring_incr(desc_count, head_idx);\n+\t\t\t\twq_desc_avail--;\n \t\t\t}\n-\t\t\tenic_send_pkt(enic, wq, tx_pkt, (unsigned short)seg_len,\n-\t\t\t\t      !frags, eop, last_seg, ol_flags, vlan_id);\n-\t\t\ttx_pkt = next_tx_pkt;\n \t\t}\n \t}\n+ post:\n+\trte_wmb();\n+\tiowrite32(head_idx, &wq->ctrl->posted_index);\n+ done:\n+\twq->ring.desc_avail = wq_desc_avail;\n+\twq->head_idx = head_idx;\n \n-\tenic_cleanup_wq(enic, wq);\n \treturn index;\n }\n+\n+\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "09/13"
    ]
}