From: Alexandru Copot Date: Sat, 7 Sep 2013 12:36:21 +0000 (+0300) Subject: ofproto: implement OFPT_GET_ASYNC_REQUEST X-Git-Tag: sliver-openvswitch-2.0.90-1~15^2~22 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c423b3b30c93d2334932b6b8e5b35bec1a62f0dc;p=sliver-openvswitch.git ofproto: implement OFPT_GET_ASYNC_REQUEST Signed-off-by: Alexandru Copot Cc: Daniel Baluta Signed-off-by: Ben Pfaff --- diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 1e9ef5b5d..2f315e608 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -985,6 +985,15 @@ ofconn_set_async_config(struct ofconn *ofconn, memcpy(ofconn->slave_async_config, slave_masks, size); } +void +ofconn_get_async_config(struct ofconn *ofconn, + uint32_t *master_masks, uint32_t *slave_masks) +{ + size_t size = sizeof ofconn->master_async_config; + memcpy(master_masks, ofconn->master_async_config, size); + memcpy(slave_masks, ofconn->slave_async_config, size); +} + /* Sends 'msg' on 'ofconn', accounting it as a reply. (If there is a * sufficient number of OpenFlow replies in-flight on a single ofconn, then the * connmgr will stop accepting new OpenFlow requests on that ofconn until the diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h index f92a523fd..72134b0a2 100644 --- a/ofproto/connmgr.h +++ b/ofproto/connmgr.h @@ -118,6 +118,9 @@ void ofconn_set_miss_send_len(struct ofconn *, int miss_send_len); void ofconn_set_async_config(struct ofconn *, const uint32_t master_masks[OAM_N_TYPES], const uint32_t slave_masks[OAM_N_TYPES]); +void ofconn_get_async_config(struct ofconn *, + uint32_t *master_masks, + uint32_t *slave_masks); void ofconn_send_reply(const struct ofconn *, struct ofpbuf *); void ofconn_send_replies(const struct ofconn *, struct list *); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index b94fd8e82..6900e99fd 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -4121,6 +4121,31 @@ handle_nxt_set_async_config(struct ofconn *ofconn, const struct ofp_header *oh) return 0; } +static enum ofperr +handle_nxt_get_async_request(struct ofconn *ofconn, const struct ofp_header *oh) +{ + struct ofpbuf *buf; + uint32_t master[OAM_N_TYPES]; + uint32_t slave[OAM_N_TYPES]; + struct nx_async_config *msg; + + ofconn_get_async_config(ofconn, master, slave); + buf = ofpraw_alloc_reply(OFPRAW_OFPT13_GET_ASYNC_REPLY, oh, 0); + msg = ofpbuf_put_zeros(buf, sizeof *msg); + + msg->packet_in_mask[0] = htonl(master[OAM_PACKET_IN]); + msg->port_status_mask[0] = htonl(master[OAM_PORT_STATUS]); + msg->flow_removed_mask[0] = htonl(master[OAM_FLOW_REMOVED]); + + msg->packet_in_mask[1] = htonl(slave[OAM_PACKET_IN]); + msg->port_status_mask[1] = htonl(slave[OAM_PORT_STATUS]); + msg->flow_removed_mask[1] = htonl(slave[OAM_FLOW_REMOVED]); + + ofconn_send_reply(ofconn, buf); + + return 0; +} + static enum ofperr handle_nxt_set_controller_id(struct ofconn *ofconn, const struct ofp_header *oh) @@ -5193,6 +5218,9 @@ handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg) case OFPTYPE_SET_ASYNC_CONFIG: return handle_nxt_set_async_config(ofconn, oh); + case OFPTYPE_GET_ASYNC_REQUEST: + return handle_nxt_get_async_request(ofconn, oh); + /* Statistics requests. */ case OFPTYPE_DESC_STATS_REQUEST: return handle_desc_stats_request(ofconn, oh); @@ -5236,7 +5264,6 @@ handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg) /* FIXME: Change the following once they are implemented: */ case OFPTYPE_QUEUE_GET_CONFIG_REQUEST: - case OFPTYPE_GET_ASYNC_REQUEST: case OFPTYPE_TABLE_FEATURES_STATS_REQUEST: return OFPERR_OFPBRC_BAD_TYPE;