From patchwork Tue Aug 20 13:36:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1974430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YjVtwg1T; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wp9VW1DvSz1yXZ for ; Tue, 20 Aug 2024 23:36:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9F361405F7; Tue, 20 Aug 2024 13:36:49 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 0B1ykNEQztVu; Tue, 20 Aug 2024 13:36:48 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1896240199 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YjVtwg1T Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1896240199; Tue, 20 Aug 2024 13:36:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B56F6C102B; Tue, 20 Aug 2024 13:36:47 +0000 (UTC) X-Original-To: ovs-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 1C1B9C1029 for ; Tue, 20 Aug 2024 13:36:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E58D940A1E for ; Tue, 20 Aug 2024 13:36:45 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 94k13JlgFkNs for ; Tue, 20 Aug 2024 13:36:44 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=lorenzo.bianconi@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org B1A9B40A0E Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B1A9B40A0E Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YjVtwg1T Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id B1A9B40A0E for ; Tue, 20 Aug 2024 13:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724161003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9gMJcVhgq4hLML4Z7y5dhG5OE6MojN8k4yEMQ7TVNRE=; b=YjVtwg1ToTwuTNdLkvchDViIdVgGhJOWKn9IxJVbRGtU3o2nqZerC6rev+cvdeF2gNTQRk Qz6iYpovF/1U6X9uKvwYD/A/nntt1GdOgrFXV5cMvqZBi/ERvC+xyPhVjzhFWIVwEiu8/f jIi+px6L70TzZKbD1CoR7/oPzOxVKV4= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-toF0RsChM1SrnjCiUhNVpQ-1; Tue, 20 Aug 2024 09:36:42 -0400 X-MC-Unique: toF0RsChM1SrnjCiUhNVpQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42809eb7b99so29633795e9.0 for ; Tue, 20 Aug 2024 06:36:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724161001; x=1724765801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9gMJcVhgq4hLML4Z7y5dhG5OE6MojN8k4yEMQ7TVNRE=; b=mdsGDJ88g6rVxgzn9OKdXJPog9svARzRzQlQr6sd3dywBx++0cJcTrrgnjwy/KO4Ae M7PwV5w9y8W2QcY4Eghd77BRzHgpbMcIBIn6YIHWPkWv8fm/36L2GHGvaFyCW4U1/cLR hBieyjg9F0PBnjo+AH+K11nhHLu6VCBLkWcuwkbot+L953V5aqXuUh1fJZQEDg+OrT4w 2ukMy+6AHCdFm2UXyniQRSAIOFcLL0YKU9wWWqu6PfAMLua++CRb7hQhEjEKcY5bBVvx ziYzJS1Iy3T1Qga4Q6+RnoXYmria1/32WkACwcY/Q65KB+kPhpRFwR3uv6ySDZaJXI7m 1q5A== X-Gm-Message-State: AOJu0YwxosY1hwtEIQypeL0oJs7gjpJmDdtSI3/LJxNIsPSShwmO0GR8 Y56QBYsfjv2G/c1Q0ZqhSpKisfw9m/syNoG6eXSgdZCDeGv1bpc6/MiFGYPVJiUcgJBJuC9QIdN j8BZDa/PAjsN4HnuNp++DN8B5ved08hLa2fSJf3r1aP6//p3aWP7MoiVhQScMAsVmVhwJpQI4fa cDZFVRbmesB8WWYadqEsLY+eUy8JwQ/NwijK8o8yTX1gVaKQ2A7A== X-Received: by 2002:a05:600c:1c10:b0:426:5b19:d2b3 with SMTP id 5b1f17b1804b1-42ab57db1a3mr17669845e9.14.1724161000776; Tue, 20 Aug 2024 06:36:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/e06aBoBnW8gsAZI6oeBxZmMIFEiBmDChiJhXlOTNzNAovUi05hwcaJ7U7GiiO7jwtB8x9g== X-Received: by 2002:a05:600c:1c10:b0:426:5b19:d2b3 with SMTP id 5b1f17b1804b1-42ab57db1a3mr17669675e9.14.1724161000297; Tue, 20 Aug 2024 06:36:40 -0700 (PDT) Received: from localhost (net-188-152-77-192.cust.vodafonedsl.it. [188.152.77.192]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed6586f7sm142730175e9.23.2024.08.20.06.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 06:36:40 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Tue, 20 Aug 2024 15:36:22 +0200 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/4] northd: Introduce bfd_sync_data data structure. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Introduce bfd_sync_data as private structure for en_bfd_sync node. Introduce bfd_sync_init and bfd_sync_destroy utility routines Build bfd_port sset in bfd_table_sync(). Signed-off-by: Lorenzo Bianconi --- northd/en-lflow.c | 5 +++-- northd/en-northd.c | 15 ++++++++------- northd/northd.c | 18 +++++++++++++++++- northd/northd.h | 11 ++++++++++- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/northd/en-lflow.c b/northd/en-lflow.c index f9d7f2459..421fcd48c 100644 --- a/northd/en-lflow.c +++ b/northd/en-lflow.c @@ -42,7 +42,8 @@ lflow_get_input_data(struct engine_node *node, struct lflow_input *lflow_input) { struct northd_data *northd_data = engine_get_input_data("northd", node); - struct bfd_data *bfd_data = engine_get_input_data("bfd_sync", node); + struct bfd_sync_data *bfd_sync_data = + engine_get_input_data("bfd_sync", node); struct static_routes_data *static_routes_data = engine_get_input_data("static_routes", node); struct route_policies_data *route_policies_data = @@ -82,7 +83,7 @@ lflow_get_input_data(struct engine_node *node, lflow_input->meter_groups = &sync_meters_data->meter_groups; lflow_input->lb_datapaths_map = &northd_data->lb_datapaths_map; lflow_input->svc_monitor_map = &northd_data->svc_monitor_map; - lflow_input->bfd_connections = &bfd_data->bfd_connections; + lflow_input->bfd_connections = &bfd_sync_data->bfd_connections; lflow_input->parsed_routes = &static_routes_data->parsed_routes; lflow_input->route_tables = &static_routes_data->route_tables; lflow_input->route_policies = &route_policies_data->route_policies; diff --git a/northd/en-northd.c b/northd/en-northd.c index 63f93bbf4..dee6c0f03 100644 --- a/northd/en-northd.c +++ b/northd/en-northd.c @@ -392,15 +392,16 @@ en_bfd_sync_run(struct engine_node *node, void *data) = engine_get_input_data("static_routes", node); const struct nbrec_bfd_table *nbrec_bfd_table = EN_OVSDB_GET(engine_get_input("NB_bfd", node)); - struct bfd_data *bfd_sync_data = data; + struct bfd_sync_data *bfd_sync_data = data; - bfd_destroy(data); - bfd_init(data); + bfd_sync_destroy(data); + bfd_sync_init(data); bfd_table_sync(eng_ctx->ovnsb_idl_txn, nbrec_bfd_table, &northd_data->lr_ports, &bfd_data->bfd_connections, &route_policies_data->bfd_active_connections, &static_routes_data->bfd_active_connections, - &bfd_sync_data->bfd_connections); + &bfd_sync_data->bfd_connections, + &bfd_sync_data->bfd_ports); engine_set_node_state(node, EN_UPDATED); } @@ -468,8 +469,8 @@ void *en_bfd_sync_init(struct engine_node *node OVS_UNUSED, struct engine_arg *arg OVS_UNUSED) { - struct bfd_data *data = xzalloc(sizeof *data); - bfd_init(data); + struct bfd_sync_data *data = xzalloc(sizeof *data); + bfd_sync_init(data); return data; } @@ -553,7 +554,7 @@ en_bfd_cleanup(void *data) void en_bfd_sync_cleanup(void *data) { - bfd_destroy(data); + bfd_sync_destroy(data); } void diff --git a/northd/northd.c b/northd/northd.c index 7ceed63dd..2009da3d0 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -10541,7 +10541,8 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn, const struct hmap *bfd_connections, const struct hmap *rp_bfd_connections, const struct hmap *sr_bfd_connections, - struct hmap *sync_bfd_connections) + struct hmap *sync_bfd_connections, + struct sset *bfd_ports) { if (!ovnsb_txn) { return; @@ -10624,6 +10625,7 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn, } } + sset_add(bfd_ports, nb_bt->logical_port); bfd_e->stale = false; } @@ -18796,6 +18798,13 @@ bfd_init(struct bfd_data *data) hmap_init(&data->bfd_connections); } +void +bfd_sync_init(struct bfd_sync_data *data) +{ + hmap_init(&data->bfd_connections); + sset_init(&data->bfd_ports); +} + void ecmp_nexthop_init(struct ecmp_nexthop_data *data) { @@ -18858,6 +18867,13 @@ bfd_destroy(struct bfd_data *data) __bfd_destroy(&data->bfd_connections); } +void +bfd_sync_destroy(struct bfd_sync_data *data) +{ + __bfd_destroy(&data->bfd_connections); + sset_destroy(&data->bfd_ports); +} + void route_policies_destroy(struct route_policies_data *data) { diff --git a/northd/northd.h b/northd/northd.h index c7f0b829b..39a16c092 100644 --- a/northd/northd.h +++ b/northd/northd.h @@ -195,6 +195,11 @@ struct bfd_data { struct hmap bfd_connections; }; +struct bfd_sync_data { + struct hmap bfd_connections; + struct sset bfd_ports; +}; + struct ecmp_nexthop_data { struct simap nexthops; }; @@ -743,6 +748,9 @@ void static_routes_destroy(struct static_routes_data *); void bfd_init(struct bfd_data *); void bfd_destroy(struct bfd_data *); +void bfd_sync_init(struct bfd_sync_data *); +void bfd_sync_destroy(struct bfd_sync_data *); + void build_ecmp_nexthop_table(struct ovsdb_idl_txn *, struct hmap *, struct simap *, const struct sbrec_ecmp_nexthop_table *); @@ -790,7 +798,8 @@ void build_route_policies(struct ovn_datapath *, const struct hmap *, const struct hmap *, struct hmap *, struct hmap *); void bfd_table_sync(struct ovsdb_idl_txn *, const struct nbrec_bfd_table *, const struct hmap *, const struct hmap *, - const struct hmap *, const struct hmap *, struct hmap *); + const struct hmap *, const struct hmap *, struct hmap *, + struct sset *); void build_bfd_map(const struct nbrec_bfd_table *, const struct sbrec_bfd_table *, struct hmap *); void run_update_worker_pool(int n_threads); From patchwork Tue Aug 20 13:36:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1974431 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hmsrJvyJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wp9VZ6B0nz1yXZ for ; Tue, 20 Aug 2024 23:36:54 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5594060902; Tue, 20 Aug 2024 13:36:53 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id sGS0tJrqmMQ1; Tue, 20 Aug 2024 13:36:51 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 66B406090B Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hmsrJvyJ Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 66B406090B; Tue, 20 Aug 2024 13:36:51 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1A844C102B; Tue, 20 Aug 2024 13:36:51 +0000 (UTC) X-Original-To: ovs-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 10580C1029 for ; Tue, 20 Aug 2024 13:36:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0C73A40A41 for ; Tue, 20 Aug 2024 13:36:49 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 5ZcykHCC6Q_J for ; Tue, 20 Aug 2024 13:36:47 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=lorenzo.bianconi@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org B55A640A39 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B55A640A39 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hmsrJvyJ Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id B55A640A39 for ; Tue, 20 Aug 2024 13:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724161005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5YWFi572IXTDE5pjnEX6lr5YAmWv/sGXNeKsWH5L8oA=; b=hmsrJvyJQS95qSgtcP9eAXx5erPLO9xDnxv3wpoaVdY54heT9hoy3Fem25chy6UcBps6LG thBnpfmah1KLWJqX/Py3t1/G3xSE45aQcMF75QPTv+M9EcK1Alo7DikFXtEH9nhe36ozvt Yoa2xSfyOjEOm/cuq+pZYOtaeIfv9eA= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-29ZbE-DzMhOmShyqhyTZrw-1; Tue, 20 Aug 2024 09:36:44 -0400 X-MC-Unique: 29ZbE-DzMhOmShyqhyTZrw-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-371a804f191so2510494f8f.3 for ; Tue, 20 Aug 2024 06:36:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724161003; x=1724765803; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5YWFi572IXTDE5pjnEX6lr5YAmWv/sGXNeKsWH5L8oA=; b=ipajkCaz4dmYQMb5cUeB+RCD1t7SgVflEO+VM88r0sLAwvMQFJG3tKc5r0LnaPez+T S5uFocNR8JGIJYPGJRYbxquEzZCfbbdarT61LN4+2/IGUT5/4oJIEri4Y5kmDyoPoNNT qMqf/qpy5i1NsY9e0m+TuyFE1APO6mjNePAJhVCbkg8KY7LfdB//D9dYDNAHZibctZ4L uTHvLXf/rVeZbjip22gV9RtF8hL+1tz0B+R2kzf3/CWO5zywWHkP8G1T/BtYJglOcH+G UhyskzL1efQOfTJLYOrtw+OC+VcOsq4Mv+Xh93UWiwpwvy5wiYzX5uU+jcp/Wce+j39e lDwA== X-Gm-Message-State: AOJu0YxiFbT2yz4PGtbFWn2D7oFs7KEByHueE+jXerWJVbboBRfxZnP5 QfSxV07Ish0B1JjAb794e3yC6bVFinDAivqIQLbRWfKam++9s4++ZZKGj65/j9lVVfFU1/9h2r9 La+5fWtWSD45FbD5vQrzuA+cWIgUw+9c4N0h/I1fNCsMZ7MELg1NfFPAD9FeMiUAVroQutrTL8N j7stXRZMkgd8/UwKE1aYProuS06GSM96NiFdyueaNGKZDASyxvwQ== X-Received: by 2002:adf:ce8e:0:b0:371:8e30:290 with SMTP id ffacd0b85a97d-3719443ecc1mr8055079f8f.21.1724161003137; Tue, 20 Aug 2024 06:36:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYMToDv8NS37u1B2OjoRlHhQ69vd0C86xo+KndosHJEGCJPf4TB9Glp9rXvaP1yk5C5bnIFw== X-Received: by 2002:adf:ce8e:0:b0:371:8e30:290 with SMTP id ffacd0b85a97d-3719443ecc1mr8055050f8f.21.1724161002454; Tue, 20 Aug 2024 06:36:42 -0700 (PDT) Received: from localhost (net-188-152-77-192.cust.dsl.teletu.it. [188.152.77.192]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37189896a9csm13178233f8f.79.2024.08.20.06.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 06:36:42 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Tue, 20 Aug 2024 15:36:23 +0200 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/4] northd: Optimize lookup in bfd_is_port_running. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Optimize port lookup in bfd_is_port_running using a bfd_ports sset. Get rid of bfd_connections hmap building lflows Signed-off-by: Lorenzo Bianconi --- northd/en-lflow.c | 2 +- northd/northd.c | 68 +++++++++++++++++++++-------------------------- northd/northd.h | 2 +- 3 files changed, 32 insertions(+), 40 deletions(-) diff --git a/northd/en-lflow.c b/northd/en-lflow.c index 421fcd48c..08e5bd0a1 100644 --- a/northd/en-lflow.c +++ b/northd/en-lflow.c @@ -83,7 +83,7 @@ lflow_get_input_data(struct engine_node *node, lflow_input->meter_groups = &sync_meters_data->meter_groups; lflow_input->lb_datapaths_map = &northd_data->lb_datapaths_map; lflow_input->svc_monitor_map = &northd_data->svc_monitor_map; - lflow_input->bfd_connections = &bfd_sync_data->bfd_connections; + lflow_input->bfd_ports = &bfd_sync_data->bfd_ports; lflow_input->parsed_routes = &static_routes_data->parsed_routes; lflow_input->route_tables = &static_routes_data->route_tables; lflow_input->route_policies = &route_policies_data->route_policies; diff --git a/northd/northd.c b/northd/northd.c index 2009da3d0..413b17830 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -10442,18 +10442,11 @@ bfd_port_lookup(const struct hmap *bfd_map, const char *logical_port, } static bool -bfd_is_port_running(const struct hmap *bfd_map, const char *port) +bfd_is_port_running(const struct sset *bfd_ports, const char *port) { - struct bfd_entry *bfd_e; - HMAP_FOR_EACH (bfd_e, hmap_node, bfd_map) { - if (!strcmp(bfd_e->logical_port, port)) { - return true; - } - } - return false; + return !!sset_find(bfd_ports, port); } - #define BFD_DEF_MINTX 1000 /* 1s */ #define BFD_DEF_MINRX 1000 /* 1s */ #define BFD_DEF_DETECT_MULT 5 @@ -11711,7 +11704,7 @@ add_route(struct lflow_table *lflows, struct ovn_datapath *od, const struct ovn_port *op, const char *lrp_addr_s, const char *network_s, int plen, const char *gateway, bool is_src_route, const uint32_t rtb_id, - const struct hmap *bfd_connections, + const struct sset *bfd_ports, const struct ovsdb_idl_row *stage_hint, bool is_discard_route, int ofs, struct lflow_ref *lflow_ref) { @@ -11760,7 +11753,7 @@ add_route(struct lflow_table *lflows, struct ovn_datapath *od, priority, ds_cstr(&match), ds_cstr(&actions), stage_hint, lflow_ref); - if (op && bfd_is_port_running(bfd_connections, op->key)) { + if (op && bfd_is_port_running(bfd_ports, op->key)) { ds_put_format(&match, " && udp.dst == 3784"); ovn_lflow_add_with_hint(lflows, op->od, S_ROUTER_IN_IP_ROUTING, @@ -11777,7 +11770,7 @@ static void build_static_route_flow(struct lflow_table *lflows, struct ovn_datapath *od, const struct hmap *lr_ports, const struct parsed_route *route_, - const struct hmap *bfd_connections, + const struct sset *bfd_ports, struct lflow_ref *lflow_ref) { const char *lrp_addr_s = NULL; @@ -11802,7 +11795,7 @@ build_static_route_flow(struct lflow_table *lflows, struct ovn_datapath *od, add_route(lflows, route_->is_discard_route ? od : out_port->od, out_port, lrp_addr_s, prefix_s, route_->plen, route->nexthop, route_->is_src_route, route_->route_table_id, - bfd_connections, &route->header_, route_->is_discard_route, + bfd_ports, &route->header_, route_->is_discard_route, ofs, lflow_ref); free(prefix_s); @@ -12954,10 +12947,10 @@ build_lrouter_force_snat_flows_op(struct ovn_port *op, static void build_lrouter_bfd_flows(struct lflow_table *lflows, struct ovn_port *op, const struct shash *meter_groups, - const struct hmap *bfd_connections, + const struct sset *bfd_ports, struct lflow_ref *lflow_ref) { - if (!bfd_is_port_running(bfd_connections, op->key)) { + if (!bfd_is_port_running(bfd_ports, op->key)) { return; } @@ -13553,7 +13546,7 @@ build_ip_routing_pre_flows_for_lrouter(struct ovn_datapath *od, */ static void build_ip_routing_flows_for_lrp(struct ovn_port *op, - const struct hmap *bfd_connections, + const struct sset *bfd_ports, struct lflow_table *lflows, struct lflow_ref *lflow_ref) { @@ -13562,7 +13555,7 @@ build_ip_routing_flows_for_lrp(struct ovn_port *op, add_route(lflows, op->od, op, op->lrp_networks.ipv4_addrs[i].addr_s, op->lrp_networks.ipv4_addrs[i].network_s, op->lrp_networks.ipv4_addrs[i].plen, NULL, false, 0, - bfd_connections, &op->nbrp->header_, false, + bfd_ports, &op->nbrp->header_, false, ROUTE_PRIO_OFFSET_CONNECTED, lflow_ref); } @@ -13570,7 +13563,7 @@ build_ip_routing_flows_for_lrp(struct ovn_port *op, add_route(lflows, op->od, op, op->lrp_networks.ipv6_addrs[i].addr_s, op->lrp_networks.ipv6_addrs[i].network_s, op->lrp_networks.ipv6_addrs[i].plen, NULL, false, 0, - bfd_connections, &op->nbrp->header_, false, + bfd_ports, &op->nbrp->header_, false, ROUTE_PRIO_OFFSET_CONNECTED, lflow_ref); } } @@ -13579,7 +13572,7 @@ static void build_static_route_flows_for_lrouter( struct ovn_datapath *od, struct lflow_table *lflows, const struct hmap *lr_ports, struct hmap *parsed_routes, - struct simap *route_tables, const struct hmap *bfd_connections, + struct simap *route_tables, const struct sset *bfd_ports, struct lflow_ref *lflow_ref, struct simap *nexthops_table) { ovs_assert(od->nbr); @@ -13628,7 +13621,7 @@ build_static_route_flows_for_lrouter( const struct unique_routes_node *ur; HMAP_FOR_EACH (ur, hmap_node, &unique_routes) { build_static_route_flow(lflows, od, lr_ports, ur->route, - bfd_connections, lflow_ref); + bfd_ports, lflow_ref); } ecmp_groups_destroy(&ecmp_groups); unique_routes_destroy(&unique_routes); @@ -15330,7 +15323,7 @@ build_lrouter_ipv4_ip_input(struct ovn_port *op, struct lflow_table *lflows, struct ds *match, struct ds *actions, const struct shash *meter_groups, - const struct hmap *bfd_connections, + const struct sset *bfd_ports, struct lflow_ref *lflow_ref) { ovs_assert(op->nbrp); @@ -15372,8 +15365,7 @@ build_lrouter_ipv4_ip_input(struct ovn_port *op, } /* BFD msg handling */ - build_lrouter_bfd_flows(lflows, op, meter_groups, bfd_connections, - lflow_ref); + build_lrouter_bfd_flows(lflows, op, meter_groups, bfd_ports, lflow_ref); /* ICMP time exceeded */ struct ds ip_ds = DS_EMPTY_INITIALIZER; @@ -16826,7 +16818,7 @@ build_lsp_lflows_for_lbnats(struct ovn_port *lsp, static void build_routable_flows_for_router_port( struct ovn_port *lrp, const struct lr_stateful_record *lr_stateful_rec, - const struct hmap *bfd_connections, + const struct sset *bfd_ports, struct lflow_table *lflows, struct ds *match, struct ds *actions) @@ -16863,7 +16855,7 @@ build_routable_flows_for_router_port( router_port->lrp_networks.ipv4_addrs[0].addr_s, laddrs->ipv4_addrs[k].network_s, laddrs->ipv4_addrs[k].plen, NULL, false, 0, - bfd_connections, &router_port->nbrp->header_, + bfd_ports, &router_port->nbrp->header_, false, ROUTE_PRIO_OFFSET_CONNECTED, lrp->stateful_lflow_ref); } @@ -16974,7 +16966,7 @@ build_lrp_lflows_for_lbnats(struct ovn_port *op, static void build_lbnat_lflows_iterate_by_lrp( struct ovn_port *op, const struct lr_stateful_table *lr_stateful_table, - const struct shash *meter_groups, const struct hmap *bfd_connections, + const struct shash *meter_groups, const struct sset *bfd_ports, struct ds *match, struct ds *actions, struct lflow_table *lflows) { ovs_assert(op->nbrp); @@ -16987,7 +16979,7 @@ build_lbnat_lflows_iterate_by_lrp( build_lrp_lflows_for_lbnats(op, lr_stateful_rec, meter_groups, match, actions, lflows); - build_routable_flows_for_router_port(op, lr_stateful_rec, bfd_connections, + build_routable_flows_for_router_port(op, lr_stateful_rec, bfd_ports, lflows, match, actions); } @@ -17051,7 +17043,7 @@ struct lswitch_flow_build_info { const struct shash *meter_groups; const struct hmap *lb_dps_map; const struct hmap *svc_monitor_map; - const struct hmap *bfd_connections; + const struct sset *bfd_ports; const struct chassis_features *features; char *svc_check_match; struct ds match; @@ -17109,7 +17101,7 @@ build_lswitch_and_lrouter_iterate_by_lr(struct ovn_datapath *od, build_ip_routing_pre_flows_for_lrouter(od, lsi->lflows, NULL); build_static_route_flows_for_lrouter(od, lsi->lflows, lsi->lr_ports, lsi->parsed_routes, lsi->route_tables, - lsi->bfd_connections, NULL, + lsi->bfd_ports, NULL, lsi->nexthops_table); build_mcast_lookup_flows_for_lrouter(od, lsi->lflows, &lsi->match, &lsi->actions, NULL); @@ -17181,7 +17173,7 @@ build_lswitch_and_lrouter_iterate_by_lrp(struct ovn_port *op, &lsi->actions, op->lflow_ref); build_neigh_learning_flows_for_lrouter_port(op, lsi->lflows, &lsi->match, &lsi->actions, op->lflow_ref); - build_ip_routing_flows_for_lrp(op, lsi->bfd_connections, + build_ip_routing_flows_for_lrp(op, lsi->bfd_ports, lsi->lflows, op->lflow_ref); build_ND_RA_flows_for_lrouter_port(op, lsi->lflows, &lsi->match, &lsi->actions, lsi->meter_groups, @@ -17200,7 +17192,7 @@ build_lswitch_and_lrouter_iterate_by_lrp(struct ovn_port *op, lsi->meter_groups, op->lflow_ref); build_lrouter_ipv4_ip_input(op, lsi->lflows, &lsi->match, &lsi->actions, - lsi->meter_groups, lsi->bfd_connections, + lsi->meter_groups, lsi->bfd_ports, op->lflow_ref); build_lrouter_icmp_packet_toobig_admin_flows(op, lsi->lflows, &lsi->match, &lsi->actions, op->lflow_ref); @@ -17293,7 +17285,7 @@ build_lflows_thread(void *arg) build_lswitch_and_lrouter_iterate_by_lrp(op, lsi); build_lbnat_lflows_iterate_by_lrp( op, lsi->lr_stateful_table, lsi->meter_groups, - lsi->bfd_connections, &lsi->match, &lsi->actions, + lsi->bfd_ports, &lsi->match, &lsi->actions, lsi->lflows); } } @@ -17434,7 +17426,7 @@ build_lswitch_and_lrouter_flows( const struct shash *meter_groups, const struct hmap *lb_dps_map, const struct hmap *svc_monitor_map, - const struct hmap *bfd_connections, + const struct sset *bfd_ports, const struct chassis_features *features, const char *svc_monitor_mac, const struct sampling_app_table *sampling_apps, @@ -17470,7 +17462,7 @@ build_lswitch_and_lrouter_flows( lsiv[index].meter_groups = meter_groups; lsiv[index].lb_dps_map = lb_dps_map; lsiv[index].svc_monitor_map = svc_monitor_map; - lsiv[index].bfd_connections = bfd_connections; + lsiv[index].bfd_ports = bfd_ports; lsiv[index].features = features; lsiv[index].svc_check_match = svc_check_match; lsiv[index].thread_lflow_counter = 0; @@ -17516,7 +17508,7 @@ build_lswitch_and_lrouter_flows( .meter_groups = meter_groups, .lb_dps_map = lb_dps_map, .svc_monitor_map = svc_monitor_map, - .bfd_connections = bfd_connections, + .bfd_ports = bfd_ports, .features = features, .svc_check_match = svc_check_match, .svc_monitor_mac = svc_monitor_mac, @@ -17556,7 +17548,7 @@ build_lswitch_and_lrouter_flows( build_lswitch_and_lrouter_iterate_by_lrp(op, &lsi); build_lbnat_lflows_iterate_by_lrp(op, lsi.lr_stateful_table, lsi.meter_groups, - lsi.bfd_connections, + lsi.bfd_ports, &lsi.match, &lsi.actions, lsi.lflows); @@ -17687,7 +17679,7 @@ void build_lflows(struct ovsdb_idl_txn *ovnsb_txn, input_data->meter_groups, input_data->lb_datapaths_map, input_data->svc_monitor_map, - input_data->bfd_connections, + input_data->bfd_ports, input_data->features, input_data->svc_monitor_mac, input_data->sampling_apps, @@ -18056,7 +18048,7 @@ lflow_handle_lr_stateful_changes(struct ovsdb_idl_txn *ovnsb_txn, build_lbnat_lflows_iterate_by_lrp(op, lflow_input->lr_stateful_table, lflow_input->meter_groups, - lflow_input->bfd_connections, + lflow_input->bfd_ports, &match, &actions, lflows); diff --git a/northd/northd.h b/northd/northd.h index 39a16c092..560e1bfe5 100644 --- a/northd/northd.h +++ b/northd/northd.h @@ -225,7 +225,7 @@ struct lflow_input { const struct ls_stateful_table *ls_stateful_table; const struct shash *meter_groups; const struct hmap *lb_datapaths_map; - const struct hmap *bfd_connections; + const struct sset *bfd_ports; const struct chassis_features *features; const struct hmap *svc_monitor_map; bool ovn_internal_version_changed; From patchwork Tue Aug 20 13:36:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1974432 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZXG8PfME; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wp9Vh1BBwz1yXZ for ; Tue, 20 Aug 2024 23:37:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A302760A6B; Tue, 20 Aug 2024 13:36:58 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ccEtx0I21Gxr; Tue, 20 Aug 2024 13:36:55 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3914F60A9B Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZXG8PfME Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3914F60A9B; Tue, 20 Aug 2024 13:36:54 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C062FC102E; Tue, 20 Aug 2024 13:36:53 +0000 (UTC) X-Original-To: ovs-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 1907EC102D for ; Tue, 20 Aug 2024 13:36:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7416260902 for ; Tue, 20 Aug 2024 13:36:50 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 2B8D47KbLD72 for ; Tue, 20 Aug 2024 13:36:49 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=lorenzo.bianconi@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 21D55608EF Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 21D55608EF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 21D55608EF for ; Tue, 20 Aug 2024 13:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724161008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9e5bM8Z0GHz9T+/2HyShI4qO3N6ChxI5ahBTUdaD58I=; b=ZXG8PfMEIo5V4WvTIlIIaRRUhEmzeeOlSSdcueGvj2bpGUbrZ91PEZXmX3E0dohSFHlAXc uv8bWoD7Kca4Z8S9lVcGjdHjCSRwuBVZMX82vOUOO0PArWChb4YgX+OQfzULKlEwWIWQsm NdIbuWWvXOf0VBxjWTwoXTbB+C4zsl8= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-395-NgK1YunXMG6e12yM7wvynQ-1; Tue, 20 Aug 2024 09:36:46 -0400 X-MC-Unique: NgK1YunXMG6e12yM7wvynQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4280c0b3017so48238395e9.1 for ; Tue, 20 Aug 2024 06:36:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724161005; x=1724765805; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9e5bM8Z0GHz9T+/2HyShI4qO3N6ChxI5ahBTUdaD58I=; b=h07QuAUPMZ6TPOLEnAZ71zTH0YFvjwMxw7juSU+jCRTcsZLR//Iql+Lkti0+QBV0jx xnCBg4RtrNJAj2HjHFr/ZXXcKOpC+LImoZstfqANnOe/NrLobuw55ML6XRWt6M2x5TaS Q+1KnHrgZsFs1Oc0x++qRJruaJRmen42Nhqo/jxhNGi36XtfY8f9KjLgqIb5cvR1dDKL FcOnnZHx2auHH0zqmAIDkkUJvYqgaRNaATftxyFM+9/GTsW9uOqMLynK0QbPXmfujHeo pwZSM2lT28VhzXeQTlW0pdyLyK3WgMq73PY6naqk8q9lte7BsLTApzgczM+oDHBCK0rs P4Ag== X-Gm-Message-State: AOJu0YyHgefaBfw8U8Ksr58LeAYIIM+tm/RDhCshMWR8IOECp8ZocJhy EldVAHwHHOg8udomQ33hi5uKs9IxmkybT+q43w7m3Zx5jNVama/3ILe3dFWjvOlmQemCDXz40nS HhUn+Ep9Bzs7cA+VhaMahR1RC8ILimHGrFe1Rw1CpG++HnwDX1hHE/B72hS5YkqoLdpVjPxGdDF vhjFwtJGNa95gXeHG/dMjf4cBHV9rDq3+X9QE/L6o4D7Ug8i9jPw== X-Received: by 2002:a05:600c:3b1e:b0:428:1fa1:7b92 with SMTP id 5b1f17b1804b1-429ed7ae3ecmr90580725e9.19.1724161005074; Tue, 20 Aug 2024 06:36:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaWGbi4/0ZIjDm7Q6oOEPL0v/ErvcP7OQU4xJ+ZedlmbsEp+9zgwjkOVqj2jtGzh2rboBwbg== X-Received: by 2002:a05:600c:3b1e:b0:428:1fa1:7b92 with SMTP id 5b1f17b1804b1-429ed7ae3ecmr90580435e9.19.1724161004576; Tue, 20 Aug 2024 06:36:44 -0700 (PDT) Received: from localhost (net-188-152-77-192.cust.dsl.teletu.it. [188.152.77.192]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3718983a1b8sm13205961f8f.5.2024.08.20.06.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 06:36:44 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Tue, 20 Aug 2024 15:36:24 +0200 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 3/4] northd: Get rid of bfd_connections in bfd_sync_data. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Remove bfd_connections hmap in bfd_sync_data structure and make it local to bfd_table_sync routine since it is no longer used in lflow codebase. Signed-off-by: Lorenzo Bianconi --- northd/en-northd.c | 1 - northd/northd.c | 14 ++++++-------- northd/northd.h | 3 +-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/northd/en-northd.c b/northd/en-northd.c index dee6c0f03..0ecc72a24 100644 --- a/northd/en-northd.c +++ b/northd/en-northd.c @@ -400,7 +400,6 @@ en_bfd_sync_run(struct engine_node *node, void *data) &northd_data->lr_ports, &bfd_data->bfd_connections, &route_policies_data->bfd_active_connections, &static_routes_data->bfd_active_connections, - &bfd_sync_data->bfd_connections, &bfd_sync_data->bfd_ports); engine_set_node_state(node, EN_UPDATED); } diff --git a/northd/northd.c b/northd/northd.c index 413b17830..c7bf09ad6 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -10534,7 +10534,6 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn, const struct hmap *bfd_connections, const struct hmap *rp_bfd_connections, const struct hmap *sr_bfd_connections, - struct hmap *sync_bfd_connections, struct sset *bfd_ports) { if (!ovnsb_txn) { @@ -10542,10 +10541,11 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn, } unsigned long *bfd_src_ports = bitmap_allocate(BFD_UDP_SRC_PORT_LEN); + struct hmap sync_bfd_connections = HMAP_INITIALIZER(&sync_bfd_connections); struct bfd_entry *bfd_e; HMAP_FOR_EACH (bfd_e, hmap_node, bfd_connections) { - struct bfd_entry *e = bfd_alloc_entry(sync_bfd_connections, + struct bfd_entry *e = bfd_alloc_entry(&sync_bfd_connections, bfd_e->logical_port, bfd_e->dst_ip, bfd_e->status); e->nb_bt = bfd_e->nb_bt; @@ -10560,7 +10560,7 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn, const struct nbrec_bfd *nb_bt; NBREC_BFD_TABLE_FOR_EACH (nb_bt, nbrec_bfd_table) { - bfd_e = bfd_port_lookup(sync_bfd_connections, nb_bt->logical_port, + bfd_e = bfd_port_lookup(&sync_bfd_connections, nb_bt->logical_port, nb_bt->dst_ip); if (!bfd_e) { continue; @@ -10622,13 +10622,13 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn, bfd_e->stale = false; } - HMAP_FOR_EACH_SAFE (bfd_e, hmap_node, sync_bfd_connections) { + HMAP_FOR_EACH_POP (bfd_e, hmap_node, &sync_bfd_connections) { if (bfd_e->stale) { - hmap_remove(sync_bfd_connections, &bfd_e->hmap_node); sbrec_bfd_delete(bfd_e->sb_bt); - bfd_erase_entry(bfd_e); } + bfd_erase_entry(bfd_e); } + hmap_destroy(&sync_bfd_connections); bitmap_free(bfd_src_ports); } @@ -18793,7 +18793,6 @@ bfd_init(struct bfd_data *data) void bfd_sync_init(struct bfd_sync_data *data) { - hmap_init(&data->bfd_connections); sset_init(&data->bfd_ports); } @@ -18862,7 +18861,6 @@ bfd_destroy(struct bfd_data *data) void bfd_sync_destroy(struct bfd_sync_data *data) { - __bfd_destroy(&data->bfd_connections); sset_destroy(&data->bfd_ports); } diff --git a/northd/northd.h b/northd/northd.h index 560e1bfe5..62e22edc1 100644 --- a/northd/northd.h +++ b/northd/northd.h @@ -196,7 +196,6 @@ struct bfd_data { }; struct bfd_sync_data { - struct hmap bfd_connections; struct sset bfd_ports; }; @@ -798,7 +797,7 @@ void build_route_policies(struct ovn_datapath *, const struct hmap *, const struct hmap *, struct hmap *, struct hmap *); void bfd_table_sync(struct ovsdb_idl_txn *, const struct nbrec_bfd_table *, const struct hmap *, const struct hmap *, - const struct hmap *, const struct hmap *, struct hmap *, + const struct hmap *, const struct hmap *, struct sset *); void build_bfd_map(const struct nbrec_bfd_table *, const struct sbrec_bfd_table *, struct hmap *); From patchwork Tue Aug 20 13:36:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1974433 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WOx2poVP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wp9Vn6qlxz1yXZ for ; Tue, 20 Aug 2024 23:37:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3E99D60A9D; Tue, 20 Aug 2024 13:37:04 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 2R7nhoST6OAv; Tue, 20 Aug 2024 13:37:02 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 54F1D60A92 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WOx2poVP Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 54F1D60A92; Tue, 20 Aug 2024 13:37:02 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0FD82C1029; Tue, 20 Aug 2024 13:37:02 +0000 (UTC) X-Original-To: ovs-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 0E8BFC1029 for ; Tue, 20 Aug 2024 13:37:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2463260A70 for ; Tue, 20 Aug 2024 13:36:57 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Gb-gRa1UuWMF for ; Tue, 20 Aug 2024 13:36:55 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=lorenzo.bianconi@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 397FD60A9D Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 397FD60A9D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 397FD60A9D for ; Tue, 20 Aug 2024 13:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724161013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kDyzcLPL+d1K5yfRE12yBb6A+YBlYCBAxfks1/zB0nY=; b=WOx2poVPyrYSyJYEBX31K/h5zVJPcbt9w0bUhvY8RKYAicpsXykG8ut2fB6Z3UdA6UeHSz Fcl/fQ9gAam68RpL7io/FTCVccaKAEFuXPm8Jf+VrY2ExpeiXUU15Q/qDW9vrgMzPS49Lp 1WPA2a91iVnrmbner/XDmjqzpe8O+tM= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-269-TDMmsddWOjeHVJ2AzycK4Q-1; Tue, 20 Aug 2024 09:36:52 -0400 X-MC-Unique: TDMmsddWOjeHVJ2AzycK4Q-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7a83f54fdeso474409966b.0 for ; Tue, 20 Aug 2024 06:36:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724161007; x=1724765807; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kDyzcLPL+d1K5yfRE12yBb6A+YBlYCBAxfks1/zB0nY=; b=Fugq+QZm5ZO8MMK8lQgKB4SaLqvKF8S3fH4lsr/lg4d3UoKKT+88+CjeoQwloj+AX5 wtsj0KFpwrPp/od1kNhpQ8kW1EgPmbnro77j5y/a+pwWAgg+n/2Lc0OyVB4cA/W1R60I 5rDVmk8DW3w+8HRFfmKivIAl5imqy33wRYL4JoGYac7ZuLPqXPUtigd/QOG99ftVyb7Z v97bgrv89Ylfqe44HqYTGj4JvAut7T6foX0wBvV2FVe0oq/ARFHEadAlNOFztJwM6rkT KOynqd5wWZilRd22h5jfSNZO7VwYNQyDqJDKk7WwnMAdQbNi9wd93hEvDQDy9HsMHrR+ uKtw== X-Gm-Message-State: AOJu0YxYTcorRFF/ATrQCXP8VcD7wn0kjIXGpO//Ac+8ekM4b+C+yLIj uxtVSh9E4zBH6HVpU/zVSBCsTW6ySiGC5636qUmJQK3tkeC3S9vv+TA75nRrdEn/MYvDKwZ0vOg AxFNAkRt4ThI4pwBr969/B39XUUDGZ5iPXOl6XTPyi5l4AD83IJrmxvz0b32WNjIyLf1uTCcWOe khe4qXBfVQfTfbgWyk1J5bnCPIhzU7JrXCr3Dyl/N+roE/6lsZxg== X-Received: by 2002:a17:907:e87:b0:a7a:af5d:f313 with SMTP id a640c23a62f3a-a83928d438bmr1016123466b.22.1724161007453; Tue, 20 Aug 2024 06:36:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvgoM9Vju9CZZekH1JhHnJve7YNX9RLr5OeyFyUlGuVHjmGWfIrxV8+8p/4bSPEUsJ4yte5Q== X-Received: by 2002:a17:907:e87:b0:a7a:af5d:f313 with SMTP id a640c23a62f3a-a83928d438bmr1016120966b.22.1724161007014; Tue, 20 Aug 2024 06:36:47 -0700 (PDT) Received: from localhost (net-188-152-77-192.cust.dsl.teletu.it. [188.152.77.192]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8383949e45sm769578166b.145.2024.08.20.06.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 06:36:46 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Tue, 20 Aug 2024 15:36:25 +0200 Message-ID: <0f6f079f3770b21df77854e85b00a49f9a729c96.1724157801.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 4/4] northd: Make bfd_connections static in build_parsed_routes. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Make hamp bfd_connections pointer static in build_parsed_routes and parsed_routes_add routines since it is used just as input. Signed-off-by: Lorenzo Bianconi --- northd/northd.c | 4 ++-- northd/northd.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index c7bf09ad6..1f71e07dc 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -11113,7 +11113,7 @@ parsed_route_lookup(struct hmap *routes, size_t hash, static void parsed_routes_add(struct ovn_datapath *od, const struct hmap *lr_ports, const struct nbrec_logical_router_static_route *route, - struct hmap *bfd_connections, + const struct hmap *bfd_connections, struct hmap *routes, struct simap *route_tables, struct hmap *bfd_active_connections) { @@ -11226,7 +11226,7 @@ parsed_routes_add(struct ovn_datapath *od, const struct hmap *lr_ports, void build_parsed_routes(struct ovn_datapath *od, const struct hmap *lr_ports, - struct hmap *bfd_connections, struct hmap *routes, + const struct hmap *bfd_connections, struct hmap *routes, struct simap *route_tables, struct hmap *bfd_active_connections) { diff --git a/northd/northd.h b/northd/northd.h index 62e22edc1..a4971e336 100644 --- a/northd/northd.h +++ b/northd/northd.h @@ -738,7 +738,7 @@ void northd_indices_create(struct northd_data *data, void route_policies_init(struct route_policies_data *); void route_policies_destroy(struct route_policies_data *); void build_parsed_routes(struct ovn_datapath *, const struct hmap *, - struct hmap *, struct hmap *, struct simap *, + const struct hmap *, struct hmap *, struct simap *, struct hmap *); uint32_t get_route_table_id(struct simap *, const char *); void static_routes_init(struct static_routes_data *);