From patchwork Wed May 13 21:51:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1289755 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.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Mpxs1qH9z9sRK for ; Thu, 14 May 2020 08:19:45 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 017768869C; Wed, 13 May 2020 22:19:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ttSXdcaMF+DG; Wed, 13 May 2020 22:19:39 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id D3E6C88447; Wed, 13 May 2020 22:19:39 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B383EC088B; Wed, 13 May 2020 22:19:39 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 13E90C016F for ; Wed, 13 May 2020 22:19:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D5845267A1 for ; Wed, 13 May 2020 22:19:38 +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 G39qwAkDrQIs for ; Wed, 13 May 2020 22:19:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mslow2.mail.gandi.net (mslow2.mail.gandi.net [217.70.178.242]) by silver.osuosl.org (Postfix) with ESMTPS id 53119266BD for ; Wed, 13 May 2020 22:19:37 +0000 (UTC) Received: from relay12.mail.gandi.net (unknown [217.70.178.232]) by mslow2.mail.gandi.net (Postfix) with ESMTP id 7D7813AC455 for ; Wed, 13 May 2020 21:51:39 +0000 (UTC) Received: from localhost.localdomain.localdomain (unknown [216.113.160.71]) (Authenticated sender: hzhou@ovn.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 47748200006; Wed, 13 May 2020 21:51:09 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Wed, 13 May 2020 14:51:03 -0700 Message-Id: <1589406663-9041-1-git-send-email-hzhou@ovn.org> X-Mailer: git-send-email 2.1.0 Cc: Han Zhou Subject: [ovs-dev] [PATCH ovn] ovn-northd: Increase ECMP route priority with 400. 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: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" In commit c0bf32d the priorities of the regular routes were increased by 400, but ECMP routes were not updated. This patch fixes it. Since for ECMP routes the outport is unknown (there can be many different outports) the condition check of whether the outport is distributed gateway port is skipped. Fixes: c0bf32d ("Manage ARP process locally in a DVR scenario") Cc: Lorenzo Bianconi Signed-off-by: Han Zhou --- northd/ovn-northd.8.xml | 3 ++- northd/ovn-northd.c | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/northd/ovn-northd.8.xml b/northd/ovn-northd.8.xml index 8f224b0..b0475d0 100644 --- a/northd/ovn-northd.8.xml +++ b/northd/ovn-northd.8.xml @@ -2601,7 +2601,8 @@ next; ids MID1, MID2, ..., a logical flow with match in CIDR notation ip4.dst == N/M, or ip6.dst == N/M, whose priority - is the integer value of M, has the following actions: + is 400 + the integer value of M, has the + following actions:

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index b25152d..c02e305 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -7337,7 +7337,8 @@ build_route_prefix_s(const struct v46_ip *prefix, unsigned int plen)
 }
 
 static void
-build_route_match(const struct ovn_port *op_inport, const char *network_s,
+build_route_match(const struct ovn_port *op_inport,
+                  const struct ovn_port *op_outport, const char *network_s,
                   int plen, bool is_src_route, bool is_ipv4, struct ds *match,
                   uint16_t *priority)
 {
@@ -7351,6 +7352,13 @@ build_route_match(const struct ovn_port *op_inport, const char *network_s,
         dir = "dst";
         *priority = (plen * 2) + 1;
     }
+    /* traffic for internal IPs of logical switch ports must be sent to
+     * the gw controller through the overlay tunnels
+     */
+    if (!op_outport ||
+        (op_outport->nbrp && !op_outport->nbrp->n_gateway_chassis)) {
+        priority += DROUTE_PRIO;
+    }
 
     if (op_inport) {
         ds_put_format(match, "inport == %s && ", op_inport->json_key);
@@ -7434,8 +7442,8 @@ build_ecmp_route_flow(struct hmap *lflows, struct ovn_datapath *od,
     uint16_t priority;
 
     char *prefix_s = build_route_prefix_s(&eg->prefix, eg->plen);
-    build_route_match(NULL, prefix_s, eg->plen, eg->is_src_route, is_ipv4,
-                      &match, &priority);
+    build_route_match(NULL, NULL, prefix_s, eg->plen, eg->is_src_route,
+                      is_ipv4, &match, &priority);
     free(prefix_s);
 
     struct ds actions = DS_EMPTY_INITIALIZER;
@@ -7548,14 +7556,8 @@ add_route(struct hmap *lflows, const struct ovn_port *op,
             op_inport = op;
         }
     }
-    build_route_match(op_inport, network_s, plen, is_src_route, is_ipv4,
+    build_route_match(op_inport, op, network_s, plen, is_src_route, is_ipv4,
                       &match, &priority);
-    /* traffic for internal IPs of logical switch ports must be sent to
-     * the gw controller through the overlay tunnels
-     */
-    if (op->nbrp && !op->nbrp->n_gateway_chassis) {
-        priority += DROUTE_PRIO;
-    }
 
     struct ds actions = DS_EMPTY_INITIALIZER;
     ds_put_format(&actions, "ip.ttl--; "REG_ECMP_GROUP_ID" = 0; %sreg0 = ",