get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 13082,
    "url": "https://patches.dpdk.org/api/patches/13082/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1464605292-4599-2-git-send-email-remy.horton@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": "<1464605292-4599-2-git-send-email-remy.horton@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1464605292-4599-2-git-send-email-remy.horton@intel.com",
    "date": "2016-05-30T10:48:03",
    "name": "[dpdk-dev,v3,01/10] rte: change xstats to use integer ids",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "6c6bd0f723850414329f03cc1079f9f9c4b1c5c2",
    "submitter": {
        "id": 326,
        "url": "https://patches.dpdk.org/api/people/326/?format=api",
        "name": "Remy Horton",
        "email": "remy.horton@intel.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/1464605292-4599-2-git-send-email-remy.horton@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/13082/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/13082/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 6D4806947;\n\tMon, 30 May 2016 12:48:24 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id D94B868CF\n\tfor <dev@dpdk.org>; Mon, 30 May 2016 12:48:16 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga104.fm.intel.com with ESMTP; 30 May 2016 03:48:16 -0700",
            "from rhorton-mobl.ger.corp.intel.com (HELO VM.ir.intel.com)\n\t([163.33.228.212])\n\tby orsmga003.jf.intel.com with ESMTP; 30 May 2016 03:48:15 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.26,389,1459839600\"; d=\"scan'208\";a=\"817650898\"",
        "From": "Remy Horton <remy.horton@intel.com>",
        "To": "dev@dpdk.org,\n\tThomas Monjalon <thomas.monjalon@6wind.com>",
        "Date": "Mon, 30 May 2016 11:48:03 +0100",
        "Message-Id": "<1464605292-4599-2-git-send-email-remy.horton@intel.com>",
        "X-Mailer": "git-send-email 2.5.5",
        "In-Reply-To": "<1464605292-4599-1-git-send-email-remy.horton@intel.com>",
        "References": "<1464605292-4599-1-git-send-email-remy.horton@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 01/10] rte: change xstats to use integer ids",
        "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": "The current extended ethernet statistics fetching involve doing several\nstring operations, which causes performance issues if there are lots of\nstatistics and/or network interfaces. This patch changes the API for\nxstats to use integer identifiers instead of strings.\n\nSigned-off-by: Remy Horton <remy.horton@intel.com>\n---\n lib/librte_ether/rte_ethdev.c          | 95 +++++++++++++++++++++++++++++++---\n lib/librte_ether/rte_ethdev.h          | 44 ++++++++++++++++\n lib/librte_ether/rte_ether_version.map |  7 +++\n 3 files changed, 138 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex e148028..86fb0bc 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -1502,6 +1502,87 @@ rte_eth_stats_reset(uint8_t port_id)\n \tdev->data->rx_mbuf_alloc_failed = 0;\n }\n \n+int\n+rte_eth_xstats_count(uint8_t port_id)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tint count;\n+\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n+\tdev = &rte_eth_devices[port_id];\n+\tif (dev->dev_ops->xstats_names != NULL) {\n+\t\tcount = (*dev->dev_ops->xstats_names)(dev, NULL, 0);\n+\t\tif (count < 0)\n+\t\t\treturn count;\n+\t} else\n+\t\tcount = 0;\n+\tcount += RTE_NB_STATS;\n+\tcount += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;\n+\tcount += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;\n+\treturn count;\n+}\n+\n+int\n+rte_eth_xstats_names(uint8_t port_id, struct rte_eth_xstats_name *ptr_names,\n+\tunsigned limit)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tint cnt_used_entries;\n+\tint cnt_expected_entries;\n+\tuint32_t idx, id_queue;\n+\n+\tif (ptr_names == NULL)\n+\t\treturn -EINVAL;\n+\tcnt_expected_entries = rte_eth_xstats_count(port_id);\n+\tif (cnt_expected_entries < 0)\n+\t\treturn cnt_expected_entries;\n+\tif ((int)limit < cnt_expected_entries)\n+\t\treturn -ERANGE;\n+\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n+\tdev = &rte_eth_devices[port_id];\n+\tif (dev->dev_ops->xstats_names != NULL) {\n+\t\tcnt_used_entries = (*dev->dev_ops->xstats_names)(\n+\t\t\tdev, ptr_names, limit);\n+\t\tif (cnt_used_entries < 0)\n+\t\t\treturn cnt_used_entries;\n+\t} else\n+\t\t/* Driver itself does not support extended stats, but\n+\t\t * still have basic stats.\n+\t\t */\n+\t\tcnt_used_entries = 0;\n+\n+\tfor (idx = 0; idx < RTE_NB_STATS; idx++) {\n+\t\tptr_names[cnt_used_entries].id = cnt_used_entries;\n+\t\tsnprintf(ptr_names[cnt_used_entries].name,\n+\t\t\tsizeof(ptr_names[0].name),\n+\t\t\t\"%s\", rte_stats_strings[idx].name);\n+\t\tcnt_used_entries++;\n+\t}\n+\tfor (id_queue = 0; id_queue < dev->data->nb_rx_queues; id_queue++) {\n+\t\tfor (idx = 0; idx < RTE_NB_RXQ_STATS; idx++) {\n+\t\t\tptr_names[cnt_used_entries].id = cnt_used_entries;\n+\t\t\tsnprintf(ptr_names[cnt_used_entries].name,\n+\t\t\t\tsizeof(ptr_names[0].name),\n+\t\t\t\t\"rx_q%u%s\",\n+\t\t\t\tid_queue, rte_rxq_stats_strings[idx].name);\n+\t\t\tcnt_used_entries++;\n+\t\t}\n+\n+\t}\n+\tfor (id_queue = 0; id_queue < dev->data->nb_tx_queues; id_queue++) {\n+\t\tfor (idx = 0; idx < RTE_NB_TXQ_STATS; idx++) {\n+\t\t\tptr_names[cnt_used_entries].id = cnt_used_entries;\n+\t\t\tsnprintf(ptr_names[cnt_used_entries].name,\n+\t\t\t\tsizeof(ptr_names[0].name),\n+\t\t\t\t\"tx_q%u%s\",\n+\t\t\t\tid_queue, rte_txq_stats_strings[idx].name);\n+\t\t\tcnt_used_entries++;\n+\t\t}\n+\t}\n+\treturn cnt_used_entries;\n+}\n+\n /* retrieve ethdev extended statistics */\n int\n rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,\n@@ -1546,8 +1627,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,\n \t\tstats_ptr = RTE_PTR_ADD(&eth_stats,\n \t\t\t\t\trte_stats_strings[i].offset);\n \t\tval = *stats_ptr;\n-\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t\"%s\", rte_stats_strings[i].name);\n+\t\txstats[count].name[0] = '\\0';\n+\t\txstats[count].id = count + xcount;\n \t\txstats[count++].value = val;\n \t}\n \n@@ -1558,9 +1639,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,\n \t\t\t\t\trte_rxq_stats_strings[i].offset +\n \t\t\t\t\tq * sizeof(uint64_t));\n \t\t\tval = *stats_ptr;\n-\t\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t\t\"rx_q%u_%s\", q,\n-\t\t\t\trte_rxq_stats_strings[i].name);\n+\t\t\txstats[count].name[0] = '\\0';\n+\t\t\txstats[count].id = count + xcount;\n \t\t\txstats[count++].value = val;\n \t\t}\n \t}\n@@ -1572,9 +1652,8 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,\n \t\t\t\t\trte_txq_stats_strings[i].offset +\n \t\t\t\t\tq * sizeof(uint64_t));\n \t\t\tval = *stats_ptr;\n-\t\t\tsnprintf(xstats[count].name, sizeof(xstats[count].name),\n-\t\t\t\t\"tx_q%u_%s\", q,\n-\t\t\t\trte_txq_stats_strings[i].name);\n+\t\t\txstats[count].name[0] = '\\0';\n+\t\t\txstats[count].id = count + xcount;\n \t\t\txstats[count++].value = val;\n \t\t}\n \t}\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 2757510..d663d60 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -915,10 +915,23 @@ struct rte_eth_txq_info {\n  * structure.\n  */\n struct rte_eth_xstats {\n+\t/* FIXME: Remove name[] once remaining drivers converted */\n \tchar name[RTE_ETH_XSTATS_NAME_SIZE];\n+\tuint64_t id;\n \tuint64_t value;\n };\n \n+/**\n+ * A name-key lookup element for extended statistics.\n+ *\n+ * This structure is used to map between names and ID numbers\n+ * for extended ethernet statistics.\n+ */\n+struct rte_eth_xstats_name {\n+\tchar name[RTE_ETH_XSTATS_NAME_SIZE];\n+\tuint64_t id;\n+};\n+\n #define ETH_DCB_NUM_TCS    8\n #define ETH_MAX_VMDQ_POOL  64\n \n@@ -1054,6 +1067,10 @@ typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,\n typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);\n /**< @internal Reset extended stats of an Ethernet device. */\n \n+typedef int (*eth_xstats_names_t)(struct rte_eth_dev *dev,\n+\tstruct rte_eth_xstats_name *ptr_names, unsigned limit);\n+/**< @internal Get names of extended stats of an Ethernet device. */\n+\n typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,\n \t\t\t\t\t     uint16_t queue_id,\n \t\t\t\t\t     uint8_t stat_idx,\n@@ -1401,6 +1418,8 @@ struct eth_dev_ops {\n \teth_stats_reset_t          stats_reset;   /**< Reset generic device statistics. */\n \teth_xstats_get_t           xstats_get;    /**< Get extended device statistics. */\n \teth_xstats_reset_t         xstats_reset;  /**< Reset extended device statistics. */\n+\teth_xstats_names_t         xstats_names;\n+\t/**< Get names of extended statistics. */\n \teth_queue_stats_mapping_set_t queue_stats_mapping_set;\n \t/**< Configure per queue stat counter mapping. */\n \teth_dev_infos_get_t        dev_infos_get; /**< Get device info. */\n@@ -2253,6 +2272,31 @@ int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);\n void rte_eth_stats_reset(uint8_t port_id);\n \n /**\n+ * Retrieve names of extended statistics of an Ethernet device.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param ptr_names\n+ *  Block of memory to insert names into. Must be at least limit in size.\n+ * @param limit\n+ *  Capacity of ptr_strings (number of names).\n+ * @return\n+ *  If successful, number of statistics; negative on error.\n+ */\n+int rte_eth_xstats_names(uint8_t port_id, struct rte_eth_xstats_name *ptr_names,\n+\tunsigned limit);\n+\n+/**\n+ * Retrieve number of extended statistics of an Ethernet device.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @return\n+ *  If successful, number of statistics; negative on error.\n+ */\n+int rte_eth_xstats_count(uint8_t port_id);\n+\n+/**\n  * Retrieve extended statistics of an Ethernet device.\n  *\n  * @param port_id\ndiff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map\nindex 214ecc7..bb339e1 100644\n--- a/lib/librte_ether/rte_ether_version.map\n+++ b/lib/librte_ether/rte_ether_version.map\n@@ -132,3 +132,10 @@ DPDK_16.04 {\n \trte_eth_tx_buffer_set_err_callback;\n \n } DPDK_2.2;\n+\n+DPDK_16.07 {\n+\tglobal:\n+\n+\trte_eth_xstats_names;\n+\trte_eth_xstats_count;\n+} DPDK_16.04;\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "01/10"
    ]
}