From 22ef3fb3edf56b4c03f38a43200a4ac196da3dbc Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 10 Jan 2024 15:36:47 -0500 Subject: [PATCH 1/3] pimd: Send up to 10 NULL registers on vxlan startup When doing pim vxlan multicast bum handling, setup the register to send up to 10 null registers on immediate startup. If the null register packet gets dropped this delays the formation of the S,G tree from the RP towards the FHR. Signed-off-by: Donald Sharp --- pimd/pim_vxlan.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- pimd/pim_vxlan.h | 3 +++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 06bd39416774..f1f315cc9810 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -32,6 +32,30 @@ static void pim_vxlan_work_timer_setup(bool start); static void pim_vxlan_set_peerlink_rif(struct pim_instance *pim, struct interface *ifp); +#define PIM_VXLAN_STARTUP_NULL_REGISTERS 10 + +static void pim_vxlan_rp_send_null_register_startup(struct event *e) +{ + struct pim_vxlan_sg *vxlan_sg = EVENT_ARG(e); + + vxlan_sg->null_register_sent++; + + if (vxlan_sg->null_register_sent > PIM_VXLAN_STARTUP_NULL_REGISTERS) { + if (PIM_DEBUG_VXLAN) + zlog_debug("Null registering stopping for %s", + vxlan_sg->sg_str); + return; + } + + pim_null_register_send(vxlan_sg->up); + + if (PIM_DEBUG_VXLAN) + zlog_debug("Sent null register for %s", vxlan_sg->sg_str); + + event_add_timer(router->master, pim_vxlan_rp_send_null_register_startup, + vxlan_sg, PIM_VXLAN_WORK_TIME, &vxlan_sg->null_register); +} + /* * The rp info has gone from no path to having a * path. Let's immediately send out the null pim register @@ -61,8 +85,13 @@ void pim_vxlan_rp_info_is_alive(struct pim_instance *pim, * If the rp is the same we should send */ if (rpg == rpg_changed) { - zlog_debug("VXLAN RP INFO is alive sending"); - pim_null_register_send(vxlan_sg->up); + if (PIM_DEBUG_VXLAN) + zlog_debug("VXLAN RP info for %s alive sending", + vxlan_sg->sg_str); + vxlan_sg->null_register_sent = 0; + event_add_event(router->master, + pim_vxlan_rp_send_null_register_startup, + vxlan_sg, 0, &vxlan_sg->null_register); } } } @@ -201,8 +230,18 @@ void pim_vxlan_update_sg_reg_state(struct pim_instance *pim, */ if (reg_join) pim_vxlan_add_work(vxlan_sg); - else + else { + /* + * Stop the event that is sending NULL Registers on startup + * there is no need to keep spamming it + */ + if (PIM_DEBUG_VXLAN) + zlog_debug("Received Register stop for %s", + vxlan_sg->sg_str); + + EVENT_OFF(vxlan_sg->null_register); pim_vxlan_del_work(vxlan_sg); + } } static void pim_vxlan_work_timer_cb(struct event *t) @@ -804,6 +843,7 @@ static void pim_vxlan_sg_del_item(struct pim_vxlan_sg *vxlan_sg) { vxlan_sg->flags |= PIM_VXLAN_SGF_DEL_IN_PROG; + EVENT_OFF(vxlan_sg->null_register); pim_vxlan_del_work(vxlan_sg); if (pim_vxlan_is_orig_mroute(vxlan_sg)) diff --git a/pimd/pim_vxlan.h b/pimd/pim_vxlan.h index 5039bf654097..fe3d6254fab7 100644 --- a/pimd/pim_vxlan.h +++ b/pimd/pim_vxlan.h @@ -49,6 +49,9 @@ struct pim_vxlan_sg { struct interface *iif; /* on a MLAG setup the peerlink is added as a static OIF */ struct interface *orig_oif; + + struct event *null_register; + uint32_t null_register_sent; }; enum pim_vxlan_mlag_flags { From f80db3063dec169b2ee67994a166543996d40814 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 10 Jan 2024 15:58:45 -0500 Subject: [PATCH 2/3] pimd: Receiving a Join or Prune should be under J_P debugs The Join or Prune messages require you to turn on `trace` but this is part of Join/Prune processing of the packet let's use PIM_DEBUG_PIM_J_P instead of TRACE here. Signed-off-by: Donald Sharp --- pimd/pim_join.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pimd/pim_join.c b/pimd/pim_join.c index 671f7a37a5a3..bfdb0f06b410 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -43,7 +43,7 @@ static void recv_join(struct interface *ifp, struct pim_neighbor *neigh, { struct pim_interface *pim_ifp = NULL; - if (PIM_DEBUG_PIM_TRACE) + if (PIM_DEBUG_PIM_J_P) zlog_debug( "%s: join (S,G)=%pSG rpt=%d wc=%d upstream=%pPAs holdtime=%d from %pPA on %s", __func__, sg, !!(source_flags & PIM_RPT_BIT_MASK), @@ -115,7 +115,7 @@ static void recv_prune(struct interface *ifp, struct pim_neighbor *neigh, { struct pim_interface *pim_ifp = NULL; - if (PIM_DEBUG_PIM_TRACE) + if (PIM_DEBUG_PIM_J_P) zlog_debug( "%s: prune (S,G)=%pSG rpt=%d wc=%d upstream=%pPAs holdtime=%d from %pPA on %s", __func__, sg, source_flags & PIM_RPT_BIT_MASK, @@ -147,7 +147,7 @@ static void recv_prune(struct interface *ifp, struct pim_neighbor *neigh, * Received Prune(*,G) messages are processed even if the * RP in the message does not match RP(G). */ - if (PIM_DEBUG_PIM_TRACE) + if (PIM_DEBUG_PIM_J_P) zlog_debug("%s: Prune received with RP(%pPAs) for %pSG", __func__, &sg->src, sg); From 8e85c8b45ef4d48737e1e24ca32330850520373d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 10 Jan 2024 16:00:33 -0500 Subject: [PATCH 3/3] pimd: Make some not very needed debugs more restrictive When turning on debug pim trace, there are lots of messages surrounding the timing of rpf lookup. 99% of the time no-one cares about these anymore. Let's make them not seen unless we turn up debugs Signed-off-by: Donald Sharp --- pimd/pim_rp.c | 2 +- pimd/pim_rpf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index c7516242f5ca..d8d25712a30f 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -248,7 +248,7 @@ struct rp_info *pim_rp_find_match_group(struct pim_instance *pim, } rp_info = rn->info; - if (PIM_DEBUG_PIM_TRACE) { + if (PIM_DEBUG_PIM_TRACE_DETAIL) { if (best) zlog_debug( "Lookedup(%pFX): prefix_list match %s, rn %p found: %pFX", diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index b17ae3131f02..d18ec4943a94 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -32,7 +32,7 @@ static pim_addr pim_rpf_find_rpf_addr(struct pim_upstream *up); void pim_rpf_set_refresh_time(struct pim_instance *pim) { pim->last_route_change_time = pim_time_monotonic_usec(); - if (PIM_DEBUG_PIM_TRACE) + if (PIM_DEBUG_PIM_TRACE_DETAIL) zlog_debug("%s: vrf(%s) New last route change time: %" PRId64, __func__, pim->vrf->name, pim->last_route_change_time);