get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 22574,
    "url": "https://patches.dpdk.org/api/patches/22574/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20170328102024.28513-1-qi.z.zhang@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": "<20170328102024.28513-1-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20170328102024.28513-1-qi.z.zhang@intel.com",
    "date": "2017-03-28T10:20:24",
    "name": "[dpdk-dev] app/testpmd: add CL to show/clear VF stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "a9d787935d6a6e967e9ee8615f52aa35258ee552",
    "submitter": {
        "id": 504,
        "url": "https://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "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/20170328102024.28513-1-qi.z.zhang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/22574/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/22574/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 E3505D202;\n\tTue, 28 Mar 2017 11:29:47 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id C2412D1BB\n\tfor <dev@dpdk.org>; Tue, 28 Mar 2017 11:29:45 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Mar 2017 02:29:44 -0700",
            "from unknown (HELO localhost.localdomain.sh.intel.com)\n\t([10.239.129.229])\n\tby orsmga005.jf.intel.com with ESMTP; 28 Mar 2017 02:29:43 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=intel;\n\tt=1490693385; x=1522229385;\n\th=from:to:cc:subject:date:message-id;\n\tbh=Z4PYAhF7pOFzhE4XGK8mAodB/GChkT9KU324CoW96JE=;\n\tb=qeK/Fihl+plkIh0L+qyUuvXEorUxSPN2COOosk0lzpw6S0gkhJnoOjV9\n\t+d7j508v08F0nV40nQg3qiRjquS+kw==;",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.36,236,1486454400\"; d=\"scan'208\";a=\"80110870\"",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "jingjing.wu@intel.com",
        "Cc": "dev@dpdk.org,\n\tQi Zhang <qi.z.zhang@intel.com>",
        "Date": "Tue, 28 Mar 2017 06:20:24 -0400",
        "Message-Id": "<20170328102024.28513-1-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "Subject": "[dpdk-dev] [PATCH] app/testpmd: add CL to show/clear VF stats",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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 two commands to show/clear VF stats\nshow vf stats <port_id> <vf_id>\nclear vf stats <port_id> <vf_id>\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n app/test-pmd/cmdline.c | 191 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 191 insertions(+)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 43fc636..d0cbc46 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -214,6 +214,12 @@ static void cmd_help_long_parsed(void *parsed_result,\n \n \t\t\t\"read txd (port_id) (queue_id) (txd_id)\\n\"\n \t\t\t\"    Display a TX descriptor of a port TX queue.\\n\\n\"\n+\n+\t\t\t\"show vf stats (port_id) (vf_id)\\n\"\n+\t\t\t\"    Display a VF's statistics.\\n\\n\"\n+\n+\t\t\t\"clear vf stats (port_id) (vf_id)\\n\"\n+\t\t\t\"    Reset a VF's statistics.\\n\\n\"\n \t\t);\n \t}\n \n@@ -12395,6 +12401,189 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = {\n \t},\n };\n \n+/* show vf stats */\n+\n+/* Common result structure for show vf stats */\n+struct cmd_show_vf_stats_result {\n+\tcmdline_fixed_string_t show;\n+\tcmdline_fixed_string_t vf;\n+\tcmdline_fixed_string_t stats;\n+\tuint8_t port_id;\n+\tuint16_t vf_id;\n+};\n+\n+/* Common CLI fields show vf stats*/\n+cmdline_parse_token_string_t cmd_show_vf_stats_show =\n+\tTOKEN_STRING_INITIALIZER\n+\t\t(struct cmd_show_vf_stats_result,\n+\t\t show, \"show\");\n+cmdline_parse_token_string_t cmd_show_vf_stats_vf =\n+\tTOKEN_STRING_INITIALIZER\n+\t\t(struct cmd_show_vf_stats_result,\n+\t\t vf, \"vf\");\n+cmdline_parse_token_string_t cmd_show_vf_stats_stats =\n+\tTOKEN_STRING_INITIALIZER\n+\t\t(struct cmd_show_vf_stats_result,\n+\t\t stats, \"stats\");\n+cmdline_parse_token_num_t cmd_show_vf_stats_port_id =\n+\tTOKEN_NUM_INITIALIZER\n+\t\t(struct cmd_show_vf_stats_result,\n+\t\t port_id, UINT8);\n+cmdline_parse_token_num_t cmd_show_vf_stats_vf_id =\n+\tTOKEN_NUM_INITIALIZER\n+\t\t(struct cmd_show_vf_stats_result,\n+\t\t vf_id, UINT16);\n+\n+static void\n+cmd_show_vf_stats_parsed(\n+\tvoid *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_vf_stats_result *res = parsed_result;\n+\tstruct rte_eth_stats stats;\n+\tint ret = -ENOTSUP;\n+\tstatic const char *nic_stats_border = \"########################\";\n+\n+\tif (port_id_is_invalid(res->port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tmemset(&stats, 0, sizeof(stats));\n+\n+#ifdef RTE_LIBRTE_I40E_PMD\n+\tret = rte_pmd_i40e_get_vf_stats(res->port_id,\n+\t\t\t\t\tres->vf_id,\n+\t\t\t\t\t&stats);\n+#endif\n+\n+\tswitch (ret) {\n+\tcase 0:\n+\t\tbreak;\n+\tcase -EINVAL:\n+\t\tprintf(\"invalid vf_id %d\\n\", res->vf_id);\n+\t\tbreak;\n+\tcase -ENODEV:\n+\t\tprintf(\"invalid port_id %d\\n\", res->port_id);\n+\t\tbreak;\n+\tcase -ENOTSUP:\n+\t\tprintf(\"function not implemented\\n\");\n+\t\tbreak;\n+\tdefault:\n+\t\tprintf(\"programming error: (%s)\\n\", strerror(-ret));\n+\t}\n+\n+\tprintf(\"\\n  %s NIC statistics for port %-2d vf %-2d %s\\n\",\n+\t\tnic_stats_border, res->port_id, res->vf_id, nic_stats_border);\n+\n+\tprintf(\"  RX-packets: %-10\"PRIu64\" RX-missed: %-10\"PRIu64\" RX-bytes:  \"\n+\t       \"%-\"PRIu64\"\\n\",\n+\t       stats.ipackets, stats.imissed, stats.ibytes);\n+\tprintf(\"  RX-errors: %-\"PRIu64\"\\n\", stats.ierrors);\n+\tprintf(\"  RX-nombuf:  %-10\"PRIu64\"\\n\",\n+\t       stats.rx_nombuf);\n+\tprintf(\"  TX-packets: %-10\"PRIu64\" TX-errors: %-10\"PRIu64\" TX-bytes:  \"\n+\t       \"%-\"PRIu64\"\\n\",\n+\t       stats.opackets, stats.oerrors, stats.obytes);\n+\n+\tprintf(\"  %s############################%s\\n\",\n+\t\t\t       nic_stats_border, nic_stats_border);\n+}\n+\n+cmdline_parse_inst_t cmd_show_vf_stats = {\n+\t.f = cmd_show_vf_stats_parsed,\n+\t.data = NULL,\n+\t.help_str = \"show vf stats <port_id> <vf_id>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_show_vf_stats_show,\n+\t\t(void *)&cmd_show_vf_stats_vf,\n+\t\t(void *)&cmd_show_vf_stats_stats,\n+\t\t(void *)&cmd_show_vf_stats_port_id,\n+\t\t(void *)&cmd_show_vf_stats_vf_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* clear vf stats */\n+\n+/* Common result structure for clear vf stats */\n+struct cmd_clear_vf_stats_result {\n+\tcmdline_fixed_string_t clear;\n+\tcmdline_fixed_string_t vf;\n+\tcmdline_fixed_string_t stats;\n+\tuint8_t port_id;\n+\tuint16_t vf_id;\n+};\n+\n+/* Common CLI fields clear vf stats*/\n+cmdline_parse_token_string_t cmd_clear_vf_stats_clear =\n+\tTOKEN_STRING_INITIALIZER\n+\t\t(struct cmd_clear_vf_stats_result,\n+\t\t clear, \"clear\");\n+cmdline_parse_token_string_t cmd_clear_vf_stats_vf =\n+\tTOKEN_STRING_INITIALIZER\n+\t\t(struct cmd_clear_vf_stats_result,\n+\t\t vf, \"vf\");\n+cmdline_parse_token_string_t cmd_clear_vf_stats_stats =\n+\tTOKEN_STRING_INITIALIZER\n+\t\t(struct cmd_clear_vf_stats_result,\n+\t\t stats, \"stats\");\n+cmdline_parse_token_num_t cmd_clear_vf_stats_port_id =\n+\tTOKEN_NUM_INITIALIZER\n+\t\t(struct cmd_clear_vf_stats_result,\n+\t\t port_id, UINT8);\n+cmdline_parse_token_num_t cmd_clear_vf_stats_vf_id =\n+\tTOKEN_NUM_INITIALIZER\n+\t\t(struct cmd_clear_vf_stats_result,\n+\t\t vf_id, UINT16);\n+\n+static void\n+cmd_clear_vf_stats_parsed(\n+\tvoid *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_clear_vf_stats_result *res = parsed_result;\n+\tint ret = -ENOTSUP;\n+\n+\tif (port_id_is_invalid(res->port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+#ifdef RTE_LIBRTE_I40E_PMD\n+\tret = rte_pmd_i40e_reset_vf_stats(res->port_id,\n+\t\t\t\t\t  res->vf_id);\n+#endif\n+\n+\tswitch (ret) {\n+\tcase 0:\n+\t\tbreak;\n+\tcase -EINVAL:\n+\t\tprintf(\"invalid vf_id %d\\n\", res->vf_id);\n+\t\tbreak;\n+\tcase -ENODEV:\n+\t\tprintf(\"invalid port_id %d\\n\", res->port_id);\n+\t\tbreak;\n+\tcase -ENOTSUP:\n+\t\tprintf(\"function not implemented\\n\");\n+\t\tbreak;\n+\tdefault:\n+\t\tprintf(\"programming error: (%s)\\n\", strerror(-ret));\n+\t}\n+}\n+\n+cmdline_parse_inst_t cmd_clear_vf_stats = {\n+\t.f = cmd_clear_vf_stats_parsed,\n+\t.data = NULL,\n+\t.help_str = \"clear vf stats <port_id> <vf_id>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_clear_vf_stats_clear,\n+\t\t(void *)&cmd_clear_vf_stats_vf,\n+\t\t(void *)&cmd_clear_vf_stats_stats,\n+\t\t(void *)&cmd_clear_vf_stats_port_id,\n+\t\t(void *)&cmd_clear_vf_stats_vf_id,\n+\t\tNULL,\n+\t},\n+};\n+\n /* ******************************************************************************** */\n \n /* list of instructions */\n@@ -12570,6 +12759,8 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_set_vf_allmulti,\n \t(cmdline_parse_inst_t *)&cmd_set_vf_broadcast,\n \t(cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag,\n+\t(cmdline_parse_inst_t *)&cmd_show_vf_stats,\n+\t(cmdline_parse_inst_t *)&cmd_clear_vf_stats,\n \tNULL,\n };\n \n",
    "prefixes": [
        "dpdk-dev"
    ]
}