From patchwork Mon May 18 06:10:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mengxin Liu X-Patchwork-Id: 1292336 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=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=aGlYjETv; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49QTC73d1fz9sTC for ; Mon, 18 May 2020 16:10:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BBB7C2079D; Mon, 18 May 2020 06:10:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Id3bmDrIVvU0; Mon, 18 May 2020 06:10:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id E7BAB20528; Mon, 18 May 2020 06:10:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C5A95C0881; Mon, 18 May 2020 06:10:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 590AFC07FF for ; Mon, 18 May 2020 06:10:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 411A8882BD for ; Mon, 18 May 2020 06:10:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1cqRR4aeP4ct for ; Mon, 18 May 2020 06:10:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by hemlock.osuosl.org (Postfix) with ESMTPS id 429D288236 for ; Mon, 18 May 2020 06:10:19 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id z18so7213192qto.2 for ; Sun, 17 May 2020 23:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ctHaSuRCCIYXu86XRgQhnScMpSMmjC+n5KGIPYwbmm8=; b=aGlYjETvrgTUOXAi99SPwHJLSx1redbs/m8HaezhoQ4k8y8oXH7yFHpLB3gc8AuAtI FAzUY++mJM3uM4pho2uqQoZo6rgw3E9HE+i5C21ICwbfHj+LDroWeU8NAITDfgh3bJZe 7UkcdJ92j3xSbuQBPUmS+fWN87EUNkLxIe+jfLUI4cD6dwXd10vXtuNfmyzEK6l1MmqA mdHwh0pTGfs3PcrIN0OXBUEpNwfUrmgWazapcss4JnDZOtPp82pZptql2INnCfMS8Xww 0JgVIM5MAbNvT5zrJ4onCe0oEFZvDaF6jv/Hf9Rh1LD0ZZTntrpa2IncJ9g0aS9ekoS4 hTAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ctHaSuRCCIYXu86XRgQhnScMpSMmjC+n5KGIPYwbmm8=; b=p/Xlt7to05CulhaK0jG0FVwtiUd59dip6t+a87LdsUZWfTFp3PKKWyyEVWbX3DeQMJ pbGU9HprmmYxSxHLYQbr0cen0iDiE1ki4xTdYxXkySnThtZFEs4Ko7qQCO7HM6nss7fG j337/VOTpyYsWENzjfsUm9DdAHnbXDmijnur7HP5/8UsQLclW8GKoSHeMe6zCC/wYC/r 0cJNtzaV4DoISSiWn9qNk5tVLhuDurPqm2lE9HYyt6k+qWZiIAgttW9Gq+Q9UBc209Bb 90UG2LxQ+tXkisQBUb06/KAs5YPk2jpKXgC9yvYvztzhOO5OQO+CVrMxLIbPpPKzwJxZ s7jw== X-Gm-Message-State: AOAM531GUbVvSZryO6eF9os/5LFJKHMtnPbwSd6rf05kc4TmmX8ETN+l ca2Rk1y0tOPN+kZZkUup7/z3rU1J/1Tt4A9RczPX+5zu X-Google-Smtp-Source: ABdhPJzMvBwY2ZuiorgbU+WSZxPEcqCzzeKOJBL1YDgVgJryk6zkquZIfFDtwGyoUuHTxrJLBzUCten0S2ETWkMu04A= X-Received: by 2002:ac8:163d:: with SMTP id p58mr15123721qtj.377.1589782218020; Sun, 17 May 2020 23:10:18 -0700 (PDT) MIME-Version: 1.0 From: =?utf-8?b?5YiY5qKm6aao?= Date: Mon, 18 May 2020 14:10:07 +0800 Message-ID: To: dev@openvswitch.org Subject: [ovs-dev] [PATCH ovn v2] ovn-northd: Do not generate logical flows if lsp is not up 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" If the logical_switch_port is not in up state, we don't need to generate related logical_flow. In this way we can reduce the flow numbers in ovn-sb. Signed-off-by: oilbeater --- northd/ovn-northd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ds_put_format(&match, "inport == %s", op->json_key); @@ -4626,7 +4630,7 @@ build_lswitch_output_port_sec(struct hmap *ports, struct hmap *datapaths, * they don't even receive multicast or broadcast packets. */ HMAP_FOR_EACH (op, key_node, ports) { - if (!op->nbsp || lsp_is_external(op->nbsp)) { + if (!op->nbsp || lsp_is_external(op->nbsp) || !lsp_is_up(op->nbsp)) { continue; } @@ -6825,7 +6829,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, /* Ingress table 19: Destination lookup, unicast handling (priority 50), */ HMAP_FOR_EACH (op, key_node, ports) { - if (!op->nbsp || lsp_is_external(op->nbsp)) { + if (!op->nbsp || lsp_is_external(op->nbsp) || !lsp_is_up(op->nbsp)) { continue; } @@ -9724,7 +9728,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, * outport and an Ethernet address in eth.dst. */ HMAP_FOR_EACH (op, key_node, ports) { - if (op->nbsp && !lsp_is_enabled(op->nbsp)) { + if (op->nbsp && (!lsp_is_enabled(op->nbsp) || !lsp_is_up(op->nbsp))) { continue; } diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 87625c395..b9830faf8 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -4569,6 +4569,10 @@ build_lswitch_input_port_sec(struct hmap *ports, struct hmap *datapaths, continue; } + if (!lsp_is_up(op->nbsp)) { + continue; + } + ds_clear(&match); ds_clear(&actions);