get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 64546,
    "url": "http://patches.dpdk.org/api/patches/64546/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200113095708.67598-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": "<20200113095708.67598-3-chenxux.di@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200113095708.67598-3-chenxux.di@intel.com",
    "date": "2020-01-13T09:57:06",
    "name": "[v9,2/4] net/ice: cleanup Tx buffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2c6766bca236cbb8ce843ba20607311f087fa431",
    "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/20200113095708.67598-3-chenxux.di@intel.com/mbox/",
    "series": [
        {
            "id": 8078,
            "url": "http://patches.dpdk.org/api/series/8078/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8078",
            "date": "2020-01-13T09:57:04",
            "name": "drivers/net: cleanup Tx buffers",
            "version": 9,
            "mbox": "http://patches.dpdk.org/series/8078/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/64546/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/64546/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 67DF0A04F0;\n\tMon, 13 Jan 2020 10:57:48 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CC76B1D641;\n\tMon, 13 Jan 2020 10:57:34 +0100 (CET)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by dpdk.org (Postfix) with ESMTP id 78F1D1D619\n for <dev@dpdk.org>; Mon, 13 Jan 2020 10:57:30 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 13 Jan 2020 01:57:30 -0800",
            "from intel.sh.intel.com ([10.239.255.149])\n by fmsmga002.fm.intel.com with ESMTP; 13 Jan 2020 01:57:29 -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,428,1571727600\"; d=\"scan'208\";a=\"255833218\"",
        "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": "Mon, 13 Jan 2020 09:57:06 +0000",
        "Message-Id": "<20200113095708.67598-3-chenxux.di@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200113095708.67598-1-chenxux.di@intel.com>",
        "References": "<20191203055134.72874-1-chenxux.di@intel.com>\n <20200113095708.67598-1-chenxux.di@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v9 2/4] net/ice: 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 ice 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/ice/ice_ethdev.c |   1 +\n drivers/net/ice/ice_rxtx.c   | 111 +++++++++++++++++++++++++++++++++++\n drivers/net/ice/ice_rxtx.h   |   2 +\n 3 files changed, 114 insertions(+)",
    "diff": "diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c\nindex de189daba..b55cdbf74 100644\n--- a/drivers/net/ice/ice_ethdev.c\n+++ b/drivers/net/ice/ice_ethdev.c\n@@ -220,6 +220,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = {\n \t.filter_ctrl                  = ice_dev_filter_ctrl,\n \t.udp_tunnel_port_add          = ice_dev_udp_tunnel_port_add,\n \t.udp_tunnel_port_del          = ice_dev_udp_tunnel_port_del,\n+\t.tx_done_cleanup              = ice_tx_done_cleanup,\n };\n \n /* store statistics names and its offset in stats structure */\ndiff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c\nindex 2db174456..8f12df807 100644\n--- a/drivers/net/ice/ice_rxtx.c\n+++ b/drivers/net/ice/ice_rxtx.c\n@@ -863,6 +863,9 @@ ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)\n \treturn 0;\n }\n \n+\n+\n+\n int\n ice_rx_queue_setup(struct rte_eth_dev *dev,\n \t\t   uint16_t queue_idx,\n@@ -2643,6 +2646,114 @@ ice_tx_free_bufs(struct ice_tx_queue *txq)\n \treturn txq->tx_rs_thresh;\n }\n \n+static int\n+ice_tx_done_cleanup_full(struct ice_tx_queue *txq,\n+\t\t\tuint32_t free_cnt)\n+{\n+\tstruct ice_tx_entry *swr_ring = txq->sw_ring;\n+\tuint16_t i, tx_last, tx_id;\n+\tuint16_t nb_tx_free_last;\n+\tuint16_t nb_tx_to_clean;\n+\tuint32_t pkt_cnt;\n+\n+\t/* Start free mbuf from the next of tx_tail */\n+\ttx_last = txq->tx_tail;\n+\ttx_id  = swr_ring[tx_last].next_id;\n+\n+\tif (txq->nb_tx_free == 0 && ice_xmit_cleanup(txq))\n+\t\treturn 0;\n+\n+\tnb_tx_to_clean = txq->nb_tx_free;\n+\tnb_tx_free_last = txq->nb_tx_free;\n+\tif (!free_cnt)\n+\t\tfree_cnt = txq->nb_tx_desc;\n+\n+\t/* Loop through swr_ring to count the amount of\n+\t * freeable mubfs and packets.\n+\t */\n+\tfor (pkt_cnt = 0; pkt_cnt < free_cnt; ) {\n+\t\tfor (i = 0; i < nb_tx_to_clean &&\n+\t\t\tpkt_cnt < free_cnt &&\n+\t\t\ttx_id != tx_last; i++) {\n+\t\t\tif (swr_ring[tx_id].mbuf != NULL) {\n+\t\t\t\trte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);\n+\t\t\t\tswr_ring[tx_id].mbuf = NULL;\n+\n+\t\t\t\t/*\n+\t\t\t\t * last segment in the packet,\n+\t\t\t\t * increment packet count\n+\t\t\t\t */\n+\t\t\t\tpkt_cnt += (swr_ring[tx_id].last_id == tx_id);\n+\t\t\t}\n+\n+\t\t\ttx_id = swr_ring[tx_id].next_id;\n+\t\t}\n+\n+\t\tif (txq->tx_rs_thresh > txq->nb_tx_desc -\n+\t\t\ttxq->nb_tx_free || tx_id == tx_last)\n+\t\t\tbreak;\n+\n+\t\tif (pkt_cnt < free_cnt) {\n+\t\t\tif (ice_xmit_cleanup(txq))\n+\t\t\t\tbreak;\n+\n+\t\t\tnb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last;\n+\t\t\tnb_tx_free_last = txq->nb_tx_free;\n+\t\t}\n+\t}\n+\n+\treturn (int)pkt_cnt;\n+}\n+\n+static int\n+ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused,\n+\t\t\tuint32_t free_cnt __rte_unused)\n+{\n+\treturn -ENOTSUP;\n+}\n+\n+static int\n+ice_tx_done_cleanup_simple(struct ice_tx_queue *txq,\n+\t\t\tuint32_t free_cnt)\n+{\n+\tint i, n, cnt;\n+\n+\tif (free_cnt == 0 || free_cnt > txq->nb_tx_desc)\n+\t\tfree_cnt = txq->nb_tx_desc;\n+\n+\tcnt = free_cnt - free_cnt % txq->tx_rs_thresh;\n+\n+\tfor (i = 0; i < cnt; i += n) {\n+\t\tif (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh)\n+\t\t\tbreak;\n+\n+\t\tn = ice_tx_free_bufs(txq);\n+\n+\t\tif (n == 0)\n+\t\t\tbreak;\n+\t}\n+\n+\treturn i;\n+}\n+\n+int\n+ice_tx_done_cleanup(void *txq, uint32_t free_cnt)\n+{\n+\tstruct ice_tx_queue *q = (struct ice_tx_queue *)txq;\n+\tstruct rte_eth_dev *dev = &rte_eth_devices[q->port_id];\n+\tstruct ice_adapter *ad =\n+\t\tICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);\n+\n+#ifdef RTE_ARCH_X86\n+\tif (ad->tx_vec_allowed)\n+\t\treturn ice_tx_done_cleanup_vec(q, free_cnt);\n+#endif\n+\tif (ad->tx_simple_allowed)\n+\t\treturn ice_tx_done_cleanup_simple(q, free_cnt);\n+\telse\n+\t\treturn ice_tx_done_cleanup_full(q, free_cnt);\n+}\n+\n /* Populate 4 descriptors with data from 4 mbufs */\n static inline void\n tx4(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkts)\ndiff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h\nindex 9e3d2cd07..0946ee69e 100644\n--- a/drivers/net/ice/ice_rxtx.h\n+++ b/drivers/net/ice/ice_rxtx.h\n@@ -202,4 +202,6 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue,\n uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\t\t\tuint16_t nb_pkts);\n int ice_fdir_programming(struct ice_pf *pf, struct ice_fltr_desc *fdir_desc);\n+int ice_tx_done_cleanup(void *txq, uint32_t free_cnt);\n+\n #endif /* _ICE_RXTX_H_ */\n",
    "prefixes": [
        "v9",
        "2/4"
    ]
}