From patchwork Thu Jun 3 12:29:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1487211 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=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::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 4FwlZR2txLz9sxS for ; Thu, 3 Jun 2021 22:29:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id EB65A40517; Thu, 3 Jun 2021 12:29:16 +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 tfkIdO6JIZME; Thu, 3 Jun 2021 12:29:13 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTP id 6923B400CA; Thu, 3 Jun 2021 12:29:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3EB9CC000F; Thu, 3 Jun 2021 12:29:12 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id E2095C0001 for ; Thu, 3 Jun 2021 12:29:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C4978606A5 for ; Thu, 3 Jun 2021 12:29:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7BITVvebXcX6 for ; Thu, 3 Jun 2021 12:29:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by smtp3.osuosl.org (Postfix) with ESMTPS id E6D9360679 for ; Thu, 3 Jun 2021 12:29:09 +0000 (UTC) Received: (Authenticated sender: numans@ovn.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 81D5EC0009; Thu, 3 Jun 2021 12:29:07 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Thu, 3 Jun 2021 08:29:01 -0400 Message-Id: <20210603122901.2066782-1-numans@ovn.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210603122721.2066524-1-numans@ovn.org> References: <20210603122721.2066524-1-numans@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v9 2/5] controller: Handle sbrec_chassis changes in lflow and pflow output engines. 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" From: Numan Siddique This patch adds a sbrec_chassis change handler to both the lflow and plfow output engines. It returns false if a chassis is added or deleted so that a full recompute is triggered. Any updates to the sbrec_chassis table is ignored as there is no need to handle these changes. Signed-off-by: Numan Siddique --- controller/ovn-controller.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 5ea3035fb..b49786441 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -2454,6 +2454,30 @@ struct ovn_controller_exit_args { bool *restart; }; +/* Handles sbrec_chassis changes. + * If a new chassis is added or removed return false, so that + * flows are recomputed. For any updates, there is no need for + * any flow computation. Encap changes will also result in + * sbrec_chassis changes, but we handle encap changes separately. + */ +static bool +pflow_lflow_output_sb_chassis_handler(struct engine_node *node, + void *data OVS_UNUSED) +{ + struct sbrec_chassis_table *chassis_table = + (struct sbrec_chassis_table *)EN_OVSDB_GET( + engine_get_input("SB_chassis", node)); + + const struct sbrec_chassis *ch; + SBREC_CHASSIS_TABLE_FOR_EACH_TRACKED (ch, chassis_table) { + if (sbrec_chassis_is_deleted(ch) || sbrec_chassis_is_new(ch)) { + return false; + } + } + + return true; +} + /* Returns false if the northd internal version stored in SB_Global * and ovn-controller internal version don't match. */ @@ -2672,7 +2696,9 @@ main(int argc, char *argv[]) engine_add_input(&en_pflow_output, &en_ovs_interface, pflow_output_ovs_iface_handler); engine_add_input(&en_pflow_output, &en_ct_zones, NULL); - engine_add_input(&en_pflow_output, &en_sb_chassis, NULL); + engine_add_input(&en_pflow_output, &en_sb_chassis, + pflow_lflow_output_sb_chassis_handler); + engine_add_input(&en_pflow_output, &en_sb_port_binding, pflow_output_sb_port_binding_handler); engine_add_input(&en_pflow_output, &en_sb_multicast_group, @@ -2699,7 +2725,8 @@ main(int argc, char *argv[]) engine_add_input(&en_lflow_output, &en_sb_multicast_group, engine_noop_handler); - engine_add_input(&en_lflow_output, &en_sb_chassis, NULL); + engine_add_input(&en_lflow_output, &en_sb_chassis, + pflow_lflow_output_sb_chassis_handler); /* Any changes to the port binding, need not be handled * for lflow_outout engine. We still need sb_port_binding