From patchwork Tue Feb 18 15:31:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1240138 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.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48MPwz3N02z9sRh for ; Wed, 19 Feb 2020 02:32:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id EFBBB84995; Tue, 18 Feb 2020 15:32:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tFXGbMbW4yXu; Tue, 18 Feb 2020 15:32:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 4303B84580; Tue, 18 Feb 2020 15:32:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1A068C08A0; Tue, 18 Feb 2020 15:32:16 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id EEB48C013E for ; Tue, 18 Feb 2020 15:32:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DF65184763 for ; Tue, 18 Feb 2020 15:32:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HgWXNrySMcFC for ; Tue, 18 Feb 2020 15:32:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by whitealder.osuosl.org (Postfix) with ESMTPS id 9566184580 for ; Tue, 18 Feb 2020 15:32:13 +0000 (UTC) X-Originating-IP: 115.99.223.178 Received: from nummac.local (unknown [115.99.223.178]) (Authenticated sender: numans@ovn.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id A83211BF216; Tue, 18 Feb 2020 15:32:10 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Tue, 18 Feb 2020 21:01:59 +0530 Message-Id: <20200218153159.843124-1-numans@ovn.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn] ovn-controller: Don't clear the lflow resources ref during flow_output_run 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 After the patch [1], which added caching of lflow expr, the lflow_resource_ref is not rebuilt properly when lflow_run() is called. If a lflow is already cached in lflow expr cache, then the lflow_resource_ref is not updated. But flow_output_run() clears the lflow_resource_ref cache before calling lflow_run(). This results in incorrect OF flows present in the switch even if the address set/port group references have changed. This patch fixes this issue by not clearing the lflow_resource_ref cache. This cache gets cleaned up during lflow change handler or in lflow_run(). [1] - 8795bec737b9("ovn-controller: Cache logical flow expr tree for each lflow.") Fixes: 8795bec737b9("ovn-controller: Cache logical flow expr tree for each lflow.") Signed-off-by: Numan Siddique --- controller/lflow.c | 3 +++ controller/ovn-controller.c | 2 -- tests/ovn.at | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/controller/lflow.c b/controller/lflow.c index 79d89131a..072b2f1f1 100644 --- a/controller/lflow.c +++ b/controller/lflow.c @@ -924,6 +924,9 @@ lflow_run(struct lflow_ctx_in *l_ctx_in, struct lflow_ctx_out *l_ctx_out) SBREC_LOGICAL_FLOW_TABLE_FOR_EACH_TRACKED (lflow, l_ctx_in->logical_flow_table) { if (sbrec_logical_flow_is_deleted(lflow)) { + /* Delete entries from lflow resource reference. */ + lflow_resource_destroy_lflow(l_ctx_out->lfrr, + &lflow->header_.uuid); struct lflow_expr *le = lflow_expr_get(l_ctx_out->lflow_expr_cache, lflow); if (le) { diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 4d245ca28..b3be5c2db 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1441,7 +1441,6 @@ en_flow_output_run(struct engine_node *node, void *data) struct ovn_extend_table *group_table = &fo->group_table; struct ovn_extend_table *meter_table = &fo->meter_table; uint32_t *conj_id_ofs = &fo->conj_id_ofs; - struct lflow_resource_ref *lfrr = &fo->lflow_resource_ref; static bool first_run = true; if (first_run) { @@ -1450,7 +1449,6 @@ en_flow_output_run(struct engine_node *node, void *data) ovn_desired_flow_table_clear(flow_table); ovn_extend_table_clear(group_table, false /* desired */); ovn_extend_table_clear(meter_table, false /* desired */); - lflow_resource_clear(lfrr); } *conj_id_ofs = 1; diff --git a/tests/ovn.at b/tests/ovn.at index ea6760e1f..254645a3a 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -13778,6 +13778,10 @@ for i in 1 2 3; do n_flows_after=`ovs-ofctl dump-flows br-int | grep "10.1.2.10" | wc -l` AT_CHECK([test $(expr $n_flows_before \* 2) = $n_flows_after], [0], [ignore]) + # Trigger full recompute. Creating a chassis would trigger full recompute. + ovn-sbctl chassis-add tst geneve 127.0.0.4 + ovn-sbctl chassis-del tst + # Remove an ACL ovn-nbctl --wait=hv acl-del ls1 to-lport 200 \ 'outport=="lp2" && ip4 && ip4.src == $as1'