diff mbox series

[ovs-dev,3/7] northd: Improve comments.

Message ID 20201026181626.1827014-3-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev,1/7] northd: Count mask length and priority correctly for IPv6 addresses. | expand

Commit Message

Ben Pfaff Oct. 26, 2020, 6:16 p.m. UTC
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 northd/ovn-northd.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

Comments

Numan Siddique Oct. 27, 2020, 3:30 p.m. UTC | #1
On Mon, Oct 26, 2020 at 11:46 PM Ben Pfaff <blp@ovn.org> wrote:
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  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

nit: s/iff/if

Acked-by: Numan Siddique <numans@ovn.org>

Thanks
Numan

> +     * 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;
> --
> 2.26.2
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Ben Pfaff Oct. 27, 2020, 5:44 p.m. UTC | #2
On Tue, Oct 27, 2020 at 09:00:10PM +0530, Numan Siddique wrote:
> On Mon, Oct 26, 2020 at 11:46 PM Ben Pfaff <blp@ovn.org> wrote:
> > -    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
> 
> nit: s/iff/if

"iff" is fairly common mathematical jargon for "if and only if".  This
isn't space-constrained so I just wrote it out in full.

Thanks,

Ben.
Numan Siddique Oct. 27, 2020, 6:06 p.m. UTC | #3
On Tue, Oct 27, 2020, 11:14 PM Ben Pfaff <blp@ovn.org> wrote:

> On Tue, Oct 27, 2020 at 09:00:10PM +0530, Numan Siddique wrote:
> > On Mon, Oct 26, 2020 at 11:46 PM Ben Pfaff <blp@ovn.org> wrote:
> > > -    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
> >
> > nit: s/iff/if
>
> "iff" is fairly common mathematical jargon for "if and only if".  This
> isn't space-constrained so I just wrote it out in full.
>

Ok. Then please ignore my comment. I wasn't aware of it.

Thanks
Numan


> Thanks,
>
> Ben.
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
diff mbox series

Patch

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;