From patchwork Wed Jul 27 12:29:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Moats X-Patchwork-Id: 653288 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 3rzvTL0Y0Qz9t27 for ; Wed, 27 Jul 2016 22:30:14 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 12CE810DF3; Wed, 27 Jul 2016 05:30:13 -0700 (PDT) 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 45AFA10DC0 for ; Wed, 27 Jul 2016 05:30:12 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id D1AD01625C4 for ; Wed, 27 Jul 2016 06:30:11 -0600 (MDT) X-ASG-Debug-ID: 1469622610-0b32374772ebd10001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar6.cudamail.com with ESMTP id rTzWV025rxuQ7mEz (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 27 Jul 2016 06:30:10 -0600 (MDT) X-Barracuda-Envelope-From: stack@tombstone-01.cloud.svl.ibm.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by mx3-pf3.cudamail.com with ESMTPS (AES256-SHA encrypted); 27 Jul 2016 12:30:10 -0000 Received-SPF: none (mx3-pf3.cudamail.com: domain at tombstone-01.cloud.svl.ibm.com does not designate permitted sender hosts) X-Barracuda-Apparent-Source-IP: 148.163.156.1 X-Barracuda-RBL-IP: 148.163.156.1 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6RCTPiU015331 for ; Wed, 27 Jul 2016 08:30:08 -0400 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 24dsrqe99u-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 27 Jul 2016 08:30:08 -0400 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Jul 2016 06:30:07 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 27 Jul 2016 06:29:54 -0600 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: stack@tombstone-01.cloud.svl.ibm.com Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 950A219D804E for ; Wed, 27 Jul 2016 06:29:28 -0600 (MDT) Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u6RCTshs39845978; Wed, 27 Jul 2016 12:29:54 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98B0BAE034; Wed, 27 Jul 2016 08:29:52 -0400 (EDT) Received: from localhost (unknown [9.30.183.40]) by b01ledav005.gho.pok.ibm.com (Postfix) with SMTP id 4C5C2AE03C; Wed, 27 Jul 2016 08:29:52 -0400 (EDT) Received: by localhost (Postfix, from userid 1000) id A862B601AA; Wed, 27 Jul 2016 12:29:44 +0000 (UTC) X-CudaMail-Envelope-Sender: stack@tombstone-01.cloud.svl.ibm.com From: Ryan Moats To: dev@openvswitch.org X-CudaMail-MID: CM-V3-726007453 X-CudaMail-DTE: 072716 X-CudaMail-Originating-IP: 148.163.156.1 Date: Wed, 27 Jul 2016 12:29:38 +0000 X-ASG-Orig-Subj: [##CM-V3-726007453##][PATCH] ovn-controller: Restore all_lports for update_ct_zone X-Mailer: git-send-email 1.9.1 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16072712-0028-0000-0000-00000540720E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16072712-0029-0000-0000-00002DE384AD Message-Id: <1469622578-23611-1-git-send-email-rmoats@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-27_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607270129 X-GBUdb-Analysis: 0, 148.163.156.1, Ugly c=0.442133 p=-0.39726 Source Normal X-MessageSniffer-Rules: 0-0-0-11666-c X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1469622610 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.31553 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] [PATCH] ovn-controller: Restore all_lports for update_ct_zone 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" As [1] indicates, commit 263064a (Convert binding_run to incremental processing.) incorrectly localized all_lports to the binding module, leaving an empty set for update_ct_zone to work with. This patch restores all_lports processing to what existed prior to that patch. Signed-off-by: Ryan Moats --- ovn/controller/binding.c | 31 +++++++++++++++++++++++++++++-- ovn/controller/binding.h | 3 ++- ovn/controller/ovn-controller.c | 3 ++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c index e83c1d5..d67412e 100644 --- a/ovn/controller/binding.c +++ b/ovn/controller/binding.c @@ -177,7 +177,6 @@ consider_local_datapath(struct controller_ctx *ctx, if (iface_rec || (binding_rec->parent_port && binding_rec->parent_port[0] && sset_contains(&local_ids, binding_rec->parent_port))) { - add_local_datapath(local_datapaths, binding_rec); if (iface_rec && ctx->ovs_idl_txn) { update_qos(iface_rec, binding_rec); } @@ -230,7 +229,8 @@ consider_local_datapath(struct controller_ctx *ctx, void binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, - const char *chassis_id, struct hmap *local_datapaths) + const char *chassis_id, struct set *all_lports, + struct hmap *local_datapaths) { const struct sbrec_chassis *chassis_rec; const struct sbrec_port_binding *binding_rec; @@ -251,6 +251,33 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, process_full_binding = true; } + struct shash_node *node; + SHASH_FOR_EACH (node, &lport_to_iface) { + sset_add(all_lports, node->name); + } + + /* Run through all binding records to collect lists of lports + for later use in updating ct zones. */ + SBREC_PORT_BINDING_FOR_EACH(binding_rec, ctx->ovnsb_idl) { + const struct ovsrec_interface *iface_rec + = shash_find_data(lport_to_iface, binding_rec->logical_port); + if (iface_rec + || (binding_rec->parent_port && binding_rec->parent_port[0] && + sset_contains(all_lports, binding_rec->parent_port))) { + if (binding_rec->parent_port && binding_rec->parent_port[0]) { + /* Add child logical port to the set of all local ports. */ + sset_add(all_lports, binding_rec->logical_port); + } + } else if (!binding_rec->chassis + && !strcmp(binding_rec->type, "localnet")) { + /* localnet ports will never be bound to a chassis, but we want + * to list them in all_lports because we want to allocate + * a conntrack zone ID for each one, as we'll be creating + * a patch port for each one. */ + sset_add(all_lports, binding_rec->logical_port); + } + } + /* Run through each binding record to see if it is resident on this * chassis and update the binding accordingly. This includes both * directly connected logical ports and children of those ports. */ diff --git a/ovn/controller/binding.h b/ovn/controller/binding.h index 8753d44..0cb4a0f 100644 --- a/ovn/controller/binding.h +++ b/ovn/controller/binding.h @@ -29,7 +29,8 @@ struct sset; void binding_register_ovs_idl(struct ovsdb_idl *); void binding_reset_processing(void); void binding_run(struct controller_ctx *, const struct ovsrec_bridge *br_int, - const char *chassis_id, struct hmap *local_datapaths); + const char *chassis_id, struct sset *all_lports, + struct hmap *local_datapaths); bool binding_cleanup(struct controller_ctx *, const char *chassis_id); #endif /* ovn/binding.h */ diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index ecf1306..fb5d81b 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -434,7 +434,8 @@ main(int argc, char *argv[]) if (chassis_id) { chassis = chassis_run(&ctx, chassis_id); encaps_run(&ctx, br_int, chassis_id); - binding_run(&ctx, br_int, chassis_id, &local_datapaths); + binding_run(&ctx, br_int, chassis_id, &all_lports, + &local_datapaths); } if (br_int && chassis_id) {