get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41924,
    "url": "http://patches.dpdk.org/api/patches/41924/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180629092944.15576-12-johndale@cisco.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": "<20180629092944.15576-12-johndale@cisco.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180629092944.15576-12-johndale@cisco.com",
    "date": "2018-06-29T09:29:40",
    "name": "[v2,11/15] net/enic: add the simple version of Tx handler",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7797b1cfc90b9f186481434059592550894ec0cb",
    "submitter": {
        "id": 359,
        "url": "http://patches.dpdk.org/api/people/359/?format=api",
        "name": "John Daley (johndale)",
        "email": "johndale@cisco.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180629092944.15576-12-johndale@cisco.com/mbox/",
    "series": [
        {
            "id": 308,
            "url": "http://patches.dpdk.org/api/series/308/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=308",
            "date": "2018-06-29T09:29:29",
            "name": "enic PMD fixes and performance improvements",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/308/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41924/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/41924/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 0A9751B3AD;\n\tFri, 29 Jun 2018 11:34:29 +0200 (CEST)",
            "from alln-iport-2.cisco.com (alln-iport-2.cisco.com\n\t[173.37.142.89]) by dpdk.org (Postfix) with ESMTP id 3A3471B14C\n\tfor <dev@dpdk.org>; Fri, 29 Jun 2018 11:34:28 +0200 (CEST)",
            "from rcdn-core-8.cisco.com ([173.37.93.144])\n\tby alln-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jun 2018 09:34:27 +0000",
            "from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48])\n\tby rcdn-core-8.cisco.com (8.14.5/8.14.5) with ESMTP id w5T9YRfC003596;\n\tFri, 29 Jun 2018 09:34:27 GMT",
            "by cisco.com (Postfix, from userid 392789)\n\tid 382A420F2001; Fri, 29 Jun 2018 02:34:27 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n\td=cisco.com; i=@cisco.com; l=6821; q=dns/txt; s=iport;\n\tt=1530264868; x=1531474468;\n\th=from:to:cc:subject:date:message-id:in-reply-to: references;\n\tbh=fPifJXOdTBMZjsim0/ABJ1AQIpRipbjld+HB4wDXI6A=;\n\tb=dnynJ+4JQWiIPw748GR6ENpd3i5Qd+hqG0jOcMHdecLcgue3+68sOsfs\n\tk43+Mbtj/oz8KYMEM+PThM0N8ZH8ekayfn2CrFE7AbTRIG/Doi+KsEqJk\n\tuzLmgWCjpWheGvLjwPCpryl/3Ht9FdZf7uspErajBCMd8rV5dAVsOdING w=;",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,285,1526342400\"; d=\"scan'208\";a=\"136375678\"",
        "From": "John Daley <johndale@cisco.com>",
        "To": "ferruh.yigit@intel.com",
        "Cc": "dev@dpdk.org, Hyong Youb Kim <hyonkim@cisco.com>",
        "Date": "Fri, 29 Jun 2018 02:29:40 -0700",
        "Message-Id": "<20180629092944.15576-12-johndale@cisco.com>",
        "X-Mailer": "git-send-email 2.16.2",
        "In-Reply-To": "<20180629092944.15576-1-johndale@cisco.com>",
        "References": "<20180628031940.17397-1-johndale@cisco.com>\n\t<20180629092944.15576-1-johndale@cisco.com>",
        "Subject": "[dpdk-dev] [PATCH v2 11/15] net/enic: add the simple version of Tx\n\thandler",
        "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": "From: Hyong Youb Kim <hyonkim@cisco.com>\n\nAdd a much-simplified handler that works when all offloads are\ndisabled, except mbuf fast free. When compared against the default\nhandler, under ideal conditions, cycles per packet drop by 60+%.\nThe driver tries to use the simple handler first.\n\nThe idea of using specialized/simplified handlers is from the Intel\nand Mellanox drivers.\n\nSigned-off-by: Hyong Youb Kim <hyonkim@cisco.com>\nReviewed-by: John Daley <johndale@cisco.com>\n---\n\nv2: removed devarg to disable handler\n\n drivers/net/enic/enic.h        |  2 ++\n drivers/net/enic/enic_compat.h |  5 +++\n drivers/net/enic/enic_ethdev.c |  4 ---\n drivers/net/enic/enic_main.c   | 36 ++++++++++++++++++++\n drivers/net/enic/enic_rxtx.c   | 77 ++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 120 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h\nindex af790fc2e..a40ea790e 100644\n--- a/drivers/net/enic/enic.h\n+++ b/drivers/net/enic/enic.h\n@@ -318,6 +318,8 @@ uint16_t enic_dummy_recv_pkts(void *rx_queue,\n \t\t\t      uint16_t nb_pkts);\n uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\t\tuint16_t nb_pkts);\n+uint16_t enic_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n+\t\t\t       uint16_t nb_pkts);\n uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\t\tuint16_t nb_pkts);\n int enic_set_mtu(struct enic *enic, uint16_t new_mtu);\ndiff --git a/drivers/net/enic/enic_compat.h b/drivers/net/enic/enic_compat.h\nindex c0af1ed29..ceb1b0962 100644\n--- a/drivers/net/enic/enic_compat.h\n+++ b/drivers/net/enic/enic_compat.h\n@@ -56,6 +56,11 @@\n #define dev_debug(x, args...) dev_printk(DEBUG, args)\n \n extern int enicpmd_logtype_flow;\n+extern int enicpmd_logtype_init;\n+\n+#define PMD_INIT_LOG(level, fmt, args...) \\\n+\trte_log(RTE_LOG_ ## level, enicpmd_logtype_init, \\\n+\t\t\"%s\" fmt \"\\n\", __func__, ##args)\n \n #define __le16 u16\n #define __le32 u32\ndiff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c\nindex ef18f8802..15d93711d 100644\n--- a/drivers/net/enic/enic_ethdev.c\n+++ b/drivers/net/enic/enic_ethdev.c\n@@ -24,10 +24,6 @@\n int enicpmd_logtype_init;\n int enicpmd_logtype_flow;\n \n-#define PMD_INIT_LOG(level, fmt, args...) \\\n-\trte_log(RTE_LOG_ ## level, enicpmd_logtype_init, \\\n-\t\t\"%s\" fmt \"\\n\", __func__, ##args)\n-\n #define ENICPMD_FUNC_TRACE() PMD_INIT_LOG(DEBUG, \" >>\")\n \n /*\ndiff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c\nindex c03ec247a..e89105d96 100644\n--- a/drivers/net/enic/enic_main.c\n+++ b/drivers/net/enic/enic_main.c\n@@ -493,6 +493,27 @@ static void enic_rxq_intr_deinit(struct enic *enic)\n \t}\n }\n \n+static void enic_prep_wq_for_simple_tx(struct enic *enic, uint16_t queue_idx)\n+{\n+\tstruct wq_enet_desc *desc;\n+\tstruct vnic_wq *wq;\n+\tunsigned int i;\n+\n+\t/*\n+\t * Fill WQ descriptor fields that never change. Every descriptor is\n+\t * one packet, so set EOP. Also set CQ_ENTRY every ENIC_WQ_CQ_THRESH\n+\t * descriptors (i.e. request one completion update every 32 packets).\n+\t */\n+\twq = &enic->wq[queue_idx];\n+\tdesc = (struct wq_enet_desc *)wq->ring.descs;\n+\tfor (i = 0; i < wq->ring.desc_count; i++, desc++) {\n+\t\tdesc->header_length_flags = 1 << WQ_ENET_FLAGS_EOP_SHIFT;\n+\t\tif (i % ENIC_WQ_CQ_THRESH == ENIC_WQ_CQ_THRESH - 1)\n+\t\t\tdesc->header_length_flags |=\n+\t\t\t\t(1 << WQ_ENET_FLAGS_CQ_ENTRY_SHIFT);\n+\t}\n+}\n+\n int enic_enable(struct enic *enic)\n {\n \tunsigned int index;\n@@ -535,6 +556,21 @@ int enic_enable(struct enic *enic)\n \t\t}\n \t}\n \n+\t/*\n+\t * Use the simple TX handler if possible. All offloads must be disabled\n+\t * except mbuf fast free.\n+\t */\n+\tif ((eth_dev->data->dev_conf.txmode.offloads &\n+\t     ~DEV_TX_OFFLOAD_MBUF_FAST_FREE) == 0) {\n+\t\tPMD_INIT_LOG(DEBUG, \" use the simple tx handler\");\n+\t\teth_dev->tx_pkt_burst = &enic_simple_xmit_pkts;\n+\t\tfor (index = 0; index < enic->wq_count; index++)\n+\t\t\tenic_prep_wq_for_simple_tx(enic, index);\n+\t} else {\n+\t\tPMD_INIT_LOG(DEBUG, \" use the default tx handler\");\n+\t\teth_dev->tx_pkt_burst = &enic_xmit_pkts;\n+\t}\n+\n \tfor (index = 0; index < enic->wq_count; index++)\n \t\tenic_start_wq(enic, index);\n \tfor (index = 0; index < enic->rq_count; index++)\ndiff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c\nindex 7cddb53d9..7dec486fe 100644\n--- a/drivers/net/enic/enic_rxtx.c\n+++ b/drivers/net/enic/enic_rxtx.c\n@@ -741,4 +741,81 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n \treturn index;\n }\n \n+static void enqueue_simple_pkts(struct rte_mbuf **pkts,\n+\t\t\t\tstruct wq_enet_desc *desc,\n+\t\t\t\tuint16_t n,\n+\t\t\t\tstruct enic *enic)\n+{\n+\tstruct rte_mbuf *p;\n+\n+\twhile (n) {\n+\t\tn--;\n+\t\tp = *pkts++;\n+\t\tdesc->address = p->buf_iova + p->data_off;\n+\t\tdesc->length = p->pkt_len;\n+\t\t/*\n+\t\t * The app should not send oversized\n+\t\t * packets. tx_pkt_prepare includes a check as\n+\t\t * well. But some apps ignore the device max size and\n+\t\t * tx_pkt_prepare. Oversized packets cause WQ errrors\n+\t\t * and the NIC ends up disabling the whole WQ. So\n+\t\t * truncate packets..\n+\t\t */\n+\t\tif (unlikely(p->pkt_len > ENIC_TX_MAX_PKT_SIZE)) {\n+\t\t\tdesc->length = ENIC_TX_MAX_PKT_SIZE;\n+\t\t\trte_atomic64_inc(&enic->soft_stats.tx_oversized);\n+\t\t}\n+\t\tdesc++;\n+\t}\n+}\n+\n+uint16_t enic_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n+\t\t\t       uint16_t nb_pkts)\n+{\n+\tunsigned int head_idx, desc_count;\n+\tstruct wq_enet_desc *desc;\n+\tstruct vnic_wq *wq;\n+\tstruct enic *enic;\n+\tuint16_t rem, n;\n+\n+\twq = (struct vnic_wq *)tx_queue;\n+\tenic = vnic_dev_priv(wq->vdev);\n+\tenic_cleanup_wq(enic, wq);\n+\t/* Will enqueue this many packets in this call */\n+\tnb_pkts = RTE_MIN(nb_pkts, wq->ring.desc_avail);\n+\tif (nb_pkts == 0)\n+\t\treturn 0;\n+\n+\thead_idx = wq->head_idx;\n+\tdesc_count = wq->ring.desc_count;\n+\n+\t/* Descriptors until the end of the ring */\n+\tn = desc_count - head_idx;\n+\tn = RTE_MIN(nb_pkts, n);\n \n+\t/* Save mbuf pointers to free later */\n+\tmemcpy(wq->bufs + head_idx, tx_pkts, sizeof(struct rte_mbuf *) * n);\n+\n+\t/* Enqueue until the ring end */\n+\trem = nb_pkts - n;\n+\tdesc = ((struct wq_enet_desc *)wq->ring.descs) + head_idx;\n+\tenqueue_simple_pkts(tx_pkts, desc, n, enic);\n+\n+\t/* Wrap to the start of the ring */\n+\tif (rem) {\n+\t\ttx_pkts += n;\n+\t\tmemcpy(wq->bufs, tx_pkts, sizeof(struct rte_mbuf *) * rem);\n+\t\tdesc = (struct wq_enet_desc *)wq->ring.descs;\n+\t\tenqueue_simple_pkts(tx_pkts, desc, rem, enic);\n+\t}\n+\trte_wmb();\n+\n+\t/* Update head_idx and desc_avail */\n+\twq->ring.desc_avail -= nb_pkts;\n+\thead_idx += nb_pkts;\n+\tif (head_idx >= desc_count)\n+\t\thead_idx -= desc_count;\n+\twq->head_idx = head_idx;\n+\tiowrite32_relaxed(head_idx, &wq->ctrl->posted_index);\n+\treturn nb_pkts;\n+}\n",
    "prefixes": [
        "v2",
        "11/15"
    ]
}