From patchwork Mon Oct 26 18:16:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1387966 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.137; helo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CKjhs12gDz9sSW for ; Tue, 27 Oct 2020 05:16:45 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6A7C485A74; Mon, 26 Oct 2020 18:16:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M53Fv7Llrh4D; Mon, 26 Oct 2020 18:16:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6939B85EBE; Mon, 26 Oct 2020 18:16:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 453D1C08A1; Mon, 26 Oct 2020 18:16:41 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id DD8A5C0051 for ; Mon, 26 Oct 2020 18:16:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CC16F866C7 for ; Mon, 26 Oct 2020 18:16:38 +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 pqLfabfDNKVU for ; Mon, 26 Oct 2020 18:16:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by whitealder.osuosl.org (Postfix) with ESMTPS id 05BAE85FAC for ; Mon, 26 Oct 2020 18:16:36 +0000 (UTC) Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 6678D10000B; Mon, 26 Oct 2020 18:16:34 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 26 Oct 2020 11:16:22 -0700 Message-Id: <20201026181626.1827014-3-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201026181626.1827014-1-blp@ovn.org> References: <20201026181626.1827014-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 3/7] northd: Improve comments. 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff Acked-by: Numan Siddique --- northd/ovn-northd.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 4457cdc2d392..e69845fbb219 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -1386,9 +1386,29 @@ build_datapaths(struct northd_context *ctx, struct hmap *datapaths, } } +/* A logical switch port or logical router port. + * + * In steady state, an ovn_port points to a northbound Logical_Switch_Port + * record (via 'nbsp') *or* a Logical_Router_Port record (via 'nbrp'), and to a + * southbound Port_Binding record (via 'sb'). As the state of the system + * changes, join_logical_ports() may determine that there is a new LSP or LRP + * that has no corresponding Port_Binding record (in which case build_ports()) + * will create the missing Port_Binding) or that a Port_Binding record exists + * that has no coresponding LSP (in which case build_ports() will delete the + * spurious Port_Binding). Thus, after build_ports() runs, any given ovn_port + * will have 'sb' nonnull, and 'nbsp' xor 'nbrp' nonnull. + * + * Ordinarily there is only one ovn_port that points to a given LSP or LRP (but + * distributed gateway ports point a "derived" ovn_port to a duplicate LRP). + */ struct ovn_port { + /* Port name aka key. + * + * This is ordinarily the same as nbsp->name or nbrp->name and + * sb->logical_port. (A distributed gateway port creates a "derived" + * ovn_port with key "cr-%s" % nbrp->name.) */ struct hmap_node key_node; /* Index on 'key'. */ - char *key; /* nbs->name, nbr->name, sb->logical_port. */ + char *key; /* nbsp->name, nbrp->name, sb->logical_port. */ char *json_key; /* 'key', quoted for use in JSON. */ const struct sbrec_port_binding *sb; /* May be NULL. */ @@ -1410,15 +1430,20 @@ struct ovn_port { /* Logical port multicast data. */ struct mcast_port_info mcast_info; - bool derived; /* Indicates whether this is an additional port - * derived from nbsp or nbrp. */ + /* This is ordinarily false. It is true iff this ovn_port is derived from + * a chassis-redirect port. */ + bool derived; + bool has_unknown; /* If the addresses have 'unknown' defined. */ + /* The port's peer: * * - A switch port S of type "router" has a router port R as a peer, * and R in turn has S has its peer. * - * - Two connected logical router ports have each other as peer. */ + * - Two connected logical router ports have each other as peer. + * + * - Other kinds of ports have no peer. */ struct ovn_port *peer; struct ovn_datapath *od;