OVS_REQUIRES(ofproto_mutex);
static struct ofconn *find_controller_by_target(struct connmgr *,
const char *target);
-static void update_fail_open(struct connmgr *);
+static void update_fail_open(struct connmgr *) OVS_EXCLUDED(ofproto_mutex);
static int set_pvconns(struct pvconn ***pvconnsp, size_t *n_pvconnsp,
const struct sset *);
shash_destroy(&new_controllers);
+ ovs_mutex_unlock(&ofproto_mutex);
+
update_in_band_remotes(mgr);
update_fail_open(mgr);
if (had_controllers != connmgr_has_controllers(mgr)) {
ofproto_flush_flows(mgr->ofproto);
}
- ovs_mutex_unlock(&ofproto_mutex);
}
/* Drops the connections between 'mgr' and all of its primary and secondary
static void
update_fail_open(struct connmgr *mgr)
+ OVS_EXCLUDED(ofproto_mutex)
{
if (connmgr_has_controllers(mgr)
&& mgr->fail_mode == OFPROTO_FAIL_STANDALONE) {
return ofconn->role;
}
+void
+ofconn_send_role_status(struct ofconn *ofconn, uint32_t role, uint8_t reason)
+{
+ struct ofputil_role_status status;
+ struct ofpbuf *buf;
+
+ status.reason = reason;
+ status.role = role;
+ ofconn_get_master_election_id(ofconn, &status.generation_id);
+
+ buf = ofputil_encode_role_status(&status, ofconn_get_protocol(ofconn));
+
+ ofconn_send(ofconn, buf, NULL);
+}
+
/* Changes 'ofconn''s role to 'role'. If 'role' is OFPCR12_ROLE_MASTER then
* any existing master is demoted to a slave. */
void
ofconn_set_role(struct ofconn *ofconn, enum ofp12_controller_role role)
{
- if (role == OFPCR12_ROLE_MASTER) {
+ if (role != ofconn->role && role == OFPCR12_ROLE_MASTER) {
struct ofconn *other;
HMAP_FOR_EACH (other, hmap_node, &ofconn->connmgr->controllers) {
if (other->role == OFPCR12_ROLE_MASTER) {
other->role = OFPCR12_ROLE_SLAVE;
+ ofconn_send_role_status(other, OFPCR12_ROLE_SLAVE, OFPCRR_MASTER_REQUEST);
}
}
}
LIST_FOR_EACH_SAFE (pin, next_pin, list_node, txq) {
list_remove(&pin->list_node);
- rconn_send_with_limit(ofconn->rconn, pin,
- ofconn->packet_in_counter, 100);
+ if (rconn_send_with_limit(ofconn->rconn, pin,
+ ofconn->packet_in_counter, 100) == EAGAIN) {
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
+
+ VLOG_INFO_RL(&rl, "%s: dropping packet-in due to queue overflow",
+ rconn_get_name(ofconn->rconn));
+ }
}
}
default:
case NXFME_ABBREV:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {