get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 124910,
    "url": "https://patches.dpdk.org/api/patches/124910/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230309182758.1005573-1-abdullah.sevincer@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": "<20230309182758.1005573-1-abdullah.sevincer@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230309182758.1005573-1-abdullah.sevincer@intel.com",
    "date": "2023-03-09T18:27:58",
    "name": "[v7] app/procinfo: display eventdev xstats",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f28e0610dd4187bc3c3f5372e31f45d6febee0b0",
    "submitter": {
        "id": 2843,
        "url": "https://patches.dpdk.org/api/people/2843/?format=api",
        "name": "Sevincer, Abdullah",
        "email": "abdullah.sevincer@intel.com"
    },
    "delegate": {
        "id": 310,
        "url": "https://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230309182758.1005573-1-abdullah.sevincer@intel.com/mbox/",
    "series": [
        {
            "id": 27315,
            "url": "https://patches.dpdk.org/api/series/27315/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=27315",
            "date": "2023-03-09T18:27:58",
            "name": "[v7] app/procinfo: display eventdev xstats",
            "version": 7,
            "mbox": "https://patches.dpdk.org/series/27315/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/124910/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/124910/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8DF8C41E21;\n\tThu,  9 Mar 2023 19:28:05 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2326F40ED7;\n\tThu,  9 Mar 2023 19:28:05 +0100 (CET)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by mails.dpdk.org (Postfix) with ESMTP id 9E1B240695\n for <dev@dpdk.org>; Thu,  9 Mar 2023 19:28:03 +0100 (CET)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 09 Mar 2023 10:28:02 -0800",
            "from txanpdk02.an.intel.com ([10.123.117.76])\n by orsmga007.jf.intel.com with ESMTP; 09 Mar 2023 10:28:01 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1678386483; x=1709922483;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=Ahr5+OFRdwy+C84smM0QX7alWHN2+nlSTBQNkq7lvQg=;\n b=QUpfc1aM2vfxWs3yBuuH4+T0ZPlKGYeICrr+1bxGRmClKU/GHjk68MJp\n x9EG3WNHD1K6/WDjzAZwMDmHfb4pqvsIjPkbXSbbCyPdtYzhExhDFbKtS\n BtfT5LU+Req2RxR8mayTt8CJ1LwRsCFnbt5n0txNe9EB8RtFBEBSZ/nLp\n q+T9TgvWSmEgTTE3fNWx6zK8sFIfUsU8CgpSOpQ4S1msIS3xcGv102wgY\n IB+EA6tdggECukqd1J4a+pmh/owPKXI/JyuHAOD7BZQ0LlsQn2gA43Blg\n t4T5u/r055M3ULfDCmKJjBgcE/RpmSO7Mhw8l1z+XsM758tDgLV7oPVJQ Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10644\"; a=\"401379900\"",
            "E=Sophos;i=\"5.98,247,1673942400\"; d=\"scan'208\";a=\"401379900\"",
            "E=McAfee;i=\"6500,9779,10644\"; a=\"670836196\"",
            "E=Sophos;i=\"5.98,247,1673942400\"; d=\"scan'208\";a=\"670836196\""
        ],
        "X-ExtLoop1": "1",
        "From": "Abdullah Sevincer <abdullah.sevincer@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "jerinj@marvell.com, reshma.pattan@intel.com,\n Abdullah Sevincer <abdullah.sevincer@intel.com>",
        "Subject": "[PATCH v7] app/procinfo: display eventdev xstats",
        "Date": "Thu,  9 Mar 2023 12:27:58 -0600",
        "Message-Id": "<20230309182758.1005573-1-abdullah.sevincer@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230223010819.4164765-1-abdullah.sevincer@intel.com>",
        "References": "<20230223010819.4164765-1-abdullah.sevincer@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This commit extends proc-info application to\ndisplay xstats for the eventdev devices.\n\nNew command line arguments are introduced to\ndisplay xstats for eventdev devices. The command\nexample is like:\n\nFor displaying a specific port stats (e.g. port 1):\n./dpdk-proc-info -- --show-edev-port-xstats=1\n\nIf any xstats parameters for eventdev passed through\nproc-info command line, proc-info will only display\nrequested eventdev data and exit.\n\nUsers should not pass any eventdev xstats parameters\nif they desire to dump other proc-info data such as\nRx/Tx descriptor dump.\nMore information can be found in proc-info app doc.\n\nSigned-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com>\n---\n app/proc-info/main.c           | 211 ++++++++++++++++++++++++++++++++-\n app/proc-info/meson.build      |   2 +-\n doc/guides/tools/proc_info.rst |  27 ++++-\n 3 files changed, 237 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/app/proc-info/main.c b/app/proc-info/main.c\nindex 53e852a07c..c004f63e2c 100644\n--- a/app/proc-info/main.c\n+++ b/app/proc-info/main.c\n@@ -40,11 +40,17 @@\n #include <rte_tm.h>\n #include <rte_hexdump.h>\n #include <rte_version.h>\n+#include <rte_eventdev.h>\n \n /* Maximum long option length for option parsing. */\n #define MAX_LONG_OPT_SZ 64\n #define MAX_STRING_LEN 256\n \n+/* Note: Port_queue_id in xstats APIs is 8 bits, so we have a maximum of\n+ * 256 ports and queues for event_Dev\n+ */\n+#define MAX_PORTS_QUEUES 256\n+\n #define ETHDEV_FWVERS_LEN 32\n #define RTE_RETA_CONF_GROUP_NUM 32\n #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))\n@@ -121,6 +127,18 @@ static uint32_t enable_shw_module_eeprom;\n static uint32_t enable_shw_rx_desc_dump;\n static uint32_t enable_shw_tx_desc_dump;\n \n+static uint32_t enable_shw_all_eventdev_queues;\n+static uint32_t enable_shw_all_eventdev_ports;\n+static uint32_t enable_dump_eventdev_xstats;\n+static uint32_t enable_eventdev_reset_xstats;\n+static uint32_t enable_shw_eventdev_device_xstats;\n+\n+static uint8_t evdev_id;\n+static uint8_t num_ports;\n+static uint8_t ports[MAX_PORTS_QUEUES];\n+static uint8_t num_queues;\n+static uint8_t queues[MAX_PORTS_QUEUES];\n+\n #define DESC_PARAM_NUM 3\n \n struct desc_param {\n@@ -172,7 +190,12 @@ proc_info_usage(const char *prgname)\n \t\t\t\"offset: The offset of the descriptor starting from tail. \"\n \t\t\t\"num: The number of the descriptors to dump.\\n\"\n \t\t\"  --iter-mempool=name: iterate mempool elements to display content\\n\"\n-\t\t\"  --dump-regs=file-prefix: dump registers to file with the file-prefix\\n\",\n+\t\t\"  --dump-regs=file-prefix: dump registers to file with the file-prefix\\n\"\n+\t\t\"  --show-edev-queue-xstats=queue_num or * to get queue xstats for specified queue or all queues;\\n\"\n+\t\t\"  --show-edev-port-xstats=port_num or * to get queue xstats for specified port or all ports;\\n\"\n+\t\t\"  --edev-dump-xstats to dump all event_dev xstats;\\n\"\n+\t\t\"  --edev-reset-xstats to reset event_dev stats after reading;\\n\"\n+\t\t\"  --show-edev-device-xstats to get event_dev device stats;\\n\",\n \t\tprgname);\n }\n \n@@ -302,6 +325,11 @@ proc_info_parse_args(int argc, char **argv)\n \t\t{\"show-module-eeprom\", 0, NULL, 0},\n \t\t{\"show-rx-descriptor\", required_argument, NULL, 1},\n \t\t{\"show-tx-descriptor\", required_argument, NULL, 1},\n+\t\t{\"show-edev-queue-xstats\", required_argument, NULL, 0},\n+\t\t{\"show-edev-port-xstats\", required_argument, NULL, 0},\n+\t\t{\"edev-dump-xstats\", 0, NULL, 0},\n+\t\t{\"edev-reset-xstats\", 0, NULL, 0},\n+\t\t{\"show-edev-device-xstats\", 0, NULL, 0},\n \t\t{NULL, 0, 0, 0}\n \t};\n \n@@ -385,6 +413,32 @@ proc_info_parse_args(int argc, char **argv)\n \t\t\telse if (!strncmp(long_option[option_index].name,\n \t\t\t\t\t\"show-module-eeprom\", MAX_LONG_OPT_SZ))\n \t\t\t\tenable_shw_module_eeprom = 1;\n+\t\t\telse if (!strncmp(long_option[option_index].name,\n+\t\t\t\t\t\"edev-dump-xstats\", MAX_LONG_OPT_SZ))\n+\t\t\t\tenable_dump_eventdev_xstats = 1;\n+\t\t\telse if (!strncmp(long_option[option_index].name,\n+\t\t\t\t\t\"edev-reset-xstats\", MAX_LONG_OPT_SZ))\n+\t\t\t\tenable_eventdev_reset_xstats = 1;\n+\t\t\telse if (!strncmp(long_option[option_index].name,\n+\t\t\t\t\t\"show-edev-device-xstats\", MAX_LONG_OPT_SZ))\n+\t\t\t\tenable_shw_eventdev_device_xstats = 1;\n+\t\t\telse if (!strncmp(long_option[option_index].name,\n+\t\t\t\t\t\"show-edev-queue-xstats\", MAX_LONG_OPT_SZ)) {\n+\t\t\t\tif (strcmp(\"*\", optarg) == 0) {\n+\t\t\t\t\tenable_shw_all_eventdev_queues = 1;\n+\t\t\t\t} else {\n+\t\t\t\t\tqueues[num_queues] = atoi(optarg);\n+\t\t\t\t\tnum_queues++;\n+\t\t\t\t}\n+\t\t\t} else if (!strncmp(long_option[option_index].name,\n+\t\t\t\t\t\"show-edev-port-xstats\", MAX_LONG_OPT_SZ)) {\n+\t\t\t\tif (strcmp(\"*\", optarg) == 0) {\n+\t\t\t\t\tenable_shw_all_eventdev_ports = 1;\n+\t\t\t\t} else {\n+\t\t\t\t\tports[num_ports] = atoi(optarg);\n+\t\t\t\t\tnum_ports++;\n+\t\t\t\t}\n+\t\t\t}\n \t\t\tbreak;\n \t\tcase 1:\n \t\t\t/* Print xstat single value given by name*/\n@@ -1744,6 +1798,137 @@ nic_tx_descriptor_display(uint16_t port_id, struct desc_param *desc)\n \t\t\tstrerror(-ret));\n }\n \n+static bool\n+show_edev_xstats(void)\n+{\n+\t/* Check if any event dev xstats requested from command line */\n+\tif (enable_shw_all_eventdev_queues || enable_shw_all_eventdev_ports\n+\t\t|| enable_dump_eventdev_xstats || enable_eventdev_reset_xstats ||\n+\t\tenable_shw_eventdev_device_xstats || num_ports > 0 || num_queues > 0)\n+\t\treturn true;\n+\n+\treturn false;\n+}\n+\n+static void\n+get_eventdev_xstats(uint8_t dev_id,\n+\t  enum rte_event_dev_xstats_mode mode,\n+\t  uint8_t queue_port_id,\n+\t  bool reset)\n+{\n+\tint ret;\n+\tstruct rte_event_dev_xstats_name *xstats_names;\n+\tuint64_t *ids;\n+\tunsigned int size;\n+\tint i;\n+\n+\n+\t/* Get amount of storage required */\n+\tret = rte_event_dev_xstats_names_get(dev_id,\n+\t\t\t\t\t     mode,\n+\t\t\t\t\t     queue_port_id,\n+\t\t\t\t\t     NULL, /* names */\n+\t\t\t\t\t     NULL, /* ids */\n+\t\t\t\t\t     0);   /* num */\n+\n+\tif (ret < 0)\n+\t\trte_panic(\"rte_event_dev_xstats_names_get err %d\\n\", ret);\n+\n+\tif (ret == 0) {\n+\t\tprintf(\n+\t\t\"No stats available for this item, mode=%d, queue_port_id=%d\\n\",\n+\t\t\tmode, queue_port_id);\n+\t\treturn;\n+\t}\n+\n+\tsize = (unsigned int)ret; /* number of names */\n+\n+\t/* Get memory to hold stat names, IDs, and values */\n+\n+\txstats_names = malloc(sizeof(struct rte_event_dev_xstats_name) * size);\n+\tids = malloc(sizeof(unsigned int) * size);\n+\n+\tif (!xstats_names || !ids)\n+\t\trte_panic(\"unable to alloc memory for stats retrieval\\n\");\n+\n+\tret = rte_event_dev_xstats_names_get(dev_id, mode, queue_port_id,\n+\t\t\t\t\t     xstats_names, ids,\n+\t\t\t\t\t     size);\n+\tif (ret != (int)size)\n+\t\trte_panic(\"rte_event_dev_xstats_names_get err %d\\n\", ret);\n+\n+\tif (!reset) {\n+\t\tuint64_t *values;\n+\n+\t\tvalues = malloc(sizeof(uint64_t) * size);\n+\t\tif (!values)\n+\t\t\trte_panic(\"unable to alloc memory for stats retrieval\\n\");\n+\n+\t\tret = rte_event_dev_xstats_get(dev_id, mode, queue_port_id,\n+\t\t\t\t\t       ids, values, size);\n+\n+\t\tif (ret != (int)size)\n+\t\t\trte_panic(\"rte_event_dev_xstats_get err %d\\n\", ret);\n+\n+\t\tfor (i = 0; i < (int)size; i++) {\n+\t\t\tprintf(\"id %\"PRIu64\"  %s = %\"PRIu64\"\\n\",\n+\t\t\t\tids[i], &xstats_names[i].name[0], values[i]);\n+\t\t}\n+\n+\t\tfree(values);\n+\t} else\n+\t\trte_event_dev_xstats_reset(dev_id, mode, queue_port_id,\n+\t\t\t\t\t   ids, size);\n+\n+\tfree(xstats_names);\n+\tfree(ids);\n+}\n+\n+static void\n+process_eventdev_xstats(bool reset)\n+{\n+\tint i;\n+\n+\tif (enable_shw_eventdev_device_xstats) {\n+\t\tget_eventdev_xstats(evdev_id,\n+\t\t\t  RTE_EVENT_DEV_XSTATS_DEVICE,\n+\t\t\t  0,\n+\t\t\t  reset);\n+\t}\n+\n+\tif (enable_shw_all_eventdev_ports) {\n+\t\tfor (i = 0; i < MAX_PORTS_QUEUES; i++) {\n+\t\t\tget_eventdev_xstats(evdev_id,\n+\t\t\t\t  RTE_EVENT_DEV_XSTATS_PORT,\n+\t\t\t\t  i,\n+\t\t\t\t  reset);\n+\t\t}\n+\t} else {\n+\t\tfor (i = 0; i < num_ports; i++) {\n+\t\t\tget_eventdev_xstats(evdev_id,\n+\t\t\t\t  RTE_EVENT_DEV_XSTATS_PORT,\n+\t\t\t\t  ports[i],\n+\t\t\t\t  reset);\n+\t\t}\n+\t}\n+\n+\tif (enable_shw_all_eventdev_queues) {\n+\t\tfor (i = 0; i < MAX_PORTS_QUEUES; i++) {\n+\t\t\tget_eventdev_xstats(evdev_id,\n+\t\t\t\t  RTE_EVENT_DEV_XSTATS_QUEUE,\n+\t\t\t\t  i,\n+\t\t\t\t  reset);\n+\t\t}\n+\t} else {\n+\t\tfor (i = 0; i < num_queues; i++) {\n+\t\t\tget_eventdev_xstats(evdev_id,\n+\t\t\t\t  RTE_EVENT_DEV_XSTATS_QUEUE,\n+\t\t\t\t  queues[i],\n+\t\t\t\t  reset);\n+\t\t}\n+\t}\n+}\n+\n int\n main(int argc, char **argv)\n {\n@@ -1794,6 +1979,30 @@ main(int argc, char **argv)\n \t\treturn 0;\n \t}\n \n+\tif (show_edev_xstats()) {\n+\t\tconst uint8_t ndevs = rte_event_dev_count();\n+\n+\t\tif (ndevs == 0)\n+\t\t\trte_panic(\"No event devs found. Do you need\"\n+\t\t\t  \" to pass in a --vdev flag?\\n\");\n+\n+\t\tif (ndevs > 1)\n+\t\t\tprintf(\"Warning: More than one event dev, but using idx 0\\n\");\n+\n+\t\tif (enable_dump_eventdev_xstats) {\n+\t\t\tret = rte_event_dev_dump(evdev_id, stdout);\n+\t\t\tif (ret)\n+\t\t\t\trte_panic(\"dump failed with err=%d\\n\", ret);\n+\t\t}\n+\n+\t\tprocess_eventdev_xstats(false);\n+\n+\t\tif (enable_eventdev_reset_xstats)\n+\t\t\tprocess_eventdev_xstats(true);\n+\n+\t\treturn 0;\n+\t}\n+\n \tnb_ports = rte_eth_dev_count_avail();\n \tif (nb_ports == 0)\n \t\trte_exit(EXIT_FAILURE, \"No Ethernet ports - bye\\n\");\ndiff --git a/app/proc-info/meson.build b/app/proc-info/meson.build\nindex 1563ce656a..4f83f29a64 100644\n--- a/app/proc-info/meson.build\n+++ b/app/proc-info/meson.build\n@@ -8,7 +8,7 @@ if is_windows\n endif\n \n sources = files('main.c')\n-deps += ['ethdev', 'security']\n+deps += ['ethdev', 'security', 'eventdev']\n if dpdk_conf.has('RTE_LIB_METRICS')\n     deps += 'metrics'\n endif\ndiff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst\nindex cf3502a8cb..ad6d2e8aeb 100644\n--- a/doc/guides/tools/proc_info.rst\n+++ b/doc/guides/tools/proc_info.rst\n@@ -22,7 +22,9 @@ The application has a number of command line options:\n    --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name |\n    --show-port-private | --version | --firmware-version | --show-rss-reta |\n    --show-module-eeprom | --show-rx-descriptor queue_id:offset:num |\n-   --show-tx-descriptor queue_id:offset:num ]\n+   --show-tx-descriptor queue_id:offset:num | --show-edev-queue-xstats=queue_num |\n+   --show-edev-port-xstats=port_num | --edev-dump-xstats | --edev-reset-xstats |\n+   --show-edev-device-xstats]\n \n Parameters\n ~~~~~~~~~~\n@@ -101,6 +103,29 @@ queue_id: A Tx queue identifier on this port.\n offset: The offset of the descriptor starting from tail.\n num: The number of the descriptors to dump.\n \n+**--show-edev-queue-xstats**\n+The show-edev-queue-xstats parameter enables stats for specified queue or all queues.\n+queue_num: The queue number to get queue stats for this specified queue or * for all queues.\n+\n+**--show-edev-port-xstats**\n+The show-edev-port-xstats parameter enables stats for specified port or all ports.\n+queue_num: The port number to get port stats for this specified port or * for all ports.\n+\n+**--edev-dump-xstats**\n+The edev-dump-xstats parameter dumps all eventdev stats.\n+\n+**--edev-reset-xstats**\n+The edev-reset-xstats parameter resets eventdev stats after reading.\n+\n+**--show-edev-device-xstats**\n+The show-edev-device-xstats parameter displays eventdev device stats.\n+\n+A typical command line usage for eventdev stats:\n+\n+    .. code-block:: console\n+\n+       ./dpdk-proc-info -- --show-edev-port-xstats=1\n+\n Limitations\n -----------\n \n",
    "prefixes": [
        "v7"
    ]
}