From patchwork Fri Jul 30 07:21:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1511531 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gbf444SD0z9sXV for ; Fri, 30 Jul 2021 17:22:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8EF7E40548; Fri, 30 Jul 2021 07:22:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z32lmR_VrzMu; Fri, 30 Jul 2021 07:22:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id D7F8B4022D; Fri, 30 Jul 2021 07:22:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A9DA4C001A; Fri, 30 Jul 2021 07:22:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9020DC000E for ; Fri, 30 Jul 2021 07:22:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8014C405C9 for ; Fri, 30 Jul 2021 07:22:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VBkqVSLtnZ-y for ; Fri, 30 Jul 2021 07:22:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by smtp4.osuosl.org (Postfix) with ESMTPS id C1C074032E for ; Fri, 30 Jul 2021 07:22:15 +0000 (UTC) Received: (Authenticated sender: hzhou@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 0B72AE0006; Fri, 30 Jul 2021 07:22:12 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Fri, 30 Jul 2021 00:21:39 -0700 Message-Id: <20210730072141.1938378-3-hzhou@ovn.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210730072141.1938378-1-hzhou@ovn.org> References: <20210730072141.1938378-1-hzhou@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [RFC PATCH ovn 2/4] binding.c: Refactor binding_handle_port_binding_changes. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The extra get_local_datapath() call seems unnecessary. Remove it and combine the two if-blocks to an if-else block. Signed-off-by: Han Zhou --- controller/binding.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index d50f3affa..f58bb4b17 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2613,15 +2613,10 @@ delete_done: b_ctx_out->local_datapaths, b_ctx_out->tracked_dp_bindings); } - - ld = get_local_datapath(b_ctx_out->local_datapaths, - pb->datapath->tunnel_key); - } - - /* Add the peer datapath to the local datapaths if it's - * not present yet. - */ - if (ld) { + } else { + /* Add the peer datapath to the local datapaths if it's + * not present yet. + */ add_local_datapath_peer_port(pb, b_ctx_in, b_ctx_out, ld); } }