Skip to content

Commit

Permalink
LSP disbursment architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
Purbayan2014 committed Feb 14, 2023
1 parent 06dcb9c commit 798b539
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
23 changes: 22 additions & 1 deletion Layer5/isis/isis_flood.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "isis_adjacency.h"
#include "isis_lspdb.h"
#include "isis_intf_group.h"
#include <stdio.h>

extern void
isis_parse_lsp_tlvs_internal(isis_lsp_pkt_t *new_lsp_pkt,
Expand Down Expand Up @@ -74,10 +75,14 @@ isis_lsp_xmit_job(void *arg, uint32_t arg_size) {
sprintf(tlb, "%s : lsp xmit job triggered\n", ISIS_LSPDB_MGMT);
tcp_trace(intf->att_node, intf, tlb);

/*sanity checks*/
if (!isis_node_intf_is_enable(intf)) return;

/* eligibility checks for the interface */
has_up_adjacency = isis_any_adjacency_up_on_interface(intf);


/* iteration over the pending lsp queue of the interface for flooding */
ITERATE_GLTHREAD_BEGIN(&intf_info->lsp_xmit_list_head, curr) {

lsp_xmit_elem = glue_to_lsp_xmit_elem(curr);
Expand Down Expand Up @@ -134,22 +139,31 @@ isis_queue_lsp_pkt_for_transmission(
isis_node_info_t *node_info;
isis_intf_info_t *intf_info;

/* sanity checks */
if (!isis_node_intf_is_enable(intf)) return;

if (!lsp_pkt->flood_eligibility) return;

intf_info = ISIS_INTF_INFO(intf);
node_info = ISIS_NODE_INFO(intf->att_node);

/* lsp_xmit_elem is used to queue up elements into the pending queue of the interfaces */
isis_lsp_xmit_elem_t *lsp_xmit_elem =

XCALLOC(0, 1, isis_lsp_xmit_elem_t);

/* lsp_xmit_elem serves as the glue */
init_glthread(&lsp_xmit_elem->glue);
lsp_xmit_elem->lsp_pkt = lsp_pkt;
isis_ref_isis_pkt(lsp_pkt);

sprintf(tlb, "%s : LSP %s sheduled to enter into %s\n",
ISIS_LSPDB_MGMT, isis_print_lsp_id(lsp_pkt),
intf->if_name);

/* adding element at the tail of the linked list */
glthread_add_last(&intf_info->lsp_xmit_list_head,
&lsp_xmit_elem->glue);
&lsp_xmit_elem->glue); /* lsp_xmit_elem getting added at the end of the linked list */

sprintf(tlb, "%s : LSP %s scheduled to flood out of %s\n",
ISIS_LSPDB_MGMT, isis_print_lsp_id(lsp_pkt),
Expand All @@ -159,10 +173,15 @@ isis_queue_lsp_pkt_for_transmission(
lsp_pkt->flood_queue_count++;
node_info->pending_lsp_flood_count++;

/* if job is not there then create a new one */
if (!intf_info->lsp_xmit_job) {

sprintf(tlb,"%s: No task was present for interface %s\n",
ISIS_LSPDB_MGMT, intf->if_name);
intf_info->lsp_xmit_job =
task_create_new_job(intf, isis_lsp_xmit_job, TASK_ONE_SHOT);
sprintf(tlb, "%s : New task has been enqueued for the interface %s\n",
ISIS_LSPDB_MGMT, intf->if_name);
}
}

Expand Down Expand Up @@ -213,10 +232,12 @@ isis_schedule_lsp_flood(node_t *node,

if (!lsp_pkt->flood_eligibility) return;

/* iterating over all the interfaces of the node */
ITERATE_NODE_INTERFACES_BEGIN(node, intf) {

if (!isis_node_intf_is_enable(intf)) continue;

/* if the interface is exempted */
if (intf == exempt_iif) {
sprintf(tlb, "%s : LSP %s flood skip out of intf %s, Reason :reciepient intf\n",
ISIS_LSPDB_MGMT, isis_print_lsp_id(lsp_pkt), intf->if_name);
Expand Down
4 changes: 3 additions & 1 deletion Layer5/isis/isis_flood.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ typedef struct isis_lsp_xmit_elem_ {
GLTHREAD_TO_STRUCT(glue_to_lsp_xmit_elem,
isis_lsp_xmit_elem_t, glue);

/* Disbursment API*/
void
isis_queue_lsp_pkt_for_transmission(
interface_t *intf,
Expand All @@ -27,9 +28,10 @@ isis_schedule_lsp_flood(node_t *node,
void
isis_lsp_pkt_flood_complete(node_t *node, isis_lsp_pkt_t *lsp_pkt);

/* Flooding API*/
void
isis_start_lsp_pkt_periodic_flooding(node_t *node);

/* Flooding API*/
void
isis_stop_lsp_pkt_periodic_flooding(node_t *node);

Expand Down
2 changes: 2 additions & 0 deletions Layer5/isis/isis_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ isis_generate_lsp_pkt(void *arg, uint32_t arg_size_unused) {
/* Now generate LSP pkt */
isis_create_fresh_lsp_pkt(node);
isis_install_lsp(node, 0, node_info->self_lsp_pkt);
sprintf(tlb, "%s : Self-LSP Genearation task %p that was triggered has been ended\n",
ISIS_LSPDB_MGMT, node_info->lsp_pkt_gen_task);
}

void
Expand Down

0 comments on commit 798b539

Please sign in to comment.