From patchwork Sun Nov 29 19:48:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 549792 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 4C27D14017E for ; Mon, 30 Nov 2015 06:48:47 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1BC59101A0; Sun, 29 Nov 2015 11:48:46 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 4BC9D10196 for ; Sun, 29 Nov 2015 11:48:44 -0800 (PST) Received: from bar3.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id CC31E161526 for ; Sun, 29 Nov 2015 12:48:43 -0700 (MST) X-ASG-Debug-ID: 1448826523-03dd7b0fbd3e4560001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar3.cudamail.com with ESMTP id LzheHErbsHJAUvB2 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 29 Nov 2015 12:48:43 -0700 (MST) X-Barracuda-Envelope-From: blp@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO relay3-d.mail.gandi.net) (217.70.183.195) by mx3-pf3.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 29 Nov 2015 19:53:52 -0000 Received-SPF: pass (mx3-pf3.cudamail.com: SPF record at ovn.org designates 217.70.183.195 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.195 X-Barracuda-RBL-IP: 217.70.183.195 Received: from mfilter47-d.gandi.net (mfilter47-d.gandi.net [217.70.178.178]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 24DFBA80CB; Sun, 29 Nov 2015 20:48:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter47-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter47-d.gandi.net (mfilter47-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id TfjB9H9Pf-m4; Sun, 29 Nov 2015 20:48:36 +0100 (CET) X-Originating-IP: 173.228.112.189 Received: from sigabrt.gateway.sonic.net (173-228-112-189.dsl.dynamic.fusionbroadband.com [173.228.112.189]) (Authenticated sender: blp@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 01871A80C1; Sun, 29 Nov 2015 20:48:35 +0100 (CET) X-CudaMail-Envelope-Sender: blp@ovn.org From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-1128013973 X-CudaMail-DTE: 112915 X-CudaMail-Originating-IP: 217.70.183.195 Date: Sun, 29 Nov 2015 11:48:43 -0800 X-ASG-Orig-Subj: [##CM-V3-1128013973##][PATCH repost] physical: Improve treatment of localnet non-VLAN logical ports. Message-Id: <1448826523-6966-1-git-send-email-blp@ovn.org> X-Mailer: git-send-email 2.1.3 X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1448826523 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 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH repost] physical: Improve treatment of localnet non-VLAN logical ports. 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" Until now, the flow table treated localnet logical ports that have a VLAN quite differently from those that don't. The ones without a VLAN were essentially trunk ports: any packets that came in, that weren't picked off by a localnet port with a VLAN, were passed to the ones without a VLAN. This wasn't the intended behavior. This commit changes behavior to the intended behavior. Now, localnet ports without a specific VLAN only receive packets without a VLAN header or those with VLAN ID 0 (with that header stripped off). Found by inspection. Signed-off-by: Ben Pfaff --- Repost of a patch from Oct. 15: https://patchwork.ozlabs.org/patch/530988/ ovn/controller/physical.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c index 5821c11..302bb57 100644 --- a/ovn/controller/physical.c +++ b/ovn/controller/physical.c @@ -726,15 +726,12 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, } hmap_destroy(&tunnels); - /* Table 0, Priority 150 and 100. - * ============================== + /* Table 0, Priority 100. + * ====================== * * We have now determined the full set of port bindings associated with * each "localnet" network. Only create flows for datapaths that have * another local binding. Otherwise, we know it would just be dropped. - * - * Use priority 150 for inputs that match both the network and a VLAN tag. - * Use priority 100 for matching untagged traffic from the local network. */ struct shash_node *ln_bindings_node, *ln_bindings_node_next; SHASH_FOR_EACH_SAFE (ln_bindings_node, ln_bindings_node_next, @@ -747,14 +744,19 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, match_set_in_port(&match, ln_bindings->ofport); if (ln_vlan->tag) { match_set_dl_vlan(&match, htons(ln_vlan->tag)); + } else { + /* Match priority-tagged frames, e.g. VLAN ID 0. + * + * We'll add a second flow for frames that lack any 802.1Q + * header later. */ + match_set_dl_tci_masked(&match, htons(VLAN_CFI), + htons(VLAN_VID_MASK | VLAN_CFI)); } struct ofpbuf ofpacts; ofpbuf_init(&ofpacts, 0); - if (ln_vlan->tag) { - ofpact_put_STRIP_VLAN(&ofpacts); - } + ofpact_put_STRIP_VLAN(&ofpacts); uint32_t ofpacts_orig_size = ofpacts.size; struct binding_elem *b; @@ -775,8 +777,16 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, } if (ofpacts.size > ofpacts_orig_size) { - ofctrl_add_flow(flow_table, 0, ln_vlan->tag ? 150 : 100, - &match, &ofpacts); + ofctrl_add_flow(flow_table, 0, 100, &match, &ofpacts); + + if (!ln_vlan->tag) { + /* Add a second flow for frames that lack any 802.1Q + * header. For these, drop the OFPACT_STRIP_VLAN + * action. */ + ofpbuf_pull(&ofpacts, ofpacts_orig_size); + match_set_dl_tci_masked(&match, 0, htons(VLAN_CFI)); + ofctrl_add_flow(flow_table, 0, 100, &match, &ofpacts); + } } ofpbuf_uninit(&ofpacts);