From patchwork Mon Oct 30 09:10:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1856887 X-Patchwork-Delegate: dceara@redhat.com 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=fs0Bxkc2; 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 4SJnYN26C9z1yQW for ; Mon, 30 Oct 2023 20:10:32 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 73A7870B10; Mon, 30 Oct 2023 09:10:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 73A7870B10 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=fs0Bxkc2 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1p731Hhjr28I; Mon, 30 Oct 2023 09:10:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 831AC70B05; Mon, 30 Oct 2023 09:10:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 831AC70B05 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3914BC0071; Mon, 30 Oct 2023 09:10:28 +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 7339BC0032 for ; Mon, 30 Oct 2023 09:10:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 4198D4F4BA for ; Mon, 30 Oct 2023 09:10:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4198D4F4BA 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=fs0Bxkc2 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 sHXvJ52FehxV for ; Mon, 30 Oct 2023 09:10:25 +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 D26A14F4B9 for ; Mon, 30 Oct 2023 09:10:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D26A14F4B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698657023; 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=nzfHrlRT0Jphfro2H2tR/FcJb6v7MQxegUHjo0Dbuz8=; b=fs0Bxkc27M99Dc4FtwwTb/XyyllBs93Z783bfuG02FmVdfhvMwBVOeS4rJtAfAYbvuPTSI 2oNGdVDetKNOkvh2azykVAjPAkO2HPx23SIz6bR/VcJZNf8tQCILnOJTwRMfhEyn4R3TJm 5uTjK6xTirqd2FGkUWtrPnBSc13VAPw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-CWzcAq_3M7eyEuFyqzvz5A-1; Mon, 30 Oct 2023 05:10:22 -0400 X-MC-Unique: CWzcAq_3M7eyEuFyqzvz5A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 82C4229AA2D7 for ; Mon, 30 Oct 2023 09:10:22 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.ntdv.lab.eng.bos.redhat.com [10.19.188.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 665DF40C6EB9; Mon, 30 Oct 2023 09:10:22 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Mon, 30 Oct 2023 10:10:20 +0100 Message-Id: <20231030091022.2397676-2-xsimonar@redhat.com> In-Reply-To: <20231030091022.2397676-1-xsimonar@redhat.com> References: <20230920154557.4010537-1-xsimonar@redhat.com> <20231030091022.2397676-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v3 1/3] binding: slight refactor if no local binding in consider_iface_release 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" Signed-off-by: Xavier Simonart --- controller/binding.c | 74 +++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 8020d052f..9a09b2074 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2392,7 +2392,7 @@ consider_iface_release(const struct ovsrec_interface *iface_rec, lbinding = local_binding_find(local_bindings, iface_id); - if (lbinding) { + if (lbinding) { if (lbinding->multiple_bindings) { VLOG_INFO("Multiple bindings for %s: force recompute to clean up", iface_id); @@ -2412,52 +2412,50 @@ consider_iface_release(const struct ovsrec_interface *iface_rec, return true; } } - } - struct binding_lport *b_lport = - local_binding_get_primary_or_localport_lport(lbinding); - if (is_binding_lport_this_chassis(b_lport, b_ctx_in->chassis_rec)) { - struct local_datapath *ld = - get_local_datapath(b_ctx_out->local_datapaths, - b_lport->pb->datapath->tunnel_key); - if (ld) { - remove_pb_from_local_datapath(b_lport->pb, - b_ctx_out, ld); - } + struct binding_lport *b_lport = + local_binding_get_primary_or_localport_lport(lbinding); - add_or_del_qos_port(b_lport->pb->logical_port, false); + if (is_binding_lport_this_chassis(b_lport, b_ctx_in->chassis_rec)) { + struct local_datapath *ld = + get_local_datapath(b_ctx_out->local_datapaths, + b_lport->pb->datapath->tunnel_key); + if (ld) { + remove_pb_from_local_datapath(b_lport->pb, + b_ctx_out, ld); + } + add_or_del_qos_port(b_lport->pb->logical_port, false); - /* Release the primary binding lport and other children lports if - * any. */ - LIST_FOR_EACH (b_lport, list_node, &lbinding->binding_lports) { - if (!release_binding_lport(b_ctx_in->chassis_rec, b_lport, - !b_ctx_in->ovnsb_idl_txn, - b_ctx_out)) { - return false; + /* Release the primary binding lport and other children lports if + * any. */ + LIST_FOR_EACH (b_lport, list_node, &lbinding->binding_lports) { + if (!release_binding_lport(b_ctx_in->chassis_rec, b_lport, + !b_ctx_in->ovnsb_idl_txn, + b_ctx_out)) { + return false; + } + } + if (lbinding->iface && lbinding->iface->name) { + if_status_mgr_remove_ovn_installed(b_ctx_out->if_mgr, + lbinding->iface->name, + &lbinding->iface->header_.uuid); } - } - if (lbinding->iface && lbinding->iface->name) { - if_status_mgr_remove_ovn_installed(b_ctx_out->if_mgr, - lbinding->iface->name, - &lbinding->iface->header_.uuid); - } - } else if (lbinding && b_lport && b_lport->type == LP_LOCALPORT) { - /* lbinding is associated with a localport. Remove it from the - * related lports. */ - remove_related_lport(b_lport->pb, b_ctx_out); - } + } else if (b_lport && b_lport->type == LP_LOCALPORT) { + /* lbinding is associated with a localport. Remove it from the + * related lports. */ + remove_related_lport(b_lport->pb, b_ctx_out); + } - if (lbinding) { /* Clear the iface of the local binding. */ lbinding->iface = NULL; - } - /* Check if the lbinding has children of type PB_CONTAINER. - * If so, don't delete the local_binding. */ - if (lbinding && !is_lbinding_container_parent(lbinding)) { - local_binding_delete(lbinding, local_bindings, binding_lports, - b_ctx_out->if_mgr); + /* Check if the lbinding has children of type PB_CONTAINER. + * If so, don't delete the local_binding. */ + if (!is_lbinding_container_parent(lbinding)) { + local_binding_delete(lbinding, local_bindings, binding_lports, + b_ctx_out->if_mgr); + } } remove_local_lports(iface_id, b_ctx_out);