[PATCH v17] app/procinfo: display eventdev xstats
Stephen Hemminger
stephen at networkplumber.org
Sat Jul 8 17:26:58 CEST 2023
On Sat, 8 Jul 2023 15:11:45 +0000
"Sevincer, Abdullah" <abdullah.sevincer at intel.com> wrote:
> >+Has new coverity issue.
> >+The reason is the boolean is set every time because it gets every time.
>
> >+Looks like code goes over eventdev_var[] even if no eventdevs are present.
> >+Should only look for the number of eventdevs
>
> Thanks Stephen, I will add a condition at the top of the function like:
>
> evdevs = rte_event_dev_count();
> if (!evdevs)
> return 0;
>
> This will ensure if there is no eventdev device function returns.
>
> I will also change the for loop to iterate only with the count of evdevs like:
> for (i = 0; i < evdevs; i++) {....... instead of for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) {.
>
> I still need that flag to be set when a user sets a value from command line for a queue or port.
> The flag is needed to display and exit from the program.
>
> if (process_eventdev_xstats())
> return 0;
>
Maybe something like this:
PS: also shortened variable names for clarity
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index be63eace6909..e3d2578c39dc 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -2045,18 +2045,13 @@ 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++) {
-
- if (!processing_eventdev_xstats)
- processing_eventdev_xstats = 1;
+ unsigned int count = 0;
+ int i, j;
+ for (i = 0; i < rte_event_dev_count(); i++) {
if (eventdev_var[i].dump_xstats) {
int ret = rte_event_dev_dump(i, stdout);
@@ -2106,12 +2101,10 @@ process_eventdev_xstats(void)
eventdev_var[i].queues[j]);
}
}
+ ++count;
}
- if (processing_eventdev_xstats)
- return 1;
-
- return 0;
+ return count;
}
int
@@ -2164,7 +2157,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();
More information about the dev
mailing list