get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 17154,
    "url": "https://patches.dpdk.org/api/patches/17154/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1479740470-6723-57-git-send-email-arybchenko@solarflare.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": "<1479740470-6723-57-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1479740470-6723-57-git-send-email-arybchenko@solarflare.com",
    "date": "2016-11-21T15:01:10",
    "name": "[dpdk-dev,56/56] net/sfc: add callback to send bursts of packets",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "fa87f6f5527edc2b1ab2b3c10b40aa4770e481f7",
    "submitter": {
        "id": 607,
        "url": "https://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1479740470-6723-57-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/17154/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/17154/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 F14AFD66A;\n\tMon, 21 Nov 2016 16:03:49 +0100 (CET)",
            "from nbfkord-smmo02.seg.att.com (nbfkord-smmo02.seg.att.com\n\t[209.65.160.78]) by dpdk.org (Postfix) with ESMTP id 5CE433977\n\tfor <dev@dpdk.org>; Mon, 21 Nov 2016 16:01:51 +0100 (CET)",
            "from unknown [12.187.104.26] (EHLO nbfkord-smmo02.seg.att.com)\n\tby nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id\n\tf5c03385.2b9284833940.1541321.00-2472.3424293.nbfkord-smmo02.seg.att.com\n\t(envelope-from <arybchenko@solarflare.com>); \n\tMon, 21 Nov 2016 15:01:51 +0000 (UTC)",
            "from unknown [12.187.104.26]\n\tby nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with SMTP id\n\t55c03385.0.1541303.00-2373.3424249.nbfkord-smmo02.seg.att.com\n\t(envelope-from <arybchenko@solarflare.com>); \n\tMon, 21 Nov 2016 15:01:43 +0000 (UTC)",
            "from ocex03.SolarFlarecom.com (10.20.40.36) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id 15.0.1044.25; Mon, 21 Nov 2016 07:01:23 -0800",
            "from opal.uk.solarflarecom.com (10.17.10.1) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id\n\t15.0.1044.25 via Frontend Transport; Mon, 21 Nov 2016 07:01:22 -0800",
            "from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com\n\t[10.17.10.10])\n\tby opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tuALF1LS1007266; Mon, 21 Nov 2016 15:01:21 GMT",
            "from uklogin.uk.solarflarecom.com (localhost.localdomain\n\t[127.0.0.1])\n\tby uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tuALF1J3l006765; Mon, 21 Nov 2016 15:01:21 GMT"
        ],
        "X-MXL-Hash": [
            "58330c5f7b393d7b-df8107b19eced5e0eabf34f1514cf383b0ef6e7a",
            "58330c5702b547ad-50c401828f477c19daabc6516cec1845095e9ac2"
        ],
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<dev@dpdk.org>",
        "CC": "Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Mon, 21 Nov 2016 15:01:10 +0000",
        "Message-ID": "<1479740470-6723-57-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.2.3",
        "In-Reply-To": "<1479740470-6723-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1479740470-6723-1-git-send-email-arybchenko@solarflare.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-AnalysisOut": [
            "[v=2.1 cv=UI/baXry c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==]",
            "[:17 a=L24OOQBejmoA:10 a=pK7X0mNQAAAA:8 a=zRKbQ67AAAAA:8 a=]",
            "[x3NtvZPS5Aqf7GUG1cQA:9 a=XvkekhfmQLjxaZK_:21 a=gBNrHQtNUfY]",
            "[wr3WT:21 a=5HA-qpC1VU4iIGLgRoNS:22 a=PA03WX8tBzeizutn5_OT:]",
            "[22]"
        ],
        "X-Spam": "[F=0.3521600375; CM=0.500; S=0.352(2015072901)]",
        "X-MAIL-FROM": "<arybchenko@solarflare.com>",
        "X-SOURCE-IP": "[12.187.104.26]",
        "Subject": "[dpdk-dev] [PATCH 56/56] net/sfc: add callback to send bursts of\n\tpackets",
        "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": "From: Ivan Malov <ivan.malov@oktetlabs.ru>\n\nReviewed-by: Andy Moreton <amoreton@solarflare.com>\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <arybchenko@solarflare.com>\n---\n drivers/net/sfc/efx/sfc_ethdev.c |   2 +\n drivers/net/sfc/efx/sfc_ev.c     |  22 +++++++-\n drivers/net/sfc/efx/sfc_tweak.h  |   7 +++\n drivers/net/sfc/efx/sfc_tx.c     | 115 +++++++++++++++++++++++++++++++++++++++\n drivers/net/sfc/efx/sfc_tx.h     |  18 ++++++\n 5 files changed, 162 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/sfc/efx/sfc_ethdev.c b/drivers/net/sfc/efx/sfc_ethdev.c\nindex 98e5d83..4f94653 100644\n--- a/drivers/net/sfc/efx/sfc_ethdev.c\n+++ b/drivers/net/sfc/efx/sfc_ethdev.c\n@@ -386,6 +386,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)\n \n \tdev->dev_ops = &sfc_eth_dev_ops;\n \tdev->rx_pkt_burst = &sfc_recv_pkts;\n+\tdev->tx_pkt_burst = &sfc_xmit_pkts;\n \n \tsfc_adapter_unlock(sa);\n \n@@ -424,6 +425,7 @@ sfc_eth_dev_uninit(struct rte_eth_dev *dev)\n \n \tdev->dev_ops = NULL;\n \tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n \n \tsfc_kvargs_cleanup(sa);\n \ndiff --git a/drivers/net/sfc/efx/sfc_ev.c b/drivers/net/sfc/efx/sfc_ev.c\nindex b3cecbb..8b3f098 100644\n--- a/drivers/net/sfc/efx/sfc_ev.c\n+++ b/drivers/net/sfc/efx/sfc_ev.c\n@@ -142,9 +142,27 @@ static boolean_t\n sfc_ev_tx(void *arg, uint32_t label, uint32_t id)\n {\n \tstruct sfc_evq *evq = arg;\n+\tstruct sfc_txq *txq;\n+\tunsigned int stop;\n+\tunsigned int delta;\n \n-\tsfc_err(evq->sa, \"EVQ %u unexpected Tx event\", evq->evq_index);\n-\treturn B_TRUE;\n+\ttxq = evq->txq;\n+\n+\tSFC_ASSERT(txq != NULL);\n+\tSFC_ASSERT(txq->evq == evq);\n+\n+\tif (unlikely((txq->state & SFC_TXQ_STARTED) == 0))\n+\t\tgoto done;\n+\n+\tstop = (id + 1) & txq->ptr_mask;\n+\tid = txq->pending & txq->ptr_mask;\n+\n+\tdelta = (stop >= id) ? (stop - id) : (txq->ptr_mask + 1 - id + stop);\n+\n+\ttxq->pending += delta;\n+\n+done:\n+\treturn B_FALSE;\n }\n \n static boolean_t\ndiff --git a/drivers/net/sfc/efx/sfc_tweak.h b/drivers/net/sfc/efx/sfc_tweak.h\nindex 24cb9f4..60b618b 100644\n--- a/drivers/net/sfc/efx/sfc_tweak.h\n+++ b/drivers/net/sfc/efx/sfc_tweak.h\n@@ -41,4 +41,11 @@\n  */\n #define\tSFC_RX_REFILL_BULK\t(RTE_CACHE_LINE_SIZE / sizeof(efx_qword_t))\n \n+/**\n+ * Make the transmit path reap at least one time per a burst;\n+ * this improves cache locality because the same mbufs may be used to send\n+ * subsequent bursts in certain cases because of well-timed reap\n+ */\n+#define\tSFC_TX_XMIT_PKTS_REAP_AT_LEAST_ONCE\t0\n+\n #endif /* _SFC_TWEAK_H_ */\ndiff --git a/drivers/net/sfc/efx/sfc_tx.c b/drivers/net/sfc/efx/sfc_tx.c\nindex 99d845a..92e81a8 100644\n--- a/drivers/net/sfc/efx/sfc_tx.c\n+++ b/drivers/net/sfc/efx/sfc_tx.c\n@@ -32,6 +32,7 @@\n #include \"sfc_log.h\"\n #include \"sfc_ev.h\"\n #include \"sfc_tx.h\"\n+#include \"sfc_tweak.h\"\n \n /*\n  * Maximum number of TX queue flush attempts in case of\n@@ -529,3 +530,117 @@ sfc_tx_stop(struct sfc_adapter *sa)\n \n \tefx_tx_fini(sa->nic);\n }\n+\n+uint16_t\n+sfc_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n+{\n+\tstruct sfc_txq *txq = (struct sfc_txq *)tx_queue;\n+\tunsigned int added = txq->added;\n+\tunsigned int pushed = added;\n+\tunsigned int pkts_sent = 0;\n+\tefx_desc_t *pend = &txq->pend_desc[0];\n+\tconst unsigned int hard_max_fill = EFX_TXQ_LIMIT(txq->ptr_mask + 1);\n+\tconst unsigned int soft_max_fill = hard_max_fill -\n+\t\t\t\t\t   SFC_TX_MAX_PKT_DESC;\n+\tunsigned int fill_level = added - txq->completed;\n+\tboolean_t reap_done;\n+\tint rc;\n+\tstruct rte_mbuf **pktp;\n+\n+\tif (unlikely((txq->state & SFC_TXQ_RUNNING) == 0))\n+\t\tgoto done;\n+\n+\t/*\n+\t * If insufficient space for a single packet is present,\n+\t * we should reap; otherwise, we shouldn't do that all the time\n+\t * to avoid latency increase\n+\t */\n+\treap_done = (fill_level > soft_max_fill);\n+\n+\tif (reap_done) {\n+\t\tsfc_tx_reap(txq);\n+\t\t/*\n+\t\t * Recalculate fill level since 'txq->completed'\n+\t\t * might have changed on reap\n+\t\t */\n+\t\tfill_level = added - txq->completed;\n+\t}\n+\n+\tfor (pkts_sent = 0, pktp = &tx_pkts[0];\n+\t     (pkts_sent < nb_pkts) && (fill_level <= soft_max_fill);\n+\t     pkts_sent++, pktp++) {\n+\t\tstruct rte_mbuf\t\t*m_seg = *pktp;\n+\t\tsize_t\t\t\tpkt_len = m_seg->pkt_len;\n+\t\tunsigned int\t\tpkt_descs = 0;\n+\n+\t\tfor (; m_seg != NULL; m_seg = m_seg->next) {\n+\t\t\tefsys_dma_addr_t\tnext_frag;\n+\t\t\tsize_t\t\t\tseg_len;\n+\n+\t\t\tseg_len = m_seg->data_len;\n+\t\t\tnext_frag = rte_mbuf_data_dma_addr(m_seg);\n+\n+\t\t\tdo {\n+\t\t\t\tefsys_dma_addr_t\tfrag_addr = next_frag;\n+\t\t\t\tsize_t\t\t\tfrag_len;\n+\n+\t\t\t\tnext_frag = RTE_ALIGN(frag_addr + 1,\n+\t\t\t\t\t\t      SFC_TX_SEG_BOUNDARY);\n+\t\t\t\tfrag_len = MIN(next_frag - frag_addr, seg_len);\n+\t\t\t\tseg_len -= frag_len;\n+\t\t\t\tpkt_len -= frag_len;\n+\n+\t\t\t\tefx_tx_qdesc_dma_create(txq->common,\n+\t\t\t\t\t\t\tfrag_addr, frag_len,\n+\t\t\t\t\t\t\t(pkt_len == 0),\n+\t\t\t\t\t\t\tpend++);\n+\n+\t\t\t\tpkt_descs++;\n+\t\t\t} while (seg_len != 0);\n+\t\t}\n+\n+\t\tadded += pkt_descs;\n+\n+\t\tfill_level += pkt_descs;\n+\t\tif (unlikely(fill_level > hard_max_fill)) {\n+\t\t\t/*\n+\t\t\t * Our estimation for maximum number of descriptors\n+\t\t\t * required to send a packet seems to be wrong.\n+\t\t\t * Try to reap (if we haven't yet).\n+\t\t\t */\n+\t\t\tif (!reap_done) {\n+\t\t\t\tsfc_tx_reap(txq);\n+\t\t\t\treap_done = B_TRUE;\n+\t\t\t\tfill_level = added - txq->completed;\n+\t\t\t\tif (fill_level > hard_max_fill) {\n+\t\t\t\t\tpend -= pkt_descs;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tpend -= pkt_descs;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\t/* Assign mbuf to the last used desc */\n+\t\ttxq->sw_ring[(added - 1) & txq->ptr_mask].mbuf = *pktp;\n+\t}\n+\n+\tif (likely(pkts_sent > 0)) {\n+\t\trc = efx_tx_qdesc_post(txq->common, txq->pend_desc,\n+\t\t\t\t       pend - &txq->pend_desc[0],\n+\t\t\t\t       txq->completed, &txq->added);\n+\t\tSFC_ASSERT(rc == 0);\n+\n+\t\tif (likely(pushed != txq->added))\n+\t\t\tefx_tx_qpush(txq->common, txq->added, pushed);\n+\t}\n+\n+#if SFC_TX_XMIT_PKTS_REAP_AT_LEAST_ONCE\n+\tif (!reap_done)\n+\t\tsfc_tx_reap(txq);\n+#endif\n+\n+done:\n+\treturn pkts_sent;\n+}\ndiff --git a/drivers/net/sfc/efx/sfc_tx.h b/drivers/net/sfc/efx/sfc_tx.h\nindex 47970f9..ae13a16 100644\n--- a/drivers/net/sfc/efx/sfc_tx.h\n+++ b/drivers/net/sfc/efx/sfc_tx.h\n@@ -39,6 +39,21 @@\n extern \"C\" {\n #endif\n \n+/**\n+ * Estimated maximum number of segments that transmit packet consists of;\n+ * it is determined with respect to the expectation of a packet to consist\n+ * of a header plus a couple of data segments one of those crossing 4K page;\n+ * it is used by transmit path to avoid redundant reaping and, thus,\n+ * to avoid increase of latency\n+ */\n+#define\tSFC_TX_MAX_PKT_DESC\t4\n+\n+/**\n+ * A segment must not cross 4K boundary\n+ * (this is a requirement of NIC TX descriptors)\n+ */\n+#define\tSFC_TX_SEG_BOUNDARY\t4096\n+\n struct sfc_adapter;\n struct sfc_evq;\n \n@@ -100,6 +115,9 @@ void sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index);\n int sfc_tx_start(struct sfc_adapter *sa);\n void sfc_tx_stop(struct sfc_adapter *sa);\n \n+uint16_t sfc_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n+\t\t       uint16_t nb_pkts);\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "56/56"
    ]
}