get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 86,
    "url": "http://patches.dpdk.org/api/patches/86/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1406118534-6169-3-git-send-email-olivier.matz@6wind.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1406118534-6169-3-git-send-email-olivier.matz@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1406118534-6169-3-git-send-email-olivier.matz@6wind.com",
    "date": "2014-07-23T12:28:54",
    "name": "[dpdk-dev,2/2] testpmd: add a new command to get the extended statistics of a port",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "506f21cad43694f407f1ba9c1f3ff53c48badb84",
    "submitter": {
        "id": 8,
        "url": "http://patches.dpdk.org/api/people/8/?format=api",
        "name": "Olivier Matz",
        "email": "olivier.matz@6wind.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1406118534-6169-3-git-send-email-olivier.matz@6wind.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/86/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/86/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<olivier.matz@6wind.com>",
        "Received": [
            "from mail-wg0-f46.google.com (mail-wg0-f46.google.com\n\t[74.125.82.46]) by dpdk.org (Postfix) with ESMTP id B33C1594D\n\tfor <dev@dpdk.org>; Wed, 23 Jul 2014 14:27:39 +0200 (CEST)",
            "by mail-wg0-f46.google.com with SMTP id m15so1091958wgh.17\n\tfor <dev@dpdk.org>; Wed, 23 Jul 2014 05:29:03 -0700 (PDT)",
            "from glumotte.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net.\n\t[82.239.227.177]) by mx.google.com with ESMTPSA id\n\tch5sm5882484wjb.18.2014.07.23.05.29.01 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 23 Jul 2014 05:29:02 -0700 (PDT)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=FFfukQ1b6PPuWesVBTZojnilIFlt9MVXT1NaDS7iot8=;\n\tb=lnLkje5S50XWgxyLZ0pdG3VeWgoMWPge17a/sryzYJfhgWpDTjWoSYu3VicL/N4ovC\n\tdh1O9SfpQMy422AlzU27LWB0A+J3ybZMGcUlzDI9bOPJ8JuCzn0FUmhy/hvNkpFMoS0n\n\tLtXMSWD8Hk+dMce2+KfikhHXNe7sXt3XTXXe80DapnCBFqL7yBG192Jr0BMetKUmVBCa\n\t/Ja/4NC3FE064l9f2kYlOWCMPTBvhmbNQQB/KMftepZXSl+7I7qJ4/4wGhdquDAQMaQJ\n\tm4vxDM16X45FwrpFVXZoyo8zbdSVortTy4cBuffY2v1rNHRhSOVVTSWqy3LhcWJ1KWrh\n\tbmhA==",
        "X-Gm-Message-State": "ALoCoQlrK/bLi7L17XnW+fQg6Ek+5d8SbX1scGc7k3OcXrzpAwB9PxHxs6Ie0KNFiyRSOPAG9wVT",
        "X-Received": "by 10.194.174.35 with SMTP id bp3mr1280317wjc.33.1406118543104; \n\tWed, 23 Jul 2014 05:29:03 -0700 (PDT)",
        "From": "Olivier Matz <olivier.matz@6wind.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 23 Jul 2014 14:28:54 +0200",
        "Message-Id": "<1406118534-6169-3-git-send-email-olivier.matz@6wind.com>",
        "X-Mailer": "git-send-email 2.0.1",
        "In-Reply-To": "<1406118534-6169-1-git-send-email-olivier.matz@6wind.com>",
        "References": "<1406118534-6169-1-git-send-email-olivier.matz@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH 2/2] testpmd: add a new command to get the\n\textended statistics of a port",
        "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>",
        "X-List-Received-Date": "Wed, 23 Jul 2014 12:27:39 -0000"
    },
    "content": "Add a new token in \"show port\" command to dump the extended statistics\nof a device. It validates the new xstats framework added in previous commit.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n app/test-pmd/cmdline.c | 22 ++++++++++++++++------\n app/test-pmd/config.c  | 34 ++++++++++++++++++++++++++++++++++\n app/test-pmd/testpmd.h |  2 ++\n 3 files changed, 52 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 345be11..972ef8c 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -183,14 +183,14 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"Display:\\n\"\n \t\t\t\"--------\\n\\n\"\n \n-\t\t\t\"show port (info|stats|fdir|stat_qmap) (port_id|all)\\n\"\n+\t\t\t\"show port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\\n\"\n \t\t\t\"    Display information for port_id, or all.\\n\\n\"\n \n \t\t\t\"show port rss-hash [key]\\n\"\n \t\t\t\"    Display the RSS hash functions and RSS hash key\"\n \t\t\t\" of port X\\n\\n\"\n \n-\t\t\t\"clear port (info|stats|fdir|stat_qmap) (port_id|all)\\n\"\n+\t\t\t\"clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\\n\"\n \t\t\t\"    Clear information for port_id, or all.\\n\\n\"\n \n \t\t\t\"show config (rxtx|cores|fwd)\\n\"\n@@ -5015,12 +5015,18 @@ static void cmd_showportall_parsed(void *parsed_result,\n \t\tif (!strcmp(res->what, \"stats\"))\n \t\t\tfor (i = 0; i < nb_ports; i++)\n \t\t\t\tnic_stats_clear(i);\n+\t\telse if (!strcmp(res->what, \"xstats\"))\n+\t\t\tfor (i = 0; i < nb_ports; i++)\n+\t\t\t\tnic_xstats_clear(i);\n \t} else if (!strcmp(res->what, \"info\"))\n \t\tfor (i = 0; i < nb_ports; i++)\n \t\t\tport_infos_display(i);\n \telse if (!strcmp(res->what, \"stats\"))\n \t\tfor (i = 0; i < nb_ports; i++)\n \t\t\tnic_stats_display(i);\n+\telse if (!strcmp(res->what, \"xstats\"))\n+\t\tfor (i = 0; i < nb_ports; i++)\n+\t\t\tnic_xstats_display(i);\n \telse if (!strcmp(res->what, \"fdir\"))\n \t\tfor (i = 0; i < nb_ports; i++)\n \t\t\tfdir_get_infos(i);\n@@ -5036,13 +5042,13 @@ cmdline_parse_token_string_t cmd_showportall_port =\n \tTOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, \"port\");\n cmdline_parse_token_string_t cmd_showportall_what =\n \tTOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what,\n-\t\t\t\t \"info#stats#fdir#stat_qmap\");\n+\t\t\t\t \"info#stats#xstats#fdir#stat_qmap\");\n cmdline_parse_token_string_t cmd_showportall_all =\n \tTOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, \"all\");\n cmdline_parse_inst_t cmd_showportall = {\n \t.f = cmd_showportall_parsed,\n \t.data = NULL,\n-\t.help_str = \"show|clear port info|stats|fdir|stat_qmap all\",\n+\t.help_str = \"show|clear port info|stats|xstats|fdir|stat_qmap all\",\n \t.tokens = {\n \t\t(void *)&cmd_showportall_show,\n \t\t(void *)&cmd_showportall_port,\n@@ -5068,10 +5074,14 @@ static void cmd_showport_parsed(void *parsed_result,\n \tif (!strcmp(res->show, \"clear\")) {\n \t\tif (!strcmp(res->what, \"stats\"))\n \t\t\tnic_stats_clear(res->portnum);\n+\t\telse if (!strcmp(res->what, \"xstats\"))\n+\t\t\tnic_xstats_clear(res->portnum);\n \t} else if (!strcmp(res->what, \"info\"))\n \t\tport_infos_display(res->portnum);\n \telse if (!strcmp(res->what, \"stats\"))\n \t\tnic_stats_display(res->portnum);\n+\telse if (!strcmp(res->what, \"xstats\"))\n+\t\tnic_xstats_display(res->portnum);\n \telse if (!strcmp(res->what, \"fdir\"))\n \t\t fdir_get_infos(res->portnum);\n \telse if (!strcmp(res->what, \"stat_qmap\"))\n@@ -5085,14 +5095,14 @@ cmdline_parse_token_string_t cmd_showport_port =\n \tTOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, \"port\");\n cmdline_parse_token_string_t cmd_showport_what =\n \tTOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,\n-\t\t\t\t \"info#stats#fdir#stat_qmap\");\n+\t\t\t\t \"info#stats#xstats#fdir#stat_qmap\");\n cmdline_parse_token_num_t cmd_showport_portnum =\n \tTOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, INT32);\n \n cmdline_parse_inst_t cmd_showport = {\n \t.f = cmd_showport_parsed,\n \t.data = NULL,\n-\t.help_str = \"show|clear port info|stats|fdir|stat_qmap X (X = port number)\",\n+\t.help_str = \"show|clear port info|stats|xstats|fdir|stat_qmap X (X = port number)\",\n \t.tokens = {\n \t\t(void *)&cmd_showport_show,\n \t\t(void *)&cmd_showport_port,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex c72f6ee..0a42ee9 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -199,6 +199,40 @@ nic_stats_clear(portid_t port_id)\n \tprintf(\"\\n  NIC statistics for port %d cleared\\n\", port_id);\n }\n \n+void\n+nic_xstats_display(portid_t port_id)\n+{\n+\tstruct rte_eth_xstats *xstats;\n+\tint len, ret, i;\n+\n+\tprintf(\"###### NIC extended statistics for port %-2d\\n\", port_id);\n+\n+\tlen = rte_eth_xstats_get(port_id, NULL, 0);\n+\tif (len < 0) {\n+\t\tprintf(\"Cannot get xstats count\\n\");\n+\t\treturn;\n+\t}\n+\txstats = malloc(sizeof(xstats[0]) * len);\n+\tif (xstats == NULL) {\n+\t\tprintf(\"Cannot allocate memory for xstats\\n\");\n+\t\treturn;\n+\t}\n+\tret = rte_eth_xstats_get(port_id, xstats, len);\n+\tif (ret < 0 || ret > len) {\n+\t\tprintf(\"Cannot get xstats\\n\");\n+\t\tfree(xstats);\n+\t\treturn ;\n+\t}\n+\tfor (i = 0; i < len; i++)\n+\t\tprintf(\"%s: %\"PRIu64\"\\n\", xstats[i].name, xstats[i].value);\n+\tfree(xstats);\n+}\n+\n+void\n+nic_xstats_clear(portid_t port_id)\n+{\n+\trte_eth_xstats_reset(port_id);\n+}\n \n void\n nic_stats_mapping_display(portid_t port_id)\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex ac86bfe..c698c41 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -448,6 +448,8 @@ void launch_args_parse(int argc, char** argv);\n void prompt(void);\n void nic_stats_display(portid_t port_id);\n void nic_stats_clear(portid_t port_id);\n+void nic_xstats_display(portid_t port_id);\n+void nic_xstats_clear(portid_t port_id);\n void nic_stats_mapping_display(portid_t port_id);\n void port_infos_display(portid_t port_id);\n void fwd_lcores_config_display(void);\n",
    "prefixes": [
        "dpdk-dev",
        "2/2"
    ]
}