summaryrefslogtreecommitdiff
path: root/lib/ofp-print.c
diff options
context:
space:
mode:
authormweglicx <michalx.weglicki@intel.com>2016-05-05 09:46:01 +0100
committerBen Pfaff <blp@ovn.org>2016-05-06 15:28:56 -0700
commitd6e3feb57c44e18580015d8e99dd751cff4f2c9e (patch)
tree2d243eed928b2b3fad094e9990f98713176adbc4 /lib/ofp-print.c
parent104aec4e0c57bc92a3c22cea9dff69f74adda861 (diff)
downloadopenvswitch-d6e3feb57c44e18580015d8e99dd751cff4f2c9e.tar.gz
Add support for extended netdev statistics based on RFC 2819.
Implementation of new statistics extension for DPDK ports: - Add new counters definition to netdev struct and open flow, based on RFC2819. - Initialize netdev statistics as "filtered out" before passing it to particular netdev implementation (because of that change, statistics which are not collected are reported as filtered out, and some unit tests were modified in this respect). - New statistics are retrieved using experimenter code and are printed as a result to ofctl dump-ports. - New counters are available for OpenFlow 1.4+. - Add new vendor id: INTEL_VENDOR_ID. - New statistics are printed to output via ofctl only if those are present in reply message. - Add new file header: include/openflow/intel-ext.h which contains new statistics definition. - Extended statistics are implemented only for dpdk-physical and dpdk-vhost port types. - Dpdk-physical implementation uses xstats to collect statistics. - Dpdk-vhost implements only part of statistics (RX packet sized based counters). Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com> [blp@ovn.org made software devices more consistent] Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/ofp-print.c')
-rw-r--r--lib/ofp-print.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 69f90f301..b21d76f53 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -1685,6 +1685,14 @@ print_port_stat(struct ds *string, const char *leader, uint64_t stat, int more)
}
static void
+print_port_stat_cond(struct ds *string, const char *leader, uint64_t stat)
+{
+ if (stat != UINT64_MAX) {
+ ds_put_format(string, "%s%"PRIu64", ", leader, stat);
+ }
+}
+
+static void
ofp_print_ofpst_port_request(struct ds *string, const struct ofp_header *oh)
{
ofp_port_t ofp10_port;
@@ -1749,6 +1757,73 @@ ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh,
ofp_print_duration(string, ps.duration_sec, ps.duration_nsec);
ds_put_char(string, '\n');
}
+ struct ds string_ext_stats = DS_EMPTY_INITIALIZER;
+
+ ds_init(&string_ext_stats);
+
+ print_port_stat_cond(&string_ext_stats, "1_to_64_packets=",
+ ps.stats.rx_1_to_64_packets);
+ print_port_stat_cond(&string_ext_stats, "65_to_127_packets=",
+ ps.stats.rx_65_to_127_packets);
+ print_port_stat_cond(&string_ext_stats, "128_to_255_packets=",
+ ps.stats.rx_128_to_255_packets);
+ print_port_stat_cond(&string_ext_stats, "256_to_511_packets=",
+ ps.stats.rx_256_to_511_packets);
+ print_port_stat_cond(&string_ext_stats, "512_to_1023_packets=",
+ ps.stats.rx_512_to_1023_packets);
+ print_port_stat_cond(&string_ext_stats, "1024_to_1522_packets=",
+ ps.stats.rx_1024_to_1522_packets);
+ print_port_stat_cond(&string_ext_stats, "1523_to_max_packets=",
+ ps.stats.rx_1523_to_max_packets);
+ print_port_stat_cond(&string_ext_stats, "broadcast_packets=",
+ ps.stats.rx_broadcast_packets);
+ print_port_stat_cond(&string_ext_stats, "undersized_errors=",
+ ps.stats.rx_undersized_errors);
+ print_port_stat_cond(&string_ext_stats, "oversize_errors=",
+ ps.stats.rx_oversize_errors);
+ print_port_stat_cond(&string_ext_stats, "rx_fragmented_errors=",
+ ps.stats.rx_fragmented_errors);
+ print_port_stat_cond(&string_ext_stats, "rx_jabber_errors=",
+ ps.stats.rx_jabber_errors);
+
+ if (string_ext_stats.length != 0) {
+ /* If at least one statistics counter is reported: */
+ ds_put_cstr(string, " rx rfc2819 ");
+ ds_put_buffer(string, string_ext_stats.string,
+ string_ext_stats.length);
+ ds_put_cstr(string, "\n");
+ ds_destroy(&string_ext_stats);
+ }
+
+ ds_init(&string_ext_stats);
+
+ print_port_stat_cond(&string_ext_stats, "1_to_64_packets=",
+ ps.stats.tx_1_to_64_packets);
+ print_port_stat_cond(&string_ext_stats, "65_to_127_packets=",
+ ps.stats.tx_65_to_127_packets);
+ print_port_stat_cond(&string_ext_stats, "128_to_255_packets=",
+ ps.stats.tx_128_to_255_packets);
+ print_port_stat_cond(&string_ext_stats, "256_to_511_packets=",
+ ps.stats.tx_256_to_511_packets);
+ print_port_stat_cond(&string_ext_stats, "512_to_1023_packets=",
+ ps.stats.tx_512_to_1023_packets);
+ print_port_stat_cond(&string_ext_stats, "1024_to_1522_packets=",
+ ps.stats.tx_1024_to_1522_packets);
+ print_port_stat_cond(&string_ext_stats, "1523_to_max_packets=",
+ ps.stats.tx_1523_to_max_packets);
+ print_port_stat_cond(&string_ext_stats, "multicast_packets=",
+ ps.stats.tx_multicast_packets);
+ print_port_stat_cond(&string_ext_stats, "broadcast_packets=",
+ ps.stats.tx_broadcast_packets);
+
+ if (string_ext_stats.length != 0) {
+ /* If at least one statistics counter is reported: */
+ ds_put_cstr(string, " tx rfc2819 ");
+ ds_put_buffer(string, string_ext_stats.string,
+ string_ext_stats.length);
+ ds_put_cstr(string, "\n");
+ ds_destroy(&string_ext_stats);
+ }
}
}