unaligned: Add unaligned accessors for ovs_be<N> data.
[sliver-openvswitch.git] / lib / netdev-vport.c
index 1672a9b..197e74b 100644 (file)
@@ -32,7 +32,7 @@
 #include "socket-util.h"
 #include "vlog.h"
 
-VLOG_DEFINE_THIS_MODULE(netdev_vport)
+VLOG_DEFINE_THIS_MODULE(netdev_vport);
 
 struct netdev_vport_notifier {
     struct netdev_notifier notifier;
@@ -110,7 +110,7 @@ netdev_vport_parse_config(const struct netdev_class *netdev_class,
         info.devname = name;
         info.type = netdev_class->type;
         error = (c->parse_config)(&info, args);
-        *configp = info.config;
+        *configp = error ? NULL : info.config;
         return error;
     } else {
         if (!shash_is_empty(args)) {
@@ -124,8 +124,7 @@ netdev_vport_parse_config(const struct netdev_class *netdev_class,
 
 static int
 netdev_vport_create(const struct netdev_class *class, const char *name,
-                    const struct shash *args OVS_UNUSED,
-                    struct netdev_dev **netdev_devp)
+                    const struct shash *args, struct netdev_dev **netdev_devp)
 {
     int err;
     struct odp_vport_add ova;
@@ -293,19 +292,19 @@ netdev_vport_get_stats(const struct netdev *netdev, struct netdev_stats *stats)
     stats->tx_errors = ovsr.stats.tx_errors;
     stats->rx_dropped = ovsr.stats.rx_dropped;
     stats->tx_dropped = ovsr.stats.tx_dropped;
-    stats->multicast = UINT64_MAX;
+    stats->multicast = ovsr.stats.multicast;
     stats->collisions = ovsr.stats.collisions;
-    stats->rx_length_errors = UINT64_MAX;
-    stats->rx_over_errors = ovsr.stats.rx_over_err;
-    stats->rx_crc_errors = ovsr.stats.rx_crc_err;
-    stats->rx_frame_errors = ovsr.stats.rx_frame_err;
-    stats->rx_fifo_errors = UINT64_MAX;
-    stats->rx_missed_errors = UINT64_MAX;
-    stats->tx_aborted_errors = UINT64_MAX;
-    stats->tx_carrier_errors = UINT64_MAX;
-    stats->tx_fifo_errors = UINT64_MAX;
-    stats->tx_heartbeat_errors = UINT64_MAX;
-    stats->tx_window_errors = UINT64_MAX;
+    stats->rx_length_errors = ovsr.stats.rx_length_errors;
+    stats->rx_over_errors = ovsr.stats.rx_over_errors;
+    stats->rx_crc_errors = ovsr.stats.rx_crc_errors;
+    stats->rx_frame_errors = ovsr.stats.rx_frame_errors;
+    stats->rx_fifo_errors = ovsr.stats.rx_fifo_errors;
+    stats->rx_missed_errors = ovsr.stats.rx_missed_errors;
+    stats->tx_aborted_errors = ovsr.stats.tx_aborted_errors;
+    stats->tx_carrier_errors = ovsr.stats.tx_carrier_errors;
+    stats->tx_fifo_errors = ovsr.stats.tx_fifo_errors;
+    stats->tx_heartbeat_errors = ovsr.stats.tx_heartbeat_errors;
+    stats->tx_window_errors = ovsr.stats.tx_window_errors;
 
     return 0;
 }
@@ -326,10 +325,19 @@ netdev_vport_set_stats(struct netdev *netdev, const struct netdev_stats *stats)
     ovsr.stats.tx_errors = stats->tx_errors;
     ovsr.stats.rx_dropped = stats->rx_dropped;
     ovsr.stats.tx_dropped = stats->tx_dropped;
+    ovsr.stats.multicast = stats->multicast;
     ovsr.stats.collisions = stats->collisions;
-    ovsr.stats.rx_over_err = stats->rx_over_errors;
-    ovsr.stats.rx_crc_err = stats->rx_crc_errors;
-    ovsr.stats.rx_frame_err = stats->rx_frame_errors;
+    ovsr.stats.rx_length_errors = stats->rx_length_errors;
+    ovsr.stats.rx_over_errors = stats->rx_over_errors;
+    ovsr.stats.rx_crc_errors = stats->rx_crc_errors;
+    ovsr.stats.rx_frame_errors = stats->rx_frame_errors;
+    ovsr.stats.rx_fifo_errors = stats->rx_fifo_errors;
+    ovsr.stats.rx_missed_errors = stats->rx_missed_errors;
+    ovsr.stats.tx_aborted_errors = stats->tx_aborted_errors;
+    ovsr.stats.tx_carrier_errors = stats->tx_carrier_errors;
+    ovsr.stats.tx_fifo_errors = stats->tx_fifo_errors;
+    ovsr.stats.tx_heartbeat_errors = stats->tx_heartbeat_errors;
+    ovsr.stats.tx_window_errors = stats->tx_window_errors;
 
     err = netdev_vport_do_ioctl(ODP_VPORT_STATS_SET, &ovsr);
 
@@ -377,8 +385,7 @@ netdev_vport_poll_add(struct netdev *netdev,
     if (!shash_node) {
         list = xmalloc(sizeof *list);
         list_init(list);
-        shash_node = shash_add(&netdev_vport_notifiers,
-                              netdev_get_name(netdev), list);
+        shash_node = shash_add(&netdev_vport_notifiers, poll_name, list);
     } else {
         list = shash_node->data;
     }