There is no need to hold data in separate bitmap and simap as all the zones that are already assigned are in the inc-engine sctructures.
Signed-off-by: Ales Musil <[email protected]> --- controller/ovn-controller.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 856e5e270..bc5605e6b 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -731,8 +731,6 @@ update_ct_zones(const struct sset *local_lports, const char *user; struct sset all_users = SSET_INITIALIZER(&all_users); struct simap req_snat_zones = SIMAP_INITIALIZER(&req_snat_zones); - unsigned long unreq_snat_zones_map[BITMAP_N_LONGS(MAX_CT_ZONES)]; - struct simap unreq_snat_zones = SIMAP_INITIALIZER(&unreq_snat_zones); const char *local_lport; SSET_FOR_EACH (local_lport, local_lports) { @@ -777,9 +775,6 @@ update_ct_zones(const struct sset *local_lports, bitmap_set0(ct_zone_bitmap, ct_zone->data); simap_delete(ct_zones, ct_zone); - } else if (!simap_find(&req_snat_zones, ct_zone->name)) { - bitmap_set1(unreq_snat_zones_map, ct_zone->data); - simap_put(&unreq_snat_zones, ct_zone->name, ct_zone->data); } } @@ -790,19 +785,13 @@ update_ct_zones(const struct sset *local_lports, * If so, then they need to give up their assignment since * that zone is being explicitly requested now. */ - if (bitmap_is_set(unreq_snat_zones_map, snat_req_node->data)) { - struct simap_node *unreq_node; - SIMAP_FOR_EACH_SAFE (unreq_node, &unreq_snat_zones) { - if (unreq_node->data == snat_req_node->data) { - simap_find_and_delete(ct_zones, unreq_node->name); - simap_delete(&unreq_snat_zones, unreq_node); + if (bitmap_is_set(ct_zone_bitmap, snat_req_node->data)) { + SIMAP_FOR_EACH_SAFE (ct_zone, ct_zones) { + if (ct_zone->data == snat_req_node->data && + strcmp(ct_zone->name, snat_req_node->name)) { + simap_delete(ct_zones, ct_zone); } } - - /* Set this bit to 0 so that if multiple datapaths have requested - * this zone, we don't needlessly double-detect this condition. - */ - bitmap_set0(unreq_snat_zones_map, snat_req_node->data); } struct simap_node *node = simap_find(ct_zones, snat_req_node->name); @@ -840,7 +829,6 @@ update_ct_zones(const struct sset *local_lports, } simap_destroy(&req_snat_zones); - simap_destroy(&unreq_snat_zones); sset_destroy(&all_users); } -- 2.43.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
