[spp] [PATCH 1/1] spp_primary: fix incorrect statistics
Itsuro Oda
oda at valinux.co.jp
Wed Dec 18 06:02:03 CET 2019
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 at 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
More information about the spp
mailing list