From patchwork Tue Jun 27 09:36:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1800503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=ZfqrEmv3; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qr04H0CDGz20ZQ for ; Tue, 27 Jun 2023 19:37:34 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EB2A360EA0; Tue, 27 Jun 2023 09:37:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EB2A360EA0 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=ZfqrEmv3 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 2MUP47DnRrrO; Tue, 27 Jun 2023 09:37:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 03A2960A66; Tue, 27 Jun 2023 09:37:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 03A2960A66 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A3EA2C007C; Tue, 27 Jun 2023 09:37:30 +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 60829C0037 for ; Tue, 27 Jun 2023 09:37:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 4FC334171B for ; Tue, 27 Jun 2023 09:36:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4FC334171B Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZfqrEmv3 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 OTOMWnOjNUJH for ; Tue, 27 Jun 2023 09:36:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 7D42541529 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 7D42541529 for ; Tue, 27 Jun 2023 09:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687858597; 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=KivPwWhlnjDyYhlUjStdvP4HskOSX2EIEvRxh4+6u8g=; b=ZfqrEmv3CkVcTkxB660U3UlbmrcMRRkhyS74gKsTjnHoRnXXdzRLmQO70dtmryd2KYeIPy Nsi/JsS3izJo2tXMvQYZX70CH/NXvsGRv5sa67Gkr2IcR20tpAN3yIyRhndS7LVmqH0C1j gAJc8/pclwQ034rjavGUiwj+6yhXoeY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-CauaUYtqNU-0ooXlLuh4hQ-1; Tue, 27 Jun 2023 05:36:35 -0400 X-MC-Unique: CauaUYtqNU-0ooXlLuh4hQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED5C4299E74D for ; Tue, 27 Jun 2023 09:36:34 +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 D366840C6F5A; Tue, 27 Jun 2023 09:36:34 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 27 Jun 2023 11:36:34 +0200 Message-Id: <20230627093634.1465570-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] binding: fixed port claims as additional_chassis 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" When sb is read-only, the port claim is delayed until sb is rw. However, before this patch, this resulted in the chassis always claiming the port as main (while it was maybe an additional chassis). Fixes: a7c7d4519e50 ("controller: avoid recomputes triggered by SBDB Port_Binding updates.") Signed-off-by: Xavier Simonart Acked-by: Ales Musil --- controller/binding.c | 14 +++++++++++--- controller/binding.h | 3 ++- controller/if-status.c | 10 ++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 359ad6d66..9fb90cf9f 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1164,7 +1164,9 @@ local_bindings_pb_chassis_is_set(struct shash *local_bindings, local_binding_find(local_bindings, pb_name); struct binding_lport *b_lport = local_binding_get_primary_lport(lbinding); - if (b_lport && b_lport->pb && b_lport->pb->chassis == chassis_rec) { + if (b_lport && b_lport->pb && + ((b_lport->pb->chassis == chassis_rec) || + is_additional_chassis(b_lport->pb, chassis_rec))) { return true; } return false; @@ -1173,14 +1175,20 @@ local_bindings_pb_chassis_is_set(struct shash *local_bindings, void local_binding_set_pb(struct shash *local_bindings, const char *pb_name, const struct sbrec_chassis *chassis_rec, - struct hmap *tracked_datapaths, bool is_set) + struct hmap *tracked_datapaths, bool is_set, + enum can_bind bind_type) { struct local_binding *lbinding = local_binding_find(local_bindings, pb_name); struct binding_lport *b_lport = local_binding_get_primary_lport(lbinding); if (b_lport) { - set_pb_chassis_in_sbrec(b_lport->pb, chassis_rec, is_set); + if (bind_type == CAN_BIND_AS_MAIN) { + set_pb_chassis_in_sbrec(b_lport->pb, chassis_rec, is_set); + } else if (bind_type == CAN_BIND_AS_ADDITIONAL) { + set_pb_additional_chassis_in_sbrec(b_lport->pb, chassis_rec, + is_set); + } if (tracked_datapaths) { update_lport_tracking(b_lport->pb, tracked_datapaths, true); } diff --git a/controller/binding.h b/controller/binding.h index 319cbd263..abc3d6117 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -23,6 +23,7 @@ #include "openvswitch/uuid.h" #include "openvswitch/list.h" #include "sset.h" +#include "lport.h" struct hmap; struct ovsdb_idl; @@ -177,7 +178,7 @@ void local_binding_set_down(struct shash *local_bindings, const char *pb_name, void local_binding_set_pb(struct shash *local_bindings, const char *pb_name, const struct sbrec_chassis *chassis_rec, struct hmap *tracked_datapaths, - bool is_set); + bool is_set, enum can_bind); bool local_bindings_pb_chassis_is_set(struct shash *local_bindings, const char *pb_name, const struct sbrec_chassis *chassis_rec); diff --git a/controller/if-status.c b/controller/if-status.c index 2b2eb1679..b45208746 100644 --- a/controller/if-status.c +++ b/controller/if-status.c @@ -184,6 +184,7 @@ struct ovs_iface { * OIF_INSTALL_FLOWS. */ uint16_t mtu; /* Extracted from OVS interface.mtu field. */ + enum can_bind bind_type;/* CAN_BIND_AS_MAIN or CAN_BIND_AS_ADDITIONAL */ }; static uint64_t ifaces_usage; @@ -285,6 +286,7 @@ if_status_mgr_claim_iface(struct if_status_mgr *mgr, if (!iface) { iface = ovs_iface_create(mgr, iface_id, iface_rec, OIF_CLAIMED); } + iface->bind_type = bind_type; memcpy(&iface->pb_uuid, &pb->header_.uuid, sizeof(iface->pb_uuid)); if (!sb_readonly) { @@ -406,7 +408,7 @@ if_status_handle_claims(struct if_status_mgr *mgr, struct ovs_iface *iface = node->data; VLOG_INFO("if_status_handle_claims for %s", iface->id); local_binding_set_pb(bindings, iface->id, chassis_rec, - tracked_datapath, true); + tracked_datapath, true, iface->bind_type); rc = true; } return rc; @@ -473,7 +475,7 @@ if_status_mgr_update(struct if_status_mgr *mgr, chassis_rec)) { if (!sb_readonly) { local_binding_set_pb(bindings, iface->id, chassis_rec, - NULL, true); + NULL, true, iface->bind_type); } else { continue; } @@ -495,7 +497,7 @@ if_status_mgr_update(struct if_status_mgr *mgr, } if (!sb_readonly) { local_binding_set_pb(bindings, iface->id, chassis_rec, - NULL, false); + NULL, false, iface->bind_type); } if (local_binding_is_down(bindings, iface->id, chassis_rec)) { ovs_iface_destroy(mgr, iface); @@ -512,7 +514,7 @@ if_status_mgr_update(struct if_status_mgr *mgr, if (!local_bindings_pb_chassis_is_set(bindings, iface->id, chassis_rec)) { local_binding_set_pb(bindings, iface->id, chassis_rec, - NULL, true); + NULL, true, iface->bind_type); } } }