stress: Remove essentially unused library.
[sliver-openvswitch.git] / vswitchd / bridge.c
index 4ac2b26..686eb93 100644 (file)
@@ -367,6 +367,7 @@ bridge_init(const char *remote)
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_link_state);
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_link_resets);
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_mac_in_use);
+    ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_ifindex);
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_mtu);
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_ofport);
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_statistics);
@@ -695,7 +696,7 @@ bridge_update_ofprotos(void)
                 error = ofproto_port_del(br2->ofproto, ofproto_port.ofp_port);
                 if (error) {
                     VLOG_ERR("failed to delete port %s: %s", ofproto_port.name,
-                             strerror(error));
+                             ovs_strerror(error));
                 }
                 ofproto_port_destroy(&ofproto_port);
             }
@@ -704,7 +705,7 @@ bridge_update_ofprotos(void)
         error = ofproto_create(br->name, br->type, &br->ofproto);
         if (error) {
             VLOG_ERR("failed to create bridge %s: %s", br->name,
-                     strerror(error));
+                     ovs_strerror(error));
             bridge_destroy(br);
         }
     }
@@ -816,11 +817,8 @@ bridge_configure_flow_miss_model(const char *opt)
     if (opt) {
         if (strcmp(opt, "with-facets")) {
             model = OFPROTO_HANDLE_MISS_WITH_FACETS;
-            VLOG_INFO("Handling all flow misses by creating facets.\n");
-        }
-        if (strcmp(opt, "without-facets")) {
+        } else if (strcmp(opt, "without-facets")) {
             model = OFPROTO_HANDLE_MISS_WITHOUT_FACETS;
-            VLOG_INFO("Handling all flow misses without creating facets.\n");
         }
     }
 
@@ -845,7 +843,7 @@ bridge_configure_datapath_id(struct bridge *br)
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
             VLOG_ERR_RL(&rl, "bridge %s: failed to set bridge "
                         "Ethernet address: %s",
-                        br->name, strerror(error));
+                        br->name, ovs_strerror(error));
         }
     }
     memcpy(br->ea, ea, ETH_ADDR_LEN);
@@ -1323,7 +1321,7 @@ iface_set_netdev_config(const struct ovsrec_interface *iface_cfg,
     error = netdev_set_config(netdev, &iface_cfg->options);
     if (error) {
         VLOG_WARN("could not configure network device %s (%s)",
-                  iface_cfg->name, strerror(error));
+                  iface_cfg->name, ovs_strerror(error));
     }
     return error;
 }
@@ -1464,7 +1462,7 @@ iface_do_create(const struct bridge *br,
                         iface_get_type(iface_cfg, br->cfg), &netdev);
     if (error) {
         VLOG_WARN("could not open network device %s (%s)",
-                  iface_cfg->name, strerror(error));
+                  iface_cfg->name, ovs_strerror(error));
         goto error;
     }
 
@@ -1578,7 +1576,7 @@ iface_create(struct bridge *br, struct if_cfg *if_cfg, ofp_port_t ofp_port)
                 netdev_close(netdev);
             } else {
                 VLOG_WARN("could not open network device %s (%s)",
-                          port->name, strerror(error));
+                          port->name, ovs_strerror(error));
             }
         } else {
             /* Already exists, nothing to do. */
@@ -1813,6 +1811,7 @@ iface_refresh_status(struct iface *iface)
     int mtu;
     int64_t mtu_64;
     uint8_t mac[ETH_ADDR_LEN];
+    int64_t ifindex64;
     int error;
 
     if (iface_is_synthetic(iface)) {
@@ -1858,6 +1857,14 @@ iface_refresh_status(struct iface *iface)
     } else {
         ovsrec_interface_set_mac_in_use(iface->cfg, NULL);
     }
+
+    /* The netdev may return a negative number (such as -EOPNOTSUPP)
+     * if there is no valid ifindex number. */
+    ifindex64 = netdev_get_ifindex(iface->netdev);
+    if (ifindex64 < 0) {
+        ifindex64 = 0;
+    }
+    ovsrec_interface_set_ifindex(iface->cfg, &ifindex64, 1);
 }
 
 /* Writes 'iface''s CFM statistics to the database. 'iface' must not be
@@ -2569,7 +2576,7 @@ qos_unixctl_show_cb(unsigned int queue_id,
         }
     } else {
         ds_put_format(ds, "\tFailed to get statistics for queue %u: %s",
-                      queue_id, strerror(error));
+                      queue_id, ovs_strerror(error));
     }
 }
 
@@ -2605,7 +2612,8 @@ qos_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
         error = netdev_dump_queues(iface->netdev, qos_unixctl_show_cb, &data);
 
         if (error) {
-            ds_put_format(&ds, "failed to dump queues: %s", strerror(error));
+            ds_put_format(&ds, "failed to dump queues: %s",
+                          ovs_strerror(error));
         }
         unixctl_command_reply(conn, ds_cstr(&ds));
     } else {
@@ -3537,7 +3545,7 @@ iface_set_mac(struct iface *iface)
             int error = netdev_set_etheraddr(iface->netdev, ea);
             if (error) {
                 VLOG_ERR("interface %s: setting MAC failed (%s)",
-                         iface->name, strerror(error));
+                         iface->name, ovs_strerror(error));
             }
         }
     }
@@ -3575,6 +3583,7 @@ iface_clear_db_record(const struct ovsrec_interface *if_cfg)
         ovsrec_interface_set_cfm_remote_mpids(if_cfg, NULL, 0);
         ovsrec_interface_set_lacp_current(if_cfg, NULL, 0);
         ovsrec_interface_set_statistics(if_cfg, NULL, NULL, 0);
+        ovsrec_interface_set_ifindex(if_cfg, NULL, 0);
     }
 }