struct list bundle_node; /* In struct ofbundle's "ports" list. */
struct cfm *cfm; /* Connectivity Fault Management, if any. */
tag_type tag; /* Tag associated with this port. */
+ uint32_t bond_stable_id; /* stable_id to use as bond slave, or 0. */
};
static struct ofport_dpif *
{
struct ofbundle *bundle = port->bundle;
+ bundle->ofproto->need_revalidate = true;
+
list_remove(&port->bundle_node);
port->bundle = NULL;
static bool
bundle_add_port(struct ofbundle *bundle, uint32_t ofp_port,
- struct lacp_slave_settings *lacp)
+ struct lacp_slave_settings *lacp,
+ uint32_t bond_stable_id)
{
struct ofport_dpif *port;
}
if (port->bundle != bundle) {
+ bundle->ofproto->need_revalidate = true;
if (port->bundle) {
bundle_del_port(port);
}
lacp_slave_register(bundle->lacp, port, lacp);
}
+ port->bond_stable_id = bond_stable_id;
+
return true;
}
ok = true;
for (i = 0; i < s->n_slaves; i++) {
if (!bundle_add_port(bundle, s->slaves[i],
- s->lacp ? &s->lacp_slaves[i] : NULL)) {
+ s->lacp ? &s->lacp_slaves[i] : NULL,
+ s->bond_stable_ids ? s->bond_stable_ids[i] : 0)) {
ok = false;
}
}
LIST_FOR_EACH_SAFE (port, next_port, bundle_node, &bundle->ports) {
for (i = 0; i < s->n_slaves; i++) {
- if (s->slaves[i] == odp_port_to_ofp_port(port->odp_port)) {
+ if (s->slaves[i] == port->up.ofp_port) {
goto found;
}
}
}
} else {
bundle->bond = bond_create(s->bond);
+ ofproto->need_revalidate = true;
}
LIST_FOR_EACH (port, bundle_node, &bundle->ports) {
- uint16_t stable_id = (bundle->lacp
- ? lacp_slave_get_port_id(bundle->lacp, port)
- : port->odp_port);
- bond_slave_register(bundle->bond, port, stable_id,
+ bond_slave_register(bundle->bond, port, port->bond_stable_id,
port->up.netdev);
}
} else {
static struct ofport_dpif *
get_ofp_port(struct ofproto_dpif *ofproto, uint16_t ofp_port)
{
- return ofport_dpif_cast(ofproto_get_port(&ofproto->up, ofp_port));
+ struct ofport *ofport = ofproto_get_port(&ofproto->up, ofp_port);
+ return ofport ? ofport_dpif_cast(ofport) : NULL;
}
static struct ofport_dpif *
/* Find the port and bundle for the received packet. */
in_port = get_ofp_port(ofproto, flow->in_port);
- *in_bundlep = in_bundle = in_port->bundle;
+ *in_bundlep = in_bundle = in_port ? in_port->bundle : NULL;
if (!in_port || !in_bundle) {
/* No interface? Something fishy... */
if (have_packet) {