From patchwork Wed Jun 19 12:45:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1118679 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TPnT31M7z9sNC for ; Wed, 19 Jun 2019 22:45:47 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0467312DE; Wed, 19 Jun 2019 12:45:44 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C98DC12DA for ; Wed, 19 Jun 2019 12:45:42 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 441CCE6 for ; Wed, 19 Jun 2019 12:45:42 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id h19so4561615wme.0 for ; Wed, 19 Jun 2019 05:45:42 -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=nHfhAFcmPXwXS0PHbMBL4X2+W4rl+AR1WguGay9PbzA=; b=N/QOdJRkPgsbcH/9A+pgJe4k48nME5VO/+nzw4rFQw98CVTnXnjQvZXUDwszHi0fOU aUNk9oTjBbC+Cuk5UESE7yemP3qhUgnzJzmFMB3s48la+5Ux6I6eRhFieDg8XN2oWHnA elg8qwSpx/WWJjLir/6lo3N1L53ev+lbE8CCTEzcYeNr1it5IPwVHGTcH84lJrZNjlvq iWp56uqiu1mavKEtyF1LnoacB0mxI6rb95DXmxRK0MqYVH9HNwW7pngMtT6VVnkp7V2y hqrMdWJCeaH0cHOCQY84qr0sQfp/bBw766aWlkU6dYrI7yH/gEfLdWgreCUWUW3TU4dY qZdQ== X-Gm-Message-State: APjAAAV1i+7r+aoyk2PhEDXubLpyWyUMXiaN4pvPJ69dKcJjvLWEmVQV q0W/AWCBnovjMpxFHdGl89ip+YrG9ao= X-Google-Smtp-Source: APXvYqwbuDTVjFHRM3dMsIe+cywChSPmltgAZbooFF+MX84+fpHIUioDSfi4Brq1+19cnQ+eGcTToA== X-Received: by 2002:a1c:2e0a:: with SMTP id u10mr8791668wmu.92.1560948339746; Wed, 19 Jun 2019 05:45:39 -0700 (PDT) Received: from localhost.localdomain.com ([151.66.61.123]) by smtp.gmail.com with ESMTPSA id v65sm2026935wme.31.2019.06.19.05.45.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 05:45:38 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 19 Jun 2019 14:45:34 +0200 Message-Id: <67f609604346aac8d527f9aaa81d81ffbf3fae3e.1560948192.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2] OVN: run local logical flows first in S_ROUTER_OUT_SNAT table X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Run local logical flows first if the gw router port is scheduled on the local chassis in order to properly manage snat traffic Tested-by: Eran Kuris Signed-off-by: Lorenzo Bianconi Acked-by: Numan Siddique --- Changes since v1: - add priority change in ovn-northd.8.xml --- ovn/northd/ovn-northd.8.xml | 3 ++- ovn/northd/ovn-northd.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml index e6417220f..a51f4a162 100644 --- a/ovn/northd/ovn-northd.8.xml +++ b/ovn/northd/ovn-northd.8.xml @@ -2421,7 +2421,8 @@ nd_ns {

If the NAT rule cannot be handled in a distributed manner, then the flow above is only programmed on the - redirect-chassis. + redirect-chassis increasing flow priority by 128 in + order to be run first

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 0b0a96a3a..fba5e6d44 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -6566,6 +6566,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, count_1bits(ntohl(mask)) + 1, ds_cstr(&match), ds_cstr(&actions)); } else { + uint16_t priority = count_1bits(ntohl(mask)) + 1; /* Distributed router. */ ds_clear(&match); ds_put_format(&match, "ip && ip4.src == %s" @@ -6575,6 +6576,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, if (!distributed && od->l3redirect_port) { /* Flows for NAT rules that are centralized are only * programmed on the "redirect-chassis". */ + priority += 128; ds_put_format(&match, " && is_chassis_resident(%s)", od->l3redirect_port->json_key); } @@ -6589,8 +6591,8 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, * nat->logical_ip with the longest mask gets a higher * priority. */ ovn_lflow_add(lflows, od, S_ROUTER_OUT_SNAT, - count_1bits(ntohl(mask)) + 1, - ds_cstr(&match), ds_cstr(&actions)); + priority, ds_cstr(&match), + ds_cstr(&actions)); } }