X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=isisd%2Fisis_tx_queue.c;h=507fd489bc621fb3e50bd9f73f1d39e665bf1c46;hb=f94ed830df98218447f00b97f856de811bfcc4a2;hp=fe67a3f4d19794b6c5d5871301d6f1b0efa87ce4;hpb=168012eb9d725ad10397ce563e76402464b65c50;p=mirror_frr.git diff --git a/isisd/isis_tx_queue.c b/isisd/isis_tx_queue.c index fe67a3f4d..507fd489b 100644 --- a/isisd/isis_tx_queue.c +++ b/isisd/isis_tx_queue.c @@ -27,30 +27,32 @@ #include "isisd/isisd.h" #include "isisd/isis_memory.h" #include "isisd/isis_flags.h" -#include "dict.h" #include "isisd/isis_circuit.h" #include "isisd/isis_lsp.h" +#include "isisd/isis_misc.h" #include "isisd/isis_tx_queue.h" DEFINE_MTYPE_STATIC(ISISD, TX_QUEUE, "ISIS TX Queue") DEFINE_MTYPE_STATIC(ISISD, TX_QUEUE_ENTRY, "ISIS TX Queue Entry") struct isis_tx_queue { - void *arg; - void (*send_event)(void *arg, struct isis_lsp *, enum isis_tx_type); + struct isis_circuit *circuit; + void (*send_event)(struct isis_circuit *circuit, + struct isis_lsp *, enum isis_tx_type); struct hash *hash; }; struct isis_tx_queue_entry { struct isis_lsp *lsp; enum isis_tx_type type; + bool is_retry; struct thread *retry; struct isis_tx_queue *queue; }; -static unsigned tx_queue_hash_key(void *p) +static unsigned tx_queue_hash_key(const void *p) { - struct isis_tx_queue_entry *e = p; + const struct isis_tx_queue_entry *e = p; uint32_t id_key = jhash(e->lsp->hdr.lsp_id, ISIS_SYS_ID_LEN + 2, 0x55aa5a5a); @@ -72,14 +74,15 @@ static bool tx_queue_hash_cmp(const void *a, const void *b) return true; } -struct isis_tx_queue *isis_tx_queue_new(void *arg, - void(*send_event)(void *arg, - struct isis_lsp *, - enum isis_tx_type)) +struct isis_tx_queue *isis_tx_queue_new( + struct isis_circuit *circuit, + void(*send_event)(struct isis_circuit *circuit, + struct isis_lsp *, + enum isis_tx_type)) { struct isis_tx_queue *rv = XCALLOC(MTYPE_TX_QUEUE, sizeof(*rv)); - rv->arg = arg; + rv->circuit = circuit; rv->send_event = send_event; rv->hash = hash_create(tx_queue_hash_key, tx_queue_hash_cmp, NULL); @@ -121,19 +124,35 @@ static int tx_queue_send_event(struct thread *thread) e->retry = NULL; thread_add_timer(master, tx_queue_send_event, e, 5, &e->retry); - queue->send_event(queue->arg, e->lsp, e->type); + if (e->is_retry) + queue->circuit->area->lsp_rxmt_count++; + else + e->is_retry = true; + + queue->send_event(queue->circuit, e->lsp, e->type); /* Don't access e here anymore, send_event might have destroyed it */ return 0; } -void isis_tx_queue_add(struct isis_tx_queue *queue, - struct isis_lsp *lsp, - enum isis_tx_type type) +void _isis_tx_queue_add(struct isis_tx_queue *queue, + struct isis_lsp *lsp, + enum isis_tx_type type, + const char *func, const char *file, + int line) { if (!queue) return; + if (isis->debugs & DEBUG_TX_QUEUE) { + zlog_debug("Add LSP %s to %s queue as %s LSP. (From %s %s:%d)", + rawlspid_print(lsp->hdr.lsp_id), + queue->circuit->interface->name, + (type == TX_LSP_CIRCUIT_SCOPED) ? + "circuit scoped" : "regular", + func, file, line); + } + struct isis_tx_queue_entry *e = tx_queue_find(queue, lsp); if (!e) { e = XCALLOC(MTYPE_TX_QUEUE_ENTRY, sizeof(*e)); @@ -150,9 +169,12 @@ void isis_tx_queue_add(struct isis_tx_queue *queue, if (e->retry) thread_cancel(e->retry); thread_add_event(master, tx_queue_send_event, e, 0, &e->retry); + + e->is_retry = false; } -void isis_tx_queue_del(struct isis_tx_queue *queue, struct isis_lsp *lsp) +void _isis_tx_queue_del(struct isis_tx_queue *queue, struct isis_lsp *lsp, + const char *func, const char *file, int line) { if (!queue) return; @@ -161,6 +183,13 @@ void isis_tx_queue_del(struct isis_tx_queue *queue, struct isis_lsp *lsp) if (!e) return; + if (isis->debugs & DEBUG_TX_QUEUE) { + zlog_debug("Remove LSP %s from %s queue. (From %s %s:%d)", + rawlspid_print(lsp->hdr.lsp_id), + queue->circuit->interface->name, + func, file, line); + } + if (e->retry) thread_cancel(e->retry);