From: Numan Siddique Date: Wed, 10 Feb 2016 20:18:58 +0000 (-0800) Subject: ovn-controller: Use ofputil_encode_set_config to set the switch config X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=660f5a612862bf18b4785190ff343965d970708a ovn-controller: Use ofputil_encode_set_config to set the switch config This is cleaner. Signed-off-by: Numan Siddique Signed-off-by: Ben Pfaff --- diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index 239b3ad0c..545ee47d6 100644 --- a/ovn/controller/pinctrl.c +++ b/ovn/controller/pinctrl.c @@ -62,14 +62,11 @@ get_switch_config(struct rconn *swconn) } static void -set_switch_config(struct rconn *swconn, const struct ofp_switch_config *config) +set_switch_config(struct rconn *swconn, + const struct ofputil_switch_config *config) { - struct ofpbuf *request; - - request = - ofpraw_alloc(OFPRAW_OFPT_SET_CONFIG, rconn_get_version(swconn), 0); - ofpbuf_put(request, config, sizeof *config); - + enum ofp_version version = rconn_get_version(swconn); + struct ofpbuf *request = ofputil_encode_set_config(config, version); queue_msg(request); } @@ -98,13 +95,9 @@ pinctrl_recv(struct controller_ctx *ctx, const struct ofp_header *oh, if (type == OFPTYPE_ECHO_REQUEST) { queue_msg(make_echo_reply(oh)); } else if (type == OFPTYPE_GET_CONFIG_REPLY) { - struct ofpbuf rq_buf; - struct ofp_switch_config *config_, config; + struct ofputil_switch_config config; - ofpbuf_use_const(&rq_buf, oh, ntohs(oh->length)); - ofpraw_pull_assert(&rq_buf); - config_ = ofpbuf_pull(&rq_buf, sizeof *config_); - config = *config_; + ofputil_decode_get_config_reply(oh, &config); config.miss_send_len = htons(UINT16_MAX); set_switch_config(swconn, &config); } else if (type == OFPTYPE_PACKET_IN) {