get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 17236,
    "url": "https://patches.dpdk.org/api/patches/17236/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1479981261-19512-6-git-send-email-olivier.matz@6wind.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": "<1479981261-19512-6-git-send-email-olivier.matz@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1479981261-19512-6-git-send-email-olivier.matz@6wind.com",
    "date": "2016-11-24T09:54:17",
    "name": "[dpdk-dev,RFC,5/9] net/ixgbe: add handler for Tx queue descriptor count",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ffd03eef6008e5a86d2035354b4bb104395049f8",
    "submitter": {
        "id": 8,
        "url": "https://patches.dpdk.org/api/people/8/?format=api",
        "name": "Olivier Matz",
        "email": "olivier.matz@6wind.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/1479981261-19512-6-git-send-email-olivier.matz@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/17236/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/17236/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 A873E58C5;\n\tThu, 24 Nov 2016 11:00:34 +0100 (CET)",
            "from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com\n\t[62.23.145.76]) by dpdk.org (Postfix) with ESMTP id B0C3D558D\n\tfor <dev@dpdk.org>; Thu, 24 Nov 2016 10:59:38 +0100 (CET)",
            "from glumotte.dev.6wind.com (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id 51173278C1;\n\tThu, 24 Nov 2016 10:59:34 +0100 (CET)"
        ],
        "From": "Olivier Matz <olivier.matz@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas.monjalon@6wind.com, konstantin.ananyev@intel.com,\n\twenzhuo.lu@intel.com, helin.zhang@intel.com",
        "Date": "Thu, 24 Nov 2016 10:54:17 +0100",
        "Message-Id": "<1479981261-19512-6-git-send-email-olivier.matz@6wind.com>",
        "X-Mailer": "git-send-email 2.8.1",
        "In-Reply-To": "<1479981261-19512-1-git-send-email-olivier.matz@6wind.com>",
        "References": "<1479981261-19512-1-git-send-email-olivier.matz@6wind.com>",
        "Subject": "[dpdk-dev] [RFC 5/9] net/ixgbe: add handler for Tx queue descriptor\n\tcount",
        "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": "Like for TX, use a binary search algorithm to get the number of used Tx\ndescriptors.\n\nPR=52423\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\nAcked-by: Ivan Boule <ivan.boule@6wind.com>\n---\n drivers/net/ixgbe/ixgbe_ethdev.c |  1 +\n drivers/net/ixgbe/ixgbe_ethdev.h |  4 ++-\n drivers/net/ixgbe/ixgbe_rxtx.c   | 57 ++++++++++++++++++++++++++++++++++++++++\n drivers/net/ixgbe/ixgbe_rxtx.h   |  2 ++\n 4 files changed, 63 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c\nindex baffc71..0ba098a 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.c\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.c\n@@ -553,6 +553,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {\n \t.rx_queue_intr_disable = ixgbe_dev_rx_queue_intr_disable,\n \t.rx_queue_release     = ixgbe_dev_rx_queue_release,\n \t.rx_queue_count       = ixgbe_dev_rx_queue_count,\n+\t.tx_queue_count       = ixgbe_dev_tx_queue_count,\n \t.rx_descriptor_done   = ixgbe_dev_rx_descriptor_done,\n \t.tx_queue_setup       = ixgbe_dev_tx_queue_setup,\n \t.tx_queue_release     = ixgbe_dev_tx_queue_release,\ndiff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h\nindex 4ff6338..e060c3d 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.h\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.h\n@@ -348,7 +348,9 @@ int  ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,\n \t\tconst struct rte_eth_txconf *tx_conf);\n \n uint32_t ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev,\n-\t\tuint16_t rx_queue_id);\n+\t\t\t\t  uint16_t rx_queue_id);\n+uint32_t ixgbe_dev_tx_queue_count(struct rte_eth_dev *dev,\n+\t\t\t\t  uint16_t tx_queue_id);\n \n int ixgbe_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);\n int ixgbevf_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);\ndiff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c\nindex 07509b4..5bf6b1a 100644\n--- a/drivers/net/ixgbe/ixgbe_rxtx.c\n+++ b/drivers/net/ixgbe/ixgbe_rxtx.c\n@@ -2437,6 +2437,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,\n \n \ttxq->nb_tx_desc = nb_desc;\n \ttxq->tx_rs_thresh = tx_rs_thresh;\n+\ttxq->tx_rs_thresh_div = nb_desc / tx_rs_thresh;\n \ttxq->tx_free_thresh = tx_free_thresh;\n \ttxq->pthresh = tx_conf->tx_thresh.pthresh;\n \ttxq->hthresh = tx_conf->tx_thresh.hthresh;\n@@ -2906,6 +2907,62 @@ ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)\n \treturn offset;\n }\n \n+uint32_t\n+ixgbe_dev_tx_queue_count(struct rte_eth_dev *dev, uint16_t tx_queue_id)\n+{\n+\tstruct ixgbe_tx_queue *txq;\n+\tuint32_t status;\n+\tint32_t offset, interval, idx = 0;\n+\tint32_t max_offset, used_desc;\n+\n+\ttxq = dev->data->tx_queues[tx_queue_id];\n+\n+\t/* if DD on next threshold desc is not set, assume used packets\n+\t * are pending.\n+\t */\n+\tstatus = txq->tx_ring[txq->tx_next_dd].wb.status;\n+\tif (!(status & rte_cpu_to_le_32(IXGBE_ADVTXD_STAT_DD)))\n+\t\treturn txq->nb_tx_desc - txq->nb_tx_free - 1;\n+\n+\t/* browse DD bits between tail starting from tx_next_dd: we have\n+\t * to be careful since DD bits are only set every tx_rs_thresh\n+\t * descriptor.\n+\t */\n+\tinterval = txq->tx_rs_thresh_div >> 1;\n+\toffset = interval * txq->tx_rs_thresh;\n+\n+\t/* don't go beyond tail */\n+\tmax_offset = txq->tx_tail - txq->tx_next_dd;\n+\tif (max_offset < 0)\n+\t\tmax_offset += txq->nb_tx_desc;\n+\n+\tdo {\n+\t\tinterval >>= 1;\n+\n+\t\tif (offset >= max_offset) {\n+\t\t\toffset -= (interval * txq->tx_rs_thresh);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tidx = txq->tx_next_dd + offset;\n+\t\tif (idx >= txq->nb_tx_desc)\n+\t\t\tidx -= txq->nb_tx_desc;\n+\n+\t\tstatus = txq->tx_ring[idx].wb.status;\n+\t\tif (status & rte_cpu_to_le_32(IXGBE_ADVTXD_STAT_DD))\n+\t\t\toffset += (interval * txq->tx_rs_thresh);\n+\t\telse\n+\t\t\toffset -= (interval * txq->tx_rs_thresh);\n+\t} while (interval > 0);\n+\n+\t/* idx is now the index of the head */\n+\tused_desc = txq->tx_tail - idx;\n+\tif (used_desc < 0)\n+\t\tused_desc += txq->nb_tx_desc;\n+\n+\treturn used_desc;\n+}\n+\n int\n ixgbe_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)\n {\ndiff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h\nindex 2608b36..f69b5de 100644\n--- a/drivers/net/ixgbe/ixgbe_rxtx.h\n+++ b/drivers/net/ixgbe/ixgbe_rxtx.h\n@@ -221,6 +221,8 @@ struct ixgbe_tx_queue {\n \tuint16_t            tx_free_thresh;\n \t/** Number of TX descriptors to use before RS bit is set. */\n \tuint16_t            tx_rs_thresh;\n+\t/** Number of TX descriptors divided by tx_rs_thresh. */\n+\tuint16_t            tx_rs_thresh_div;\n \t/** Number of TX descriptors used since RS bit was set. */\n \tuint16_t            nb_tx_used;\n \t/** Index to last TX descriptor to have been cleaned. */\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "5/9"
    ]
}