pimd: Fix the number of SAs pushed into one MSDP SA-TLV

The entry_cnt in a SA TLV is one byte. I was trying to push 765 SAs into
each TLV resulting in strange problems in a scale setup.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
This commit is contained in:
anuradhak 2016-11-30 16:14:20 -08:00 committed by Donald Sharp
parent d52ff9b703
commit c024cfacea
2 changed files with 15 additions and 2 deletions

View File

@ -194,6 +194,7 @@ pim_msdp_write(struct thread *thread)
enum pim_msdp_tlv type;
int len;
int work_cnt = 0;
int work_max_cnt = 1;
mp = THREAD_ARG(thread);
mp->t_write = NULL;
@ -273,8 +274,11 @@ pim_msdp_write(struct thread *thread)
pim_msdp_pkt_delete(mp);
++work_cnt;
/* XXX - may need to pause if we have done too much work in this
/* may need to pause if we have done too much work in this
* loop */
if (work_cnt >= work_max_cnt) {
break;
}
} while ((s = stream_fifo_head(mp->obuf)) != NULL);
pim_msdp_write_proceed_actions(mp);
@ -380,6 +384,10 @@ pim_msdp_pkt_sa_gen(struct pim_msdp_peer *mp)
int local_cnt = msdp->local_cnt;
sa_count = 0;
if (PIM_DEBUG_MSDP_INTERNAL) {
zlog_debug(" sa gen %d", local_cnt);
}
local_cnt = pim_msdp_pkt_sa_fill_hdr(local_cnt);
for (ALL_LIST_ELEMENTS_RO(msdp->sa_list, sanode, sa)) {
@ -395,6 +403,9 @@ pim_msdp_pkt_sa_gen(struct pim_msdp_peer *mp)
pim_msdp_pkt_sa_push(mp);
/* reset headers */
sa_count = 0;
if (PIM_DEBUG_MSDP_INTERNAL) {
zlog_debug(" sa gen for remainder %d", local_cnt);
}
local_cnt = pim_msdp_pkt_sa_fill_hdr(local_cnt);
}
}

View File

@ -55,7 +55,9 @@
PIM_MSDP_SA_Y_SIZE(entry_cnt))
/* SA TLV has to have atleast only one entry in it so x=8 + y=12 */
#define PIM_MSDP_SA_TLV_MIN_SIZE PIM_MSDP_SA_ENTRY_CNT2SIZE(1)
#define PIM_MSDP_SA_MAX_ENTRY_CNT ((PIM_MSDP_SA_TLV_MAX_SIZE - PIM_MSDP_SA_X_SIZE)/PIM_MSDP_SA_ONE_ENTRY_SIZE)
/* XXX: theoretically we can fix a max of 255 but that may result in packet
* fragmentation */
#define PIM_MSDP_SA_MAX_ENTRY_CNT 120
#define PIM_MSDP_MAX_PACKET_SIZE max(PIM_MSDP_SA_TLV_MAX_SIZE, PIM_MSDP_KA_TLV_MAX_SIZE)