get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 20064,
    "url": "https://patches.dpdk.org/api/patches/20064/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20170127183800.27466-2-bmcfall@redhat.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": "<20170127183800.27466-2-bmcfall@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20170127183800.27466-2-bmcfall@redhat.com",
    "date": "2017-01-27T18:37:58",
    "name": "[dpdk-dev,v5,1/3] ethdev: new API to free consumed buffers in Tx ring",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bd45d2a51ebc1381bc34fe06ff41e5afdda0c32d",
    "submitter": {
        "id": 629,
        "url": "https://patches.dpdk.org/api/people/629/?format=api",
        "name": "Billy McFall",
        "email": "bmcfall@redhat.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20170127183800.27466-2-bmcfall@redhat.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/20064/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/20064/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 43DB45589;\n\tFri, 27 Jan 2017 19:38:27 +0100 (CET)",
            "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id CC7FC2B83\n\tfor <dev@dpdk.org>; Fri, 27 Jan 2017 19:38:04 +0100 (CET)",
            "from smtp.corp.redhat.com\n\t(int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 446A881F07;\n\tFri, 27 Jan 2017 18:38:05 +0000 (UTC)",
            "from localhost.localdomain.com (ovpn-119-105.rdu2.redhat.com\n\t[10.10.119.105])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id B2D86AE2F5;\n\tFri, 27 Jan 2017 18:38:04 +0000 (UTC)"
        ],
        "From": "Billy McFall <bmcfall@redhat.com>",
        "To": "thomas.monjalon@6wind.com, wenzhuo.lu@intel.com, olivier.matz@6wind.com",
        "Cc": "dev@dpdk.org,\n\tBilly McFall <bmcfall@redhat.com>",
        "Date": "Fri, 27 Jan 2017 13:37:58 -0500",
        "Message-Id": "<20170127183800.27466-2-bmcfall@redhat.com>",
        "In-Reply-To": "<20170127183800.27466-1-bmcfall@redhat.com>",
        "References": "<20170123211340.22570-1-bmcfall@redhat.com>\n\t<20170127183800.27466-1-bmcfall@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-Scanned-By": "MIMEDefang 2.74 on 10.5.11.28",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]); Fri, 27 Jan 2017 18:38:05 +0000 (UTC)",
        "Subject": "[dpdk-dev] [PATCH v5 1/3] ethdev: new API to free consumed buffers\n\tin Tx ring",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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": "Add a new API to force free consumed buffers on Tx ring. API will return\nthe number of packets freed (0-n) or error code if feature not supported\n(-ENOTSUP) or input invalid (-ENODEV).\n\nSigned-off-by: Billy McFall <bmcfall@redhat.com>\n---\n doc/guides/nics/features/default.ini  |  1 +\n doc/guides/prog_guide/mempool_lib.rst | 29 +++++++++++++++++++++++++++++\n lib/librte_ether/rte_ethdev.c         | 14 ++++++++++++++\n lib/librte_ether/rte_ethdev.h         | 31 +++++++++++++++++++++++++++++++\n 4 files changed, 75 insertions(+)",
    "diff": "diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini\nindex 6e4a043..e2d8c83 100644\n--- a/doc/guides/nics/features/default.ini\n+++ b/doc/guides/nics/features/default.ini\n@@ -55,6 +55,7 @@ FW version           =\n EEPROM dump          =\n Registers dump       =\n Multiprocess aware   =\n+Free TX ring buffers =\n BSD nic_uio          =\n Linux UIO            =\n Linux VFIO           =\ndiff --git a/doc/guides/prog_guide/mempool_lib.rst b/doc/guides/prog_guide/mempool_lib.rst\nindex ffdc109..92c6fd5 100644\n--- a/doc/guides/prog_guide/mempool_lib.rst\n+++ b/doc/guides/prog_guide/mempool_lib.rst\n@@ -132,6 +132,35 @@ These user-owned caches can be explicitly passed to ``rte_mempool_generic_put()`\n The ``rte_mempool_default_cache()`` call returns the default internal cache if any.\n In contrast to the default caches, user-owned caches can be used by non-EAL threads too.\n \n+\n+Driver Cache\n+~~~~~~~~~~~~\n+\n+In addition to the a core’s local cache, many of the drivers don't release the mbuf back to the mempool, or local cache,\n+immediately after the packet has been transmitted.\n+Instead, they leave the mbuf in their txRing and either perform a bulk release when the tx_rs_thresh has been crossed\n+or free the mbuf when a slot in the txRing is needed.\n+\n+An application can request the driver to release used mbufs with the ``rte_eth_tx_done_cleanup()`` API.\n+This API requests the driver to release mbufs that are no longer in use, independent of whether or not the tx_rs_thresh\n+has been crossed.\n+There are two scenarios when an application may want the mbuf back immediately:\n+\n+* When a given packet needs to be sent to multiple destination interfaces (either for Layer 2 flooding or Layer 3 multi-cast).\n+  One option is to make a copy of the packet or a copy of the header portion that needs to manipulated.\n+  A second option is to transmit the packet and then poll the ``rte_eth_tx_done_cleanup()`` API until the reference count\n+  on the packet is decremented.\n+  Then the same packet can be transmitted to the next destination interface.\n+\n+* If an application is designed to make multiple runs, like a packet generator, and one run has completed.\n+  The application may want to reset to a clean state.\n+  In this case, it may want to call the ``rte_eth_tx_done_cleanup()`` API to request each destination interface it has been\n+  using to release all of its used mbufs.\n+\n+To determine if a driver supports this API, check for the *Free TX ring buffers* feature in the *Network Interface\n+Controller Drivers* document.\n+\n+\n Mempool Handlers\n ------------------------\n \ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 61f44e2..1cbf6d0 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -1253,6 +1253,20 @@ rte_eth_tx_buffer_set_err_callback(struct rte_eth_dev_tx_buffer *buffer,\n }\n \n int\n+rte_eth_tx_done_cleanup(uint8_t port_id, uint16_t queue_id,  uint32_t free_cnt)\n+{\n+\tstruct rte_eth_dev *dev = &rte_eth_devices[port_id];\n+\n+\t/* Validate Input Data. Bail if not valid or not supported. */\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_done_cleanup, -ENOTSUP);\n+\n+\t/* Call driver to free pending mbufs. */\n+\treturn (*dev->dev_ops->tx_done_cleanup)(dev->data->tx_queues[queue_id],\n+\t\t\tfree_cnt);\n+}\n+\n+int\n rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size)\n {\n \tint ret = 0;\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex c17bbda..b23886c 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -1183,6 +1183,9 @@ typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,\n \t\t\t\t     char *fw_version, size_t fw_size);\n /**< @internal Get firmware information of an Ethernet device. */\n \n+typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);\n+/**< @internal Force mbufs to be from TX ring. */\n+\n typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,\n \tuint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);\n \n@@ -1487,6 +1490,7 @@ struct eth_dev_ops {\n \teth_rx_disable_intr_t      rx_queue_intr_disable; /**< Disable Rx queue interrupt. */\n \teth_tx_queue_setup_t       tx_queue_setup;/**< Set up device TX queue. */\n \teth_queue_release_t        tx_queue_release; /**< Release TX queue. */\n+\teth_tx_done_cleanup_t      tx_done_cleanup;/**< Free tx ring mbufs */\n \n \teth_dev_led_on_t           dev_led_on;    /**< Turn on LED. */\n \teth_dev_led_off_t          dev_led_off;   /**< Turn off LED. */\n@@ -3091,6 +3095,33 @@ rte_eth_tx_buffer(uint8_t port_id, uint16_t queue_id,\n }\n \n /**\n+ * Request the driver to free mbufs currently cached by the driver. The\n+ * driver will only free the mbuf if it is no longer in use. It is the\n+ * application's responsibity to ensure rte_eth_tx_buffer_flush(..) is\n+ * called if needed.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param queue_id\n+ *   The index of the transmit queue through which output packets must be\n+ *   sent.\n+ *   The value must be in the range [0, nb_tx_queue - 1] previously supplied\n+ *   to rte_eth_dev_configure().\n+ * @param free_cnt\n+ *   Maximum number of packets to free. Use 0 to indicate all possible packets\n+ *   should be freed. Note that a packet may be using multiple mbufs.\n+ * @return\n+ *   Failure: < 0\n+ *     -ENODEV: Invalid interface\n+ *     -ENOTSUP: Driver does not support function\n+ *   Success: >= 0\n+ *     0-n: Number of packets freed. More packets may still remain in ring that\n+ *     are in use.\n+ */\n+int\n+rte_eth_tx_done_cleanup(uint8_t port_id, uint16_t queue_id,  uint32_t free_cnt);\n+\n+/**\n  * Configure a callback for buffered packets which cannot be sent\n  *\n  * Register a specific callback to be called when an attempt is made to send\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "1/3"
    ]
}