From patchwork Thu Jan 18 08:07:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1887784 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=JXjcDg1b; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TFwMk3ZLpz1yPJ for ; Thu, 18 Jan 2024 19:07:30 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id F20A0436BE; Thu, 18 Jan 2024 08:07:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org F20A0436BE Authentication-Results: smtp2.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=JXjcDg1b 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 Gxuzs-HVSRvV; Thu, 18 Jan 2024 08:07:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8916843789; Thu, 18 Jan 2024 08:07:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8916843789 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5F80AC0DCE; Thu, 18 Jan 2024 08:07:25 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id BA335C0037 for ; Thu, 18 Jan 2024 08:07:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C6CA141EA6 for ; Thu, 18 Jan 2024 08:07:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C6CA141EA6 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JXjcDg1b X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XwBSxmAH3LR4 for ; Thu, 18 Jan 2024 08:07:22 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1E80240250 for ; Thu, 18 Jan 2024 08:07:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1E80240250 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705565241; 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; bh=Yb00BwCb4MWaArp2ixdm8lvQksUc+IJqbOzk2mdxGBs=; b=JXjcDg1bd/TXpIuOTPQpuG4gd/9R/RLPHfnATeo90/DGFVZnmHBSaZOG5UPyVC8iVN0s+Z 1yS2nu31n7mx8LSCFTU1fUXbmJOKwbhe3Zcl/316FWK7OhD8ojWsJIJlBzHJZOYRqvyzcl 3lYMEKG/VHO9tKHqjtfmt2u2G6WSmew= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-wI7KYX3oMkqjbT4XNk1teg-1; Thu, 18 Jan 2024 03:07:18 -0500 X-MC-Unique: wI7KYX3oMkqjbT4XNk1teg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE98D185A786 for ; Thu, 18 Jan 2024 08:07:18 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4E572028CD4; Thu, 18 Jan 2024 08:07:17 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Thu, 18 Jan 2024 09:07:17 +0100 Message-ID: <20240118080717.65255-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] controller: Slightly simplify the ct zone assignment 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" There is no need to hold data in separate bitmap and simap as all the zones that are already assigned are in the inc-engine sctructures. Signed-off-by: Ales Musil --- controller/ovn-controller.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 856e5e270..bc5605e6b 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -731,8 +731,6 @@ update_ct_zones(const struct sset *local_lports, const char *user; struct sset all_users = SSET_INITIALIZER(&all_users); struct simap req_snat_zones = SIMAP_INITIALIZER(&req_snat_zones); - unsigned long unreq_snat_zones_map[BITMAP_N_LONGS(MAX_CT_ZONES)]; - struct simap unreq_snat_zones = SIMAP_INITIALIZER(&unreq_snat_zones); const char *local_lport; SSET_FOR_EACH (local_lport, local_lports) { @@ -777,9 +775,6 @@ update_ct_zones(const struct sset *local_lports, bitmap_set0(ct_zone_bitmap, ct_zone->data); simap_delete(ct_zones, ct_zone); - } else if (!simap_find(&req_snat_zones, ct_zone->name)) { - bitmap_set1(unreq_snat_zones_map, ct_zone->data); - simap_put(&unreq_snat_zones, ct_zone->name, ct_zone->data); } } @@ -790,19 +785,13 @@ update_ct_zones(const struct sset *local_lports, * If so, then they need to give up their assignment since * that zone is being explicitly requested now. */ - if (bitmap_is_set(unreq_snat_zones_map, snat_req_node->data)) { - struct simap_node *unreq_node; - SIMAP_FOR_EACH_SAFE (unreq_node, &unreq_snat_zones) { - if (unreq_node->data == snat_req_node->data) { - simap_find_and_delete(ct_zones, unreq_node->name); - simap_delete(&unreq_snat_zones, unreq_node); + if (bitmap_is_set(ct_zone_bitmap, snat_req_node->data)) { + SIMAP_FOR_EACH_SAFE (ct_zone, ct_zones) { + if (ct_zone->data == snat_req_node->data && + strcmp(ct_zone->name, snat_req_node->name)) { + simap_delete(ct_zones, ct_zone); } } - - /* Set this bit to 0 so that if multiple datapaths have requested - * this zone, we don't needlessly double-detect this condition. - */ - bitmap_set0(unreq_snat_zones_map, snat_req_node->data); } struct simap_node *node = simap_find(ct_zones, snat_req_node->name); @@ -840,7 +829,6 @@ update_ct_zones(const struct sset *local_lports, } simap_destroy(&req_snat_zones); - simap_destroy(&unreq_snat_zones); sset_destroy(&all_users); }