Soft Patch Panel
 help / color / mirror / Atom feed
From: Itsuro Oda <oda@valinux.co.jp>
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 1/1] spp_primary: fix incorrect statistics
Date: Wed, 18 Dec 2019 14:02:03 +0900	[thread overview]
Message-ID: <20191218050203.2898-2-oda@valinux.co.jp> (raw)
In-Reply-To: <20191218050203.2898-1-oda@valinux.co.jp>

When showing primary's stat, tx_drops of physical ports
indicates tx_drops of the ring which has same ID mistakenly.
Also stats of ring ports includes other type of ports (ex. vhost)
which has same ID mistakenly. This patch fiexes these mistakes.

Signed-off-by: Itsuro Oda <oda@valinux.co.jp>
---
 src/nfv/commands.h |  7 ++++++-
 src/primary/main.c | 11 ++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/nfv/commands.h b/src/nfv/commands.h
index 4a6a170..f6c2305 100644
--- a/src/nfv/commands.h
+++ b/src/nfv/commands.h
@@ -88,7 +88,12 @@ do_add(char *p_type, int p_id)
 	port_id = (uint16_t) res;
 	port_map[port_id].id = p_id;
 	port_map[port_id].port_type = type;
-	port_map[port_id].stats = &ports->client_stats[p_id];
+	if (type == RING)
+		port_map[port_id].stats = &ports->client_stats[p_id];
+	/* NOTE: port_map[].stats points to &port_map[].default_stats
+	 * other than RING. There is no support to show/clear this stats
+	 * at the moment.
+	 */
 
 	/* Update ports_fwd_array with port id */
 	ports_fwd_array[port_id].in_port_id = port_id;
diff --git a/src/primary/main.c b/src/primary/main.c
index fbc47c3..26e9c42 100644
--- a/src/primary/main.c
+++ b/src/primary/main.c
@@ -118,7 +118,7 @@ do_stats_display(void)
 			" tx_drop: %9"PRIu64"\n",
 			ports->id[i], ports->port_stats[i].rx,
 			ports->port_stats[i].tx,
-			ports->client_stats[i].tx_drop);
+			ports->port_stats[i].tx_drop);
 	}
 
 	printf("\nCLIENTS\n");
@@ -644,7 +644,7 @@ phy_port_stats_json(char *str)
 				get_printable_mac_addr(ports->id[i]),
 				ports->port_stats[i].rx,
 				ports->port_stats[i].tx,
-				ports->client_stats[i].tx_drop);
+				ports->port_stats[i].tx_drop);
 
 		int cur_buf_size = (int)strlen(buf_phy_ports) +
 			(int)strlen(phy_port);
@@ -827,7 +827,12 @@ add_port(char *p_type, int p_id)
 	port_id = (uint16_t) res;
 	port_map[port_id].id = p_id;
 	port_map[port_id].port_type = port_id_list[cnt].type;
-	port_map[port_id].stats = &ports->client_stats[p_id];
+	if (port_map[port_id].port_type == RING)
+		port_map[port_id].stats = &ports->client_stats[p_id];
+	/* NOTE: port_map[].stats points to &port_map[].default_stats
+	 * other than RING. There is no support to show/clear this stats
+	 * at the moment.
+	 */
 
 	/* Update ports_fwd_array with port id */
 	ports_fwd_array[port_id].in_port_id = port_id;
-- 
2.17.1


  reply	other threads:[~2019-12-18  5:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18  5:02 [spp] [PATCH 0/1] " Itsuro Oda
2019-12-18  5:02 ` Itsuro Oda [this message]
2019-12-18  6:58   ` [spp] [PATCH 1/1] " Yasufumi Ogawa

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=20191218050203.2898-2-oda@valinux.co.jp \
    --to=oda@valinux.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    --cc=yasufum.o@gmail.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).