get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7300,
    "url": "https://patches.dpdk.org/api/patches/7300/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1443606022-13581-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": "<1443606022-13581-5-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1443606022-13581-5-git-send-email-harry.van.haaren@intel.com",
    "date": "2015-09-30T09:40:15",
    "name": "[dpdk-dev,v2,04/11] virtio: add xstats() implementation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0cdba9cbeef9b429fc3e69cdab237c599912f4e2",
    "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/1443606022-13581-5-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7300/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7300/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 12A288E5F;\n\tWed, 30 Sep 2015 11:41:02 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 2B53A8D36\n\tfor <dev@dpdk.org>; Wed, 30 Sep 2015 11:40:55 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga102.fm.intel.com with ESMTP; 30 Sep 2015 02:40:54 -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; 30 Sep 2015 02:40:53 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,611,1437462000\"; d=\"scan'208\";a=\"571197957\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 30 Sep 2015 10:40:15 +0100",
        "Message-Id": "<1443606022-13581-5-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1443606022-13581-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1443606022-13581-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 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 | 82 +++++++++++++++++++++++++++++++++++++-\n 1 file changed, 80 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 465d3cd..c897d1b 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,64 @@ 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+\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+\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\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",
        "v2",
        "04/11"
    ]
}