From patchwork Mon Apr 16 20:14:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 898915 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BuLjhdKY"; dkim-atps=neutral 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 40Q07V6qJlz9s19 for ; Tue, 17 Apr 2018 06:18:14 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A630CF80; Mon, 16 Apr 2018 20:15:18 +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 2262CE93 for ; Mon, 16 Apr 2018 20:15:14 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl0-f68.google.com (mail-pl0-f68.google.com [209.85.160.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 7E2F3672 for ; Mon, 16 Apr 2018 20:15:12 +0000 (UTC) Received: by mail-pl0-f68.google.com with SMTP id c7-v6so10652337plr.5 for ; Mon, 16 Apr 2018 13:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YeQKzGDhuA5KmFqxgCbG9fDsxcjm/hCCG5MTEyseSHQ=; b=BuLjhdKYb1jqdTtK38ST1ufAshIsP88vjD2JUWINJGQqpXYLpk4x6FoGvFTIf3uf7n /Lj+7MgfQNCceUcBOB/iY9okRLglTfwcs9zfwHk8/Y48d2gHwZPw4sm2teRcUCi80lfk PJ8v7OJ3TuOqYTnG/aIV2pQrqtT45zsLQEpoUkkn0izQnf7MQbOK2ViwcQeahVeaWwnd JlKWNbSVIqi2C3DQy1gMDEL4DGhW13qqw8s1Icd2xib1g1wZE6FSlM/GfVdsjQqWLz4N /vREHw9ESQM7Y9zpIOTP/5e20wcA/Wyh3ii/QQmvm/QoYzwT5qhJeY1YcrysGWm/MAGe m5Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YeQKzGDhuA5KmFqxgCbG9fDsxcjm/hCCG5MTEyseSHQ=; b=sr+hedgNcMD0T6uu4olgrvo3qCDAmEuNfaEuFnhY6QX9W00nApKfOkEgwJ5z6ZagiE c8U8nBH48qK7uVXvxooJMyc7OgwXBz1I1mFf3CdzaQ0VfqomrqjXN5zQHo2RNgr2xjmp jLuXtTFyHBqRgVXDw+D3JE9TSmEHBD+G20c+2WcJ9/HJXsKPhNHLLlC88YmnWTHkWNOE xcDQ/00Lc3RYpq+9Msd0PZxQue9zgliTTaXG3HP7T3iLXLTXwHmSMvFKbGScHFV8Iqna Tg4NLQtWDCd19a/Z+wHY7E7aFbBwi9aMUvDqZ4PGtBzIXzCa+l0yQENIr1yhabh474fT V07A== X-Gm-Message-State: ALQs6tAsMFQzvjAr/uObyVbpoqLZqRiJzw9OF5GEDlWaz7YPATlsICZM MvkK7dfmWkv5UzWU3Kn/lVIpPQ== X-Google-Smtp-Source: AIpwx48HpUg06Ghq5Yy7U6la2yKzogrq1VPRe1lAsk6zKdxnNSRYgNJkvW78PhULR7yMxktDENuc0w== X-Received: by 2002:a17:902:bd8d:: with SMTP id q13-v6mr16917508pls.330.1523909711826; Mon, 16 Apr 2018 13:15:11 -0700 (PDT) Received: from localhost.localdomain.localdomain ([216.113.160.71]) by smtp.gmail.com with ESMTPSA id m7sm2306746pga.46.2018.04.16.13.15.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 13:15:11 -0700 (PDT) From: Han Zhou X-Google-Original-From: Han Zhou To: dev@openvswitch.org Date: Mon, 16 Apr 2018 13:14:20 -0700 Message-Id: <1523909665-27961-6-git-send-email-hzhou8@ebay.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1523909665-27961-1-git-send-email-hzhou8@ebay.com> References: <1523909665-27961-1-git-send-email-hzhou8@ebay.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE 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] [RFC v3 05/10] ovn-controller: split ovs_idl inputs in incremental engine 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 Create nodes for ovs_idl inputs and add ovs_idl inputs and SB inputs as dependencies for runtime_data. With this patch there is no recomputed if there is no change in input. For example, pinctrl input will not trigger flow recompute any more. Signed-off-by: Han Zhou --- ovn/controller/ovn-controller.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index 847a3aa..1f8ae05 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -605,6 +605,9 @@ ENGINE_FUNC_SB(dhcpv6_options); ENGINE_FUNC_SB(dns); ENGINE_FUNC_SB(gateway_chassis); +ENGINE_FUNC_OVS(port); +ENGINE_FUNC_OVS(interface); + struct ed_type_runtime_data { struct chassis_index chassis_index; @@ -729,6 +732,7 @@ runtime_data_run(struct engine_node *node) chassis_index_init(chassis_index, ctx->ovnsb_idl); bfd_calculate_active_tunnels(br_int, active_tunnels); + /* requires ctx->ovnsb_idl_txn */ binding_run(ctx, br_int, chassis, chassis_index, active_tunnels, local_datapaths, local_lports, local_lport_ids); @@ -897,6 +901,9 @@ main(int argc, char *argv[]) ENGINE_NODE_SB(dns, "dns", &ctx); ENGINE_NODE_SB(gateway_chassis, "gateway_chassis", &ctx); + ENGINE_NODE_OVS(port, "ovs_table_port", &ctx); + ENGINE_NODE_OVS(interface, "ovs_table_interface", &ctx); + ENGINE_NODE(runtime_data, "runtime_data", &ctx); ENGINE_NODE(flow_output, "flow_output", &ctx); engine_add_input(&en_flow_output, &en_runtime_data, NULL); @@ -915,6 +922,15 @@ main(int argc, char *argv[]) engine_add_input(&en_flow_output, &en_sb_dns, NULL); engine_add_input(&en_flow_output, &en_sb_gateway_chassis, NULL); + engine_add_input(&en_runtime_data, &en_ovs_port, NULL); + engine_add_input(&en_runtime_data, &en_ovs_interface, NULL); + + engine_add_input(&en_runtime_data, &en_sb_chassis, NULL); + engine_add_input(&en_runtime_data, &en_sb_address_set, NULL); + engine_add_input(&en_runtime_data, &en_sb_datapath_binding, NULL); + engine_add_input(&en_runtime_data, &en_sb_port_binding, NULL); + engine_add_input(&en_runtime_data, &en_sb_gateway_chassis, NULL); + engine_init(&en_flow_output); ofctrl_init(&ed_flow_output.group_table, @@ -927,9 +943,11 @@ main(int argc, char *argv[]) &pending_pkt); uint64_t engine_run_id = 0; + uint64_t old_engine_run_id = 0; /* Main loop. */ exiting = false; while (!exiting) { + old_engine_run_id = engine_run_id; /* Check OVN SB database. */ char *new_ovnsb_remote = get_ovnsb_remote(ovs_idl_loop.idl); if (strcmp(ovnsb_remote, new_ovnsb_remote)) { @@ -975,10 +993,13 @@ main(int argc, char *argv[]) &ed_runtime_data.local_datapaths, &ed_runtime_data.chassis_index); } - ofctrl_put(&ed_flow_output.flow_table, - &ed_runtime_data.pending_ct_zones, - get_nb_cfg(ctx.ovnsb_idl)); + if (en_flow_output.changed) { + ofctrl_put(&ed_flow_output.flow_table, + &ed_runtime_data.pending_ct_zones, + get_nb_cfg(ctx.ovnsb_idl)); + } } + pinctrl_run(&ctx, br_int, chassis, &ed_runtime_data.chassis_index, &ed_runtime_data.local_datapaths, &ed_runtime_data.active_tunnels); @@ -988,6 +1009,14 @@ main(int argc, char *argv[]) &ed_runtime_data.local_datapaths); } + if (old_engine_run_id == engine_run_id || + !ctx.ovnsb_idl_txn || !ctx.ovs_idl_txn) { + VLOG_DBG("engine did not run, force recompute next time: " + "br_int %p, chassis %p", br_int, chassis); + engine_set_force_recompute(true); + } else { + engine_set_force_recompute(false); + } if (ctx.ovnsb_idl_txn) { int64_t cur_cfg = ofctrl_get_cur_cfg();