diff options
author | Niti Rohilla <niti.rohilla@tcs.com> | 2015-09-09 17:33:42 +0530 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2015-09-09 13:17:23 -0700 |
commit | 3c35db62d0ebdf6191c60aae0ccadbb40ac933ba (patch) | |
tree | 5b00bf8df1a1ec8f2c472e85aebb55a125b6cd20 /ofproto | |
parent | 3514c765179a92f57508885a41356cda940bed0c (diff) | |
download | openvswitch-3c35db62d0ebdf6191c60aae0ccadbb40ac933ba.tar.gz |
ofproto: Implement OF1.4 Group & Meter change notification messages
This patch adds support for Openflow1.4 Group & meter change notification
messages. In a multi controller environment, when a controller modifies the
state of group and meter table, the request that successfully modifies this
state is forwarded to other controllers. Other controllers are informed with
the OFPT_REQUESTFORWARD message. Request forwarding is enabled on a per
controller channel basis using the Set Asynchronous Configuration Message.
Signed-off-by: Niti Rohilla <niti.rohilla@tcs.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/connmgr.c | 22 | ||||
-rw-r--r-- | ofproto/connmgr.h | 3 | ||||
-rw-r--r-- | ofproto/ofproto.c | 33 |
3 files changed, 53 insertions, 5 deletions
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index b1ba0c697..ef2c06fc4 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -1709,6 +1709,28 @@ connmgr_send_port_status(struct connmgr *mgr, struct ofconn *source, } } +/* Sends an OFPT_REQUESTFORWARD message with 'request' and 'reason' to + * appropriate controllers managed by 'mgr'. For messages caused by a + * controller OFPT_GROUP_MOD and OFPT_METER_MOD, specify 'source' as the + * controller connection that sent the request; otherwise, specify 'source' + * as NULL. */ +void +connmgr_send_requestforward(struct connmgr *mgr, const struct ofconn *source, + const struct ofputil_requestforward *rf) +{ + struct ofconn *ofconn; + + LIST_FOR_EACH (ofconn, node, &mgr->all_conns) { + if (ofconn_receives_async_msg(ofconn, OAM_REQUESTFORWARD, rf->reason) + && rconn_get_version(ofconn->rconn) >= OFP14_VERSION + && ofconn != source) { + enum ofputil_protocol protocol = ofconn_get_protocol(ofconn); + ofconn_send(ofconn, ofputil_encode_requestforward(rf, protocol), + NULL); + } + } +} + /* Sends an OFPT_FLOW_REMOVED or NXT_FLOW_REMOVED message based on 'fr' to * appropriate controllers managed by 'mgr'. */ void diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h index 7ef583ad8..8048424b7 100644 --- a/ofproto/connmgr.h +++ b/ofproto/connmgr.h @@ -168,6 +168,9 @@ void connmgr_send_packet_in(struct connmgr *, void ofconn_send_role_status(struct ofconn *ofconn, uint32_t role, uint8_t reason); +void connmgr_send_requestforward(struct connmgr *, const struct ofconn *source, + const struct ofputil_requestforward *); + /* Fail-open settings. */ enum ofproto_fail_mode connmgr_get_fail_mode(const struct connmgr *); void connmgr_set_fail_mode(struct connmgr *, enum ofproto_fail_mode); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index e6c03516e..c1301b5c1 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -5908,6 +5908,14 @@ handle_meter_mod(struct ofconn *ofconn, const struct ofp_header *oh) break; } + if (!error) { + struct ofputil_requestforward rf; + rf.xid = oh->xid; + rf.reason = OFPRFR_METER_MOD; + rf.meter_mod = &mm; + connmgr_send_requestforward(ofproto->connmgr, ofconn, &rf); + } + exit_free_bands: ofpbuf_uninit(&bands); return error; @@ -6575,20 +6583,25 @@ handle_group_mod(struct ofconn *ofconn, const struct ofp_header *oh) switch (gm.command) { case OFPGC11_ADD: - return add_group(ofproto, &gm); + error = add_group(ofproto, &gm); + break; case OFPGC11_MODIFY: - return modify_group(ofproto, &gm); + error = modify_group(ofproto, &gm); + break; case OFPGC11_DELETE: delete_group(ofproto, gm.group_id); - return 0; + error = 0; + break; case OFPGC15_INSERT_BUCKET: - return modify_group(ofproto, &gm); + error = modify_group(ofproto, &gm); + break; case OFPGC15_REMOVE_BUCKET: - return modify_group(ofproto, &gm); + error = modify_group(ofproto, &gm); + break; default: if (gm.command > OFPGC11_DELETE) { @@ -6597,6 +6610,15 @@ handle_group_mod(struct ofconn *ofconn, const struct ofp_header *oh) } return OFPERR_OFPGMFC_BAD_COMMAND; } + + if (!error) { + struct ofputil_requestforward rf; + rf.xid = oh->xid; + rf.reason = OFPRFR_GROUP_MOD; + rf.group_mod = &gm; + connmgr_send_requestforward(ofproto->connmgr, ofconn, &rf); + } + return error; } enum ofputil_table_miss @@ -7211,6 +7233,7 @@ handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg) case OFPTYPE_TABLE_FEATURES_STATS_REPLY: case OFPTYPE_TABLE_DESC_REPLY: case OFPTYPE_ROLE_STATUS: + case OFPTYPE_REQUESTFORWARD: case OFPTYPE_NXT_GENEVE_TABLE_REPLY: default: if (ofpmsg_is_stat_request(oh)) { |