get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7267,
    "url": "https://patches.dpdk.org/api/patches/7267/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1443537175-13809-5-git-send-email-harry.van.haaren@intel.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": "<1443537175-13809-5-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1443537175-13809-5-git-send-email-harry.van.haaren@intel.com",
    "date": "2015-09-29T14:32:48",
    "name": "[dpdk-dev,04/11] virtio: add xstats() implementation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "369cfc3c673e0af6f4fd41d2538d312dc7529f6f",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1443537175-13809-5-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7267/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7267/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 C10D88DAC;\n\tTue, 29 Sep 2015 16:33:25 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 8425E5960\n\tfor <dev@dpdk.org>; Tue, 29 Sep 2015 16:33:24 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga103.jf.intel.com with ESMTP; 29 Sep 2015 07:33:25 -0700",
            "from sie-lab-212-222.ir.intel.com (HELO\n\tsilpixa00366884.ir.intel.com) ([10.237.212.222])\n\tby FMSMGA003.fm.intel.com with ESMTP; 29 Sep 2015 07:33:23 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,608,1437462000\"; d=\"scan'208\";a=\"570542963\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 29 Sep 2015 15:32:48 +0100",
        "Message-Id": "<1443537175-13809-5-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1443537175-13809-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1443537175-13809-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 04/11] virtio: add xstats() implementation",
        "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": "Add xstats() functions and statistic strings to virtio PMD.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 86 +++++++++++++++++++++++++++++++++++++-\n 1 file changed, 84 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 465d3cd..165ad97 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -80,7 +80,10 @@ static int virtio_dev_link_update(struct rte_eth_dev *dev,\n static void virtio_set_hwaddr(struct virtio_hw *hw);\n static void virtio_get_hwaddr(struct virtio_hw *hw);\n \n-static void virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);\n+static void virtio_dev_stats_get(struct rte_eth_dev *dev,\n+\t\t\t\t struct rte_eth_stats *stats);\n+static int virtio_dev_xstats_get(struct rte_eth_dev *dev,\n+\t\t\t\t struct rte_eth_xstats *xstats, unsigned n);\n static void virtio_dev_stats_reset(struct rte_eth_dev *dev);\n static void virtio_dev_free_mbufs(struct rte_eth_dev *dev);\n static int virtio_vlan_filter_set(struct rte_eth_dev *dev,\n@@ -109,6 +112,21 @@ static const struct rte_pci_id pci_id_virtio_map[] = {\n { .vendor_id = 0, /* sentinel */ },\n };\n \n+struct rte_virtio_xstats_name_off {\n+\tchar name[RTE_ETH_XSTATS_NAME_SIZE];\n+\tunsigned offset;\n+};\n+\n+/* [rt]x_qX_ is prepended to the name string here */\n+static const struct rte_virtio_xstats_name_off rte_virtio_q_stat_strings[] = {\n+\t{\"packets\", offsetof(struct virtqueue, packets)},\n+\t{\"bytes\", offsetof(struct virtqueue, bytes)},\n+\t{\"errors\", offsetof(struct virtqueue, errors)},\n+};\n+\n+#define VIRTIO_NB_Q_XSTATS (sizeof(rte_virtio_q_stat_strings) / \\\n+\t\t\t    sizeof(rte_virtio_q_stat_strings[0]))\n+\n static int\n virtio_send_command(struct virtqueue *vq, struct virtio_pmd_ctrl *ctrl,\n \t\tint *dlen, int pkt_num)\n@@ -568,7 +586,9 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {\n \n \t.dev_infos_get           = virtio_dev_info_get,\n \t.stats_get               = virtio_dev_stats_get,\n+\t.xstats_get              = virtio_dev_xstats_get,\n \t.stats_reset             = virtio_dev_stats_reset,\n+\t.xstats_reset            = virtio_dev_stats_reset,\n \t.link_update             = virtio_dev_link_update,\n \t.rx_queue_setup          = virtio_dev_rx_queue_setup,\n \t.rx_queue_release        = virtio_dev_rx_queue_release,\n@@ -623,7 +643,7 @@ virtio_dev_atomic_write_link_status(struct rte_eth_dev *dev,\n }\n \n static void\n-virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)\n+virtio_update_stats(struct rte_eth_dev *dev, struct rte_eth_stats *stats)\n {\n \tunsigned i;\n \n@@ -660,6 +680,68 @@ virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)\n \tstats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;\n }\n \n+static int\n+virtio_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,\n+\t\t      unsigned n)\n+{\n+\tunsigned i;\n+\tunsigned count = 0;\n+\n+\t// TODO: what about global stats? mbuf_alloc_failed?\n+\tunsigned nstats = dev->data->nb_tx_queues * VIRTIO_NB_Q_XSTATS +\n+\t\tdev->data->nb_rx_queues * VIRTIO_NB_Q_XSTATS;\n+\n+\tif(n < nstats)\n+\t\treturn nstats;\n+\n+\n+\tfor (i = 0; i < dev->data->nb_rx_queues; i++) {\n+\t\tstruct virtqueue *rxvq = dev->data->rx_queues[i];\n+\n+\t\tif(rxvq == NULL)\n+\t\t\tcontinue;\n+\n+\t\tunsigned t;\n+\n+\t\tfor(t = 0; t < VIRTIO_NB_Q_XSTATS; t++) {\n+\t\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n+\t\t\t\t \"rx_q%u_%s\", i,\n+\t\t\t\t rte_virtio_q_stat_strings[t].name);\n+\t\t\txstats[count].value = *(uint64_t *)(((char *)rxvq) +\n+\t\t\t\trte_virtio_q_stat_strings[t].offset);\n+\t\t\tcount++;\n+\t\t}\n+\t}\n+\n+\tfor (i = 0; i < dev->data->nb_tx_queues; i++) {\n+\t\tstruct virtqueue *txvq = dev->data->tx_queues[i];\n+\n+\t\t// TODO: Concider returning 0 value instead of skipping?\n+\t\t// TODO: Is it possible to have NULL queues? ie check necessary?\n+\t\tif(txvq == NULL)\n+\t\t\tcontinue;\n+\n+\t\tunsigned t;\n+\n+\t\tfor(t = 0; t < VIRTIO_NB_Q_XSTATS; t++) {\n+\t\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n+\t\t\t\t \"tx_q%u_%s\", i,\n+\t\t\t\t rte_virtio_q_stat_strings[t].name);\n+\t\t\txstats[count].value = *(uint64_t *)(((char *)txvq) +\n+\t\t\t\trte_virtio_q_stat_strings[t].offset);\n+\t\t\tcount++;\n+\t\t}\n+\t}\n+\n+\treturn count;\n+}\n+\n+static void\n+virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)\n+{\n+\tvirtio_update_stats(dev, stats);\n+}\n+\n static void\n virtio_dev_stats_reset(struct rte_eth_dev *dev)\n {\n",
    "prefixes": [
        "dpdk-dev",
        "04/11"
    ]
}