From patchwork Mon Jul 31 17:18:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Heib X-Patchwork-Id: 1815194 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::133; helo=smtp2.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=PbWGm9TK; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RF4hW48Vmz20G3 for ; Tue, 1 Aug 2023 03:18:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9947E40BE4; Mon, 31 Jul 2023 17:18:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9947E40BE4 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=PbWGm9TK 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 z2oQw_lkc1pU; Mon, 31 Jul 2023 17:18:32 +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 6C00240577; Mon, 31 Jul 2023 17:18:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6C00240577 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3CEA3C0071; Mon, 31 Jul 2023 17:18:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 22575C0032 for ; Mon, 31 Jul 2023 17:18:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id EBB4640333 for ; Mon, 31 Jul 2023 17:18:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EBB4640333 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=PbWGm9TK 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 pZCcuAFo1j-G for ; Mon, 31 Jul 2023 17:18:28 +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 75D744032A for ; Mon, 31 Jul 2023 17:18:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 75D744032A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690823907; 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=jKohY4spwaDoLYKpuX7WdXaNjfvLbJoCGgSXMy3cbRc=; b=PbWGm9TKaFYdUg3ZarxMBsED+rp/WwhPxSU202yRW9QMuBR3rrouz/92Ozos9AwkTISP6W Recvurs8Goayi9txqzqAu9fPrPJcaG4VCMIpfz+Kte7XvBaHvnPzEgWBjsEmlxynB51ZXo hCoknAPqabGo9Fr6moR3RFbCHOR8xT4= Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-223-dQ56mTZbO26DyB1F0DdKcw-1; Mon, 31 Jul 2023 13:18:25 -0400 X-MC-Unique: dQ56mTZbO26DyB1F0DdKcw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43BE31C068C5 for ; Mon, 31 Jul 2023 17:18:25 +0000 (UTC) Received: from mheiblap.localdomain.com (unknown [10.35.206.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7776E2166B25; Mon, 31 Jul 2023 17:18:24 +0000 (UTC) From: Mohammad Heib To: dev@openvswitch.org Date: Mon, 31 Jul 2023 20:18:16 +0300 Message-Id: <20230731171816.2932499-1-mheib@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2] binding: handle ovs ofport update 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" Currently when ovs interface ofport is updated after setting external_ids:iface_id, the ovn-controller will see this change but will not do much if it handles this change incrementally. This behavior leads to a mismatch between the ovs openflow flows in table=0 (inaccurate in_port) and the ofport number that the packet was received at which will lead to packets drop in table=0. This patch will resolve the above issue by triggering flows recompute during the I-P processing only if the affected port are associated with lport and has flows that need to be updated. Reported-at: https://issues.redhat.com/browse/FD-3063 Signed-off-by: Mohammad Heib Acked-by: Mark Michelson Acked-by: Ales Musil --- controller/binding.c | 15 ++++++++++++++ tests/ovn-controller.at | 45 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/controller/binding.c b/controller/binding.c index 9aa3fc6c4..cc4c2b0bb 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2360,6 +2360,21 @@ consider_iface_claim(const struct ovsrec_interface *iface_rec, /* Get the (updated) b_lport again for the lbinding. */ b_lport = local_binding_get_primary_lport(lbinding); + /* + * Update the tracked_dp_bindings whenever an ofport + * on a specific ovs port changes. + * This update will trigger flow recomputation during + * the incremental processing run which updates the local + * flows in_port filed. + */ + if (b_lport && ovsrec_interface_is_updated(iface_rec, + OVSREC_INTERFACE_COL_OFPORT)) { + tracked_datapath_lport_add(b_lport->pb, TRACKED_RESOURCE_UPDATED, + b_ctx_out->tracked_dp_bindings); + b_ctx_out->local_lports_changed = true; + } + + /* Update the child local_binding's iface (if any children) and try to * claim the container lbindings. */ LIST_FOR_EACH (b_lport, list_node, &lbinding->binding_lports) { diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at index e1b6491b3..f2216d245 100644 --- a/tests/ovn-controller.at +++ b/tests/ovn-controller.at @@ -2606,3 +2606,48 @@ AT_CHECK([ovn-sbctl get chassis $chassis_id other_config:unsupported], [1], [ign OVN_CLEANUP([hv1]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-controller - ovs iface change ofport]) +AT_KEYWORDS([ovn]) +ovn_start + +net_add n1 + +sim_add hv1 +as hv1 +ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.168.0.1 +ovs-vsctl -- add-port br-int hv1-vif1 -- \ + set interface hv1-vif1 external-ids:iface-id=sw0-p1 \ + options:tx_pcap=hv1/vif1-tx.pcap \ + options:rxq_pcap=hv1/vif1-rx.pcap \ + ofport-request=1 + + +ovn-nbctl ls-add sw0 + +check ovn-nbctl lsp-add sw0 sw0-p1 +check ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03 10.0.0.3 1000::3" + +wait_for_ports_up +ovn-nbctl --wait=hv sync + +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=0 | grep -c in_port=1], [0],[dnl +1 +]) + +# update the ovs interface ofport from 1 to 24 +check as hv1 ovs-vsctl set Interface hv1-vif1 ofport-request=24 +OVS_WAIT_UNTIL([test x`as hv1 ovs-vsctl get Interface hv1-vif1 ofport` = x24]) + +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=0 | grep -c in_port=24], [0],[dnl +1 +]) +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=0 | grep -c in_port=1], [1],[dnl +0 +]) + +OVN_CLEANUP([hv1]) +AT_CLEANUP +])