From patchwork Fri Sep 29 15:05:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 820000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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 3y3ZdC08v8z9t5P for ; Sat, 30 Sep 2017 01:06:07 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7F3A7AC8; Fri, 29 Sep 2017 15:05:32 +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 E1F95A92 for ; Fri, 29 Sep 2017 15:05:29 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 68056157 for ; Fri, 29 Sep 2017 15:05:29 +0000 (UTC) Received: by mail-wr0-f177.google.com with SMTP id h16so2491427wrf.6 for ; Fri, 29 Sep 2017 08:05:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=dbOPgfa3TU3luysiwJU2CVbejWjVz7hR95mfNe8SJ9w=; b=H1HBknhPPYjvzJFftYp96WNkJQ0pnCQJ9KQmC2fN509llev/RadEP2MiSPe1uMecek SkXPjn+KAGUIdQqZIhIE4OKvbiHZMUd9OxN/obTwA/7JDdOBBkENjIYiQ+Z0NXjdedBz gxY7EkLgt9TMQviKgVOQ5Ie7UJFi/E4v4kKkHL+FLzgxcGOjvRh5ujZEL29b0wA7Z+QE SC4wp/Rb+VOJ7MzDDzghlGi03vUvnyUsyNdedsNgBYmwwpJnUZ3FA2v8PhbyxVIOKSJt UEltFz0H/D6aZXdoOpKBx/2Cj2b25AxCcji68kQ5ryUqbABH43Z+CjqWRPCXxTfzz382 D1yA== X-Gm-Message-State: AHPjjUjSOYk/QHfAyvqQX8vh7ZhEAmQIcgfa92qpofhlG7/ss7CKjcDQ Bh2S8mESZwM3EDjOWIaQNY/IYBJXg8g= X-Google-Smtp-Source: AOwi7QAVvacF1BJbuxuBjYb4sEh1567WinnJpTq8rbDDW6KLlMyDkBsD/AZo/b+LgNayiudUdEZxKA== X-Received: by 10.223.150.194 with SMTP id u60mr7638698wrb.243.1506697527704; Fri, 29 Sep 2017 08:05:27 -0700 (PDT) Received: from redhat.com (red-hat-inc.vlan404.asr1.mad1.gblx.net. [64.215.113.190]) by smtp.gmail.com with ESMTPSA id w62sm2064944wmb.32.2017.09.29.08.05.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Sep 2017 08:05:26 -0700 (PDT) From: Jakub Sitnicki To: dev@openvswitch.org Date: Fri, 29 Sep 2017 17:05:22 +0200 Message-Id: <20170929150523.8833-2-jkbs@redhat.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170929150523.8833-1-jkbs@redhat.com> References: <20170929150523.8833-1-jkbs@redhat.com> X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 1/2] ovn-northd: Refactor logic for logical port 'up' state update 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 No functional change. Make it obvious that we determine the logical port 'up' state by checking for bound chassis, and update the NB DB only when state has not been set yet or current state is different. Signed-off-by: Jakub Sitnicki Acked-by: Mark Michelson Acked-by: Miguel Angel Ajo --- ovn/northd/ovn-northd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 2db2380..37651a0 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -5980,11 +5980,8 @@ update_logical_port_status(struct northd_context *ctx) continue; } - if (sb->chassis && (!nbsp->up || !*nbsp->up)) { - bool up = true; - nbrec_logical_switch_port_set_up(nbsp, &up, 1); - } else if (!sb->chassis && (!nbsp->up || *nbsp->up)) { - bool up = false; + bool up = sb->chassis ? true : false; + if (!nbsp->up || *nbsp->up != up) { nbrec_logical_switch_port_set_up(nbsp, &up, 1); } }