diff mbox series

[ovs-dev,4/7] northd: Rename struct northd_context

Message ID 20210929172341.719131-5-mark.d.gray@redhat.com
State Superseded
Delegated to: Han Zhou
Headers show
Series northd: Introduce incremental processing framework | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success

Commit Message

Mark Gray Sept. 29, 2021, 5:23 p.m. UTC
In order to prepare for a subsequent commit, rename
'struct northd_context' to 'struct northd_idl_context'. In
subsequent commits, 'struct northd_idl_context' will then be
used, only, to hold the IDL context required by northd.

Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
---
 northd/en-northd.c       |  2 +-
 northd/inc-proc-northd.c |  2 +-
 northd/inc-proc-northd.h |  2 +-
 northd/northd.c          | 83 ++++++++++++++++++++--------------------
 northd/northd.h          |  4 +-
 northd/ovn-northd.c      | 10 ++---
 6 files changed, 52 insertions(+), 51 deletions(-)
diff mbox series

Patch

diff --git a/northd/en-northd.c b/northd/en-northd.c
index d310fa4dd31f..8dec51535af0 100644
--- a/northd/en-northd.c
+++ b/northd/en-northd.c
@@ -28,7 +28,7 @@  VLOG_DEFINE_THIS_MODULE(en_northd);
 void en_northd_run(struct engine_node *node, void *data OVS_UNUSED)
 {
     const struct engine_context *eng_ctx = engine_get_context();
-    struct northd_context *ctx = eng_ctx->client_ctx;
+    struct northd_idl_context *ctx = eng_ctx->client_ctx;
     ovn_db_run(ctx);
 
     engine_set_node_state(node, EN_UPDATED);
diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
index 85baeb07d3d9..572b8de6536a 100644
--- a/northd/inc-proc-northd.c
+++ b/northd/inc-proc-northd.c
@@ -213,7 +213,7 @@  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
     engine_init(&en_northd, &engine_arg);
 }
 
-void inc_proc_northd_run(struct northd_context *ctx,
+void inc_proc_northd_run(struct northd_idl_context *ctx,
                          bool recompute) {
     engine_set_force_recompute(recompute);
     engine_init_run();
diff --git a/northd/inc-proc-northd.h b/northd/inc-proc-northd.h
index 09cb8f3b3a80..6ee056dc14f5 100644
--- a/northd/inc-proc-northd.h
+++ b/northd/inc-proc-northd.h
@@ -8,7 +8,7 @@ 
 
 void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
                           struct ovsdb_idl_loop *sb);
-void inc_proc_northd_run(struct northd_context *ctx,
+void inc_proc_northd_run(struct northd_idl_context *ctx,
                          bool recompute);
 void inc_proc_northd_cleanup(void);
 
diff --git a/northd/northd.c b/northd/northd.c
index b22c29f90de5..7c5948504a9b 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -1167,7 +1167,7 @@  ovn_datapath_update_external_ids(struct ovn_datapath *od)
 }
 
 static void
-join_datapaths(struct northd_context *ctx, struct hmap *datapaths,
+join_datapaths(struct northd_idl_context *ctx, struct hmap *datapaths,
                struct ovs_list *sb_only, struct ovs_list *nb_only,
                struct ovs_list *both, struct ovs_list *lr_list)
 {
@@ -1278,7 +1278,7 @@  is_vxlan_mode(struct ovsdb_idl *ovnsb_idl)
 }
 
 static uint32_t
-get_ovn_max_dp_key_local(struct northd_context *ctx)
+get_ovn_max_dp_key_local(struct northd_idl_context *ctx)
 {
     if (is_vxlan_mode(ctx->ovnsb_idl)) {
         /* OVN_MAX_DP_GLOBAL_NUM doesn't apply for vxlan mode. */
@@ -1288,7 +1288,7 @@  get_ovn_max_dp_key_local(struct northd_context *ctx)
 }
 
 static void
-ovn_datapath_allocate_key(struct northd_context *ctx,
+ovn_datapath_allocate_key(struct northd_idl_context *ctx,
                           struct hmap *datapaths, struct hmap *dp_tnlids,
                           struct ovn_datapath *od, uint32_t *hint)
 {
@@ -1334,7 +1334,7 @@  ovn_datapath_assign_requested_tnl_id(struct hmap *dp_tnlids,
  * Initializes 'datapaths' to contain a "struct ovn_datapath" for every logical
  * switch and router. */
 static void
-build_datapaths(struct northd_context *ctx, struct hmap *datapaths,
+build_datapaths(struct northd_idl_context *ctx, struct hmap *datapaths,
                 struct ovs_list *lr_list)
 {
     struct ovs_list sb_only, nb_only, both;
@@ -2305,7 +2305,7 @@  tag_alloc_create_new_tag(struct hmap *tag_alloc_table,
 
 
 static void
-join_logical_ports(struct northd_context *ctx,
+join_logical_ports(struct northd_idl_context *ctx,
                    struct hmap *datapaths, struct hmap *ports,
                    struct hmap *chassis_qdisc_queues,
                    struct hmap *tag_alloc_table, struct ovs_list *sb_only,
@@ -2767,7 +2767,7 @@  sbpb_gw_chassis_needs_update(
 }
 
 static struct sbrec_ha_chassis *
-create_sb_ha_chassis(struct northd_context *ctx,
+create_sb_ha_chassis(struct northd_idl_context *ctx,
                      const struct sbrec_chassis *chassis,
                      const char *chassis_name, int priority)
 {
@@ -2852,7 +2852,7 @@  chassis_group_list_changed(
 }
 
 static void
-sync_ha_chassis_group_for_sbpb(struct northd_context *ctx,
+sync_ha_chassis_group_for_sbpb(struct northd_idl_context *ctx,
                                const struct nbrec_ha_chassis_group *nb_ha_grp,
                                struct ovsdb_idl_index *sbrec_chassis_by_name,
                                const struct sbrec_port_binding *pb)
@@ -2905,7 +2905,7 @@  sync_ha_chassis_group_for_sbpb(struct northd_context *ctx,
  */
 static void
 copy_gw_chassis_from_nbrp_to_sbpb(
-        struct northd_context *ctx,
+        struct northd_idl_context *ctx,
         struct ovsdb_idl_index *sbrec_chassis_by_name,
         const struct nbrec_logical_router_port *lrp,
         const struct sbrec_port_binding *port_binding)
@@ -2983,7 +2983,7 @@  ovn_update_ipv6_prefix(struct hmap *ports)
 }
 
 static void
-ovn_port_update_sbrec(struct northd_context *ctx,
+ovn_port_update_sbrec(struct northd_idl_context *ctx,
                       struct ovsdb_idl_index *sbrec_chassis_by_name,
                       const struct ovn_port *op,
                       struct hmap *chassis_qdisc_queues,
@@ -3321,7 +3321,7 @@  ovn_port_update_sbrec(struct northd_context *ctx,
 /* Remove mac_binding entries that refer to logical_ports which are
  * deleted. */
 static void
-cleanup_mac_bindings(struct northd_context *ctx, struct hmap *datapaths,
+cleanup_mac_bindings(struct northd_idl_context *ctx, struct hmap *datapaths,
                      struct hmap *ports)
 {
     const struct sbrec_mac_binding *b, *n;
@@ -3337,7 +3337,7 @@  cleanup_mac_bindings(struct northd_context *ctx, struct hmap *datapaths,
 }
 
 static void
-cleanup_sb_ha_chassis_groups(struct northd_context *ctx,
+cleanup_sb_ha_chassis_groups(struct northd_idl_context *ctx,
                              struct sset *active_ha_chassis_groups)
 {
     const struct sbrec_ha_chassis_group *b, *n;
@@ -3349,7 +3349,8 @@  cleanup_sb_ha_chassis_groups(struct northd_context *ctx,
 }
 
 static void
-cleanup_stale_fdp_entries(struct northd_context *ctx, struct hmap *datapaths)
+cleanup_stale_fdp_entries(struct northd_idl_context *ctx,
+                          struct hmap *datapaths)
 {
     const struct sbrec_fdb *fdb_e, *next;
     SBREC_FDB_FOR_EACH_SAFE (fdb_e, next, ctx->ovnsb_idl) {
@@ -3376,7 +3377,7 @@  struct service_monitor_info {
 
 
 static struct service_monitor_info *
-create_or_get_service_mon(struct northd_context *ctx,
+create_or_get_service_mon(struct northd_idl_context *ctx,
                           struct hmap *monitor_map,
                           const char *ip, const char *logical_port,
                           uint16_t service_port, const char *protocol)
@@ -3408,7 +3409,7 @@  create_or_get_service_mon(struct northd_context *ctx,
 }
 
 static void
-ovn_lb_svc_create(struct northd_context *ctx, struct ovn_northd_lb *lb,
+ovn_lb_svc_create(struct northd_idl_context *ctx, struct ovn_northd_lb *lb,
                   struct hmap *monitor_map, struct hmap *ports)
 {
     for (size_t i = 0; i < lb->n_vips; i++) {
@@ -3572,7 +3573,7 @@  build_ovn_lr_lbs(struct hmap *datapaths, struct hmap *lbs)
 }
 
 static void
-build_ovn_lbs(struct northd_context *ctx, struct hmap *datapaths,
+build_ovn_lbs(struct northd_idl_context *ctx, struct hmap *datapaths,
               struct hmap *lbs)
 {
     struct ovn_northd_lb *lb;
@@ -3674,7 +3675,7 @@  build_ovn_lbs(struct northd_context *ctx, struct hmap *datapaths,
 }
 
 static void
-build_ovn_lb_svcs(struct northd_context *ctx, struct hmap *ports,
+build_ovn_lb_svcs(struct northd_idl_context *ctx, struct hmap *ports,
                   struct hmap *lbs)
 {
     struct hmap monitor_map = HMAP_INITIALIZER(&monitor_map);
@@ -3792,7 +3793,7 @@  ovn_port_allocate_key(struct hmap *ports, struct ovn_port *op)
  * using the "struct ovn_datapath"s in 'datapaths' to look up logical
  * datapaths. */
 static void
-build_ports(struct northd_context *ctx,
+build_ports(struct northd_idl_context *ctx,
             struct ovsdb_idl_index *sbrec_chassis_by_name,
             struct hmap *datapaths, struct hmap *ports)
 {
@@ -4059,7 +4060,7 @@  ovn_igmp_group_find(struct hmap *igmp_groups,
 }
 
 static struct ovn_igmp_group *
-ovn_igmp_group_add(struct northd_context *ctx, struct hmap *igmp_groups,
+ovn_igmp_group_add(struct northd_idl_context *ctx, struct hmap *igmp_groups,
                    struct ovn_datapath *datapath,
                    const struct in6_addr *address,
                    const char *address_s)
@@ -6079,7 +6080,7 @@  ovn_port_group_destroy(struct hmap *pgs, struct ovn_port_group *pg)
 }
 
 static void
-build_port_group_lswitches(struct northd_context *ctx, struct hmap *pgs,
+build_port_group_lswitches(struct northd_idl_context *ctx, struct hmap *pgs,
                            struct hmap *ports)
 {
     hmap_init(pgs);
@@ -8104,7 +8105,7 @@  bfd_port_lookup(struct hmap *bfd_map, const char *logical_port,
 }
 
 static void
-bfd_cleanup_connections(struct northd_context *ctx, struct hmap *bfd_map)
+bfd_cleanup_connections(struct northd_idl_context *ctx, struct hmap *bfd_map)
 {
     const struct nbrec_bfd *nb_bt;
     struct bfd_entry *bfd_e;
@@ -8187,7 +8188,7 @@  static int bfd_get_unused_port(unsigned long *bfd_src_ports)
 }
 
 static void
-build_bfd_table(struct northd_context *ctx, struct hmap *bfd_connections,
+build_bfd_table(struct northd_idl_context *ctx, struct hmap *bfd_connections,
                 struct hmap *ports)
 {
     struct hmap sb_only = HMAP_INITIALIZER(&sb_only);
@@ -13151,7 +13152,7 @@  ovn_dp_group_find(const struct hmap *dp_groups,
 }
 
 static struct sbrec_logical_dp_group *
-ovn_sb_insert_logical_dp_group(struct northd_context *ctx,
+ovn_sb_insert_logical_dp_group(struct northd_idl_context *ctx,
                                      const struct hmapx *od)
 {
     struct sbrec_logical_dp_group *dp_group;
@@ -13173,7 +13174,7 @@  ovn_sb_insert_logical_dp_group(struct northd_context *ctx,
 
 static void
 ovn_sb_set_lflow_logical_dp_group(
-    struct northd_context *ctx,
+    struct northd_idl_context *ctx,
     struct hmap *dp_groups,
     const struct sbrec_logical_flow *sbflow,
     const struct hmapx *od_group)
@@ -13204,7 +13205,7 @@  static bool reset_parallel = false;
 /* Updates the Logical_Flow and Multicast_Group tables in the OVN_SB database,
  * constructing their contents based on the OVN_NB database. */
 static void
-build_lflows(struct northd_context *ctx, struct hmap *datapaths,
+build_lflows(struct northd_idl_context *ctx, struct hmap *datapaths,
              struct hmap *ports, struct hmap *port_groups,
              struct hmap *mcgroups, struct hmap *igmp_groups,
              struct shash *meter_groups,
@@ -13517,7 +13518,7 @@  build_lflows(struct northd_context *ctx, struct hmap *datapaths,
 }
 
 static void
-sync_address_set(struct northd_context *ctx, const char *name,
+sync_address_set(struct northd_idl_context *ctx, const char *name,
                  const char **addrs, size_t n_addrs,
                  struct shash *sb_address_sets)
 {
@@ -13544,7 +13545,7 @@  sync_address_set(struct northd_context *ctx, const char *name,
  * in OVN_Northbound, so that the address sets used in Logical_Flows in
  * OVN_Southbound is checked against the proper set.*/
 static void
-sync_address_sets(struct northd_context *ctx)
+sync_address_sets(struct northd_idl_context *ctx)
 {
     struct shash sb_address_sets = SHASH_INITIALIZER(&sb_address_sets);
 
@@ -13614,7 +13615,7 @@  sync_address_sets(struct northd_context *ctx)
  * contains lport uuids, while in OVN_Southbound we store the lport names.
  */
 static void
-sync_port_groups(struct northd_context *ctx, struct hmap *pgs)
+sync_port_groups(struct northd_idl_context *ctx, struct hmap *pgs)
 {
     struct shash sb_port_groups = SHASH_INITIALIZER(&sb_port_groups);
 
@@ -13742,7 +13743,7 @@  done:
 }
 
 static void
-sync_meters_iterate_nb_meter(struct northd_context *ctx,
+sync_meters_iterate_nb_meter(struct northd_idl_context *ctx,
                              const char *meter_name,
                              const struct nbrec_meter *nb_meter,
                              struct shash *sb_meters,
@@ -13781,7 +13782,7 @@  sync_meters_iterate_nb_meter(struct northd_context *ctx,
 }
 
 static void
-sync_acl_fair_meter(struct northd_context *ctx, struct shash *meter_groups,
+sync_acl_fair_meter(struct northd_idl_context *ctx, struct shash *meter_groups,
                     const struct nbrec_acl *acl, struct shash *sb_meters,
                     struct sset *used_sb_meters)
 {
@@ -13804,7 +13805,7 @@  sync_acl_fair_meter(struct northd_context *ctx, struct shash *meter_groups,
  * a private copy of its meter in the SB table.
  */
 static void
-sync_meters(struct northd_context *ctx, struct shash *meter_groups)
+sync_meters(struct northd_idl_context *ctx, struct shash *meter_groups)
 {
     struct shash sb_meters = SHASH_INITIALIZER(&sb_meters);
     struct sset used_sb_meters = SSET_INITIALIZER(&used_sb_meters);
@@ -13876,7 +13877,7 @@  get_dns_info_from_hmap(struct hmap *dns_map, struct uuid *uuid)
 }
 
 static void
-sync_dns_entries(struct northd_context *ctx, struct hmap *datapaths)
+sync_dns_entries(struct northd_idl_context *ctx, struct hmap *datapaths)
 {
     struct hmap dns_map = HMAP_INITIALIZER(&dns_map);
     struct ovn_datapath *od;
@@ -13994,7 +13995,7 @@  destroy_datapaths_and_ports(struct hmap *datapaths, struct hmap *ports,
 }
 
 static void
-build_ip_mcast(struct northd_context *ctx, struct hmap *datapaths)
+build_ip_mcast(struct northd_idl_context *ctx, struct hmap *datapaths)
 {
     struct ovn_datapath *od;
 
@@ -14024,7 +14025,7 @@  build_ip_mcast(struct northd_context *ctx, struct hmap *datapaths)
 }
 
 static void
-build_mcast_groups(struct northd_context *ctx,
+build_mcast_groups(struct northd_idl_context *ctx,
                    struct hmap *datapaths, struct hmap *ports,
                    struct hmap *mcast_groups,
                    struct hmap *igmp_groups)
@@ -14199,7 +14200,7 @@  build_mcast_groups(struct northd_context *ctx,
 }
 
 static void
-build_meter_groups(struct northd_context *ctx,
+build_meter_groups(struct northd_idl_context *ctx,
                    struct shash *meter_groups)
 {
     const struct nbrec_meter *nb_meter;
@@ -14209,7 +14210,7 @@  build_meter_groups(struct northd_context *ctx,
 }
 
 static void
-ovnnb_db_run(struct northd_context *ctx,
+ovnnb_db_run(struct northd_idl_context *ctx,
              struct ovsdb_idl_index *sbrec_chassis_by_name,
              struct ovsdb_idl_loop *sb_loop,
              struct hmap *datapaths, struct hmap *ports,
@@ -14419,7 +14420,7 @@  struct ha_chassis_group_node {
 };
 
 static void
-update_sb_ha_group_ref_chassis(struct northd_context *ctx,
+update_sb_ha_group_ref_chassis(struct northd_idl_context *ctx,
                                struct shash *ha_ref_chassis_map)
 {
     struct hmap ha_ch_grps = HMAP_INITIALIZER(&ha_ch_grps);
@@ -14491,7 +14492,7 @@  update_sb_ha_group_ref_chassis(struct northd_context *ctx,
  *  - 'ref_chassis' of hagrp1.
  */
 static void
-build_ha_chassis_group_ref_chassis(struct northd_context *ctx,
+build_ha_chassis_group_ref_chassis(struct northd_idl_context *ctx,
                                    const struct sbrec_port_binding *sb,
                                    struct ovn_port *op,
                                    struct shash *ha_ref_chassis_map)
@@ -14532,7 +14533,7 @@  build_ha_chassis_group_ref_chassis(struct northd_context *ctx,
  * this column is not empty, it means we need to set the corresponding logical
  * port as 'up' in the northbound DB. */
 static void
-handle_port_binding_changes(struct northd_context *ctx, struct hmap *ports,
+handle_port_binding_changes(struct northd_idl_context *ctx, struct hmap *ports,
                             struct shash *ha_ref_chassis_map)
 {
     const struct sbrec_port_binding *sb;
@@ -14586,7 +14587,7 @@  handle_port_binding_changes(struct northd_context *ctx, struct hmap *ports,
 
 /* Updates the sb_cfg and hv_cfg columns in the northbound NB_Global table. */
 static void
-update_northbound_cfg(struct northd_context *ctx,
+update_northbound_cfg(struct northd_idl_context *ctx,
                       struct ovsdb_idl_loop *sb_loop,
                       int64_t loop_start_time)
 {
@@ -14638,7 +14639,7 @@  update_northbound_cfg(struct northd_context *ctx,
 
 /* Handle a fairly small set of changes in the southbound database. */
 static void
-ovnsb_db_run(struct northd_context *ctx,
+ovnsb_db_run(struct northd_idl_context *ctx,
              struct ovsdb_idl_loop *sb_loop,
              struct hmap *ports,
              int64_t loop_start_time)
@@ -14657,7 +14658,7 @@  ovnsb_db_run(struct northd_context *ctx,
 }
 
 void
-ovn_db_run(struct northd_context *ctx)
+ovn_db_run(struct northd_idl_context *ctx)
 {
     struct hmap datapaths, ports;
     struct ovs_list lr_list;
diff --git a/northd/northd.h b/northd/northd.h
index cb252310a10e..b742afd4b350 100644
--- a/northd/northd.h
+++ b/northd/northd.h
@@ -16,7 +16,7 @@ 
 
 #include "ovsdb-idl.h"
 
-struct northd_context {
+struct northd_idl_context {
     const char *ovnnb_db;
     const char *ovnsb_db;
     struct ovsdb_idl *ovnnb_idl;
@@ -33,6 +33,6 @@  struct northd_context {
     bool use_parallel_build;
 };
 
-void ovn_db_run(struct northd_context *ctx);
+void ovn_db_run(struct northd_idl_context *ctx);
 
 #endif /* NORTHD_H */
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 0c94afddb484..3a780cef6606 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -313,7 +313,7 @@  ovn_rbac_validate_perm(const struct sbrec_rbac_permission *perm)
 
 static void
 ovn_rbac_create_perm(struct rbac_perm_cfg *pcfg,
-                     struct northd_context *ctx,
+                     struct northd_idl_context *ctx,
                      const struct sbrec_rbac_role *rbac_role)
 {
     struct sbrec_rbac_permission *rbac_perm;
@@ -332,7 +332,7 @@  ovn_rbac_create_perm(struct rbac_perm_cfg *pcfg,
 }
 
 static void
-check_and_update_rbac(struct northd_context *ctx)
+check_and_update_rbac(struct northd_idl_context *ctx)
 {
     const struct sbrec_rbac_role *rbac_role = NULL;
     const struct sbrec_rbac_permission *perm_row, *perm_next;
@@ -369,7 +369,7 @@  check_and_update_rbac(struct northd_context *ctx)
 }
 
 static void
-check_and_add_supported_dhcp_opts_to_sb_db(struct northd_context *ctx)
+check_and_add_supported_dhcp_opts_to_sb_db(struct northd_idl_context *ctx)
 {
     struct hmap dhcp_opts_to_add = HMAP_INITIALIZER(&dhcp_opts_to_add);
     for (size_t i = 0; (i < sizeof(supported_dhcp_opts) /
@@ -407,7 +407,7 @@  check_and_add_supported_dhcp_opts_to_sb_db(struct northd_context *ctx)
 }
 
 static void
-check_and_add_supported_dhcpv6_opts_to_sb_db(struct northd_context *ctx)
+check_and_add_supported_dhcpv6_opts_to_sb_db(struct northd_idl_context *ctx)
 {
     struct hmap dhcpv6_opts_to_add = HMAP_INITIALIZER(&dhcpv6_opts_to_add);
     for (size_t i = 0; (i < sizeof(supported_dhcpv6_opts) /
@@ -993,7 +993,7 @@  main(int argc, char *argv[])
                 ovnsb_cond_seqno = new_ovnsb_cond_seqno;
             }
 
-            struct northd_context ctx = {
+            struct northd_idl_context ctx = {
                 .ovnnb_db = ovnnb_db,
                 .ovnsb_db = ovnsb_db,
                 .ovnnb_idl = ovnnb_idl_loop.idl,