From patchwork Thu Oct 15 08:54:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Pettit X-Patchwork-Id: 530563 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id CCC321402BC for ; Thu, 15 Oct 2015 19:55:18 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1F639109F1; Thu, 15 Oct 2015 01:55:10 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 64B3510936 for ; Thu, 15 Oct 2015 01:55:08 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id E515D61806E for ; Thu, 15 Oct 2015 02:55:07 -0600 (MDT) X-ASG-Debug-ID: 1444899307-03dc214308913c0001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar4.cudamail.com with ESMTP id nENFRyfz7qNgBy0A (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 15 Oct 2015 02:55:07 -0600 (MDT) X-Barracuda-Envelope-From: jpettit@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO mail-pa0-f50.google.com) (209.85.220.50) by mx3-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 15 Oct 2015 08:55:07 -0000 Received-SPF: unknown (mx3-pf2.cudamail.com: Multiple SPF records returned) X-Barracuda-Apparent-Source-IP: 209.85.220.50 X-Barracuda-RBL-IP: 209.85.220.50 Received: by payp3 with SMTP id p3so33962659pay.1 for ; Thu, 15 Oct 2015 01:55:06 -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=i+etfJpj7OeSjMPxPL/fVrOWwObFgTthcN+aeWrQfpE=; b=McQBafxCbLc2xU/nkWRjVjjAF3nEI+NeaGvv3oO2Vw234I7u09lQXJ3BhMmClAkujG YaWI61HdBqaS1BIPI6y75OO78Go4oK77bsHlctPfewN9u1b3mvwrBeO5SMJAz5u/yoK+ WumKwdE+CPrDvBRMWqkYtCT6KaJLHqpbE39oG0qWVRHq/MG/fmKMhu5spcvuzTwEC3cy rfv+XCOBfyfFSNVwnohn4fcCsqAxYNc7dE1PxhlZMYd9Lczte7K7UYpY2Dxp30rO3+Ey oj87m6p7nVPUIziu/ZIqSrcfyi4fPH2hmdcMexoAZP2DsxJkby/bLMt+zENKJ7GKvY2D Ko4g== X-Gm-Message-State: ALoCoQlJPpqi/Hs6rZ6YYUjxyDMaDXaCqwV2gUaLCYAqfOJs7hGcQhR/zusb1gXDARxqvmanGIJG X-Received: by 10.68.103.194 with SMTP id fy2mr8725032pbb.120.1444899306678; Thu, 15 Oct 2015 01:55:06 -0700 (PDT) Received: from localhost.localdomain (c-67-161-8-206.hsd1.ca.comcast.net. [67.161.8.206]) by smtp.gmail.com with ESMTPSA id ci2sm14015113pbc.66.2015.10.15.01.55.05 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Oct 2015 01:55:06 -0700 (PDT) X-CudaMail-Envelope-Sender: jpettit@nicira.com From: Justin Pettit To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V2-1014002522 X-CudaMail-DTE: 101515 X-CudaMail-Originating-IP: 209.85.220.50 Date: Thu, 15 Oct 2015 01:54:58 -0700 X-ASG-Orig-Subj: [##CM-V2-1014002522##][PATCH 3/5] ovn-controller: Support VXLAN enapsulation. Message-Id: <1444899300-37713-3-git-send-email-jpettit@nicira.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1444899300-37713-1-git-send-email-jpettit@nicira.com> References: <1444899300-37713-1-git-send-email-jpettit@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1444899307 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA 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 3/5] ovn-controller: Support VXLAN enapsulation. 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" Signed-off-by: Justin Pettit --- ovn/controller/encaps.c | 5 ++- ovn/controller/ovn-controller.8.xml | 17 ++++++++-- ovn/controller/physical.c | 58 +++++++++++++++++++++++++++++++--- 3 files changed, 68 insertions(+), 12 deletions(-) diff --git a/ovn/controller/encaps.c b/ovn/controller/encaps.c index c914e2a..de1aef3 100644 --- a/ovn/controller/encaps.c +++ b/ovn/controller/encaps.c @@ -214,10 +214,11 @@ preferred_encap(const struct sbrec_chassis *chassis_rec) /* For hypervisors, we only support Geneve and STT encapsulations. * Sets are returned alphabetically, so "geneve" will be preferred - * over "stt". */ + * over "stt". For gateways, we only support VXLAN encapsulation. */ for (i = 0; i < chassis_rec->n_encaps; i++) { if (!strcmp(chassis_rec->encaps[i]->type, "geneve") - || !strcmp(chassis_rec->encaps[i]->type, "stt")) { + || !strcmp(chassis_rec->encaps[i]->type, "stt") + || !strcmp(chassis_rec->encaps[i]->type, "vxlan")) { return chassis_rec->encaps[i]; } } diff --git a/ovn/controller/ovn-controller.8.xml b/ovn/controller/ovn-controller.8.xml index 9c041ec..b0aee10 100644 --- a/ovn/controller/ovn-controller.8.xml +++ b/ovn/controller/ovn-controller.8.xml @@ -102,10 +102,19 @@
external_ids:ovn-encap-type
- The encapsulation type that a chassis should use to connect to this - node. Supported tunnel types for connecting hypervisors are - geneve and stt. Gateways may use - geneve, vxlan, or stt. +

+ The encapsulation type that a chassis should use to connect to + this node. Supported tunnel types for connecting hypervisors + are geneve and stt. Gateways may + use geneve, vxlan, or + stt. +

+ +

+ Due to the limited amount of metadata in vxlan, + the capabilities and performance of connected gateways will be + reduced versus other tunnel formats. +

external_ids:ovn-encap-ip
diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c index 0c239df..b26db63 100644 --- a/ovn/controller/physical.c +++ b/ovn/controller/physical.c @@ -54,7 +54,7 @@ struct chassis_tunnel { struct hmap_node hmap_node; const char *chassis_id; ofp_port_t ofport; - enum chassis_tunnel_type { GENEVE, STT } type; + enum chassis_tunnel_type { GENEVE, STT, VXLAN } type; }; static struct chassis_tunnel * @@ -120,6 +120,8 @@ put_encapsulation(enum mf_field_id mff_ovn_geneve, put_load(datapath->tunnel_key | (outport << 24), MFF_TUN_ID, 0, 64, ofpacts); put_move(MFF_LOG_INPORT, 0, MFF_TUN_ID, 40, 15, ofpacts); + } else if (tun->type == VXLAN) { + put_load(datapath->tunnel_key, MFF_TUN_ID, 0, 24, ofpacts); } else { OVS_NOT_REACHED(); } @@ -182,6 +184,8 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, } } else if (!strcmp(iface_rec->type, "stt")) { tunnel_type = STT; + } else if (!strcmp(iface_rec->type, "vxlan")) { + tunnel_type = VXLAN; } else { continue; } @@ -574,11 +578,14 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, /* Table 0, priority 100. * ====================== * - * For packets that arrive from a remote hypervisor (by matching a tunnel - * in_port), set MFF_LOG_DATAPATH, MFF_LOG_INPORT, and MFF_LOG_OUTPORT from - * the tunnel key data, then resubmit to table 33 to handle packets to the - * local hypervisor. */ - + * Process packets that arrive from a remote hypervisor (by matching + * on tunnel in_port). */ + + /* Add flows for Geneve and STT encapsulations. These + * encapsulations have metadata about the ingress and egress logical + * ports. We set MFF_LOG_DATAPATH, MFF_LOG_INPORT, and + * MFF_LOG_OUTPORT from the tunnel key data, then resubmit to table + * 33 to handle packets to the local hypervisor. */ struct chassis_tunnel *tun; HMAP_FOR_EACH (tun, hmap_node, &tunnels) { struct match match = MATCH_CATCHALL_INITIALIZER; @@ -595,14 +602,53 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, put_move(MFF_TUN_ID, 40, MFF_LOG_INPORT, 0, 15, &ofpacts); put_move(MFF_TUN_ID, 24, MFF_LOG_OUTPORT, 0, 16, &ofpacts); put_move(MFF_TUN_ID, 0, MFF_LOG_DATAPATH, 0, 24, &ofpacts); + } else if (tun->type == VXLAN) { + /* We'll handle VXLAN later. */ + continue; } else { OVS_NOT_REACHED(); } + put_resubmit(OFTABLE_LOCAL_OUTPUT, &ofpacts); ofctrl_add_flow(flow_table, OFTABLE_PHY_TO_LOG, 100, &match, &ofpacts); } + /* Add flows for VXLAN encapsulations. Due to the limited amount of + * metadata, we only support VXLAN for connections to gateways. The + * VNI is used to populate MFF_LOG_DATAPATH. The gateway's logical + * port is set to MFF_LOG_INPORT. Then the packet is resubmitted to + * table 16 to determine the logical egress port. + * + * xxx Due to resubmitting to table 16, broadcasts will be re-sent to + * xxx all logical ports, including non-local ones which could cause + * xxx duplicate packets to be received by multiply-connected gateways. */ + HMAP_FOR_EACH (tun, hmap_node, &tunnels) { + if (tun->type != VXLAN) { + continue; + } + + SBREC_PORT_BINDING_FOR_EACH (binding, ctx->ovnsb_idl) { + struct match match = MATCH_CATCHALL_INITIALIZER; + + if (!binding->chassis || + strcmp(tun->chassis_id, binding->chassis->name)) { + continue; + } + + match_set_in_port(&match, tun->ofport); + match_set_tun_id(&match, htonll(binding->datapath->tunnel_key)); + + ofpbuf_clear(&ofpacts); + put_move(MFF_TUN_ID, 0, MFF_LOG_DATAPATH, 0, 24, &ofpacts); + put_load(binding->tunnel_key, MFF_LOG_INPORT, 0, 15, &ofpacts); + put_resubmit(OFTABLE_LOG_INGRESS_PIPELINE, &ofpacts); + + ofctrl_add_flow(flow_table, OFTABLE_PHY_TO_LOG, 100, &match, + &ofpacts); + } + } + /* Table 32, Priority 0. * ======================= *