From patchwork Mon Sep 18 16:46:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1836321 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=OCB+j++n; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.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 4Rq9fm1xHSz1ync for ; Tue, 19 Sep 2023 02:46:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 189B3614F3; Mon, 18 Sep 2023 16:46:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 189B3614F3 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=OCB+j++n 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 py6VFYoMyTPs; Mon, 18 Sep 2023 16:46:21 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 49D21611F3; Mon, 18 Sep 2023 16:46:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 49D21611F3 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 19EE4C0039; Mon, 18 Sep 2023 16:46:20 +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 D0CA5C0032 for ; Mon, 18 Sep 2023 16:46:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A9E69402EF for ; Mon, 18 Sep 2023 16:46:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org A9E69402EF 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=OCB+j++n 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 uoaCbkNItHPg for ; Mon, 18 Sep 2023 16:46:17 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 98EAC40236 for ; Mon, 18 Sep 2023 16:46:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 98EAC40236 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695055576; 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=esIFoIlDLuI+Ncr5WLYNT1XHq5NxffHkTH9tnEuojPA=; b=OCB+j++nFe3YaAIRJe2QSp3MVcAHFaEADrrPRLxIcxqbC/fOpd2P7ScGHMl8MTay5rn6YB aIezmTCbr1LibFNr6r2YJYIRYXeFVTuP143ufBgcDjVAkUzLB9aekAX8FnMMOI3aubXvXE RNeOYLX4YMaoEm5TcFIGHsUwGRLBcfQ= 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-583-KyyagstiNr6MqG-pX6z9DQ-1; Mon, 18 Sep 2023 12:46:14 -0400 X-MC-Unique: KyyagstiNr6MqG-pX6z9DQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 A1B7A803491 for ; Mon, 18 Sep 2023 16:46:14 +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 778BC20268CB; Mon, 18 Sep 2023 16:46:14 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Mon, 18 Sep 2023 18:46:14 +0200 Message-Id: <20230918164614.3144765-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] controller: throttle port claim attempts from if-status 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" A recent commit (4dc4bc7f) throttled the port claim attemps from the binding module when multiple chassis were fighting for the same port. However, the if-status module was also sometimes fighting for the same ports. Fix this by having the if-status module postponing claims in a similar way as the binding module. Signed-off-by: Xavier Simonart --- controller/binding.c | 2 +- controller/binding.h | 3 +++ controller/if-status.c | 11 ++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index fd08aaafa..dda4c9162 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1299,7 +1299,7 @@ remove_additional_chassis(const struct sbrec_port_binding *pb, remove_additional_encap_for_chassis(pb, chassis_rec); } -static bool +bool lport_maybe_postpone(const char *port_name, long long int now, struct sset *postponed_ports) { diff --git a/controller/binding.h b/controller/binding.h index 47df668a2..d10eeec1f 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -258,4 +258,7 @@ void update_qos(struct ovsdb_idl_index * sbrec_port_binding_by_name, const struct ovsrec_open_vswitch_table *ovs_table, const struct ovsrec_bridge_table *bridge_table); +bool lport_maybe_postpone(const char *port_name, long long int now, + struct sset *postponed_ports); + #endif /* controller/binding.h */ diff --git a/controller/if-status.c b/controller/if-status.c index 6c5afc866..6f14549c8 100644 --- a/controller/if-status.c +++ b/controller/if-status.c @@ -474,6 +474,11 @@ if_status_mgr_update(struct if_status_mgr *mgr, if (!local_bindings_pb_chassis_is_set(bindings, iface->id, chassis_rec)) { if (!sb_readonly) { + long long int now = time_msec(); + if (lport_maybe_postpone(iface->id, now, + get_postponed_ports())) { + continue; + } local_binding_set_pb(bindings, iface->id, chassis_rec, NULL, true, iface->bind_type); } else { @@ -510,9 +515,13 @@ if_status_mgr_update(struct if_status_mgr *mgr, if (!sb_readonly) { HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_INSTALL_FLOWS]) { struct ovs_iface *iface = node->data; - if (!local_bindings_pb_chassis_is_set(bindings, iface->id, chassis_rec)) { + long long int now = time_msec(); + if (lport_maybe_postpone(iface->id, now, + get_postponed_ports())) { + continue; + } local_binding_set_pb(bindings, iface->id, chassis_rec, NULL, true, iface->bind_type); }