summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-08-26 21:16:29 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-09-09 16:28:05 -0400
commit13ae845b94da86e1a7441c84e00bc97e01c048e5 (patch)
treee56f25bd925bb7ae96546d6aac73a636b3e5ef9e
parente79443fcd8f41b19e5c90732ae284ec82a5e97fe (diff)
bgpd: move t_gr_restart and _stale into peer_connection
The t_gr_restart and t_gr_stale event pointers belong into the peer_connection pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--bgpd/bgp_fsm.c22
-rw-r--r--bgpd/bgp_route.c6
-rw-r--r--bgpd/bgp_vty.c59
-rw-r--r--bgpd/bgpd.c8
-rw-r--r--bgpd/bgpd.h5
5 files changed, 54 insertions, 46 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index f1de97e179..9f19aec200 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -472,8 +472,8 @@ void bgp_timer_set(struct peer *peer)
}
break;
case Deleted:
- EVENT_OFF(peer->t_gr_restart);
- EVENT_OFF(peer->t_gr_stale);
+ EVENT_OFF(peer->connection->t_gr_restart);
+ EVENT_OFF(peer->connection->t_gr_stale);
FOREACH_AFI_SAFI (afi, safi)
EVENT_OFF(peer->t_llgr_stale[afi][safi]);
@@ -651,7 +651,7 @@ static void bgp_graceful_restart_timer_off(struct peer *peer)
return;
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
- EVENT_OFF(peer->t_gr_stale);
+ EVENT_OFF(peer->connection->t_gr_stale);
if (peer_dynamic_neighbor(peer) &&
!(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
@@ -1418,8 +1418,8 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
}
/* graceful restart */
- if (peer->t_gr_stale) {
- EVENT_OFF(peer->t_gr_stale);
+ if (connection->t_gr_stale) {
+ EVENT_OFF(connection->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP graceful restart stalepath timer stopped",
@@ -1434,10 +1434,10 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
"%pBP graceful restart stalepath timer started for %d sec",
peer, peer->bgp->stalepath_time);
}
- BGP_TIMER_ON(peer->t_gr_restart,
+ BGP_TIMER_ON(connection->t_gr_restart,
bgp_graceful_restart_timer_expire,
peer->v_gr_restart);
- BGP_TIMER_ON(peer->t_gr_stale,
+ BGP_TIMER_ON(connection->t_gr_stale,
bgp_graceful_stale_timer_expire,
peer->bgp->stalepath_time);
} else {
@@ -2271,8 +2271,8 @@ bgp_establish(struct peer_connection *connection)
SET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
else {
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
- if (peer->t_gr_stale) {
- EVENT_OFF(peer->t_gr_stale);
+ if (connection->t_gr_stale) {
+ EVENT_OFF(connection->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP graceful restart stalepath timer stopped",
@@ -2280,8 +2280,8 @@ bgp_establish(struct peer_connection *connection)
}
}
- if (peer->t_gr_restart) {
- EVENT_OFF(peer->t_gr_restart);
+ if (connection->t_gr_restart) {
+ EVENT_OFF(connection->t_gr_restart);
if (bgp_debug_neighbor_events(peer))
zlog_debug("%pBP graceful restart timer stopped", peer);
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index c8271bf5ce..849da5c97e 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -10982,10 +10982,10 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
str, label2vni(&attr->label));
}
- if (path->peer->t_gr_restart &&
+ if (path->peer->connection->t_gr_restart &&
CHECK_FLAG(path->flags, BGP_PATH_STALE)) {
- unsigned long gr_remaining =
- event_timer_remain_second(path->peer->t_gr_restart);
+ unsigned long gr_remaining = event_timer_remain_second(
+ path->peer->connection->t_gr_restart);
if (json_paths) {
json_object_int_add(json_path,
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 5268c8fc4b..1f6e58d787 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -12623,11 +12623,12 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
json_object_int_add(json_timer, "stalePathTimer",
peer->bgp->stalepath_time);
- if (peer->t_gr_stale != NULL) {
+ if (peer->connection->t_gr_stale != NULL) {
json_object_int_add(json_timer,
"stalePathTimerRemaining",
event_timer_remain_second(
- peer->t_gr_stale));
+ peer->connection
+ ->t_gr_stale));
}
/* Display Configured Selection
@@ -12657,11 +12658,11 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
" Configured Stale Path Time(sec): %u\n",
peer->bgp->stalepath_time);
- if (peer->t_gr_stale != NULL)
+ if (peer->connection->t_gr_stale != NULL)
vty_out(vty,
" Stale Path Remaining(sec): %ld\n",
event_timer_remain_second(
- peer->t_gr_stale));
+ peer->connection->t_gr_stale));
/* Display Configured Selection
* Deferral only when when
* Gr mode is enabled.
@@ -12706,10 +12707,10 @@ static void bgp_show_neighbor_graceful_restart_time(struct vty *vty,
json_object_int_add(json_timer, "receivedRestartTimer",
p->v_gr_restart);
- if (p->t_gr_restart != NULL)
- json_object_int_add(
- json_timer, "restartTimerRemaining",
- event_timer_remain_second(p->t_gr_restart));
+ if (p->connection->t_gr_restart != NULL)
+ json_object_int_add(json_timer, "restartTimerRemaining",
+ event_timer_remain_second(
+ p->connection->t_gr_restart));
json_object_object_add(json, "timers", json_timer);
} else {
@@ -12720,12 +12721,14 @@ static void bgp_show_neighbor_graceful_restart_time(struct vty *vty,
vty_out(vty, " Received Restart Time(sec): %u\n",
p->v_gr_restart);
- if (p->t_gr_restart != NULL)
+ if (p->connection->t_gr_restart != NULL)
vty_out(vty, " Restart Time Remaining(sec): %ld\n",
- event_timer_remain_second(p->t_gr_restart));
- if (p->t_gr_restart != NULL) {
+ event_timer_remain_second(
+ p->connection->t_gr_restart));
+ if (p->connection->t_gr_restart != NULL) {
vty_out(vty, " Restart Time Remaining(sec): %ld\n",
- event_timer_remain_second(p->t_gr_restart));
+ event_timer_remain_second(
+ p->connection->t_gr_restart));
}
}
}
@@ -14682,17 +14685,19 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
json_grace_recv);
- if (p->t_gr_restart)
- json_object_int_add(
- json_grace, "gracefulRestartTimerMsecs",
- event_timer_remain_second(p->t_gr_restart) *
- 1000);
+ if (p->connection->t_gr_restart)
+ json_object_int_add(json_grace,
+ "gracefulRestartTimerMsecs",
+ event_timer_remain_second(
+ p->connection->t_gr_restart) *
+ 1000);
- if (p->t_gr_stale)
- json_object_int_add(
- json_grace, "gracefulStalepathTimerMsecs",
- event_timer_remain_second(p->t_gr_stale) *
- 1000);
+ if (p->connection->t_gr_stale)
+ json_object_int_add(json_grace,
+ "gracefulStalepathTimerMsecs",
+ event_timer_remain_second(
+ p->connection->t_gr_stale) *
+ 1000);
/* more gr info in new format */
BGP_SHOW_PEER_GR_CAPABILITY(vty, p, json_grace);
json_object_object_add(json_neigh, "gracefulRestartInfo",
@@ -14729,15 +14734,17 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
vty_out(vty, "\n");
}
- if (p->t_gr_restart)
+ if (p->connection->t_gr_restart)
vty_out(vty,
" The remaining time of restart timer is %ld\n",
- event_timer_remain_second(p->t_gr_restart));
+ event_timer_remain_second(
+ p->connection->t_gr_restart));
- if (p->t_gr_stale)
+ if (p->connection->t_gr_stale)
vty_out(vty,
" The remaining time of stalepath timer is %ld\n",
- event_timer_remain_second(p->t_gr_stale));
+ event_timer_remain_second(
+ p->connection->t_gr_stale));
/* more gr info in new format */
BGP_SHOW_PEER_GR_CAPABILITY(vty, p, NULL);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 29ecab5dd4..8cdca56d4e 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2542,13 +2542,13 @@ void peer_nsf_stop(struct peer *peer)
EVENT_OFF(peer->t_llgr_stale[afi][safi]);
}
- if (peer->t_gr_restart) {
- EVENT_OFF(peer->t_gr_restart);
+ if (peer->connection->t_gr_restart) {
+ EVENT_OFF(peer->connection->t_gr_restart);
if (bgp_debug_neighbor_events(peer))
zlog_debug("%pBP graceful restart timer stopped", peer);
}
- if (peer->t_gr_stale) {
- EVENT_OFF(peer->t_gr_stale);
+ if (peer->connection->t_gr_stale) {
+ EVENT_OFF(peer->connection->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%pBP graceful restart stalepath timer stopped",
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 39266a499f..fdf1f121c3 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1146,6 +1146,9 @@ struct peer_connection {
struct event *t_connect_check_r;
struct event *t_connect_check_w;
+ struct event *t_gr_restart;
+ struct event *t_gr_stale;
+
struct event *t_routeadv;
struct event *t_process_packet;
struct event *t_process_packet_error;
@@ -1557,8 +1560,6 @@ struct peer {
/* Threads. */
struct event *t_pmax_restart;
- struct event *t_gr_restart;
- struct event *t_gr_stale;
struct event *t_llgr_stale[AFI_MAX][SAFI_MAX];
struct event *t_revalidate_all[AFI_MAX][SAFI_MAX];
struct event *t_generate_updgrp_packets;