From patchwork Thu May 13 15:33:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1478099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: 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=Oivk3Qoz; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fgwfc3Lzrz9sW4 for ; Fri, 14 May 2021 01:33:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8C6B884530; Thu, 13 May 2021 15:33:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07Hj0gaT3uD8; Thu, 13 May 2021 15:33:24 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTP id D7B08844D4; Thu, 13 May 2021 15:33:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A6848C000E; Thu, 13 May 2021 15:33:23 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9E40FC0001 for ; Thu, 13 May 2021 15:33:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 81D2184530 for ; Thu, 13 May 2021 15:33:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rtRVIcnpaR7k for ; Thu, 13 May 2021 15:33:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id EA8E9844D4 for ; Thu, 13 May 2021 15:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620919998; 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=4qzPbsxBJf/8yLZ8eqT1Wv0hvnzKuLZVuYuPJS32vds=; b=Oivk3Qozs0D9etEbWvzVWYlMvPr8BYwKu0pRLQqJPyi53Xcgumie6fLLsgD5dELm2izNpA EOo6e3WsPZ+B8Vr5oufnKxmPLcxJg3tg/Sf/Rk5oxS5mpMjuDCPQwSRSlC3RasYzyqOwVK 5H6gU+99OJn14JAoyP3X22Pdu6SSTsU= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-275-S8KrUwNGPq6EFlIkxSx0QQ-1; Thu, 13 May 2021 11:33:17 -0400 X-MC-Unique: S8KrUwNGPq6EFlIkxSx0QQ-1 Received: by mail-ej1-f70.google.com with SMTP id nd10-20020a170907628ab02903a324b229bfso8537675ejc.7 for ; Thu, 13 May 2021 08:33:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4qzPbsxBJf/8yLZ8eqT1Wv0hvnzKuLZVuYuPJS32vds=; b=mrbUD/LjI7kCAIy/IEMw70cFNFx63L5T8cscred6UfqTMngah3yLjEcBpzojefR19o p9g+UbHNk3gmLGPltxC3gegjbQ6CU1jBRQTALM/tRVN1AJrXWIcmjG80KTIZm2HaBZwF j2baGlU2aQ2Uc6Ft4njlFoqC2WdVkVWSClLIgdxUt7Lfh6V2CEXNSSXcBz9Fhnwp3xj/ awB+Q0TQe4U3G1O9vO+QPzicKILU/jPdnrzMJqmpxhJxPe3eLdL+FcV/z12Jouq+2K72 kH+5KmbWWgDPEPtZ2Y5Wich48UpA72I9XdQz+4GQ0X9B5WPPG+qCMxYgS+oizRbYfZ/E evRQ== X-Gm-Message-State: AOAM530stCd7IhMxjkUwStwDRs7jFhkVwX/bu3Ks9j0oEHigmGcql7p4 C8YT5KRHNztjfujmhbf/7BwmAQnQcOmz2soYjFwDJ0Hk3c+NSeCV935/uTaIeBoUTeMHJX5g1GQ oJD9/OcmPzqxs8VFou1Ej25K9/1Rae3AZtzVSKJ9WIMZGCophE3QBDqyI4/lmTfJ0tUHIKh4lLH 8= X-Received: by 2002:a17:906:5495:: with SMTP id r21mr44212841ejo.471.1620919994820; Thu, 13 May 2021 08:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuVxYkcIIcu1Nv697J0jiRSyDrV1dPDmovRkOpJZywcJiNs509OvXhzR22kbXAmSqI2fOayA== X-Received: by 2002:a17:906:5495:: with SMTP id r21mr44212832ejo.471.1620919994623; Thu, 13 May 2021 08:33:14 -0700 (PDT) Received: from lore-desk.redhat.com (net-37-119-129-147.cust.vodafonedsl.it. [37.119.129.147]) by smtp.gmail.com with ESMTPSA id z7sm2764697edi.39.2021.05.13.08.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 08:33:14 -0700 (PDT) From: Lorenzo Bianconi To: dev@openvswitch.org Date: Thu, 13 May 2021 17:33:06 +0200 Message-Id: <76be2426a9e56cdc87173004be2e32d440c796e0.1620918724.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lorenzo.bianconi@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [PATCH ovn] controller: fix physical flow update for localport 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" Properly update logical/openflow flows for localport removing the interface from the ovs bridge. Openflows in table 65 are not recomputed removing a localport from an ovs-bridge and the ovs bridge ends-up with a stale configuration adding the interface back. Fix the issue taking care of localport special case in physical_handle_ovs_iface_changes routine. Signed-off-by: Lorenzo Bianconi --- controller/ovn-controller.c | 1 + controller/physical.c | 6 +++++- tests/ovn.at | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 67c51a86f..8514e35ea 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1836,6 +1836,7 @@ en_physical_flow_changes_run(struct engine_node *node, void *data) { struct ed_type_pfc_data *pfc_tdata = data; pfc_tdata->recompute_physical_flows = true; + pfc_tdata->ovs_ifaces_changed = true; engine_set_node_state(node, EN_UPDATED); } diff --git a/controller/physical.c b/controller/physical.c index 96c959d18..725959678 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -1874,7 +1874,11 @@ physical_handle_ovs_iface_changes(struct physical_ctx *p_ctx, const struct sbrec_port_binding *lb_pb = local_binding_get_primary_pb(p_ctx->local_bindings, iface_id); if (!lb_pb) { - continue; + lb_pb = lport_lookup_by_name(p_ctx->sbrec_port_binding_by_name, + iface_id); + if (!lb_pb || strcmp(lb_pb->type, "localport")) { + continue; + } } int64_t ofport = iface_rec->n_ofport ? *iface_rec->ofport : 0; diff --git a/tests/ovn.at b/tests/ovn.at index 747967576..06ec60a02 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -11870,6 +11870,27 @@ AT_CHECK([ test 0 -eq $pkts ]) +AT_CHECK([ovs-ofctl dump-flows br-int |awk '/output/{print substr($8, 16, 16)}' |sort], [0], [dnl +1 +2 +3 +]) + +# remove the localport from br-int and re-create it +check ovs-vsctl del-port vif2 +AT_CHECK([ovs-ofctl dump-flows br-int |awk '/output/{print substr($8, 16, 16)}' |sort], [0], [dnl +1 +3 +]) + +check ovs-vsctl add-port br-int vif2 \ + -- set Interface vif2 external-ids:iface-id=lsp +AT_CHECK([ovs-ofctl dump-flows br-int |awk '/output/{print substr($8, 16, 16)}' |sort], [0], [dnl +1 +3 +4 +]) + OVN_CLEANUP([hv1]) AT_CLEANUP ])