From patchwork Fri Mar 17 18:38:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 740424 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vlDdf4YRxz9ryj for ; Sat, 18 Mar 2017 05:39:18 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 1AACDBCC; Fri, 17 Mar 2017 18:38:53 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 8F36195D for ; Fri, 17 Mar 2017 18:38:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 19683164 for ; Fri, 17 Mar 2017 18:38:50 +0000 (UTC) Received: from mfilter19-d.gandi.net (mfilter19-d.gandi.net [217.70.178.147]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id E041D1720BE; Fri, 17 Mar 2017 19:38:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter19-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter19-d.gandi.net (mfilter19-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id KDJb8yNCA_FJ; Fri, 17 Mar 2017 19:38:47 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from carno.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id E50421720C2; Fri, 17 Mar 2017 19:38:46 +0100 (CET) From: Joe Stringer To: dev@openvswitch.org Date: Fri, 17 Mar 2017 11:38:35 -0700 Message-Id: <20170317183835.26684-2-joe@ovn.org> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170317183835.26684-1-joe@ovn.org> References: <20170317183835.26684-1-joe@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 2/2] ofproto: Clean up style in ofproto_flow_mod_learn. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org It's slightly more cognitive load to read an inverse condition and then invert it again to understand the 'else' condition. Signed-off-by: Joe Stringer Acked-by: Ben Pfaff --- ofproto/ofproto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index c6d83d4e6b29..e196597f4013 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -5118,15 +5118,15 @@ ofproto_flow_mod_learn(struct ofproto_flow_mod *ofm, bool keep_ref, rule_criteria_destroy(&criteria); } - if (!limited) { + if (limited) { + ofproto_flow_mod_uninit(ofm); + } else { ofm->version = rule->ofproto->tables_version + 1; error = ofproto_flow_mod_learn_start(ofm); if (!error) { ofproto_flow_mod_learn_finish(ofm, NULL); } - } else { - ofproto_flow_mod_uninit(ofm); } ovs_mutex_unlock(&ofproto_mutex);