[ovs-dev] [add-remove 6/7] vswitchd: Only try to open netdev once.
Ben Pfaff
blp at nicira.com
Tue Sep 28 11:58:40 PDT 2010
The previous commit arranged to always open the netdev for bridge ports
within the loop that adds new ports to datapaths. So now the additional
attempt to open them within the following loop is superfluous and
presumably will always fail. This commit drops it and merges two
iterations through bridge ports into a single one, since the first is now
trivial.
---
vswitchd/bridge.c | 34 +++++++++++-----------------------
1 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 97cee77..ce0faee 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -450,38 +450,27 @@ reconfigure_iface_netdev(struct iface *iface)
return error;
}
+/* Callback for iterate_and_prune_ifaces(). */
static bool
-check_iface_netdev(struct bridge *br OVS_UNUSED, struct iface *iface,
- void *aux OVS_UNUSED)
+check_iface(struct bridge *br, struct iface *iface, void *aux OVS_UNUSED)
{
if (!iface->netdev) {
- int error = create_iface_netdev(iface);
- if (error) {
- VLOG_WARN("could not open netdev on %s, dropping: %s", iface->name,
- strerror(error));
- return false;
- }
+ /* We already reported a related error, don't bother duplicating it. */
+ return false;
}
- return true;
-}
-
-static bool
-check_iface_dp_ifidx(struct bridge *br, struct iface *iface,
- void *aux OVS_UNUSED)
-{
- if (iface->dp_ifidx >= 0) {
- VLOG_DBG("%s has interface %s on port %d",
- dpif_name(br->dpif),
- iface->name, iface->dp_ifidx);
- return true;
- } else {
+ if (iface->dp_ifidx < 0) {
VLOG_ERR("%s interface not in %s, dropping",
iface->name, dpif_name(br->dpif));
return false;
}
+
+ VLOG_DBG("%s has interface %s on port %d", dpif_name(br->dpif),
+ iface->name, iface->dp_ifidx);
+ return true;
}
+/* Callback for iterate_and_prune_ifaces(). */
static bool
set_iface_properties(struct bridge *br OVS_UNUSED, struct iface *iface,
void *aux OVS_UNUSED)
@@ -760,8 +749,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
bridge_fetch_dp_ifaces(br);
- iterate_and_prune_ifaces(br, check_iface_netdev, NULL);
- iterate_and_prune_ifaces(br, check_iface_dp_ifidx, NULL);
+ iterate_and_prune_ifaces(br, check_iface, NULL);
/* Pick local port hardware address, datapath ID. */
bridge_pick_local_hw_addr(br, ea, &hw_addr_iface);
--
1.7.1
More information about the dev
mailing list