log(L_TRACE "%s: " fmt, t->name, ##args); \
} while (0)
+#define req_trace(r, level, fmt, args...) do { \
+ if (r->trace_routes & (level)) \
+ log(L_TRACE "%s: " fmt, r->name, ##args); \
+} while (0)
+
+#define channel_trace(c, level, fmt, args...) do {\
+ if ((c->debug & (level)) || (c->proto->debug & (level))) \
+ log(L_TRACE "%s.%s: " fmt, c->proto->name, c->name, ##args);\
+} while (0)
+
static void
net_init_with_trie(struct fib *f, void *N)
{
{
if (new && old && rte_same(new, old))
{
+ channel_rte_trace_out(D_ROUTES, c, new, "already exported");
+
if ((new->id != old->id) && bmap_test(&c->export_map, old->id))
{
bmap_set(&c->export_map, new->id);
{
struct channel *c = SKIP_BACK(struct channel, out_req, req);
+ channel_trace(c, D_ROUTES, "Marking seen %p (%lu)", rpe, rpe->seq);
+
rpe_mark_seen(req->hook, rpe);
if (rpe->old)
bmap_clear(&c->export_reject_map, rpe->old->rte.id);
const rte *n = RTE_VALID_OR_NULL(first->new);
const rte *o = RTE_VALID_OR_NULL(first->old);
+ channel_trace(c, D_ROUTES,
+ "Notifying any, net %N, first %p (%lu), new %p, old %p",
+ net, first, first->seq, n, o);
+
if (!n && !o)
{
channel_rpe_mark_seen(req, first);
rte n0 = RTE_COPY_VALID(new_latest);
if (n0.src || o)
rt_notify_basic(c, net, n0.src ? &n0 : NULL, o);
+
+ channel_trace(c, D_ROUTES, "Notified net %N", net);
}
void
{
struct channel *c = SKIP_BACK(struct channel, out_req, req);
+ channel_trace(c, D_ROUTES, "Feeding any, net %N, first %p (%lu), %p (%lu), count %u",
+ net, first, first ? first->seq : 0, last ? last->seq : 0, count);
+
for (uint i=0; i<count; i++)
if (rte_is_valid(feed[i]))
{
if (rpe == last)
break;
}
+
+ channel_trace(c, D_ROUTES, "Fed %N", net);
}
void
.seq = tab->exporter.next_seq++,
};
- DBGL("rte_announce: table=%s net=%N new=%p id %u from %s old=%p id %u from %s new_best=%p id %u old_best=%p id %u seq=%lu",
- tab->name, net->n.addr,
+ rt_trace(tab, D_ROUTES, "Announcing %N, "
+ "new=%p id %u from %s, "
+ "old=%p id %u from %s, "
+ "new_best=%p id %u, "
+ "old_best=%p id %u seq=%lu",
+ net->n.addr,
new, new ? new->rte.id : 0, new ? new->rte.sender->req->name : NULL,
old, old ? old->rte.id : 0, old ? old->rte.sender->req->name : NULL,
- new_best, old_best, rpe->seq);
+ new_best, new_best ? new_best->rte.id : 0,
+ old_best, old_best ? old_best->rte.id : 0,
+ rpe->seq);
ASSERT_DIE(atomic_fetch_add_explicit(&rpeb->end, 1, memory_order_release) == end);
DBG("New export hook %p req %p in table %s uc=%u\n", hook, req, tab->name, tab->use_count);
struct rt_pending_export *rpe = rt_last_export(hook->table);
- DBG("store hook=%p last_export=%p seq=%lu\n", hook, rpe, rpe ? rpe->seq : 0);
+ req_trace(req, D_STATES, "Export initialized, last export %p (%lu)", rpe, rpe ? rpe->seq : 0);
atomic_store_explicit(&hook->last_export, rpe, memory_order_relaxed);
rt_init_export(re, req->hook);