get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 64329,
    "url": "http://patches.dpdk.org/api/patches/64329/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200109103822.89011-4-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": "<20200109103822.89011-4-chenxux.di@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200109103822.89011-4-chenxux.di@intel.com",
    "date": "2020-01-09T10:38:21",
    "name": "[v7,3/4] net/ixgbe: cleanup Tx buffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "dc519a5b46e908052d59fe84d784630487f1a1cb",
    "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/20200109103822.89011-4-chenxux.di@intel.com/mbox/",
    "series": [
        {
            "id": 8026,
            "url": "http://patches.dpdk.org/api/series/8026/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8026",
            "date": "2020-01-09T10:38:18",
            "name": "drivers/net: cleanup Tx buffers",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/8026/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/64329/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/64329/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 93F23A046B;\n\tThu,  9 Jan 2020 11:39:14 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 78F1D1DC22;\n\tThu,  9 Jan 2020 11:38:56 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 78E061DC04\n for <dev@dpdk.org>; Thu,  9 Jan 2020 11:38:51 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 09 Jan 2020 02:38:50 -0800",
            "from intel.sh.intel.com ([10.239.255.149])\n by fmsmga002.fm.intel.com with ESMTP; 09 Jan 2020 02:38:49 -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,413,1571727600\"; d=\"scan'208\";a=\"254553017\"",
        "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": "Thu,  9 Jan 2020 10:38:21 +0000",
        "Message-Id": "<20200109103822.89011-4-chenxux.di@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200109103822.89011-1-chenxux.di@intel.com>",
        "References": "<20191203055134.72874-1-chenxux.di@intel.com>\n <20200109103822.89011-1-chenxux.di@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v7 3/4] net/ixgbe: 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 ixgbe 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/ixgbe/ixgbe_ethdev.c |   4 +\n drivers/net/ixgbe/ixgbe_rxtx.c   | 156 ++++++++++++++++++++++++++++++-\n drivers/net/ixgbe/ixgbe_rxtx.h   |  10 ++\n 3 files changed, 169 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c\nindex 2c6fd0f13..668c36188 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.c\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.c\n@@ -601,6 +601,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {\n \t.udp_tunnel_port_add  = ixgbe_dev_udp_tunnel_port_add,\n \t.udp_tunnel_port_del  = ixgbe_dev_udp_tunnel_port_del,\n \t.tm_ops_get           = ixgbe_tm_ops_get,\n+\t.tx_done_cleanup      = ixgbe_tx_done_cleanup,\n };\n \n /*\n@@ -649,6 +650,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {\n \t.reta_query           = ixgbe_dev_rss_reta_query,\n \t.rss_hash_update      = ixgbe_dev_rss_hash_update,\n \t.rss_hash_conf_get    = ixgbe_dev_rss_hash_conf_get,\n+\t.tx_done_cleanup      = ixgbe_tx_done_cleanup,\n };\n \n /* store statistics names and its offset in stats structure */\n@@ -1101,6 +1103,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)\n \teth_dev->rx_pkt_burst = &ixgbe_recv_pkts;\n \teth_dev->tx_pkt_burst = &ixgbe_xmit_pkts;\n \teth_dev->tx_pkt_prepare = &ixgbe_prep_pkts;\n+\tixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_scalar);\n \n \t/*\n \t * For secondary processes, we don't initialise any further as primary\n@@ -1580,6 +1583,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)\n \teth_dev->dev_ops = &ixgbevf_eth_dev_ops;\n \teth_dev->rx_pkt_burst = &ixgbe_recv_pkts;\n \teth_dev->tx_pkt_burst = &ixgbe_xmit_pkts;\n+\tixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_scalar);\n \n \t/* for secondary processes, we don't initialise any further as primary\n \t * has already done this work. Only check we don't need a different\ndiff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c\nindex fa572d184..122dae425 100644\n--- a/drivers/net/ixgbe/ixgbe_rxtx.c\n+++ b/drivers/net/ixgbe/ixgbe_rxtx.c\n@@ -92,6 +92,8 @@ uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\t\t\t    uint16_t nb_pkts);\n #endif\n \n+static ixgbe_tx_done_cleanup_t ixgbe_tx_done_cleanup_op;\n+\n /*********************************************************************\n  *\n  *  TX functions\n@@ -2306,6 +2308,152 @@ ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq)\n \t}\n }\n \n+int\n+ixgbe_tx_done_cleanup_scalar(struct ixgbe_tx_queue *txq, uint32_t free_cnt)\n+{\n+\tuint32_t pkt_cnt;\n+\tuint16_t i;\n+\tuint16_t tx_last;\n+\tuint16_t tx_id;\n+\tuint16_t nb_tx_to_clean;\n+\tuint16_t nb_tx_free_last;\n+\tstruct ixgbe_tx_entry *swr_ring = txq->sw_ring;\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)\n+\t\tif (ixgbe_xmit_cleanup(txq))\n+\t\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 (tx_id == tx_last || txq->tx_rs_thresh\n+\t\t\t> txq->nb_tx_desc - txq->nb_tx_free)\n+\t\t\tbreak;\n+\n+\t\tif (pkt_cnt < free_cnt) {\n+\t\t\tif (ixgbe_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+\tPMD_TX_FREE_LOG(DEBUG,\n+\t\t\"Free %u Packets successfully \"\n+\t\t\"(port=%d queue=%d)\",\n+\t\tpkt_cnt, txq->port_id, txq->queue_id);\n+\n+\treturn (int)pkt_cnt;\n+}\n+\n+int\n+ixgbe_tx_done_cleanup_vec(struct ixgbe_tx_queue *txq __rte_unused,\n+\t\t\tuint32_t free_cnt __rte_unused)\n+{\n+\treturn -ENOTSUP;\n+}\n+\n+int\n+ixgbe_tx_done_cleanup_simple(struct ixgbe_tx_queue *txq,\n+\t\t\tuint32_t free_cnt)\n+{\n+\tuint16_t i;\n+\tuint16_t tx_first;\n+\tuint16_t tx_id;\n+\tuint32_t pkt_cnt;\n+\tstruct ixgbe_tx_entry *swr_ring = txq->sw_ring;\n+\n+\t/* Start free mbuf from tx_first */\n+\ttx_first = txq->tx_next_dd - (txq->tx_rs_thresh - 1);\n+\ttx_id  = tx_first;\n+\n+\t/* while free_cnt is 0,\n+\t * suppose one mbuf per packet,\n+\t * try to free packets as many as possible\n+\t */\n+\tif (free_cnt == 0)\n+\t\tfree_cnt = txq->nb_tx_desc;\n+\n+\t/* Loop through swr_ring to count freeable packets */\n+\tfor (pkt_cnt = 0; pkt_cnt < free_cnt; ) {\n+\t\tif (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh)\n+\t\t\tbreak;\n+\n+\t\tif (!ixgbe_tx_free_bufs(txq))\n+\t\t\tbreak;\n+\n+\t\tfor (i = 0; i != txq->tx_rs_thresh &&\n+\t\t\ttx_id != tx_first; i++) {\n+\t\t\t/* last segment in the packet,\n+\t\t\t * increment packet count\n+\t\t\t */\n+\t\t\tpkt_cnt += (tx_id == swr_ring[tx_id].last_id);\n+\t\t\ttx_id = swr_ring[tx_id].next_id;\n+\t\t}\n+\n+\t\tif (tx_id == tx_first)\n+\t\t\tbreak;\n+\t}\n+\n+\tPMD_TX_FREE_LOG(DEBUG,\n+\t\t\"Free %u packets successfully \"\n+\t\t\"(port=%d queue=%d)\",\n+\t\tpkt_cnt, txq->port_id, txq->queue_id);\n+\n+\treturn (int)pkt_cnt;\n+}\n+\n+int\n+ixgbe_tx_done_cleanup(void *txq, uint32_t free_cnt)\n+{\n+\tixgbe_tx_done_cleanup_t func = ixgbe_get_tx_done_cleanup_func();\n+\n+\tif (!func)\n+\t\treturn -ENOTSUP;\n+\n+\treturn func(txq, free_cnt);\n+}\n+\n+void\n+ixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_t fn)\n+{\n+\tixgbe_tx_done_cleanup_op = fn;\n+}\n+\n+ixgbe_tx_done_cleanup_t\n+ixgbe_get_tx_done_cleanup_func(void)\n+{\n+\treturn ixgbe_tx_done_cleanup_op;\n+}\n+\n static void __attribute__((cold))\n ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq)\n {\n@@ -2398,9 +2546,14 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq)\n \t\t\t\t\tixgbe_txq_vec_setup(txq) == 0)) {\n \t\t\tPMD_INIT_LOG(DEBUG, \"Vector tx enabled.\");\n \t\t\tdev->tx_pkt_burst = ixgbe_xmit_pkts_vec;\n-\t\t} else\n+\t\t\tixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_vec);\n+\t\t} else {\n #endif\n \t\tdev->tx_pkt_burst = ixgbe_xmit_pkts_simple;\n+\t\tixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_simple);\n+#ifdef RTE_IXGBE_INC_VECTOR\n+\t\t}\n+#endif\n \t} else {\n \t\tPMD_INIT_LOG(DEBUG, \"Using full-featured tx code path\");\n \t\tPMD_INIT_LOG(DEBUG,\n@@ -2412,6 +2565,7 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq)\n \t\t\t\t(unsigned long)RTE_PMD_IXGBE_TX_MAX_BURST);\n \t\tdev->tx_pkt_burst = ixgbe_xmit_pkts;\n \t\tdev->tx_pkt_prepare = ixgbe_prep_pkts;\n+\t\tixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_scalar);\n \t}\n }\n \ndiff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h\nindex 505d344b9..a52597aa9 100644\n--- a/drivers/net/ixgbe/ixgbe_rxtx.h\n+++ b/drivers/net/ixgbe/ixgbe_rxtx.h\n@@ -253,6 +253,8 @@ struct ixgbe_txq_ops {\n \t\t\t IXGBE_ADVTXD_DCMD_DEXT |\\\n \t\t\t IXGBE_ADVTXD_DCMD_EOP)\n \n+typedef int (*ixgbe_tx_done_cleanup_t)(struct ixgbe_tx_queue *txq,\n+\t\t\t\tuint32_t free_cnt);\n \n /* Takes an ethdev and a queue and sets up the tx function to be used based on\n  * the queue parameters. Used in tx_queue_setup by primary process and then\n@@ -285,6 +287,14 @@ int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);\n int ixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq);\n void ixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);\n \n+void ixgbe_set_tx_done_cleanup_func(ixgbe_tx_done_cleanup_t fn);\n+ixgbe_tx_done_cleanup_t ixgbe_get_tx_done_cleanup_func(void);\n+\n+int ixgbe_tx_done_cleanup(void *txq, uint32_t free_cnt);\n+int ixgbe_tx_done_cleanup_scalar(struct ixgbe_tx_queue *txq, uint32_t free_cnt);\n+int ixgbe_tx_done_cleanup_vec(struct ixgbe_tx_queue *txq, uint32_t free_cnt);\n+int ixgbe_tx_done_cleanup_simple(struct ixgbe_tx_queue *txq, uint32_t free_cnt);\n+\n extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX];\n extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX];\n \n",
    "prefixes": [
        "v7",
        "3/4"
    ]
}