netdev_tunnel_create(const struct netdev_class *class, const char *name,
struct netdev_dev **netdev_devp)
{
- static unsigned int n = 0xaa550000;
+ static unsigned int n = 0;
struct netdev_dev_tunnel *netdev_dev;
int error;
netdev_dev = xzalloc(sizeof *netdev_dev);
netdev_dev_init(&netdev_dev->netdev_dev, name, class);
- netdev_dev->hwaddr[0] = 0x55;
- netdev_dev->hwaddr[1] = 0xaa;
- netdev_dev->hwaddr[2] = n >> 24;
+ netdev_dev->hwaddr[0] = 0xfe;
+ netdev_dev->hwaddr[1] = 0xff;
+ netdev_dev->hwaddr[2] = 0xff;
netdev_dev->hwaddr[3] = n >> 16;
netdev_dev->hwaddr[4] = n >> 8;
netdev_dev->hwaddr[5] = n;
netdev_get_name(netdev_), (uintptr_t)buffer, size, retval);
if (retval >= 0) {
dev->stats.tx_packets++;
- dev->stats.tx_bytes++;
+ dev->stats.tx_bytes += retval;
if (retval != size) {
VLOG_WARN_RL(&rl, "sent partial Ethernet packet (%"PRId64" bytes of "
"%"PRIu64") on %s", retval, size, netdev_get_name(netdev_));
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;
}