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.
+/* Callback for iterate_and_prune_ifaces(). */
-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)
- 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_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)
static bool
set_iface_properties(struct bridge *br OVS_UNUSED, struct iface *iface,
void *aux OVS_UNUSED)
bridge_fetch_dp_ifaces(br);
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);
/* Pick local port hardware address, datapath ID. */
bridge_pick_local_hw_addr(br, ea, &hw_addr_iface);