X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ofproto%2Fofproto.c;h=a9c7e7672bc6c934bee782493b5d43f4cb2dba53;hb=67680b012be30d9c26eab999b83b08c6eb32dbd2;hp=bc27079867f77da0edd42d1960360a8db7296fac;hpb=e503cc1993970ef27882a9b922efbd365d9da2be;p=sliver-openvswitch.git diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index bc2707986..a9c7e7672 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2238,7 +2238,7 @@ handle_set_config(struct ofconn *ofconn, const struct ofp_header *oh) uint16_t flags = ntohs(osc->flags); if (ofconn_get_type(ofconn) != OFCONN_PRIMARY - || ofconn_get_role(ofconn) != NX_ROLE_SLAVE) { + || ofconn_get_role(ofconn) != OFPCR12_ROLE_SLAVE) { enum ofp_config_flags cur = ofproto->frag_handling; enum ofp_config_flags next = flags & OFPC_FRAG_MASK; @@ -2272,7 +2272,7 @@ static enum ofperr reject_slave_controller(struct ofconn *ofconn) { if (ofconn_get_type(ofconn) == OFCONN_PRIMARY - && ofconn_get_role(ofconn) == NX_ROLE_SLAVE) { + && ofconn_get_role(ofconn) == OFPCR12_ROLE_SLAVE) { return OFPERR_OFPBRC_EPERM; } else { return 0; @@ -3261,10 +3261,6 @@ modify_flows__(struct ofproto *ofproto, struct ofconn *ofconn, new_cookie = (fm->new_cookie != htonll(UINT64_MAX) ? fm->new_cookie : rule->flow_cookie); - if (!actions_changed && new_cookie == rule->flow_cookie) { - /* No change at all. */ - continue; - } op = ofoperation_create(group, rule, OFOPERATION_MODIFY, 0); rule->flow_cookie = new_cookie; @@ -3580,38 +3576,34 @@ handle_flow_mod__(struct ofproto *ofproto, struct ofconn *ofconn, static enum ofperr handle_role_request(struct ofconn *ofconn, const struct ofp_header *oh) { - struct ofputil_role_request rr; + struct ofputil_role_request request; + struct ofputil_role_request reply; struct ofpbuf *buf; - uint32_t role; enum ofperr error; - error = ofputil_decode_role_message(oh, &rr); + error = ofputil_decode_role_message(oh, &request); if (error) { return error; } - if (rr.request_current_role_only) { - role = ofconn_get_role(ofconn); /* NX_ROLE_* */ - goto reply; - } - - role = rr.role; - - if (ofconn_get_role(ofconn) != role - && ofconn_has_pending_opgroups(ofconn)) { - return OFPROTO_POSTPONE; - } + if (request.role != OFPCR12_ROLE_NOCHANGE) { + if (ofconn_get_role(ofconn) != request.role + && ofconn_has_pending_opgroups(ofconn)) { + return OFPROTO_POSTPONE; + } - if (rr.have_generation_id) { - if (!ofconn_set_master_election_id(ofconn, rr.generation_id)) { - return OFPERR_OFPRRFC_STALE; + if (request.have_generation_id + && !ofconn_set_master_election_id(ofconn, request.generation_id)) { + return OFPERR_OFPRRFC_STALE; } - } - ofconn_set_role(ofconn, role); + ofconn_set_role(ofconn, request.role); + } -reply: - buf = ofputil_encode_role_reply(oh, role); + reply.role = ofconn_get_role(ofconn); + reply.have_generation_id = ofconn_get_master_election_id( + ofconn, &reply.generation_id); + buf = ofputil_encode_role_reply(oh, &reply); ofconn_send_reply(ofconn, buf); return 0; @@ -4247,7 +4239,19 @@ ofopgroup_complete(struct ofopgroup *group) LIST_FOR_EACH_SAFE (op, next_op, group_node, &group->ops) { struct rule *rule = op->rule; - if (!op->error && !ofproto_rule_is_hidden(rule)) { + /* We generally want to report the change to active OpenFlow flow + monitors (e.g. NXST_FLOW_MONITOR). There are three exceptions: + + - The operation failed. + + - The affected rule is not visible to controllers. + + - The operation's only effect was to update rule->modified. */ + if (!(op->error + || ofproto_rule_is_hidden(rule) + || (op->type == OFOPERATION_MODIFY + && op->ofpacts + && rule->flow_cookie == op->flow_cookie))) { /* Check that we can just cast from ofoperation_type to * nx_flow_update_event. */ BUILD_ASSERT_DECL((enum nx_flow_update_event) OFOPERATION_ADD @@ -4850,6 +4854,9 @@ oftable_replace_rule(struct rule *rule) victim = rule_from_cls_rule(classifier_replace(&table->cls, &rule->cr)); if (victim) { + if (!list_is_empty(&victim->expirable)) { + list_remove(&victim->expirable); + } eviction_group_remove_rule(victim); } eviction_group_add_rule(rule);