get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 64119,
    "url": "http://patches.dpdk.org/api/patches/64119/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191224023906.60789-3-chenxux.di@intel.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": "<20191224023906.60789-3-chenxux.di@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191224023906.60789-3-chenxux.di@intel.com",
    "date": "2019-12-24T02:39:03",
    "name": "[v4,2/5] net/i40e: cleanup Tx buffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "09f86835ade0a47b6d7fe690cb77317b579ed473",
    "submitter": {
        "id": 1409,
        "url": "http://patches.dpdk.org/api/people/1409/?format=api",
        "name": "Chenxu Di",
        "email": "chenxux.di@intel.com"
    },
    "delegate": {
        "id": 31221,
        "url": "http://patches.dpdk.org/api/users/31221/?format=api",
        "username": "yexl",
        "first_name": "xiaolong",
        "last_name": "ye",
        "email": "xiaolong.ye@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191224023906.60789-3-chenxux.di@intel.com/mbox/",
    "series": [
        {
            "id": 7940,
            "url": "http://patches.dpdk.org/api/series/7940/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7940",
            "date": "2019-12-24T02:39:01",
            "name": "drivers/net: cleanup Tx buffers",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/7940/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/64119/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/64119/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id EBC07A04B3;\n\tTue, 24 Dec 2019 03:41:57 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id AC5EF1BE90;\n\tTue, 24 Dec 2019 03:41:49 +0100 (CET)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by dpdk.org (Postfix) with ESMTP id 2F25D1BE3D\n for <dev@dpdk.org>; Tue, 24 Dec 2019 03:41:43 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 23 Dec 2019 18:41:43 -0800",
            "from intel.sh.intel.com ([10.239.255.149])\n by fmsmga002.fm.intel.com with ESMTP; 23 Dec 2019 18:41:42 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.69,350,1571727600\"; d=\"scan'208\";a=\"249681645\"",
        "From": "Chenxu Di <chenxux.di@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Yang Qiming <qiming.yang@intel.com>,\n\tChenxu Di <chenxux.di@intel.com>",
        "Date": "Tue, 24 Dec 2019 02:39:03 +0000",
        "Message-Id": "<20191224023906.60789-3-chenxux.di@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191224023906.60789-1-chenxux.di@intel.com>",
        "References": "<20191203055134.72874-1-chenxux.di@intel.com>\n <20191224023906.60789-1-chenxux.di@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 2/5] net/i40e: cleanup Tx buffers",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add support to the i40e driver for the API rte_eth_tx_done_cleanup\nto force free consumed buffers on Tx ring.\n\nSigned-off-by: Chenxu Di <chenxux.di@intel.com>\n---\n drivers/net/i40e/i40e_ethdev.c    |   1 +\n drivers/net/i40e/i40e_ethdev_vf.c |   1 +\n drivers/net/i40e/i40e_rxtx.c      | 122 ++++++++++++++++++++++++++++++\n drivers/net/i40e/i40e_rxtx.h      |   1 +\n 4 files changed, 125 insertions(+)",
    "diff": "diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 5999c964b..fad47a942 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -522,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {\n \t.mac_addr_set                 = i40e_set_default_mac_addr,\n \t.mtu_set                      = i40e_dev_mtu_set,\n \t.tm_ops_get                   = i40e_tm_ops_get,\n+\t.tx_done_cleanup              = i40e_tx_done_cleanup,\n };\n \n /* store statistics names and its offset in stats structure */\ndiff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c\nindex 5dba0928b..0ca5417d7 100644\n--- a/drivers/net/i40e/i40e_ethdev_vf.c\n+++ b/drivers/net/i40e/i40e_ethdev_vf.c\n@@ -215,6 +215,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {\n \t.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,\n \t.mtu_set              = i40evf_dev_mtu_set,\n \t.mac_addr_set         = i40evf_set_default_mac_addr,\n+\t.tx_done_cleanup      = i40e_tx_done_cleanup,\n };\n \n /*\ndiff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c\nindex 17dc8c78f..e75733b8e 100644\n--- a/drivers/net/i40e/i40e_rxtx.c\n+++ b/drivers/net/i40e/i40e_rxtx.c\n@@ -2455,6 +2455,128 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq)\n \t}\n }\n \n+int i40e_tx_done_cleanup(void *q, uint32_t free_cnt)\n+{\n+\tstruct i40e_tx_queue *txq = (struct i40e_tx_queue *)q;\n+\tstruct i40e_tx_entry *sw_ring;\n+\tvolatile struct i40e_tx_desc *txr;\n+\tuint16_t tx_first; /* First segment analyzed. */\n+\tuint16_t tx_id;    /* Current segment being processed. */\n+\tuint16_t tx_last;  /* Last segment in the current packet. */\n+\tuint16_t tx_next;  /* First segment of the next packet. */\n+\tint count;\n+\n+\tif (txq == NULL)\n+\t\treturn -ENODEV;\n+\n+\tcount = 0;\n+\tsw_ring = txq->sw_ring;\n+\ttxr = txq->tx_ring;\n+\n+\t/*\n+\t * tx_tail is the last sent packet on the sw_ring. Goto the end\n+\t * of that packet (the last segment in the packet chain) and\n+\t * then the next segment will be the start of the oldest segment\n+\t * in the sw_ring. This is the first packet that will be\n+\t * attempted to be freed.\n+\t */\n+\n+\t/* Get last segment in most recently added packet. */\n+\ttx_first = sw_ring[txq->tx_tail].last_id;\n+\n+\t/* Get the next segment, which is the oldest segment in ring. */\n+\ttx_first = sw_ring[tx_first].next_id;\n+\n+\t/* Set the current index to the first. */\n+\ttx_id = tx_first;\n+\n+\t/*\n+\t * Loop through each packet. For each packet, verify that an\n+\t * mbuf exists and that the last segment is free. If so, free\n+\t * it and move on.\n+\t */\n+\twhile (1) {\n+\t\ttx_last = sw_ring[tx_id].last_id;\n+\n+\t\tif (sw_ring[tx_last].mbuf) {\n+\t\t\tif ((txr[tx_last].cmd_type_offset_bsz &\n+\t\t\t\trte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=\n+\t\t\t\trte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) {\n+\t\t\t\t/*\n+\t\t\t\t * Increment the number of packets\n+\t\t\t\t * freed.\n+\t\t\t\t */\n+\t\t\t\tcount++;\n+\n+\t\t\t\t/* Get the start of the next packet. */\n+\t\t\t\ttx_next = sw_ring[tx_last].next_id;\n+\n+\t\t\t\t/*\n+\t\t\t\t * Loop through all segments in a\n+\t\t\t\t * packet.\n+\t\t\t\t */\n+\t\t\t\tdo {\n+\t\t\t\t\trte_pktmbuf_free_seg(sw_ring[tx_id].mbuf);\n+\t\t\t\t\tsw_ring[tx_id].mbuf = NULL;\n+\t\t\t\t\tsw_ring[tx_id].last_id = tx_id;\n+\n+\t\t\t\t\t/* Move to next segemnt. */\n+\t\t\t\t\ttx_id = sw_ring[tx_id].next_id;\n+\n+\t\t\t\t} while (tx_id != tx_next);\n+\n+\t\t\t\tif (unlikely(count == (int)free_cnt))\n+\t\t\t\t\tbreak;\n+\t\t\t} else {\n+\t\t\t\t/*\n+\t\t\t\t * mbuf still in use, nothing left to\n+\t\t\t\t * free.\n+\t\t\t\t */\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t} else {\n+\t\t\t/*\n+\t\t\t * There are multiple reasons to be here:\n+\t\t\t * 1) All the packets on the ring have been\n+\t\t\t *    freed - tx_id is equal to tx_first\n+\t\t\t *    and some packets have been freed.\n+\t\t\t *    - Done, exit\n+\t\t\t * 2) Interfaces has not sent a rings worth of\n+\t\t\t *    packets yet, so the segment after tail is\n+\t\t\t *    still empty. Or a previous call to this\n+\t\t\t *    function freed some of the segments but\n+\t\t\t *    not all so there is a hole in the list.\n+\t\t\t *    Hopefully this is a rare case.\n+\t\t\t *    - Walk the list and find the next mbuf. If\n+\t\t\t *      there isn't one, then done.\n+\t\t\t */\n+\t\t\tif (likely(tx_id == tx_first && count != 0))\n+\t\t\t\tbreak;\n+\n+\t\t\t/*\n+\t\t\t * Walk the list and find the next mbuf, if any.\n+\t\t\t */\n+\t\t\tdo {\n+\t\t\t\t/* Move to next segemnt. */\n+\t\t\t\ttx_id = sw_ring[tx_id].next_id;\n+\n+\t\t\t\tif (sw_ring[tx_id].mbuf)\n+\t\t\t\t\tbreak;\n+\n+\t\t\t} while (tx_id != tx_first);\n+\n+\t\t\t/*\n+\t\t\t * Determine why previous loop bailed. If there\n+\t\t\t * is not an mbuf, done.\n+\t\t\t */\n+\t\t\tif (sw_ring[tx_id].mbuf == NULL)\n+\t\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\treturn count;\n+}\n+\n void\n i40e_reset_tx_queue(struct i40e_tx_queue *txq)\n {\ndiff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h\nindex 2106bb355..8f11f011a 100644\n--- a/drivers/net/i40e/i40e_rxtx.h\n+++ b/drivers/net/i40e/i40e_rxtx.h\n@@ -212,6 +212,7 @@ void i40e_dev_free_queues(struct rte_eth_dev *dev);\n void i40e_reset_rx_queue(struct i40e_rx_queue *rxq);\n void i40e_reset_tx_queue(struct i40e_tx_queue *txq);\n void i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq);\n+int i40e_tx_done_cleanup(void *txq, uint32_t free_cnt);\n int i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq);\n void i40e_rx_queue_release_mbufs(struct i40e_rx_queue *rxq);\n \n",
    "prefixes": [
        "v4",
        "2/5"
    ]
}