diff mbox series

[ovs-dev,v6,07/12] binding: Make local_binding data structure public

Message ID 20210928155325.2290444-8-frode.nordahl@canonical.com
State Changes Requested
Headers show
Series Introduce infrastructure for plug providers | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Frode Nordahl Sept. 28, 2021, 3:53 p.m. UTC
The binding module maintains a shash of lports bound to the local
chassis.  Other modules have interest in the same data for lookup,
and it would be wasteful to reimplement the same data structure
elsewhere.

The incremental processing engine already makes sharing of the
data between nodes safe and convenient and this change makes it
possible for a different module to consume the data.

Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
---
 controller/binding.c | 34 +---------------------------------
 controller/binding.h | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 33 deletions(-)

Comments

Numan Siddique Oct. 5, 2021, 2:40 a.m. UTC | #1
On Tue, Sep 28, 2021 at 11:54 AM Frode Nordahl
<frode.nordahl@canonical.com> wrote:
>
> The binding module maintains a shash of lports bound to the local
> chassis.  Other modules have interest in the same data for lookup,
> and it would be wasteful to reimplement the same data structure
> elsewhere.
>
> The incremental processing engine already makes sharing of the
> data between nodes safe and convenient and this change makes it
> possible for a different module to consume the data.
>
> Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>

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

Numan

> ---
>  controller/binding.c | 34 +---------------------------------
>  controller/binding.h | 34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 35 insertions(+), 33 deletions(-)
>
> diff --git a/controller/binding.c b/controller/binding.c
> index ecfddced5..2fde7629c 100644
> --- a/controller/binding.c
> +++ b/controller/binding.c
> @@ -507,36 +507,6 @@ update_active_pb_ras_pd(const struct sbrec_port_binding *pb,
>      }
>  }
>
> -/* Local bindings. binding.c module binds the logical port (represented by
> - * Port_Binding rows) and sets the 'chassis' column when it sees the
> - * OVS interface row (of type "" or "internal") with the
> - * external_ids:iface-id=<logical_port name> set.
> - *
> - * This module also manages the other port_bindings.
> - *
> - * To better manage the local bindings with the associated OVS interfaces,
> - * 'struct local_binding' is used. A shash of these local bindings is
> - * maintained with the 'external_ids:iface-id' as the key to the shash.
> - *
> - * struct local_binding has 3 main fields:
> - *    - name : 'external_ids:iface-id' of the OVS interface (key).
> - *    - OVS interface row object.
> - *    - List of 'binding_lport' objects with the primary lport
> - *      in the front of the list (if present).
> - *
> - *  An object of 'struct local_binding' is created:
> - *    - For each interface that has external_ids:iface-id configured.
> - *
> - *    - For each port binding (also referred as lport) of type 'LP_VIF'
> - *      if it is a parent lport of container lports even if there is no
> - *      corresponding OVS interface.
> - */
> -struct local_binding {
> -    char *name;
> -    const struct ovsrec_interface *iface;
> -    struct ovs_list binding_lports;
> -};
> -
>  /* This structure represents a logical port (or port binding)
>   * which is associated with 'struct local_binding'.
>   *
> @@ -559,8 +529,6 @@ static struct local_binding *local_binding_create(
>      const char *name, const struct ovsrec_interface *);
>  static void local_binding_add(struct shash *local_bindings,
>                                struct local_binding *);
> -static struct local_binding *local_binding_find(
> -    const struct shash *local_bindings, const char *name);
>  static void local_binding_destroy(struct local_binding *,
>                                    struct shash *binding_lports);
>  static void local_binding_delete(struct local_binding *,
> @@ -2520,7 +2488,7 @@ local_binding_create(const char *name, const struct ovsrec_interface *iface)
>      return lbinding;
>  }
>
> -static struct local_binding *
> +struct local_binding *
>  local_binding_find(const struct shash *local_bindings, const char *name)
>  {
>      return shash_find_data(local_bindings, name);
> diff --git a/controller/binding.h b/controller/binding.h
> index 70cc37c78..430a8d9b1 100644
> --- a/controller/binding.h
> +++ b/controller/binding.h
> @@ -104,11 +104,45 @@ struct binding_ctx_out {
>      struct if_status_mgr *if_mgr;
>  };
>
> +/* Local bindings. binding.c module binds the logical port (represented by
> + * Port_Binding rows) and sets the 'chassis' column when it sees the
> + * OVS interface row (of type "" or "internal") with the
> + * external_ids:iface-id=<logical_port name> set.
> + *
> + * This module also manages the other port_bindings.
> + *
> + * To better manage the local bindings with the associated OVS interfaces,
> + * 'struct local_binding' is used. A shash of these local bindings is
> + * maintained with the 'external_ids:iface-id' as the key to the shash.
> + *
> + * struct local_binding has 3 main fields:
> + *    - name : 'external_ids:iface-id' of the OVS interface (key).
> + *    - OVS interface row object.
> + *    - List of 'binding_lport' objects with the primary lport
> + *      in the front of the list (if present).
> + *
> + *  An object of 'struct local_binding' is created:
> + *    - For each interface that has external_ids:iface-id configured.
> + *
> + *    - For each port binding (also referred as lport) of type 'LP_VIF'
> + *      if it is a parent lport of container lports even if there is no
> + *      corresponding OVS interface.
> + */
> +struct local_binding {
> +    char *name;
> +    const struct ovsrec_interface *iface;
> +    struct ovs_list binding_lports;
> +};
> +
> +
>  struct local_binding_data {
>      struct shash bindings;
>      struct shash lports;
>  };
>
> +struct local_binding *local_binding_find(
> +    const struct shash *local_bindings, const char *name);
> +
>  void local_binding_data_init(struct local_binding_data *);
>  void local_binding_data_destroy(struct local_binding_data *);
>
> --
> 2.32.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/controller/binding.c b/controller/binding.c
index ecfddced5..2fde7629c 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -507,36 +507,6 @@  update_active_pb_ras_pd(const struct sbrec_port_binding *pb,
     }
 }
 
-/* Local bindings. binding.c module binds the logical port (represented by
- * Port_Binding rows) and sets the 'chassis' column when it sees the
- * OVS interface row (of type "" or "internal") with the
- * external_ids:iface-id=<logical_port name> set.
- *
- * This module also manages the other port_bindings.
- *
- * To better manage the local bindings with the associated OVS interfaces,
- * 'struct local_binding' is used. A shash of these local bindings is
- * maintained with the 'external_ids:iface-id' as the key to the shash.
- *
- * struct local_binding has 3 main fields:
- *    - name : 'external_ids:iface-id' of the OVS interface (key).
- *    - OVS interface row object.
- *    - List of 'binding_lport' objects with the primary lport
- *      in the front of the list (if present).
- *
- *  An object of 'struct local_binding' is created:
- *    - For each interface that has external_ids:iface-id configured.
- *
- *    - For each port binding (also referred as lport) of type 'LP_VIF'
- *      if it is a parent lport of container lports even if there is no
- *      corresponding OVS interface.
- */
-struct local_binding {
-    char *name;
-    const struct ovsrec_interface *iface;
-    struct ovs_list binding_lports;
-};
-
 /* This structure represents a logical port (or port binding)
  * which is associated with 'struct local_binding'.
  *
@@ -559,8 +529,6 @@  static struct local_binding *local_binding_create(
     const char *name, const struct ovsrec_interface *);
 static void local_binding_add(struct shash *local_bindings,
                               struct local_binding *);
-static struct local_binding *local_binding_find(
-    const struct shash *local_bindings, const char *name);
 static void local_binding_destroy(struct local_binding *,
                                   struct shash *binding_lports);
 static void local_binding_delete(struct local_binding *,
@@ -2520,7 +2488,7 @@  local_binding_create(const char *name, const struct ovsrec_interface *iface)
     return lbinding;
 }
 
-static struct local_binding *
+struct local_binding *
 local_binding_find(const struct shash *local_bindings, const char *name)
 {
     return shash_find_data(local_bindings, name);
diff --git a/controller/binding.h b/controller/binding.h
index 70cc37c78..430a8d9b1 100644
--- a/controller/binding.h
+++ b/controller/binding.h
@@ -104,11 +104,45 @@  struct binding_ctx_out {
     struct if_status_mgr *if_mgr;
 };
 
+/* Local bindings. binding.c module binds the logical port (represented by
+ * Port_Binding rows) and sets the 'chassis' column when it sees the
+ * OVS interface row (of type "" or "internal") with the
+ * external_ids:iface-id=<logical_port name> set.
+ *
+ * This module also manages the other port_bindings.
+ *
+ * To better manage the local bindings with the associated OVS interfaces,
+ * 'struct local_binding' is used. A shash of these local bindings is
+ * maintained with the 'external_ids:iface-id' as the key to the shash.
+ *
+ * struct local_binding has 3 main fields:
+ *    - name : 'external_ids:iface-id' of the OVS interface (key).
+ *    - OVS interface row object.
+ *    - List of 'binding_lport' objects with the primary lport
+ *      in the front of the list (if present).
+ *
+ *  An object of 'struct local_binding' is created:
+ *    - For each interface that has external_ids:iface-id configured.
+ *
+ *    - For each port binding (also referred as lport) of type 'LP_VIF'
+ *      if it is a parent lport of container lports even if there is no
+ *      corresponding OVS interface.
+ */
+struct local_binding {
+    char *name;
+    const struct ovsrec_interface *iface;
+    struct ovs_list binding_lports;
+};
+
+
 struct local_binding_data {
     struct shash bindings;
     struct shash lports;
 };
 
+struct local_binding *local_binding_find(
+    const struct shash *local_bindings, const char *name);
+
 void local_binding_data_init(struct local_binding_data *);
 void local_binding_data_destroy(struct local_binding_data *);