diff options
author | Maria Matejka <mq@ucw.cz> | 2021-06-21 19:11:42 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2021-11-09 19:20:41 +0100 |
commit | c56752e4367733c03a05e65ba62ccd2e54f7aadd (patch) | |
tree | c55f7114ab24f2356e26a7af4b871956ab14bf1e /nest/proto.c | |
parent | 56c8f2f03a8631417dc3b730625c08ffca42ead2 (diff) |
Protocol stats split to import and export
Diffstat (limited to 'nest/proto.c')
-rw-r--r-- | nest/proto.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/nest/proto.c b/nest/proto.c index 7cfb1555..631e4b60 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -284,7 +284,7 @@ channel_feed_loop(void *ptr) if (c->refeeding && (l->state == PLS_BLOCKED) && (c->refeed_count <= l->limit) && - (c->stats.exp_routes <= l->limit)) + (c->export_stats.routes <= l->limit)) { log(L_INFO "Protocol %s resets route export limit (%u)", c->proto->name, l->limit); channel_reset_limit(&c->out_limit); @@ -461,7 +461,7 @@ channel_stop_export(struct channel *c) rt_feed_channel_abort(c); c->export_state = ES_DOWN; - c->stats.exp_routes = 0; + c->export_stats.routes = 0; bmap_reset(&c->export_map, 1024); } @@ -551,7 +551,8 @@ channel_do_start(struct channel *c) c->feed_event = ev_new_init(c->proto->pool, channel_feed_loop, c); bmap_init(&c->export_map, c->proto->pool, 1024); - memset(&c->stats, 0, sizeof(struct proto_stats)); + memset(&c->export_stats, 0, sizeof(struct export_stats)); + memset(&c->import_stats, 0, sizeof(struct import_stats)); channel_reset_limit(&c->rx_limit); channel_reset_limit(&c->in_limit); @@ -600,11 +601,12 @@ channel_do_down(struct channel *c) rt_unlock_table(c->table); c->proto->active_channels--; - if ((c->stats.imp_routes + c->stats.filt_routes) != 0) + if ((c->import_stats.routes + c->import_stats.filtered) != 0) log(L_ERR "%s: Channel %s is down but still has some routes", c->proto->name, c->name); // bmap_free(&c->export_map); - memset(&c->stats, 0, sizeof(struct proto_stats)); + memset(&c->import_stats, 0, sizeof(struct import_stats)); + memset(&c->export_stats, 0, sizeof(struct export_stats)); c->in_table = NULL; c->reload_event = NULL; @@ -1842,19 +1844,19 @@ static void channel_verify_limits(struct channel *c) { struct channel_limit *l; - u32 all_routes = c->stats.imp_routes + c->stats.filt_routes; + u32 all_routes = c->import_stats.routes + c->import_stats.filtered; l = &c->rx_limit; if (l->action && (all_routes > l->limit)) channel_notify_limit(c, l, PLD_RX, all_routes); l = &c->in_limit; - if (l->action && (c->stats.imp_routes > l->limit)) - channel_notify_limit(c, l, PLD_IN, c->stats.imp_routes); + if (l->action && (c->import_stats.routes > l->limit)) + channel_notify_limit(c, l, PLD_IN, c->import_stats.routes); l = &c->out_limit; - if (l->action && (c->stats.exp_routes > l->limit)) - channel_notify_limit(c, l, PLD_OUT, c->stats.exp_routes); + if (l->action && (c->export_stats.routes > l->limit)) + channel_notify_limit(c, l, PLD_OUT, c->export_stats.routes); } static inline void @@ -2009,28 +2011,29 @@ proto_state_name(struct proto *p) static void channel_show_stats(struct channel *c) { - struct proto_stats *s = &c->stats; + struct import_stats *is = &c->import_stats; + struct export_stats *es = &c->export_stats; if (c->in_keep_filtered) cli_msg(-1006, " Routes: %u imported, %u filtered, %u exported, %u preferred", - s->imp_routes, s->filt_routes, s->exp_routes, s->pref_routes); + is->routes, is->filtered, es->routes, is->pref); else cli_msg(-1006, " Routes: %u imported, %u exported, %u preferred", - s->imp_routes, s->exp_routes, s->pref_routes); + is->routes, es->routes, is->pref); cli_msg(-1006, " Route change stats: received rejected filtered ignored accepted"); cli_msg(-1006, " Import updates: %10u %10u %10u %10u %10u", - s->imp_updates_received, s->imp_updates_invalid, - s->imp_updates_filtered, s->imp_updates_ignored, - s->imp_updates_accepted); + is->updates_received, is->updates_invalid, + is->updates_filtered, is->updates_ignored, + is->updates_accepted); cli_msg(-1006, " Import withdraws: %10u %10u --- %10u %10u", - s->imp_withdraws_received, s->imp_withdraws_invalid, - s->imp_withdraws_ignored, s->imp_withdraws_accepted); + is->withdraws_received, is->withdraws_invalid, + is->withdraws_ignored, is->withdraws_accepted); cli_msg(-1006, " Export updates: %10u %10u %10u --- %10u", - s->exp_updates_received, s->exp_updates_rejected, - s->exp_updates_filtered, s->exp_updates_accepted); + es->updates_received, es->updates_rejected, + es->updates_filtered, es->updates_accepted); cli_msg(-1006, " Export withdraws: %10u --- --- --- %10u", - s->exp_withdraws_received, s->exp_withdraws_accepted); + es->withdraws_received, es->withdraws_accepted); } void |