From patchwork Fri Jun 2 04:11:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1789453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QXV3g6s51z20Q4 for ; Fri, 2 Jun 2023 14:13:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B2C418446C; Fri, 2 Jun 2023 04:13:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B2C418446C X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bgnOiIc6umVY; Fri, 2 Jun 2023 04:13:14 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 823F784497; Fri, 2 Jun 2023 04:13:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 823F784497 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 53F84C0029; Fri, 2 Jun 2023 04:13:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 255B1C007C for ; Fri, 2 Jun 2023 04:13:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 605ED41803 for ; Fri, 2 Jun 2023 04:12:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 605ED41803 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 oZCL6Og2joUU for ; Fri, 2 Jun 2023 04:12:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 61319417CF Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by smtp2.osuosl.org (Postfix) with ESMTPS id 61319417CF for ; Fri, 2 Jun 2023 04:12:37 +0000 (UTC) X-GND-Sasl: hzhou@ovn.org X-GND-Sasl: hzhou@ovn.org X-GND-Sasl: hzhou@ovn.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 5CEAFC0005; Fri, 2 Jun 2023 04:12:34 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Thu, 1 Jun 2023 21:11:50 -0700 Message-Id: <20230602041150.3019311-15-hzhou@ovn.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230602041150.3019311-1-hzhou@ovn.org> References: <20230602041150.3019311-1-hzhou@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v2 14/14] northd: Ignore "up" column change if ignore_lsp_down is true. 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" This change avoids the unnecessary change handling in "lflow" when NB_Global:options:ignore_lsp_down is true (default) if the only change of the LSP is the column "up". This further reduces the number of recompute of "lflow" to zero for the VIF creation-and-binding scenario. Signed-off-by: Han Zhou Reviewed-by: Ales Musil --- northd/northd.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ tests/ovn-northd.at | 4 ++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index ddbc1bf389c8..20440551694a 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -4979,6 +4979,44 @@ check_ls_changes_other_than_lsp(const struct nbrec_logical_switch *ls) return false; } +static bool +check_lsp_changes_other_than_up(const struct nbrec_logical_switch_port *nbsp) +{ + /* Check if the columns are changed in this row. */ + enum nbrec_logical_switch_port_column_id col; + for (col = 0; col < NBREC_LOGICAL_SWITCH_PORT_N_COLUMNS; col++) { + if (nbrec_logical_switch_port_is_updated(nbsp, col) && + col != NBREC_LOGICAL_SWITCH_PORT_COL_UP) { + return true; + } + } + + /* Check if the referenced rows are changed. + XXX: Need a better OVSDB IDL interface for this check. */ + if (nbsp->dhcpv4_options && + nbrec_dhcp_options_row_get_seqno(nbsp->dhcpv4_options, + OVSDB_IDL_CHANGE_MODIFY) > 0) { + return true; + } + if (nbsp->dhcpv6_options && + nbrec_dhcp_options_row_get_seqno(nbsp->dhcpv6_options, + OVSDB_IDL_CHANGE_MODIFY) > 0) { + return true; + } + if (nbsp->ha_chassis_group && + nbrec_ha_chassis_group_row_get_seqno(nbsp->ha_chassis_group, + OVSDB_IDL_CHANGE_MODIFY) > 0) { + return true; + } + for (size_t i = 0; i < nbsp->n_mirror_rules; i++) { + if (nbrec_mirror_row_get_seqno(nbsp->mirror_rules[i], + OVSDB_IDL_CHANGE_MODIFY) > 0) { + return true; + } + } + return false; +} + /* Return true if changes are handled incrementally, false otherwise. * When there are any changes, try to track what's exactly changed and set * northd_data->change_tracked accordingly: change tracked - true, otherwise, @@ -5059,6 +5097,14 @@ northd_handle_ls_changes(struct ovsdb_idl_txn *ovnsb_idl_txn, * by this change. Fallback to recompute. */ goto fail; } + if (!check_lsp_is_up && + !check_lsp_changes_other_than_up(new_nbsp)) { + /* If the only change is the "up" column while the + * "ignore_lsp_down" is set to true, just ignore this + * change. */ + op->visited = true; + continue; + } ovn_port_destroy(&nd->ls_ports, op); op = ls_port_create(ovnsb_idl_txn, &nd->ls_ports, new_nbsp->name, new_nbsp, od, sb, diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index d5436136b809..999166cd427e 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -9506,14 +9506,14 @@ check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats check ovn-nbctl --wait=hv lsp-add ls0 lsp0-1 -- lsp-set-addresses lsp0-1 "aa:aa:aa:00:00:01 192.168.0.11" AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats northd recompute], [0], [0 ]) -AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats lflow recompute], [0], [2 +AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats lflow recompute], [0], [0 ]) check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats check ovn-nbctl --wait=hv lsp-add ls0 lsp0-2 -- lsp-set-addresses lsp0-2 "aa:aa:aa:00:00:02 192.168.0.12" AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats northd recompute], [0], [0 ]) -AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats lflow recompute], [0], [2 +AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats lflow recompute], [0], [0 ]) check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats