get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 70452,
    "url": "https://patches.dpdk.org/api/patches/70452/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200519165230.23306-3-stephen@networkplumber.org/",
    "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": "<20200519165230.23306-3-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200519165230.23306-3-stephen@networkplumber.org",
    "date": "2020-05-19T16:52:25",
    "name": "[v3,2/7] net/netvsc: implement rx/tx descriptor status functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "222a3d82443c2d3955de447eee0e026ae426f030",
    "submitter": {
        "id": 27,
        "url": "https://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200519165230.23306-3-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 10158,
            "url": "https://patches.dpdk.org/api/series/10158/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10158",
            "date": "2020-05-19T16:52:23",
            "name": "net/netvsc: VF bug fix and diagnostic support",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/10158/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/70452/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/70452/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 9FBCCA0093;\n\tTue, 19 May 2020 18:53:09 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6F9701D638;\n\tTue, 19 May 2020 18:52:57 +0200 (CEST)",
            "from mail-pf1-f196.google.com (mail-pf1-f196.google.com\n [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 328C11D62C\n for <dev@dpdk.org>; Tue, 19 May 2020 18:52:53 +0200 (CEST)",
            "by mail-pf1-f196.google.com with SMTP id v63so171660pfb.10\n for <dev@dpdk.org>; Tue, 19 May 2020 09:52:52 -0700 (PDT)",
            "from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n by smtp.gmail.com with ESMTPSA id c12sm107394pjm.46.2020.05.19.09.52.50\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 19 May 2020 09:52:50 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=F7Ro+4D+/RChrVm48QmNXVHptqTiavagpbltI416tB4=;\n b=tfIv6IqYKlT9TCPVGRI7Hnz39QOdZO6RoIGj37KC8m1B7cjDJ4TansAMaASG+AuRWW\n 7X4qdyrXpS8AuO9DAY2oBVqGPzIvsIlKUoCcI3fWMkzkQDI5f5eqc9o4VmQRtc3oAPhx\n 5tXO/qA54TqIwXG28FMCtc3uYBpo+G5GaSib+cFs920clJK6nirK9gt7iNzwnOsBnS1H\n D/QuUpFdayZBKmxF44KgMVZCOJmHwNNPE2muAKKzj5gv/WQpP/QPqKp5oJeoRGMPqZm7\n Fy4GRIWcRMdTscTceytUX4kOsgPzHt94J4cqXe7F8koYeuTIGnbk4FBSRscQ6hoCH9Mc\n 4LDA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=F7Ro+4D+/RChrVm48QmNXVHptqTiavagpbltI416tB4=;\n b=gIJaU/QdJQy3PY7VgpqsT7IyfED994UYm++0/XxamOl94S5+aoE9O90Gmyv5gXnh+E\n IgN3RCUjTOtVvXIIm189ip0ydnqPqw1UflfVUYlOfgFWbZPmuzyZErDBoNPZTUlgGAT4\n ezrQEiu4ID0J9qh7YFj/B2giOIoLXwlYIKgOwQ6RH1z6nyCbLGozZSd3JW412QR9bmRv\n ulEWptz54U12H3D/c0NSluIwfu3sJ5JjYFgk8c7XSgH2/IXYo77mhfwLndLJ2B0cqc1L\n QhcKQdc6GOFmlQGcbk9eqD92WPyMSkLgxOM/GQUiy424xyMMbTnNrpTgELF0kdF8MiEe\n CFVg==",
        "X-Gm-Message-State": "AOAM53090nraCuVdrWk/lRLo7BCr6JvXlFKumF4a8fd91WVO60rQMUC2\n 4ttSeyOkA5mg+FQhhdflgowWQwWANwJCLA==",
        "X-Google-Smtp-Source": "\n ABdhPJyw20v1qDvtH7310X3fuqczexkdhXf/XEskgvuYKBrifbeqcJlBZH40b7srE6exFmW3ndqrWA==",
        "X-Received": "by 2002:a63:5d55:: with SMTP id o21mr154584pgm.58.1589907171620;\n Tue, 19 May 2020 09:52:51 -0700 (PDT)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>",
        "Date": "Tue, 19 May 2020 09:52:25 -0700",
        "Message-Id": "<20200519165230.23306-3-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.26.2",
        "In-Reply-To": "<20200519165230.23306-1-stephen@networkplumber.org>",
        "References": "<20200506192730.21613-1-stephen@networkplumber.org>\n <20200519165230.23306-1-stephen@networkplumber.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 2/7] net/netvsc: implement rx/tx descriptor\n\tstatus functions",
        "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": "These functions are useful for applications and debugging.\nThe netvsc PMD also transparently handles the rx/tx descriptor\nfunctions for underlying VF device.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n drivers/net/netvsc/hn_ethdev.c |  3 ++\n drivers/net/netvsc/hn_rxtx.c   | 57 ++++++++++++++++++++++++++++++++++\n drivers/net/netvsc/hn_var.h    |  5 +++\n 3 files changed, 65 insertions(+)",
    "diff": "diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c\nindex b890fa3befa8..675a49e66a57 100644\n--- a/drivers/net/netvsc/hn_ethdev.c\n+++ b/drivers/net/netvsc/hn_ethdev.c\n@@ -875,8 +875,11 @@ static const struct eth_dev_ops hn_eth_dev_ops = {\n \t.tx_queue_setup\t\t= hn_dev_tx_queue_setup,\n \t.tx_queue_release\t= hn_dev_tx_queue_release,\n \t.tx_done_cleanup        = hn_dev_tx_done_cleanup,\n+\t.tx_descriptor_status\t= hn_dev_tx_descriptor_status,\n \t.rx_queue_setup\t\t= hn_dev_rx_queue_setup,\n \t.rx_queue_release\t= hn_dev_rx_queue_release,\n+\t.rx_queue_count\t\t= hn_dev_rx_queue_count,\n+\t.rx_descriptor_status   = hn_dev_rx_queue_status,\n \t.link_update\t\t= hn_dev_link_update,\n \t.stats_get\t\t= hn_dev_stats_get,\n \t.stats_reset            = hn_dev_stats_reset,\ndiff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c\nindex 668f48fcbf15..b22d8ea7feb0 100644\n--- a/drivers/net/netvsc/hn_rxtx.c\n+++ b/drivers/net/netvsc/hn_rxtx.c\n@@ -369,6 +369,29 @@ hn_dev_tx_queue_release(void *arg)\n \trte_free(txq);\n }\n \n+/*\n+ * Check the status of a Tx descriptor in the queue.\n+ *\n+ * returns:\n+ *  - -EINVAL              - offset outside of tx_descriptor pool.\n+ *  - RTE_ETH_TX_DESC_FULL - descriptor is not acknowleged by host.\n+ *  - RTE_ETH_TX_DESC_DONE - descriptor is available.\n+ */\n+int hn_dev_tx_descriptor_status(void *arg, uint16_t offset)\n+{\n+\tconst struct hn_tx_queue *txq = arg;\n+\n+\thn_process_events(txq->hv, txq->queue_id, 0);\n+\n+\tif (offset >= rte_mempool_avail_count(txq->txdesc_pool))\n+\t\treturn -EINVAL;\n+\n+\tif (offset < rte_mempool_in_use_count(txq->txdesc_pool))\n+\t\treturn RTE_ETH_TX_DESC_FULL;\n+\telse\n+\t\treturn RTE_ETH_TX_DESC_DONE;\n+}\n+\n static void\n hn_nvs_send_completed(struct rte_eth_dev *dev, uint16_t queue_id,\n \t\t      unsigned long xactid, const struct hn_nvs_rndis_ack *ack)\n@@ -966,6 +989,40 @@ hn_dev_rx_queue_release(void *arg)\n \thn_rx_queue_free(rxq, true);\n }\n \n+/*\n+ * Get the number of used descriptor in a rx queue\n+ * For this device that means how many packets are pending in the ring.\n+ */\n+uint32_t\n+hn_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_id)\n+{\n+\tstruct hn_rx_queue *rxq = dev->data->rx_queues[queue_id];\n+\n+\treturn rte_ring_count(rxq->rx_ring);\n+}\n+\n+/*\n+ * Check the status of a Rx descriptor in the queue\n+ *\n+ * returns:\n+ *  - -EINVAL               - offset outside of ring\n+ *  - RTE_ETH_RX_DESC_AVAIL - no data available yet\n+ *  - RTE_ETH_RX_DESC_DONE  - data is waiting in stagin ring\n+ */\n+int hn_dev_rx_queue_status(void *arg, uint16_t offset)\n+{\n+\tconst struct hn_rx_queue *rxq = arg;\n+\n+\thn_process_events(rxq->hv, rxq->queue_id, 0);\n+\tif (offset >= rxq->rx_ring->capacity)\n+\t\treturn -EINVAL;\n+\n+\tif (offset < rte_ring_count(rxq->rx_ring))\n+\t\treturn RTE_ETH_RX_DESC_DONE;\n+\telse\n+\t\treturn RTE_ETH_RX_DESC_AVAIL;\n+}\n+\n int\n hn_dev_tx_done_cleanup(void *arg, uint32_t free_cnt)\n {\ndiff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h\nindex 93168d2e0102..ded0d4c60a04 100644\n--- a/drivers/net/netvsc/hn_var.h\n+++ b/drivers/net/netvsc/hn_var.h\n@@ -169,6 +169,7 @@ void\thn_dev_tx_queue_release(void *arg);\n void\thn_dev_tx_queue_info(struct rte_eth_dev *dev, uint16_t queue_idx,\n \t\t\t     struct rte_eth_txq_info *qinfo);\n int\thn_dev_tx_done_cleanup(void *arg, uint32_t free_cnt);\n+int\thn_dev_tx_descriptor_status(void *arg, uint16_t offset);\n \n struct hn_rx_queue *hn_rx_queue_alloc(struct hn_data *hv,\n \t\t\t\t      uint16_t queue_id,\n@@ -181,6 +182,8 @@ int\thn_dev_rx_queue_setup(struct rte_eth_dev *dev,\n void\thn_dev_rx_queue_info(struct rte_eth_dev *dev, uint16_t queue_id,\n \t\t\t     struct rte_eth_rxq_info *qinfo);\n void\thn_dev_rx_queue_release(void *arg);\n+uint32_t hn_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_id);\n+int\thn_dev_rx_queue_status(void *rxq, uint16_t offset);\n void\thn_dev_free_queues(struct rte_eth_dev *dev);\n \n /* Check if VF is attached */\n@@ -231,6 +234,8 @@ int\thn_vf_tx_queue_setup(struct rte_eth_dev *dev,\n \t\t\t     unsigned int socket_id,\n \t\t\t     const struct rte_eth_txconf *tx_conf);\n void\thn_vf_tx_queue_release(struct hn_data *hv, uint16_t queue_id);\n+int\thn_vf_tx_queue_status(struct hn_data *hv, uint16_t queue_id, uint16_t offset);\n+\n int\thn_vf_rx_queue_setup(struct rte_eth_dev *dev,\n \t\t\t     uint16_t queue_idx, uint16_t nb_desc,\n \t\t\t     unsigned int socket_id,\n",
    "prefixes": [
        "v3",
        "2/7"
    ]
}