From patchwork Fri Apr 26 17:54:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1928287 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=Z7tuZ1k2; 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 4VR0l574x2z23hv for ; Sat, 27 Apr 2024 03:56:01 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AEB7741CB5; Fri, 26 Apr 2024 17:55:57 +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 gReZoHzOKsns; Fri, 26 Apr 2024 17:55:56 +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 smtp2.osuosl.org 34C8C4011C 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=Z7tuZ1k2 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 34C8C4011C; Fri, 26 Apr 2024 17:55:56 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C93D2C0DD2; Fri, 26 Apr 2024 17:55:55 +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 DA6C3C0037 for ; Fri, 26 Apr 2024 17:55:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id BD02640385 for ; Fri, 26 Apr 2024 17:55:54 +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 BAZAkVW7UTFI for ; Fri, 26 Apr 2024 17:55:54 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=ihrachys@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org E88F44011C 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 E88F44011C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id E88F44011C for ; Fri, 26 Apr 2024 17:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714154152; 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=pDBWHdcTCF7/a5HhXMoe5orMW6KEsRbli1oTjRG+17o=; b=Z7tuZ1k2KqeBn4U5+aq5dOY2887n3N8B1ms6Lz5h2l8g5208HJ8lE91eksTxfYg7T/cnap 0gWQCRgoHglm6a/pEXS1CH32NEnbzYacg0SUJA0KPPSeDmYGxHGGF3lBF4v9w1EyhpZWEP suizUZ3a3WhKSLqUc7RTnOq9v7foN30= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-436-cXwtoZh7McCObdHP9-aYtA-1; Fri, 26 Apr 2024 13:55:51 -0400 X-MC-Unique: cXwtoZh7McCObdHP9-aYtA-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6a0b7ba8d0aso1313346d6.0 for ; Fri, 26 Apr 2024 10:55:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714154150; x=1714758950; 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=pDBWHdcTCF7/a5HhXMoe5orMW6KEsRbli1oTjRG+17o=; b=XNgZRVHnIB2OwvyjZyijA2FtcLcL9A2Nb57PjNZxLpQBoO7zQM2TZPKdsX8VejYsq1 Nwv20JRSEy+/PeSgF76x1EE7IBdpm13qGir3WQ4+RLO0RURYvKcbFxFdSJRCIav35lRz Gu6G2/Ks4qZeGTLQ6giA8uv7jA5OxJXLSEaDUN1S5hfxtcHXkKsJwOFHYBxOfzMUR8ai zLRpXmA6AmRy5wm3XP/3anF9Z5ieqhz3tbEukRInxr0dal+6mESswMVVtedX5tJ7HEGm 1cSRI1obJvQ8j7nYSkZZsr9s9ngdAjvECUVw6VzoybK06L0HVmSaTxO5PzkA2CYaLIFr Gg7w== X-Gm-Message-State: AOJu0YzWCj452vNT9Y3bkAEbgDNlN+n4CBd9BMhmsoy+mzeRacLMR2Ra DAjmqKcIatoLK01F+4vcrI+fTDFof3pruarGo73vfjqib/wnitbFMGvHfvBn3Kt8n/wcrRuv8+Z m3hskPzdD76e+uGrms+voq78KlIz+UKwG4z5enGXKdyHrajQ4e4Vnn/yK/ZWRq0kNxazCO3Tm7z KOFdNQQ2DadPosI3x8GEnIA0G9bBiXxkdU0A== X-Received: by 2002:a05:6214:16ce:b0:6a0:a6a0:8f96 with SMTP id d14-20020a05621416ce00b006a0a6a08f96mr952327qvz.0.1714154150032; Fri, 26 Apr 2024 10:55:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnXwX44KpNaH704tkjse8L7i5RZlcFShdFeLkJrWlUpLdC3vGLrrmGlYXZGOw760JPBuT52Q== X-Received: by 2002:a05:6214:16ce:b0:6a0:a6a0:8f96 with SMTP id d14-20020a05621416ce00b006a0a6a08f96mr952295qvz.0.1714154149721; Fri, 26 Apr 2024 10:55:49 -0700 (PDT) Received: from fedora38.localdomain.com ([172.73.180.250]) by smtp.gmail.com with ESMTPSA id w17-20020a056214013100b0069b57111a98sm7179855qvs.79.2024.04.26.10.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 10:55:49 -0700 (PDT) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Fri, 26 Apr 2024 17:54:55 +0000 Message-ID: <20240426175501.858655-2-ihrachys@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240426175501.858655-1-ihrachys@redhat.com> References: <20240426175501.858655-1-ihrachys@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v7 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 b541e8455..3bdd0648c 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -4012,7 +4012,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) { @@ -4021,11 +4020,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; } } @@ -4090,10 +4084,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 @@ -4324,7 +4325,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,