DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Abdullah Sevincer <abdullah.sevincer@intel.com>
Cc: dev@dpdk.org, jerinj@marvell.com, reshma.pattan@intel.com
Subject: Re: [PATCH v16] app/procinfo: display eventdev xstats
Date: Thu, 25 May 2023 10:35:04 -0700	[thread overview]
Message-ID: <20230525103504.47375d4d@hermes.local> (raw)
In-Reply-To: <20230525164127.3046135-1-abdullah.sevincer@intel.com>

On Thu, 25 May 2023 11:41:27 -0500
Abdullah Sevincer <abdullah.sevincer@intel.com> wrote:

> This commit extends proc-info application to
> display xstats for the eventdev devices.
> 
> New command line arguments are introduced to
> display xstats for eventdev devices. The command
> example is like:
> 
> For displaying a specific port stats (e.g. port 1):
> ./dpdk-proc-info -- --show-edev-port-xstats=1:0
> 
> If any xstats parameters for eventdev passed through
> proc-info command line, proc-info will only display
> requested eventdev data and exit.
> 
> Users should not pass any eventdev xstats parameters
> if they desire to dump other proc-info data such as
> Rx/Tx descriptor dump.
> More information can be found in proc-info app doc.
> 
> Signed-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com>

I was thinking of helper function and using const strings.
Don't need to panic on invalid eventdev.

Also the flags could be just bitfield to save some space.

Something like this. Untested since I have no hardware with
eventdevs.

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index f53fab2e3346..d330afd6815e 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -132,11 +132,11 @@ struct eventdev_params {
 	uint16_t queues[MAX_PORTS_QUEUES];
 	uint16_t num_queues;
 	uint16_t num_ports;
-	uint32_t shw_all_queues;
-	uint32_t shw_all_ports;
-	uint32_t dump_xstats;
-	uint32_t reset_xstats;
-	uint32_t shw_device_xstats;
+	uint8_t shw_all_queues:1,
+		shw_all_ports:1,
+		dump_xstats:1,
+		reset_xstats:1,
+		shw_device_xstats:1;
 };
 
 static struct eventdev_params eventdev_var[RTE_EVENT_MAX_DEVS];
@@ -261,71 +261,57 @@ parse_descriptor_param(char *list, struct desc_param *desc)
 	return 0;
 }
 
-static int
-parse_eventdev_dump_xstats_params(char *list)
+static uint16_t parse_eventdev(const char *str)
 {
 	unsigned long evdev_id;
 	char *endp;
 
-	evdev_id = strtoul(list, &endp, 0);
-
-	if (*list == '\0' || *endp != '\0' || evdev_id >= RTE_EVENT_MAX_DEVS) {
-		fprintf(stderr, "Invalid eventdev id: %s\n", list);
-		return -EINVAL;
+	evdev_id = strtoul(str, &endp, 0);
+	if (*str == '\0' || *endp != '\0' || evdev_id >= rte_event_dev_count()) {
+		fprintf(stderr, "Invalid eventdev id: %s\n", str);
+		return -1;
 	}
+	return evdev_id;
+}
 
-	eventdev_var[evdev_id].dump_xstats = 1;
+static int
+parse_eventdev_dump_xstats_params(const char *list)
+{
+	int evdev_id = parse_eventdev(list);
 
-	if (evdev_id >= rte_event_dev_count())
-		rte_panic("Invalid eventdev id: %s\n", list);
+	if (evdev_id < 0)
+		return -EINVAL;
 
+	eventdev_var[evdev_id].dump_xstats = 1;
 	return 0;
 }
 
 static int
-parse_eventdev_reset_xstats_params(char *list)
+parse_eventdev_reset_xstats_params(const char *list)
 {
-	unsigned long evdev_id;
-	char *endp;
-
-	evdev_id = strtoul(list, &endp, 0);
+	int evdev_id = parse_eventdev(list);
 
-	if (*list == '\0' || *endp != '\0' || evdev_id >= RTE_EVENT_MAX_DEVS) {
-		fprintf(stderr, "Invalid eventdev id: %s\n", list);
+	if (evdev_id < 0)
 		return -EINVAL;
-	}
 
 	eventdev_var[evdev_id].reset_xstats = 1;
-
-	if (evdev_id >= rte_event_dev_count())
-		rte_panic("Invalid eventdev id: %s\n", list);
-
 	return 0;
 }
 
 static int
-parse_eventdev_device_xstats_params(char *list)
+parse_eventdev_device_xstats_params(const char *list)
 {
-	unsigned long evdev_id;
-	char *endp;
-
-	evdev_id = strtoul(list, &endp, 0);
+	int evdev_id = parse_eventdev(list);
 
-	if (*list == '\0' || *endp != '\0' || evdev_id >= RTE_EVENT_MAX_DEVS) {
-		fprintf(stderr, "Invalid eventdev id: %s\n", list);
+	if (evdev_id < 0)
 		return -EINVAL;
-	}
 
 	eventdev_var[evdev_id].shw_device_xstats = 1;
-
-	if (evdev_id >= rte_event_dev_count())
-		rte_panic("Invalid eventdev id: %s\n", list);
-
 	return 0;
 }
 
 static int
-parse_eventdev_queue_xstats_params(char *list)
+parse_eventdev_queue_xstats_params(const char *list)
 {
 	uint16_t queue_id;
 	uint16_t evdev_id;
@@ -353,7 +339,7 @@ parse_eventdev_queue_xstats_params(char *list)
 		return -EINVAL;
 	}
 
-	if (evdev_id >= rte_event_dev_count())
+
 		rte_panic("invalid event device %hu\n", evdev_id);
 
 	return 0;


  reply	other threads:[~2023-05-25 17:35 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09 15:30 [PATCH] app/eventdev_dump: introduce eventdev_dump application Timothy McDaniel
2022-04-10  6:48 ` Jerin Jacob
2022-04-10 13:18   ` McDaniel, Timothy
2023-02-06 18:34 ` [PATCH v2] app/procinfo: display eventdev xstats for PMD data Abdullah Sevincer
2023-02-06 23:05 ` [PATCH v3] " Abdullah Sevincer
2023-02-07  0:22   ` Stephen Hemminger
2023-02-12 19:43     ` Sevincer, Abdullah
2023-02-17 15:58       ` Sevincer, Abdullah
2023-02-17 16:33         ` Stephen Hemminger
2023-02-22  1:54           ` Sevincer, Abdullah
2023-02-07  0:04 ` [PATCH v4] " Abdullah Sevincer
2023-02-07 16:33 ` [PATCH v5] " Abdullah Sevincer
2023-02-23  1:08 ` [PATCH v6] " Abdullah Sevincer
2023-02-27 16:33   ` Jerin Jacob
2023-03-03 10:58   ` Pattan, Reshma
2023-03-03 16:22     ` Sevincer, Abdullah
2023-03-04  7:17       ` Pattan, Reshma
2023-03-09 18:27   ` [PATCH v7] app/procinfo: display eventdev xstats Abdullah Sevincer
2023-03-09 20:31     ` Stephen Hemminger
2023-03-10 17:35       ` Sevincer, Abdullah
2023-03-10 17:49         ` Stephen Hemminger
2023-03-10 18:06           ` Sevincer, Abdullah
2023-03-09 18:51   ` [PATCH v8] " Abdullah Sevincer
2023-03-15 11:56     ` Pattan, Reshma
2023-03-15 19:40       ` Sevincer, Abdullah
2023-03-15 14:24     ` Pattan, Reshma
2023-03-18 18:49       ` Sevincer, Abdullah
2023-03-20  2:11     ` [PATCH v9] " Abdullah Sevincer
2023-03-20  2:15     ` [PATCH v10] " Abdullah Sevincer
2023-03-20  2:19     ` [PATCH v11] " Abdullah Sevincer
2023-03-20  2:23     ` [PATCH v12] " Abdullah Sevincer
2023-03-20 17:29       ` Pattan, Reshma
2023-03-20 18:01         ` Sevincer, Abdullah
2023-03-20 18:35         ` Sevincer, Abdullah
2023-03-21  9:37           ` Pattan, Reshma
2023-03-21 10:20             ` Sevincer, Abdullah
2023-03-21 10:27               ` Pattan, Reshma
2023-05-17 21:22       ` [PATCH v13] " Abdullah Sevincer
2023-05-17 22:37       ` [PATCH v14] " Abdullah Sevincer
2023-05-17 22:45         ` Stephen Hemminger
2023-05-17 23:30           ` Sevincer, Abdullah
2023-05-24 15:09         ` Pattan, Reshma
2023-05-25  6:08         ` [PATCH v15] " Abdullah Sevincer
2023-05-25 15:24           ` Stephen Hemminger
2023-05-25 16:41         ` [PATCH v16] " Abdullah Sevincer
2023-05-25 17:35           ` Stephen Hemminger [this message]
2023-05-25 17:56             ` Sevincer, Abdullah
2023-05-25 18:47           ` [PATCH v17] " Abdullah Sevincer
2023-05-25 20:07             ` Stephen Hemminger
2023-07-07  9:15               ` Thomas Monjalon
2023-07-07 14:55                 ` Stephen Hemminger
2023-07-08 15:11                   ` Sevincer, Abdullah
2023-07-08 15:26                     ` Stephen Hemminger
2023-05-26  8:32             ` Pattan, Reshma
2023-06-08 17:35             ` Sevincer, Abdullah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230525103504.47375d4d@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=abdullah.sevincer@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=reshma.pattan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).