bridge: Add port to datapath before trying to retrieve device stats.
authorBen Pfaff <blp@nicira.com>
Fri, 5 Aug 2011 21:14:18 +0000 (14:14 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 8 Aug 2011 17:24:24 +0000 (10:24 -0700)
Virtual ports such as GRE tunnels don't exist until after the port is
added to the datapath, so without this change adding such a port yields
a warning like the following:

netdev|WARN|failed to retrieve MTU for network device gre0: No such device

vswitchd/bridge.c

index 6491590a9c3075fbf7b7475349f2c1dc0b2b038b..bd369eb7e4d8054b6fda80fc476572bc312d82d5 100644 (file)
@@ -871,12 +871,6 @@ bridge_add_ofproto_ports(struct bridge *br)
                           iface->name, strerror(error));
             }
 
-            /* Populate stats columns in new Interface rows. */
-            if (iface->netdev && !iface->cfg->mtu) {
-                iface_refresh_stats(iface);
-                iface_refresh_status(iface);
-            }
-
             /* Add the port, if necessary. */
             if (iface->netdev && iface->ofp_port < 0) {
                 uint16_t ofp_port;
@@ -892,6 +886,12 @@ bridge_add_ofproto_ports(struct bridge *br)
                 }
             }
 
+            /* Populate stats columns in new Interface rows. */
+            if (iface->netdev && !iface->cfg->mtu) {
+                iface_refresh_stats(iface);
+                iface_refresh_status(iface);
+            }
+
             /* Delete the iface if  */
             if (iface->netdev && iface->ofp_port >= 0) {
                 VLOG_DBG("bridge %s: interface %s is on port %d",