From f730ecef4f13a8c83f1529dfe6b46261da9ff11d Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 1 Nov 2023 18:25:40 +0100 Subject: [PATCH] Dumping route sources along with protocols and routes --- lib/route.h | 2 ++ nest/proto.c | 3 +++ nest/rt-attr.c | 24 ++++++++++++++++++++++++ nest/rt-table.c | 1 + 4 files changed, 30 insertions(+) diff --git a/lib/route.h b/lib/route.h index 0fc0d0b3..06772577 100644 --- a/lib/route.h +++ b/lib/route.h @@ -173,6 +173,8 @@ static inline void rt_unlock_source(struct rte_src *src) void rt_init_sources(struct rte_owner *, const char *name, event_list *list); void rt_destroy_sources(struct rte_owner *, event *); +void rt_dump_sources(struct rte_owner *); + /* * Route Attributes * diff --git a/nest/proto.c b/nest/proto.c index 414ce704..8b949c9c 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -2034,6 +2034,9 @@ protos_dump_all(void) c->out_req.hook ? rt_export_state_name(rt_export_get_state(c->out_req.hook)) : "-"); } + debug("\tSOURCES\n"); + rt_dump_sources(&p->sources); + if (p->proto->dump && (p->proto_state != PS_DOWN)) p->proto->dump(p); } diff --git a/nest/rt-attr.c b/nest/rt-attr.c index 2e703a0b..53111696 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -366,6 +366,30 @@ rt_prune_sources(void *data) RTA_UNLOCK; } +void +rt_dump_sources(struct rte_owner *o) +{ + debug("\t%s: hord=%u, uc=%u, cnt=%u prune=%p, stop=%p\n", + o->name, o->hash.order, o->uc, o->hash.count, o->prune, o->stop); + debug("\tget_route_info=%p, better=%p, mergable=%p, igp_metric=%p, recalculate=%p", + o->class->get_route_info, o->class->rte_better, o->class->rte_mergable, + o->class->rte_igp_metric, o->rte_recalculate); + + int splitting = 0; + HASH_WALK(o->hash, next, src) + { + debug("%c%c%uL %uG %luU", + (splitting % 8) ? ',' : '\n', + (splitting % 8) ? ' ' : '\t', + src->private_id, src->global_id, + atomic_load_explicit(&src->uc, memory_order_relaxed)); + + splitting++; + } + HASH_WALK_END; + debug("\n"); +} + void rt_init_sources(struct rte_owner *o, const char *name, event_list *list) { diff --git a/nest/rt-table.c b/nest/rt-table.c index e86397e4..0075bb7f 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -2502,6 +2502,7 @@ rte_dump(struct rte_storage *e) { debug("%-1N ", e->rte.net); debug("PF=%02x ", e->rte.pflags); + debug("SRC=%uG ", e->rte.src->global_id); ea_dump(e->rte.attrs); debug("\n"); }