nx-match: Implement support for arbitrary VLAN TCI masks.
[openvswitch] / lib / netdev-vport.c
index d354dc3986fcc85c014cda91db3a045e10e1c125..197e74bb24b54f1754affc9ecd43ae3329461123 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;
@@ -272,13 +271,6 @@ netdev_vport_get_mtu(const struct netdev *netdev, int *mtup)
     return 0;
 }
 
-static int
-netdev_vport_get_carrier(const struct netdev *netdev OVS_UNUSED, bool *carrier)
-{
-    *carrier = true;
-    return 0;
-}
-
 int
 netdev_vport_get_stats(const struct netdev *netdev, struct netdev_stats *stats)
 {
@@ -300,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;
 }
@@ -333,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);
 
@@ -384,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;
     }
@@ -613,7 +613,7 @@ parse_patch_config(struct vport_info *port, const struct shash *args)
     netdev_vport_get_etheraddr,                             \
     netdev_vport_get_mtu,                                   \
     NULL,                       /* get_ifindex */           \
-    netdev_vport_get_carrier,                               \
+    NULL,                       /* get_carrier */           \
     netdev_vport_get_stats,                                 \
     netdev_vport_set_stats,                                 \
                                                             \