From patchwork Mon Sep 18 16:46:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1836325 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=Znx3hP5z; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.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 4Rq9gk4hGJz1ync for ; Tue, 19 Sep 2023 02:47:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 702DB41693; Mon, 18 Sep 2023 16:47:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 702DB41693 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=Znx3hP5z 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 fOtyEXNUiEzO; Mon, 18 Sep 2023 16:47:08 +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 9B7F04157E; Mon, 18 Sep 2023 16:47:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9B7F04157E Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3D4B3C0032; Mon, 18 Sep 2023 16:47:06 +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 11E9AC0039 for ; Mon, 18 Sep 2023 16:47:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 414DB41564 for ; Mon, 18 Sep 2023 16:46:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 414DB41564 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 eg_yrcBuL0d7 for ; Mon, 18 Sep 2023 16:46:50 +0000 (UTC) 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 72EAF41559 for ; Mon, 18 Sep 2023 16:46:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 72EAF41559 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695055609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6kNVFK1Zpzfm39BNQ+DSst0BJpOh3JMohutD/xHfKL4=; b=Znx3hP5zvxOhztEuixn1zoCuk7OgzPDkHhMCpGI8gI9Fm0vSOOKWd0sjR+cIdiH2FLIvnb JptchbMSTkeVqIvlT6T//doYPVXCZv9cFjnDi38DHh1n9nL954q6fIlJuJ+DP+lm28FzR8 h20Zrx9tHZSgg5onlQOODTPw2A7sMbk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-159-3U9mLJWpPiWPagBne0xN_A-1; Mon, 18 Sep 2023 12:46:47 -0400 X-MC-Unique: 3U9mLJWpPiWPagBne0xN_A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6FA2A811E7B for ; Mon, 18 Sep 2023 16:46:47 +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 57111492C37; Mon, 18 Sep 2023 16:46:47 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Mon, 18 Sep 2023 18:46:45 +0200 Message-Id: <20230918164647.3144917-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 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 fd08aaafa..dbd2d52b7 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2391,7 +2391,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); @@ -2411,52 +2411,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);