From c1f7d66a477a1e7c3c7126407ce3ce76bc62ebe8 Mon Sep 17 00:00:00 2001 From: Igor Putovny Date: Wed, 27 Mar 2024 12:23:19 +0100 Subject: [PATCH] Remove debugging logs --- proto/aggregator/aggregator.c | 93 ----------------------------------- proto/aggregator/aggregator.h | 1 - 2 files changed, 94 deletions(-) diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index a1834ccc..d09bf4d1 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -65,24 +65,6 @@ extern linpool *rte_update_pool; -static void -dump_hash_table(const struct aggregator_proto *p) -{ - log("================ HASH TABLE DUMP ================"); - - HASH_WALK(p->buckets, next_hash, b) - { - for (const struct rte *rte = b->rte; rte; rte = rte->next) - { - struct net_addr *addr = rte->net->n.addr; - log("bucket %p: addr: %N,\troute: %p, net: %p, src: %p", b, addr, rte, rte->net, rte->src); - } - } - HASH_WALK_END; - - log("============== END HASH TABLE DUMP =============="); -} - static void aggregator_bucket_update(struct aggregator_proto *p, struct aggregator_bucket *bucket, struct network *net); static inline int @@ -436,27 +418,15 @@ bucket_sets_are_disjoint(const struct trie_node *left, const struct trie_node *r int res = aggregator_bucket_compare(left->potential_buckets[i], right->potential_buckets[j]); if (res == 0) - { - // log("left: %p, right: %p, res: %d, verdict: EQUAL", left->potential_buckets[i], right->potential_buckets[i], res); - // log("Buckets are NOT disjoint"); return 0; - } else if (res == -1) - { - // log("left: %p, right: %p, res: %d, verdict: LEFT < RIGHT", left->potential_buckets[i], right->potential_buckets[i], res); i++; - } else if (res == 1) - { - // log("left: %p, right: %p, res: %d, verdict: LEFT > RIGHT", left->potential_buckets[i], right->potential_buckets[i], res); j++; - } else bug("Impossible"); } - // log("Buckets are disjoint"); - // log("=========================================="); return 1; } @@ -726,8 +696,6 @@ print_prefixes(const struct trie_node *node, int type) static void create_route_ip4(struct aggregator_proto *p, const struct net_addr_ip4 *addr, struct aggregator_bucket *bucket) { - log("create route XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); - struct { struct network net; union net_addr_union u; @@ -754,8 +722,6 @@ create_route_ip6(struct aggregator_proto *p, struct net_addr_ip6 *addr, struct a static void collect_prefixes_helper_ip4(const struct trie_node *node, struct net_addr_ip4 *addr, struct aggregator_proto *p, int depth, int *count) { - log("collect prefixes XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); - assert(node != NULL); if (is_leaf(node)) @@ -856,25 +822,20 @@ calculate_trie(void *P) assert(p->addr_type == NET_IP4 || p->addr_type == NET_IP6); log("====PREFIXES BEFORE ===="); - log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); first_pass(p->root, p->trie_slab); log("====FIRST PASS===="); - log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); print_prefixes(p->root, p->addr_type); second_pass(p->root); log("====SECOND PASS===="); - log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); print_prefixes(p->root, p->addr_type); third_pass(p->root); log("====THIRD PASS===="); - log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); print_prefixes(p->root, p->addr_type); collect_prefixes(p); - log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); log("==== AGGREGATION DONE ===="); } @@ -966,8 +927,6 @@ same_val_list(const struct f_val *v1, const struct f_val *v2, uint len) static void aggregator_bucket_update(struct aggregator_proto *p, struct aggregator_bucket *bucket, struct network *net) { - log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); - /* Empty bucket */ if (!bucket->rte) { @@ -1009,9 +968,6 @@ aggregator_bucket_update(struct aggregator_proto *p, struct aggregator_bucket *b log("New route created: id = %d, protocol: %s", new->src->global_id, new->src->proto->name); log("==================================================="); - log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src); - - /* merge filter needs one argument called "routes" */ struct f_val val = { .type = T_ROUTES_BLOCK, @@ -1415,8 +1371,6 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new sl_free(old_route); } - dump_hash_table(p); - HASH_WALK(p->buckets, next_hash, bucket) { for (const struct rte *rte = bucket->rte; rte; rte = rte->next) @@ -1588,8 +1542,6 @@ aggregator_start(struct proto *P) arte->rte.net = default_net; default_net->routes = &arte->rte; - p->default_arte = arte; - HASH_INSERT2(p->routes, AGGR_RTE, p->p.pool, arte); HASH_INSERT2(p->buckets, AGGR_BUCK, p->p.pool, new_bucket); @@ -1604,61 +1556,16 @@ aggregator_shutdown(struct proto *P) { struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, P); - HASH_WALK(p->buckets, next_hash, b) - { - log(L_WARN "Buckets: %u %p", _i, b); - - for (struct rte *r = b->rte; r; r = r->next) - { - log(L_WARN " in bucket: %p", SKIP_BACK(struct aggregator_route, rte, r)); - } - } - HASH_WALK_END; - - HASH_WALK(p->routes, next_hash, r) - { - log(L_WARN "Routes: %u %p, net: %p, src: %p, hash: %x", _i, r, r->rte.net, r->rte.src, aggr_route_hash(&r->rte)); - } - HASH_WALK_END; - HASH_WALK_DELSAFE(p->buckets, next_hash, b) { while (b->rte) { - { - HASH_WALK(p->routes, next_hash, r) - { - log(L_WARN "%u %p", _i, r); - } - HASH_WALK_END; - } - - log("Hash table dump before"); - dump_hash_table(p); - struct aggregator_route *arte = SKIP_BACK(struct aggregator_route, rte, b->rte); - struct net_addr *addr = arte->rte.net->n.addr; - - log("Removing arte %p, rte: %p, addr: %N, net: %p, src: %p, hash: %x", - arte, &arte->rte, addr, arte->rte.net, arte->rte.src, aggr_route_hash(&arte->rte)); - - net_addr_union *n = (void *)arte->rte.net->n.addr; - log("Net type: %d", n->n.type); b->rte = arte->rte.next; b->count--; - int count_before_remove = p->routes.count; - - assert(n->n.type == NET_IP4); - log("Hash count before HASH_REMOVE: %d", count_before_remove); HASH_REMOVE(p->routes, AGGR_RTE, arte); - int count_after_remove = p->routes.count; - log("Hash count after HASH_REMOVE: %d", count_after_remove); - assert(count_before_remove == count_after_remove + 1); rta_free(arte->rte.attrs); sl_free(arte); - - log("Hash table dump after"); - dump_hash_table(p); } ASSERT_DIE(b->count == 0); diff --git a/proto/aggregator/aggregator.h b/proto/aggregator/aggregator.h index c92c4646..b28008a9 100644 --- a/proto/aggregator/aggregator.h +++ b/proto/aggregator/aggregator.h @@ -71,7 +71,6 @@ struct aggregator_proto { slab *trie_slab; struct trie_node *root; struct event reload_trie; - struct aggregator_route *default_arte; }; enum aggr_item_type {