From patchwork Wed Jul 24 12:53:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1964271 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=c7DvsWSw; 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 4WTYqB2ckRz1yXx for ; Wed, 24 Jul 2024 22:53:42 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5A06E40489; Wed, 24 Jul 2024 12:53:40 +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 XHwlXSlzo5cy; Wed, 24 Jul 2024 12:53:38 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B3A8840289 Authentication-Results: smtp2.osuosl.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=c7DvsWSw Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id B3A8840289; Wed, 24 Jul 2024 12:53:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7337DC0A97; Wed, 24 Jul 2024 12:53:38 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3BC21C0A96 for ; Wed, 24 Jul 2024 12:53:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1DD1C81441 for ; Wed, 24 Jul 2024 12:53:37 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id AnUmFdDBV_qt for ; Wed, 24 Jul 2024 12:53:36 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=amusil@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 0DC7B81440 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 0DC7B81440 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=c7DvsWSw Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 0DC7B81440 for ; Wed, 24 Jul 2024 12:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721825614; 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; bh=sL1nvIVwmt5KZ+4ZxENVP9Zje1tKoEQ7DFFgyKWEgq4=; b=c7DvsWSwmPvGj3bWC/t5zFg5rrCSYF15pdC7p8AbsCeN9VJ6HxAqwuXyqGDwhdCpJBXcrv tXDHw7ohHvX/b65R0YLmbXpIO98C8OhOp45DWDGiorVhtT4yohDDU7jGxLeqUrrSJA/xLj uLML0nbnTgtr6J9Xe/ZsjQyB5ao3v80= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-P9ljQCWfOnu9DUDz79wmeA-1; Wed, 24 Jul 2024 08:53:33 -0400 X-MC-Unique: P9ljQCWfOnu9DUDz79wmeA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 34EA41955D4A for ; Wed, 24 Jul 2024 12:53:32 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.32]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3F0181955D42; Wed, 24 Jul 2024 12:53:31 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Wed, 24 Jul 2024 14:53:30 +0200 Message-ID: <20240724125330.1235599-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2] controller: Remove OvS iface type check in I-P processing. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The handler for OvS interface in runtime data was checking interface type before proceeding with the I-P processing. The type is not necessary because the main thing that is interesting for OVN is the iface-id, if the interface doesn't have any it won't be processed regardless of the type. The processing would happen anyway, however it would be more costly because it would lead to full recompute of the whole runtime data node. The type check remains for the purpose of not regressing when iface id is set in different transaction than the actual interface creation for the internal and empty type. Reported-at: https://github.com/ovn-org/ovn/issues/174 Reported-at: https://issues.redhat.com/browse/FDP-255 Signed-off-by: Ales Musil Acked-by: Mark Michelson --- v2: Rebase on top of current main. Address comment from Xavier: - Make sure we are not causing recompute if iface-id is set in separate transaction. --- controller/binding.c | 14 +++++----- tests/ovn-controller.at | 57 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index b7e7f4874..f4f5f9407 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2630,17 +2630,17 @@ binding_handle_ovs_interface_changes(struct binding_ctx_in *b_ctx_in, const struct ovsrec_interface *iface_rec; OVSREC_INTERFACE_TABLE_FOR_EACH_TRACKED (iface_rec, b_ctx_in->iface_table) { - if (!is_iface_vif(iface_rec)) { - /* Right now we are not handling ovs_interface changes of - * other types. This can be enhanced to handle of - * types - patch and tunnel. */ + const char *iface_id = smap_get(&iface_rec->external_ids, "iface-id"); + const char *old_iface_id = smap_get(b_ctx_out->local_iface_ids, + iface_rec->name); + if (!iface_id && !old_iface_id && !is_iface_vif(iface_rec)) { + /* Right now we are not handling ovs_interface changes if the + * interface doesn't have iface-id or didn't have it + * previously. */ handled = false; break; } - const char *iface_id = smap_get(&iface_rec->external_ids, "iface-id"); - const char *old_iface_id = smap_get(b_ctx_out->local_iface_ids, - iface_rec->name); const char *cleared_iface_id = NULL; if (!ovsrec_interface_is_deleted(iface_rec)) { int64_t ofport = iface_rec->n_ofport ? *iface_rec->ofport : 0; diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at index 9cb099e68..208645504 100644 --- a/tests/ovn-controller.at +++ b/tests/ovn-controller.at @@ -3127,3 +3127,60 @@ OVS_WAIT_UNTIL([grep -q 'tcp:127.0.0.1:1235: connected' hv1/ovn-controller.log]) OVN_CLEANUP([hv1]) AT_CLEANUP + +AT_SETUP([ovn-controller - I-P different port types]) +AT_KEYWORDS([ovn]) +ovn_start + +net_add n1 +sim_add hv1 +ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.168.0.20 + +check ovn-nbctl ls-add ls0 +check ovn-nbctl lsp-add ls0 vif + +ovn-appctl inc-engine/clear-stats + +ovs-vsctl -- add-port br-int vif -- \ + set Interface vif external-ids:iface-id=vif +wait_row_count Port_Binding 1 logical_port="vif" up=true + +ovs-vsctl del-port br-int vif +wait_row_count Port_Binding 1 logical_port="vif" up=false + +ovs-vsctl add-port br-int vif -- \ + set Interface vif type=dummy -- \ + set Interface vif external-ids:iface-id=vif +wait_row_count Port_Binding 1 logical_port="vif" up=true + +ovs-vsctl del-port br-int vif +wait_row_count Port_Binding 1 logical_port="vif" up=false + +ovs-vsctl add-port br-int vif -- \ + set Interface vif type=geneve -- \ + set Interface vif options:remote_ip=1.1.1.1 external-ids:iface-id=vif +wait_row_count Port_Binding 1 logical_port="vif" up=true + +ovs-vsctl del-port br-int vif +wait_row_count Port_Binding 1 logical_port="vif" up=false + +# Make sure that setting iface in two different transaction doesn't +# cause recompute. +ovs-vsctl add-port br-int vif +ovs-vsctl set Interface vif external-ids:iface-id=vif +wait_row_count Port_Binding 1 logical_port="vif" up=true + +ovs-vsctl del-port br-int vif +wait_row_count Port_Binding 1 logical_port="vif" up=false + +AT_CHECK([ovn-appctl inc-engine/show-stats runtime_data |\ + sed "s/- compute:\s\+[[0-9]]\+/- compute: ??/"], [0], [dnl +Node: runtime_data +- recompute: 0 +- compute: ?? +- cancel: 0 +]) + +OVN_CLEANUP([hv1]) +AT_CLEANUP