From patchwork Wed Feb 3 10:38:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 577810 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 8E94C140328 for ; Wed, 3 Feb 2016 21:38:12 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 313321077C; Wed, 3 Feb 2016 02:38:11 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id D8BAC1077B for ; Wed, 3 Feb 2016 02:38:09 -0800 (PST) Received: from bar4.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 6830B16360D for ; Wed, 3 Feb 2016 03:38:09 -0700 (MST) X-ASG-Debug-ID: 1454495888-03dc217d9d114da30001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar4.cudamail.com with ESMTP id Wa5SarZi1kVoG2Mz (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 03 Feb 2016 03:38:08 -0700 (MST) X-Barracuda-Envelope-From: nusiddiq@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 3 Feb 2016 10:38:07 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at _spf1.redhat.com designates 209.132.183.28 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 0665270003 for ; Wed, 3 Feb 2016 10:38:06 +0000 (UTC) Received: from nusiddiq.blr.redhat.com (dhcp-0-76.blr.redhat.com [10.70.1.76]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u13Ac5GT022136 for ; Wed, 3 Feb 2016 05:38:06 -0500 X-CudaMail-Envelope-Sender: nusiddiq@redhat.com From: Numan Siddique X-CudaMail-MID: CM-E1-202005523 X-CudaMail-DTE: 020316 X-CudaMail-Originating-IP: 209.132.183.28 To: dev@openvswitch.org X-ASG-Orig-Subj: [##CM-E1-202005523##][PATCH] ovn-controller: Use ofputil_encode_set_config to set the switch config Organization: Red Hat Message-ID: <56B1D88C.4040703@redhat.com> Date: Wed, 3 Feb 2016 16:08:04 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-GBUdb-Analysis: 0, 209.132.183.28, Ugly c=0.113212 p=-0.333333 Source Normal X-MessageSniffer-Rules: 0-0-0-4939-c X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1454495888 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.26702 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] [PATCH] ovn-controller: Use ofputil_encode_set_config to set the switch config X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" After the commit ad99e2e, setting the switch config 'miss_send_len' is failing in ovn-controller because of validation in OFPT_SET_CONFIG messages. Signed-off-by: Numan Siddique --- ovn/controller/pinctrl.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index 360f38b..847731d 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,12 +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)); - 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) {