Merge pull request #1358 from opensourcerouting/isis-lsp_tick-fixes

Isis lsp_tick fix and improve perfomance for processing LSP updates
This commit is contained in:
Donald Sharp 2017-10-25 09:19:06 -04:00 committed by GitHub
commit ef47f23b91
5 changed files with 12 additions and 25 deletions

View File

@ -676,7 +676,7 @@ int isis_circuit_up(struct isis_circuit *circuit)
circuit->lsp_queue = list_new(); circuit->lsp_queue = list_new();
circuit->lsp_hash = isis_lsp_hash_new(); circuit->lsp_hash = isis_lsp_hash_new();
monotime(&circuit->lsp_queue_last_cleared); circuit->lsp_queue_last_push = monotime(NULL);
return ISIS_OK; return ISIS_OK;
} }

View File

@ -84,7 +84,7 @@ struct isis_circuit {
struct thread *t_send_lsp; struct thread *t_send_lsp;
struct list *lsp_queue; /* LSPs to be txed (both levels) */ struct list *lsp_queue; /* LSPs to be txed (both levels) */
struct isis_lsp_hash *lsp_hash; /* Hashtable synchronized with lsp_queue */ struct isis_lsp_hash *lsp_hash; /* Hashtable synchronized with lsp_queue */
struct timeval lsp_queue_last_cleared; /* timestamp used to enforce transmit time_t lsp_queue_last_push; /* timestamp used to enforce transmit
* interval; * interval;
* for scalability, use one timestamp per * for scalability, use one timestamp per
* circuit, instead of one per lsp per * circuit, instead of one per lsp per

View File

@ -73,7 +73,7 @@
#define MAX_MIN_LSP_GEN_INTERVAL 120 /* RFC 4444 says 65535 */ #define MAX_MIN_LSP_GEN_INTERVAL 120 /* RFC 4444 says 65535 */
#define DEFAULT_MIN_LSP_GEN_INTERVAL 30 #define DEFAULT_MIN_LSP_GEN_INTERVAL 30
#define MIN_LSP_TRANS_INTERVAL 20000 /* Microseconds */ #define MIN_LSP_RETRANS_INTERVAL 5 /* Seconds */
#define MIN_CSNP_INTERVAL 1 #define MIN_CSNP_INTERVAL 1
#define MAX_CSNP_INTERVAL 600 #define MAX_CSNP_INTERVAL 600

View File

@ -454,17 +454,6 @@ void lsp_update(struct isis_lsp *lsp, struct isis_lsp_hdr *hdr,
struct isis_tlvs *tlvs, struct stream *stream, struct isis_tlvs *tlvs, struct stream *stream,
struct isis_area *area, int level, bool confusion) struct isis_area *area, int level, bool confusion)
{ {
dnode_t *dnode = NULL;
/* Remove old LSP from database. This is required since the
* lsp_update_data will free the lsp->pdu (which has the key, lsp_id)
* and will update it with the new data in the stream.
* XXX: This doesn't hold true anymore since the header is now a copy.
* keeping the LSP in the dict if it is already present should be possible */
dnode = dict_lookup(area->lspdb[level - 1], lsp->hdr.lsp_id);
if (dnode)
dnode_destroy(dict_delete(area->lspdb[level - 1], dnode));
if (lsp->own_lsp) { if (lsp->own_lsp) {
zlog_err( zlog_err(
"ISIS-Upd (%s): BUG updating LSP %s still marked as own LSP", "ISIS-Upd (%s): BUG updating LSP %s still marked as own LSP",
@ -490,8 +479,8 @@ void lsp_update(struct isis_lsp *lsp, struct isis_lsp_hdr *hdr,
lsp_link_fragment(lsp, lsp0); lsp_link_fragment(lsp, lsp0);
} }
/* insert the lsp back into the database */ if (lsp->hdr.seqno)
lsp_insert(lsp, area->lspdb[level - 1]); isis_spf_schedule(lsp->area, lsp->level);
} }
/* creation of LSP directly from what we received */ /* creation of LSP directly from what we received */
@ -1805,6 +1794,7 @@ int lsp_tick(struct thread *thread)
dnode_t *dnode, *dnode_next; dnode_t *dnode, *dnode_next;
int level; int level;
u_int16_t rem_lifetime; u_int16_t rem_lifetime;
time_t now = monotime(NULL);
lsp_list = list_new(); lsp_list = list_new();
@ -1883,12 +1873,13 @@ int lsp_tick(struct thread *thread)
if (!circuit->lsp_queue) if (!circuit->lsp_queue)
continue; continue;
if (monotime_since( if (now - circuit->lsp_queue_last_push
&circuit->lsp_queue_last_cleared, < MIN_LSP_RETRANS_INTERVAL) {
NULL) < MIN_LSP_TRANS_INTERVAL) {
continue; continue;
} }
circuit->lsp_queue_last_push = now;
for (ALL_LIST_ELEMENTS_RO( for (ALL_LIST_ELEMENTS_RO(
lsp_list, lspnode, lsp)) { lsp_list, lspnode, lsp)) {
if (circuit->upadjcount if (circuit->upadjcount

View File

@ -2059,12 +2059,8 @@ int send_lsp(struct thread *thread)
lsp = isis_circuit_lsp_queue_pop(circuit); lsp = isis_circuit_lsp_queue_pop(circuit);
if (!lsp) if (!lsp)
return ISIS_OK; return ISIS_OK;
/* Set the last-cleared time if the queue is empty. */
/* TODO: Is is possible that new lsps keep being added to the queue if (!list_isempty(circuit->lsp_queue)) {
* that the queue is never empty? */
if (list_isempty(circuit->lsp_queue)) {
monotime(&circuit->lsp_queue_last_cleared);
} else {
isis_circuit_schedule_lsp_send(circuit); isis_circuit_schedule_lsp_send(circuit);
} }