From patchwork Tue Aug 23 09:46:17 2016
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Gurucharan Shetty
X-Patchwork-Id: 662016
X-Patchwork-Delegate: blp@nicira.com
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Received: from archives.nicira.com (archives.nicira.com [96.126.127.54])
by ozlabs.org (Postfix) with ESMTP id 3sJgwM1VzGz9sXx
for ;
Wed, 24 Aug 2016 05:48:19 +1000 (AEST)
Received: from archives.nicira.com (localhost [127.0.0.1])
by archives.nicira.com (Postfix) with ESMTP id 7496610886;
Tue, 23 Aug 2016 12:48:13 -0700 (PDT)
X-Original-To: dev@openvswitch.org
Delivered-To: dev@openvswitch.org
Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67])
by archives.nicira.com (Postfix) with ESMTPS id 4EADE1086A
for ; Tue, 23 Aug 2016 12:48:12 -0700 (PDT)
Received: from bar5.cudamail.com (unknown [192.168.21.12])
by mx1e4.cudamail.com (Postfix) with ESMTPS id BAB531E03FB
for ; Tue, 23 Aug 2016 13:48:11 -0600 (MDT)
X-ASG-Debug-ID: 1471981691-09eadd7b911bcf0001-byXFYA
Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com
with ESMTP id JTmhuYNmiYRhTvXv (version=TLSv1.2
cipher=ECDHE-RSA-AES256-GCM-SHA384
bits=256 verify=NO) for ;
Tue, 23 Aug 2016 13:48:11 -0600 (MDT)
X-Barracuda-Envelope-From: guru.ovn@gmail.com
X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1
Received: from unknown (HELO mail-pf0-f195.google.com) (209.85.192.195)
by mx1-pf1.cudamail.com with ESMTPS (AES128-SHA encrypted);
23 Aug 2016 19:48:11 -0000
Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at _netblocks.google.com
designates 209.85.192.195 as permitted sender)
X-Barracuda-Apparent-Source-IP: 209.85.192.195
X-Barracuda-RBL-IP: 209.85.192.195
Received: by mail-pf0-f195.google.com with SMTP id h186so8747398pfg.2
for ; Tue, 23 Aug 2016 12:48:11 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
:references;
bh=wRKfFvirjF6IHVckFiCD8rIVkr7T3o6Q1UMXIoftsrw=;
b=RFww2aCFOBOrRKvUXqpSdsNho2Kb+ZiWTh/5LM5p8WbTmW3xKHBXQKPk8XezxmdaiA
KU2pE7O9XLU52J0Vxlb+5Mn7ksrtdYpN+YqBIqNmd0kWqQSDdo7d0XraGoNi6k7bGQEi
NEcXaUKtnpzmS7kZ5EqMouNLA6gRXKkY6vDACL67IzxugO2k1IY349tuhL2P2BRfYlZU
7FAmVR3UIc2FPjBNYogrASbBeK5HlSaYuldSZfQsVRqOQv+uHB3oY6ajtPSjmHkItwTO
FOuX4RAHWnI+crlu3EKrk0up22k5i7diuhd8e9eYUsgMEA6U2Ng1TLRh1WzLw+jRZvlo
5ndA==
X-Gm-Message-State:
AEkoousUzQlek+0f1G8xHn2G9TKax13aZV8C30yiXtLm/oi3SMbOYNDsNRV9YfrZodCSaQ==
X-Received: by 10.98.34.66 with SMTP id i63mr56701991pfi.130.1471981690148;
Tue, 23 Aug 2016 12:48:10 -0700 (PDT)
Received: from ubuntu.eng.vmware.com ([208.91.1.34])
by smtp.gmail.com with ESMTPSA id
bw10sm7709928pac.27.2016.08.23.12.48.08 for
(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
Tue, 23 Aug 2016 12:48:08 -0700 (PDT)
X-CudaMail-Envelope-Sender: guru.ovn@gmail.com
From: Gurucharan Shetty
To: dev@openvswitch.org
X-CudaMail-Whitelist-To: dev@openvswitch.org
X-CudaMail-MID: CM-E1-822065637
X-CudaMail-DTE: 082316
X-CudaMail-Originating-IP: 209.85.192.195
Date: Tue, 23 Aug 2016 02:46:17 -0700
X-ASG-Orig-Subj: [##CM-E1-822065637##][PATCH 1/2] ovn-controller: Datapath
based conntrack zone for load-balancing.
Message-Id: <1471945578-28525-2-git-send-email-guru@ovn.org>
X-Mailer: git-send-email 1.9.1
In-Reply-To: <1471945578-28525-1-git-send-email-guru@ovn.org>
References: <1471945578-28525-1-git-send-email-guru@ovn.org>
X-Barracuda-Connect: UNKNOWN[192.168.24.1]
X-Barracuda-Start-Time: 1471981691
X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384
X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi
X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?=
X-Virus-Scanned: by bsmtpd at cudamail.com
X-Barracuda-BRTS-Status: 1
Subject: [ovs-dev] [PATCH 1/2] ovn-controller: Datapath based conntrack zone
for load-balancing.
X-BeenThere: dev@openvswitch.org
X-Mailman-Version: 2.1.16
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Errors-To: dev-bounces@openvswitch.org
Sender: "dev"
Currently ct_lb() logical action is only added for a logical switch and
we use the conntrack zone allocated for the logical port. A future commit
will use ct_lb() for a logical router too. In that case, use the allocated
DNAT zone.
Signed-off-by: Gurucharan Shetty
Acked-by: Ben Pfaff
---
include/ovn/actions.h | 3 +++
ovn/controller/lflow.c | 1 +
ovn/lib/actions.c | 7 +++++--
ovn/ovn-sb.xml | 6 ++++--
tests/test-ovn.c | 1 +
5 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/include/ovn/actions.h b/include/ovn/actions.h
index e2a716a..fd03c00 100644
--- a/include/ovn/actions.h
+++ b/include/ovn/actions.h
@@ -406,6 +406,9 @@ struct ovnact_encode_params {
unsigned int *portp);
const void *aux;
+ /* 'true' if the flow is for a switch. */
+ bool is_switch;
+
/* A map from a port name to its connection tracking zone. */
const struct simap *ct_zones;
diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c
index 341ca08..71167ef 100644
--- a/ovn/controller/lflow.c
+++ b/ovn/controller/lflow.c
@@ -419,6 +419,7 @@ consider_logical_flow(const struct lport_index *lports,
struct ovnact_encode_params ep = {
.lookup_port = lookup_port_cb,
.aux = &aux,
+ .is_switch = is_switch(ldp),
.ct_zones = ct_zones,
.group_table = group_table,
.lflow_uuid = lflow->header_.uuid,
diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c
index 3908e1d..f2002cf 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -927,7 +927,8 @@ encode_CT_LB(const struct ovnact_ct_lb *cl,
struct ofpact_conntrack *ct = ofpact_put_CT(ofpacts);
struct ofpact_nat *nat;
size_t nat_offset;
- ct->zone_src.field = mf_from_id(MFF_LOG_CT_ZONE);
+ ct->zone_src.field = ep->is_switch ? mf_from_id(MFF_LOG_CT_ZONE)
+ : mf_from_id(MFF_LOG_DNAT_ZONE);
ct->zone_src.ofs = 0;
ct->zone_src.n_bits = 16;
ct->flags = 0;
@@ -951,6 +952,8 @@ encode_CT_LB(const struct ovnact_ct_lb *cl,
uint32_t group_id = 0, hash;
struct group_info *group_info;
struct ofpact_group *og;
+ uint32_t zone_reg = ep->is_switch ? MFF_LOG_CT_ZONE - MFF_REG0
+ : MFF_LOG_DNAT_ZONE - MFF_REG0;
struct ds ds = DS_EMPTY_INITIALIZER;
ds_put_format(&ds, "type=select");
@@ -965,7 +968,7 @@ encode_CT_LB(const struct ovnact_ct_lb *cl,
ds_put_format(&ds, ":%"PRIu16, dst->port);
}
ds_put_format(&ds, "),commit,table=%d,zone=NXM_NX_REG%d[0..15])",
- recirc_table, MFF_LOG_CT_ZONE - MFF_REG0);
+ recirc_table, zone_reg);
}
hash = hash_string(ds_cstr(&ds), 0);
diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml
index e119249..235c21c 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -1345,8 +1345,10 @@
DNAT address. Processing automatically moves on to the next table,
as if next;
were specified, and later tables act on
the packet as modified by the connection tracker. Connection
- tracking state is scoped by the logical port, so overlapping
- addresses may be used.
+ tracking state is scoped by the logical port when the action is
+ used in a flow for a logical switch, so overlapping
+ addresses may be used. Connection tracking state is scoped by the
+ logical topology when the action is used in a flow for a router.
Without arguments, ct_lb
sends the packet to the
diff --git a/tests/test-ovn.c b/tests/test-ovn.c
index 0ef09ab..837399e 100644
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -1181,6 +1181,7 @@ test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED)
const struct ovnact_encode_params ep = {
.lookup_port = lookup_port_cb,
.aux = &ports,
+ .is_switch = true,
.ct_zones = &ct_zones,
.group_table = &group_table,