2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

ovs-dpctl: Add -s option to print packet and byte counters.

This commit is contained in:
Ben Pfaff
2011-04-28 13:02:15 -07:00
parent d39808227b
commit 032aa6a354
6 changed files with 86 additions and 3 deletions

View File

@@ -35,6 +35,7 @@
#include "bitmap.h"
#include "dpif-provider.h"
#include "netdev.h"
#include "netdev-linux.h"
#include "netdev-vport.h"
#include "netlink-socket.h"
#include "netlink.h"
@@ -431,6 +432,12 @@ dpif_linux_port_query__(const struct dpif *dpif, uint32_t port_no,
dpif_port->name = xstrdup(reply.name);
dpif_port->type = xstrdup(netdev_vport_get_netdev_type(&reply));
dpif_port->port_no = reply.port_no;
if (reply.stats) {
netdev_stats_from_rtnl_link_stats64(&dpif_port->stats,
reply.stats);
} else {
memset(&dpif_port->stats, 0xff, sizeof dpif_port->stats);
}
ofpbuf_delete(buf);
}
return error;
@@ -526,6 +533,11 @@ dpif_linux_port_dump_next(const struct dpif *dpif OVS_UNUSED, void *state_,
dpif_port->name = (char *) vport.name;
dpif_port->type = (char *) netdev_vport_get_netdev_type(&vport);
dpif_port->port_no = vport.port_no;
if (vport.stats) {
netdev_stats_from_rtnl_link_stats64(&dpif_port->stats, vport.stats);
} else {
memset(&dpif_port->stats, 0xff, sizeof dpif_port->stats);
}
return 0;
}