From patchwork Fri Apr 12 01:57:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1922805 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=BQiW7+MZ; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VG07t31C6z1yYM for ; Fri, 12 Apr 2024 11:57:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 5DF3C82391; Fri, 12 Apr 2024 01:57:42 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dKtNbp4VdRw2; Fri, 12 Apr 2024 01:57:41 +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 smtp1.osuosl.org E682182392 Authentication-Results: smtp1.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=BQiW7+MZ Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id E682182392; Fri, 12 Apr 2024 01:57:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 448DDC0DD5; Fri, 12 Apr 2024 01:57:39 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 34A06C0037 for ; Fri, 12 Apr 2024 01:57:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 17F1A82355 for ; Fri, 12 Apr 2024 01:57:37 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id vh3moo4bNHLp for ; Fri, 12 Apr 2024 01:57:36 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=ihrachys@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 59C35822F8 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 59C35822F8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 59C35822F8 for ; Fri, 12 Apr 2024 01:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712887054; 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=xME80Pt/m7/sruTQ6ewz03sZkQItZbKtaQhWs/EwYMQ=; b=BQiW7+MZEw+0aaOMQfvZuOMiWsVZzTSt32f79X4wVVNoIRJ+zJfRWaZyHwZcjagbXEUrjt 5t9HO6rcZQfQNxdh8DpPgMgGvEoMagO7EzvGx5sSJkZGOguXZyHfGOA1pXCHKAB6lS3nr1 OOejgyVlZanm7J3F0FaLDDSZLa4pAqA= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-J2SVmqQlOna4nhua9HRi7g-1; Thu, 11 Apr 2024 21:57:33 -0400 X-MC-Unique: J2SVmqQlOna4nhua9HRi7g-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-61810d4408cso8136947b3.1 for ; Thu, 11 Apr 2024 18:57:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712887052; x=1713491852; 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=xME80Pt/m7/sruTQ6ewz03sZkQItZbKtaQhWs/EwYMQ=; b=m75MVbfzB9sahFzHJgn/ZlOaGde4oofp0+7SYt3tVY4gpwXUHR4tLGM1Va68NyqrKc 2GahzVctplBdtTi5t6aVGO1WSZpmS6uV6VB+3fZflKlCNrzJVwzXy6HWRp576USvKzKQ dO8ArRagccVvu+gf+JqoBa7nvUT36h2C9TZJcfYx4iPJkttSROtgIncdh/t+D3Cg0mBz 5sCqndlSP7e1OkaxCqJ3eUSB/yS5vldCQRaofjJcH97AjzbKKH83y0GHclFhFBDsR3Io 2BKJuP0XtJsWsTVmnEAX9/BtzZ/dIWAwcQl5mQzqaSA7J/GTGoTIqHydljifEjZEAbkF Xo6g== X-Gm-Message-State: AOJu0Yz2A872HJSxsENDAgb4nuklrySxSTKJJa63fkZWinHiTfv+72V5 X/fTQvfXRGhhBDaDj01i7T1v9f2RBrzYTYDUmlTQ63odaWHVP5r3BkuNe7EBL20UupcIg5NfD5O Sw7W2ovqEJ7u10FHO/LdTD80Tc9Mx54iv3LqG6RZT22RJFIIYs6AwMPAbiQzAd2X67aXqidU2xE N7Es1ya9K8Om3NK9OKmYrHinj4U6JEGctm6Q== X-Received: by 2002:a81:b24a:0:b0:615:c96:1a8d with SMTP id q71-20020a81b24a000000b006150c961a8dmr1275177ywh.8.1712887051987; Thu, 11 Apr 2024 18:57:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsvIWQXKJ2QcMaHiK7dR4ydKrLef+iWL+cd3SuMEzBj0z5DQlfcMdsTUNFsVH9EieXWu9Kng== X-Received: by 2002:a81:b24a:0:b0:615:c96:1a8d with SMTP id q71-20020a81b24a000000b006150c961a8dmr1275168ywh.8.1712887051639; Thu, 11 Apr 2024 18:57:31 -0700 (PDT) Received: from fedora38.localdomain (172-073-180-250.res.spectrum.com. [172.73.180.250]) by smtp.gmail.com with ESMTPSA id y71-20020a0dd64a000000b00617c80f06cesm602877ywd.90.2024.04.11.18.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 18:57:31 -0700 (PDT) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Fri, 12 Apr 2024 01:57:22 +0000 Message-ID: <20240412015727.4152034-2-ihrachys@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240412015727.4152034-1-ihrachys@redhat.com> References: <20240412015727.4152034-1-ihrachys@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v6 1/6] northd: Don't cleanup op in ovn_port_allocate_key. 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" Let the callers do the cleanup as needed. Signed-off-by: Ihar Hrachyshka --- northd/northd.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 02cf5b234..f2406890c 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -4006,7 +4006,6 @@ ovn_port_assign_requested_tnl_id( static bool ovn_port_allocate_key(const struct sbrec_chassis_table *sbrec_chassis_table, - struct hmap *ports, struct ovn_port *op) { if (!op->tunnel_key) { @@ -4015,11 +4014,6 @@ ovn_port_allocate_key(const struct sbrec_chassis_table *sbrec_chassis_table, 1, (1u << (key_bits - 1)) - 1, &op->od->port_key_hint); if (!op->tunnel_key) { - if (op->sb) { - sbrec_port_binding_delete(op->sb); - } - ovs_list_remove(&op->list); - ovn_port_destroy(ports, op); return false; } } @@ -4084,10 +4078,17 @@ build_ports(struct ovsdb_idl_txn *ovnsb_txn, /* Assign new tunnel ids where needed. */ LIST_FOR_EACH_SAFE (op, list, &both) { - ovn_port_allocate_key(sbrec_chassis_table, ports, op); + if (!ovn_port_allocate_key(sbrec_chassis_table, op)) { + sbrec_port_binding_delete(op->sb); + ovs_list_remove(&op->list); + ovn_port_destroy(ports, op); + } } LIST_FOR_EACH_SAFE (op, list, &nb_only) { - ovn_port_allocate_key(sbrec_chassis_table, ports, op); + if (!ovn_port_allocate_key(sbrec_chassis_table, op)) { + ovs_list_remove(&op->list); + ovn_port_destroy(ports, op); + } } /* For logical ports that are in both databases, update the southbound @@ -4318,7 +4319,12 @@ ls_port_init(struct ovn_port *op, struct ovsdb_idl_txn *ovnsb_txn, sbrec_port_binding_set_logical_port(op->sb, op->key); } /* Assign new tunnel ids where needed. */ - if (!ovn_port_allocate_key(sbrec_chassis_table, ls_ports, op)) { + if (!ovn_port_allocate_key(sbrec_chassis_table, op)) { + if (op->sb) { + sbrec_port_binding_delete(op->sb); + } + ovs_list_remove(&op->list); + ovn_port_destroy(ls_ports, op); return false; } ovn_port_update_sbrec(ovnsb_txn, sbrec_chassis_by_name,