static void iface_refresh_stats(struct iface *);
static void iface_refresh_status(struct iface *);
static bool iface_is_synthetic(const struct iface *);
+static int64_t iface_pick_ofport(const struct ovsrec_interface *);
/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.)
*
iface_hint = xmalloc(sizeof *iface_hint);
iface_hint->br_name = br_cfg->name;
iface_hint->br_type = br_cfg->datapath_type;
- iface_hint->ofp_port = if_cfg->n_ofport_request ?
- *if_cfg->ofport_request : OFPP_NONE;
+ iface_hint->ofp_port = iface_pick_ofport(if_cfg);
shash_add(&iface_hints, if_cfg->name, iface_hint);
}
error = iface_do_create(br, if_cfg, &ofp_port, &netdev);
bridge_run_fast();
if (error) {
+ iface_set_ofport(iface_cfg, -1);
iface_clear_db_record(iface_cfg);
ok = false;
goto done;
if_cfg->cfg = cfg;
if_cfg->parent = parent;
- if_cfg->ofport = cfg->n_ofport_request ? *cfg->ofport_request : OFPP_NONE;
+ if_cfg->ofport = iface_pick_ofport(cfg);
hmap_insert(&br->if_cfg_todo, &if_cfg->hmap_node,
hash_string(if_cfg->cfg->name, 0));
}
iface_clear_db_record(const struct ovsrec_interface *if_cfg)
{
if (!ovsdb_idl_row_is_synthetic(&if_cfg->header_)) {
- iface_set_ofport(if_cfg, -1);
ovsrec_interface_set_status(if_cfg, NULL);
ovsrec_interface_set_admin_state(if_cfg, NULL);
ovsrec_interface_set_duplex(if_cfg, NULL);
return ovsdb_idl_row_is_synthetic(&iface->cfg->header_);
}
+static int64_t
+iface_pick_ofport(const struct ovsrec_interface *cfg)
+{
+ int64_t ofport = cfg->n_ofport ? *cfg->ofport : OFPP_NONE;
+ return cfg->n_ofport_request ? *cfg->ofport_request : ofport;
+}
+
\f
/* Port mirroring. */