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);