X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev-tunnel.c;h=797813b05d94cdfb985e4ac129ce545628be67c8;hb=59af549f66c770a9c76a4f00d10abf5dd2009f6e;hp=91220a6c0448ef37410c2b160eb6bf7c246141cc;hpb=6b66a4abaf9336dcaa11f2fba1ceb7efabed0b7f;p=sliver-openvswitch.git diff --git a/lib/netdev-tunnel.c b/lib/netdev-tunnel.c index 91220a6c0..797813b05 100644 --- a/lib/netdev-tunnel.c +++ b/lib/netdev-tunnel.c @@ -439,12 +439,50 @@ netdev_tunnel_get_port(struct unixctl_conn *conn, unixctl_command_reply(conn, buf); } +static void +netdev_tunnel_get_tx_bytes(struct unixctl_conn *conn, + int argc OVS_UNUSED, const char *argv[], void *aux OVS_UNUSED) +{ + struct netdev_dev_tunnel *tunnel_dev; + char buf[128]; + + tunnel_dev = shash_find_data(&tunnel_netdev_devs, argv[1]); + if (!tunnel_dev) { + unixctl_command_reply_error(conn, "no such tunnel netdev"); + return; + } + + sprintf(buf, "%"PRIu64, tunnel_dev->stats.tx_bytes); + unixctl_command_reply(conn, buf); +} + +static void +netdev_tunnel_get_rx_bytes(struct unixctl_conn *conn, + int argc OVS_UNUSED, const char *argv[], void *aux OVS_UNUSED) +{ + struct netdev_dev_tunnel *tunnel_dev; + char buf[128]; + + tunnel_dev = shash_find_data(&tunnel_netdev_devs, argv[1]); + if (!tunnel_dev) { + unixctl_command_reply_error(conn, "no such tunnel netdev"); + return; + } + + sprintf(buf, "%"PRIu64, tunnel_dev->stats.rx_bytes); + unixctl_command_reply(conn, buf); +} + static int netdev_tunnel_init(void) { unixctl_command_register("netdev-tunnel/get-port", "NAME", 1, 1, netdev_tunnel_get_port, NULL); + unixctl_command_register("netdev-tunnel/get-tx-bytes", "NAME", + 1, 1, netdev_tunnel_get_tx_bytes, NULL); + unixctl_command_register("netdev-tunnel/get-rx-bytes", "NAME", + 1, 1, netdev_tunnel_get_rx_bytes, NULL); return 0; }