patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1] app/procinfo: revise display eventdev xstats
@ 2023-07-08 16:23 Abdullah Sevincer
  2023-07-12  2:43 ` Yuan, DukaiX
  0 siblings, 1 reply; 3+ messages in thread
From: Abdullah Sevincer @ 2023-07-08 16:23 UTC (permalink / raw)
  To: dev; +Cc: reshma.pattan, stephen, Abdullah Sevincer, stable

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v1] app/procinfo: revise display eventdev xstats
  2023-07-08 16:23 [PATCH v1] app/procinfo: revise display eventdev xstats Abdullah Sevincer
@ 2023-07-12  2:43 ` Yuan, DukaiX
  2023-07-12 14:22   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Yuan, DukaiX @ 2023-07-12  2:43 UTC (permalink / raw)
  To: Sevincer, Abdullah, dev
  Cc: Pattan, Reshma, stephen, Sevincer, Abdullah, stable

> -----Original Message-----
> From: Abdullah Sevincer <abdullah.sevincer@intel.com>
> Sent: 2023年7月9日 0:24
> To: dev@dpdk.org
> Cc: Pattan, Reshma <reshma.pattan@intel.com>;
> stephen@networkplumber.org; Sevincer, Abdullah
> <abdullah.sevincer@intel.com>; stable@dpdk.org
> Subject: [PATCH v1] app/procinfo: revise display eventdev xstats
>
> 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>
> ---
Tested-by: Dukai Yuan<dukaix.yuan@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] app/procinfo: revise display eventdev xstats
  2023-07-12  2:43 ` Yuan, DukaiX
@ 2023-07-12 14:22   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2023-07-12 14:22 UTC (permalink / raw)
  To: Sevincer, Abdullah
  Cc: dev, stable, Pattan, Reshma, stephen, Sevincer, Abdullah, stable,
	Yuan, DukaiX

> > 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>
> > ---
> Tested-by: Dukai Yuan<dukaix.yuan@intel.com>

No need Cc stable when the bug was introduced in the same release.

Applied, thanks.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-12 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-08 16:23 [PATCH v1] app/procinfo: revise display eventdev xstats Abdullah Sevincer
2023-07-12  2:43 ` Yuan, DukaiX
2023-07-12 14:22   ` Thomas Monjalon

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).