From: Abdullah Sevincer <abdullah.sevincer@intel.com>
To: dev@dpdk.org
Cc: reshma.pattan@intel.com, stephen@networkplumber.org,
Abdullah Sevincer <abdullah.sevincer@intel.com>,
stable@dpdk.org
Subject: [PATCH v1] app/procinfo: revise display eventdev xstats
Date: Sat, 8 Jul 2023 11:23:56 -0500 [thread overview]
Message-ID: <20230708162356.2961843-1-abdullah.sevincer@intel.com> (raw)
process_eventdev_xstats() function was iterating over
eventdev_var[] structure even if there is no eventdev present.
Revised the code to check to iterate and only look for the number
of eventdevs present in the system. Also, shortened function name to
eventdev_xstats().
Coverity issue: 395458
Fixes: 674bb3906931 ("app/procinfo: display eventdev xstats")
Cc: stable@dpdk.org
Signed-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com>
---
app/proc-info/main.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index be63eace69..88cee0ca48 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -2045,19 +2045,16 @@ xstats_reset(uint8_t dev_id,
}
-static int
-process_eventdev_xstats(void)
+static unsigned int
+eventdev_xstats(void)
{
- int i;
- int j;
- int processing_eventdev_xstats = 0;
-
- for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) {
+ unsigned int count = 0;
+ int i, j;
- if (!processing_eventdev_xstats)
- processing_eventdev_xstats = 1;
+ for (i = 0; i < rte_event_dev_count(); i++) {
if (eventdev_var[i].dump_xstats) {
+ ++count;
int ret = rte_event_dev_dump(i, stdout);
if (ret)
@@ -2065,6 +2062,7 @@ process_eventdev_xstats(void)
}
if (eventdev_var[i].shw_device_xstats == 1) {
+ ++count;
xstats_display(i, RTE_EVENT_DEV_XSTATS_DEVICE, 0);
if (eventdev_var[i].reset_xstats == 1)
@@ -2072,6 +2070,7 @@ process_eventdev_xstats(void)
}
if (eventdev_var[i].shw_all_ports == 1) {
+ ++count;
for (j = 0; j < MAX_PORTS_QUEUES; j++) {
xstats_display(i, RTE_EVENT_DEV_XSTATS_PORT, j);
@@ -2079,6 +2078,8 @@ process_eventdev_xstats(void)
xstats_reset(i, RTE_EVENT_DEV_XSTATS_PORT, j);
}
} else {
+ if (eventdev_var[i].num_ports > 0)
+ ++count;
for (j = 0; j < eventdev_var[i].num_ports; j++) {
xstats_display(i, RTE_EVENT_DEV_XSTATS_PORT,
eventdev_var[i].ports[j]);
@@ -2090,6 +2091,7 @@ process_eventdev_xstats(void)
}
if (eventdev_var[i].shw_all_queues == 1) {
+ ++count;
for (j = 0; j < MAX_PORTS_QUEUES; j++) {
xstats_display(i, RTE_EVENT_DEV_XSTATS_QUEUE, j);
@@ -2097,6 +2099,8 @@ process_eventdev_xstats(void)
xstats_reset(i, RTE_EVENT_DEV_XSTATS_QUEUE, j);
}
} else {
+ if (eventdev_var[i].num_queues > 0)
+ ++count;
for (j = 0; j < eventdev_var[i].num_queues; j++) {
xstats_display(i, RTE_EVENT_DEV_XSTATS_QUEUE,
eventdev_var[i].queues[j]);
@@ -2108,10 +2112,7 @@ process_eventdev_xstats(void)
}
}
- if (processing_eventdev_xstats)
- return 1;
-
- return 0;
+ return count;
}
int
@@ -2164,7 +2165,7 @@ main(int argc, char **argv)
return 0;
}
- if (process_eventdev_xstats())
+ if (eventdev_xstats() > 0)
return 0;
nb_ports = rte_eth_dev_count_avail();
--
2.25.1
next reply other threads:[~2023-07-08 16:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-08 16:23 Abdullah Sevincer [this message]
2023-07-12 2:43 ` Yuan, DukaiX
2023-07-12 14:22 ` Thomas Monjalon
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=20230708162356.2961843-1-abdullah.sevincer@intel.com \
--to=abdullah.sevincer@intel.com \
--cc=dev@dpdk.org \
--cc=reshma.pattan@intel.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
/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).