As it has been already done for logical routers, add logical switches datapath references in ovn_northd_lb data structure. This is a preliminary patch to invert the logic used during the lb flow creation in order to visit lb first and then related datapath.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianc...@redhat.com> --- lib/lb.c | 11 +++++++++++ lib/lb.h | 6 ++++++ northd/ovn-northd.c | 1 + 3 files changed, 18 insertions(+) diff --git a/lib/lb.c b/lib/lb.c index d24672b82..e8abdbb20 100644 --- a/lib/lb.c +++ b/lib/lb.c @@ -255,6 +255,16 @@ ovn_northd_lb_add_lr(struct ovn_northd_lb *lb, struct ovn_datapath *od) lb->nb_lr[lb->n_nb_lr++] = od; } +void +ovn_northd_lb_add_ls(struct ovn_northd_lb *lb, struct ovn_datapath *od) +{ + if (lb->n_allocated_nb_ls == lb->n_nb_ls) { + lb->nb_ls = x2nrealloc(lb->nb_ls, &lb->n_allocated_nb_ls, + sizeof *lb->nb_ls); + } + lb->nb_ls[lb->n_nb_ls++] = od; +} + void ovn_northd_lb_destroy(struct ovn_northd_lb *lb) { @@ -269,6 +279,7 @@ ovn_northd_lb_destroy(struct ovn_northd_lb *lb) free(lb->selection_fields); free(lb->dps); free(lb->nb_lr); + free(lb->nb_ls); free(lb); } diff --git a/lib/lb.h b/lib/lb.h index 4e8fd6604..06763a3f2 100644 --- a/lib/lb.h +++ b/lib/lb.h @@ -49,6 +49,10 @@ struct ovn_northd_lb { size_t n_nb_lr; size_t n_allocated_nb_lr; struct ovn_datapath **nb_lr; + + size_t n_nb_ls; + size_t n_allocated_nb_ls; + struct ovn_datapath **nb_ls; }; struct ovn_lb_vip { @@ -91,6 +95,8 @@ void ovn_northd_lb_add_datapath(struct ovn_northd_lb *, const struct sbrec_datapath_binding *); void ovn_northd_lb_add_lr(struct ovn_northd_lb *lb, struct ovn_datapath *od); +void +ovn_northd_lb_add_ls(struct ovn_northd_lb *lb, struct ovn_datapath *od); struct ovn_controller_lb { const struct sbrec_load_balancer *slb; /* May be NULL. */ diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index d1507d4b5..37a13c56c 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -3435,6 +3435,7 @@ build_ovn_lbs(struct northd_context *ctx, struct hmap *datapaths, lb = ovn_northd_lb_find(lbs, lb_uuid); ovn_northd_lb_add_datapath(lb, od->sb); + ovn_northd_lb_add_ls(lb, od); } } -- 2.31.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev