Skip to content

Commit

Permalink
TESTING DO NOT UP
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldsharp committed May 15, 2024
1 parent 75b7746 commit 265b302
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
18 changes: 16 additions & 2 deletions bgpd/bgp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -1814,9 +1814,10 @@ static void bgp_handle_route_announcements_to_zebra(struct thread *e)

if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug(
"BGP %s route %pBD(%s) with dest %p and flags 0x%x to zebra",
"BGP %s route %pBD(%s) with dest %p and flags 0x%x to zebra delete is set: %d",
install ? "announcing" : "withdrawing", dest,
table->bgp->name_pretty, dest, dest->flags);
table->bgp->name_pretty, dest, dest->flags,
CHECK_FLAG(dest->flags, BGP_NODE_SCHEDULE_FOR_DELETE));

if (install) {
if (is_evpn)
Expand Down Expand Up @@ -1859,6 +1860,10 @@ static void bgp_handle_route_announcements_to_zebra(struct thread *e)
thread_add_event(bm->master,
bgp_handle_route_announcements_to_zebra, NULL,
0, &bm->t_bgp_zebra_route);

zlog_debug("BGP Buffered: %u count: %zu and event: %p",
status, zebra_announce_count(&bm->zebra_announce_head),
bm->t_bgp_zebra_route);
}

/*
Expand All @@ -1867,6 +1872,7 @@ static void bgp_handle_route_announcements_to_zebra(struct thread *e)
*/
static void bgp_zebra_buffer_write_ready(void)
{
zlog_debug("BGP bgp_zebra_buffer_write_read callback");
bgp_handle_route_announcements_to_zebra(NULL);
}

Expand Down Expand Up @@ -1931,9 +1937,16 @@ void bgp_zebra_route_install(struct bgp_dest *dest, struct bgp_path_info *info,
if (!bgp_install_info_to_zebra(bgp) && !is_evpn)
return;

// zlog_debug(
// "ZRI: %s route %pBD(%s) with dest %p and flags 0x%x to zebra",
// install ? "announcing" : "withdrawing", dest,
// table->bgp->name_pretty, dest, dest->flags);

if (!CHECK_FLAG(dest->flags, BGP_NODE_SCHEDULE_FOR_INSTALL) &&
!CHECK_FLAG(dest->flags, BGP_NODE_SCHEDULE_FOR_DELETE)) {
zebra_announce_add_tail(&bm->zebra_announce_head, dest);
// zlog_debug("ZRI: route %pBD(%s) is added to tail",
// dest, table->bgp->name_pretty);
/*
* If neither flag is set and za_bgp_pi is not set then it is a
* bug
Expand Down Expand Up @@ -1972,6 +1985,7 @@ void bgp_zebra_route_install(struct bgp_dest *dest, struct bgp_path_info *info,

thread_add_event(bm->master, bgp_handle_route_announcements_to_zebra,
NULL, 0, &bm->t_bgp_zebra_route);
zlog_debug("BGP t_bgp_zebra_route: %p", bm->t_bgp_zebra_route);
}

/* Withdraw all entries in a BGP instances RIB table from Zebra */
Expand Down
8 changes: 4 additions & 4 deletions tests/topotests/bgp_suppress_fib/r2/bgpd.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
debug bgp updates
debug bgp bestpath 40.0.0.0/8
debug bgp zebra
#debug bgp updates
#debug bgp bestpath 40.0.0.0/8
#debug bgp zebra
!
router bgp 2
no bgp ebgp-requires-policy
bgp suppress-fib-pending
neighbor 10.0.0.1 remote-as 1
neighbor 10.0.0.10 remote-as 3
address-family ipv4 uni
network 60.0.0.0/24
network 60.0.0.0/24
18 changes: 12 additions & 6 deletions zebra/zserv.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,11 @@ static void zserv_read(struct thread *thread)
memory_order_relaxed);
p2p_avail = p2p_orig - client_ibuf_fifo_cnt;

/*
* Do nothing if ibuf_fifo count has reached its max limit. Otherwise
* proceed and reschedule ourselves if there is space in the ibuf_fifo.
*/
zlog_debug("AAA p2p_orig: %u avail: %u", p2p_orig, p2p_avail);
/*
* Do nothing if ibuf_fifo count has reached its max limit. Otherwise
* proceed and reschedule ourselves if there is space in the ibuf_fifo.
*/
if (p2p_avail <= 0)
return;

Expand Down Expand Up @@ -454,6 +455,7 @@ static void zserv_read(struct thread *thread)
if (p2p < (uint32_t)p2p_avail) {
uint64_t time_now = monotime(NULL);

zlog_debug("AAA p2p: %u is less than p2p_avail: %u", p2p, (uint32_t)p2p_avail);
/* update session statistics */
frr_with_mutex (&client->stats_mtx) {
client->last_read_time = time_now;
Expand All @@ -471,11 +473,12 @@ static void zserv_read(struct thread *thread)
}

/* Schedule job to process those packets */
zlog_debug("AAA Tell master to process messages");
zserv_event(client, ZSERV_PROCESS_MESSAGES);
}

if (IS_ZEBRA_DEBUG_PACKET)
zlog_debug("Read %d packets from client: %s. Current ibuf fifo count: %zu. Conf P2p %d",
// if (IS_ZEBRA_DEBUG_PACKET)
zlog_debug("AAA Read %d packets from client: %s. Current ibuf fifo count: %zu. Conf P2p %d",
p2p_avail - p2p, zebra_route_string(client->proto),
client_ibuf_fifo_cnt, p2p_orig);

Expand Down Expand Up @@ -540,6 +543,7 @@ static void zserv_process_messages(struct thread *thread)
uint32_t p2p = zrouter.packets_to_process;
bool need_resched = false;

zlog_debug("AAA master processing messages");
frr_with_mutex (&client->ibuf_mtx) {
uint32_t i;
for (i = 0; i < p2p && stream_fifo_head(client->ibuf_fifo);
Expand Down Expand Up @@ -568,6 +572,7 @@ static void zserv_process_messages(struct thread *thread)
zserv_event(client, ZSERV_PROCESS_MESSAGES);

/* Ensure to include the read socket in the select/poll/etc.. */
zlog_debug("AAA zserv_process_messages CLIENT_READ");
zserv_client_event(client, ZSERV_CLIENT_READ);
}

Expand Down Expand Up @@ -816,6 +821,7 @@ static struct zserv *zserv_client_create(int sock)
"zebra_apic");

/* start read loop */
zlog_debug("AAA client_create setup read");
zserv_client_event(client, ZSERV_CLIENT_READ);

/* call callbacks */
Expand Down

0 comments on commit 265b302

Please sign in to comment.