@@ -1075,7 +1075,11 @@ netdev_dummy_get_stats(const struct netdev *netdev, struct netdev_stats *stats)
struct netdev_dummy *dev = netdev_dummy_cast(netdev);
ovs_mutex_lock(&dev->mutex);
- *stats = dev->stats;
+ /* Passing only collected counters */
+ stats->tx_packets = dev->stats.tx_packets;
+ stats->tx_bytes = dev->stats.tx_bytes;
+ stats->rx_packets = dev->stats.rx_packets;
+ stats->rx_bytes = dev->stats.rx_bytes;
ovs_mutex_unlock(&dev->mutex);
return 0;
@@ -1685,17 +1685,10 @@ 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,
- uint64_t filter, int more)
+print_port_stat_cond(struct ds *string, const char *leader, uint64_t stat)
{
- if (stat != filter) {
- print_port_stat(string, leader, stat, more);
- } else {
- if (0 == more) {
- /* Line will be terminated even if filtering
- * condition isn't met. */
- print_port_stat(string, "", stat, more);
- }
+ if (stat != UINT64_MAX) {
+ ds_put_format(string, "%s%"PRIu64", ", leader, stat);
}
}
@@ -1769,29 +1762,29 @@ ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh,
ds_init(&string_ext_stats);
print_port_stat_cond(&string_ext_stats, "1_to_64_packets=",
- ps.stats.rx_1_to_64_packets, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ ps.stats.rx_1523_to_max_packets);
print_port_stat_cond(&string_ext_stats, "broadcast_packets=",
- ps.stats.rx_broadcast_packets, UINT64_MAX, 1);
+ ps.stats.rx_broadcast_packets);
print_port_stat_cond(&string_ext_stats, "undersized_errors=",
- ps.stats.rx_undersized_errors, UINT64_MAX, 1);
+ ps.stats.rx_undersized_errors);
print_port_stat_cond(&string_ext_stats, "oversize_errors=",
- ps.stats.rx_oversize_errors, UINT64_MAX, 1);
+ ps.stats.rx_oversize_errors);
print_port_stat_cond(&string_ext_stats, "rx_fragmented_errors=",
- ps.stats.rx_fragmented_errors, UINT64_MAX, 1);
+ ps.stats.rx_fragmented_errors);
print_port_stat_cond(&string_ext_stats, "rx_jabber_errors=",
- ps.stats.rx_jabber_errors, UINT64_MAX, 1);
+ ps.stats.rx_jabber_errors);
if (string_ext_stats.length != 0) {
/* If at least one statistics counter is reported: */
@@ -1805,23 +1798,23 @@ ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh,
ds_init(&string_ext_stats);
print_port_stat_cond(&string_ext_stats, "1_to_64_packets=",
- ps.stats.tx_1_to_64_packets, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ 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, UINT64_MAX, 1);
+ ps.stats.tx_1523_to_max_packets);
print_port_stat_cond(&string_ext_stats, "multicast_packets=",
- ps.stats.tx_multicast_packets, UINT64_MAX, 1);
+ ps.stats.tx_multicast_packets);
print_port_stat_cond(&string_ext_stats, "broadcast_packets=",
- ps.stats.tx_broadcast_packets, UINT64_MAX, 1);
+ ps.stats.tx_broadcast_packets);
if (string_ext_stats.length != 0) {
/* If at least one statistics counter is reported: */
@@ -329,11 +329,11 @@ NXST_FLOW reply:
AT_CHECK(
[(ovs-ofctl dump-ports br0 2; ovs-ofctl dump-ports br0 3) | strip_xids], [0],
[OFPST_PORT reply: 1 ports
- port 2: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=1, bytes=60, drop=0, errs=0, coll=0
+ port 2: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=1, bytes=60, drop=?, errs=?, coll=?
OFPST_PORT reply: 1 ports
- port 3: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=9, bytes=540, drop=0, errs=0, coll=0
+ port 3: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=9, bytes=540, drop=?, errs=?, coll=?
])
OVS_VSWITCHD_STOP
@@ -380,11 +380,11 @@ done
AT_CHECK(
[(ovs-ofctl dump-ports br0 2; ovs-ofctl dump-ports br0 3) | strip_xids], [0],
[OFPST_PORT reply: 1 ports
- port 2: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=2, bytes=120, drop=0, errs=0, coll=0
+ port 2: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=2, bytes=120, drop=?, errs=?, coll=?
OFPST_PORT reply: 1 ports
- port 3: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=18, bytes=1080, drop=0, errs=0, coll=0
+ port 3: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=18, bytes=1080, drop=?, errs=?, coll=?
])
# Check for the learning entry.
@@ -466,11 +466,11 @@ done
AT_CHECK(
[(ovs-ofctl dump-ports br0 2; ovs-ofctl dump-ports br0 3) | strip_xids], [0],
[OFPST_PORT reply: 1 ports
- port 2: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=3, bytes=180, drop=0, errs=0, coll=0
+ port 2: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=3, bytes=180, drop=?, errs=?, coll=?
OFPST_PORT reply: 1 ports
- port 3: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=17, bytes=1020, drop=0, errs=0, coll=0
+ port 3: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=17, bytes=1020, drop=?, errs=?, coll=?
])
# Check for the learning entry.
@@ -5163,17 +5163,17 @@ IFCOUNTERS
status=0
in_octets=0
in_unicasts=0
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=120
out_unicasts=2
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=2
@@ -5186,17 +5186,17 @@ IFCOUNTERS
status=0
in_octets=138
in_unicasts=3
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=120
out_unicasts=2
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=2
@@ -5209,17 +5209,17 @@ IFCOUNTERS
status=0
in_octets=84
in_unicasts=2
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=180
out_unicasts=3
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=3
@@ -5232,17 +5232,17 @@ IFCOUNTERS
status=0
in_octets=0
in_unicasts=0
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=120
out_unicasts=2
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=3
@@ -5255,17 +5255,17 @@ IFCOUNTERS
status=0
in_octets=138
in_unicasts=3
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=120
out_unicasts=2
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=3
@@ -5278,17 +5278,17 @@ IFCOUNTERS
status=0
in_octets=84
in_unicasts=2
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=180
out_unicasts=3
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
OPENFLOWPORT
datapath_id=18364758544493064720
@@ -84,8 +84,8 @@ OVS_VSWITCHD_START
AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
AT_CHECK([strip_xids < stdout], [0], [dnl
OFPST_PORT reply: 1 ports
- port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=0, bytes=0, drop=0, errs=0, coll=0
+ port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=0, bytes=0, drop=?, errs=?, coll=?
])
OVS_VSWITCHD_STOP
AT_CLEANUP
@@ -95,8 +95,8 @@ OVS_VSWITCHD_START
AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
AT_CHECK([strip_xids < stdout], [0], [dnl
OFPST_PORT reply (OF1.2): 1 ports
- port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=0, bytes=0, drop=0, errs=0, coll=0
+ port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=0, bytes=0, drop=?, errs=?, coll=?
])
OVS_VSWITCHD_STOP
AT_CLEANUP
@@ -104,11 +104,11 @@ AT_CLEANUP
AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
OVS_VSWITCHD_START
AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
-AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sed '/rfc2819/d'],
+AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
[0], [dnl
OFPST_PORT reply (OF1.4): 1 ports
- port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=0, bytes=0, drop=0, errs=0, coll=0
+ port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=0, bytes=0, drop=?, errs=?, coll=?
duration=?s
])
OVS_VSWITCHD_STOP