summaryrefslogtreecommitdiff
path: root/bgpd/rfapi
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-07-22 08:26:08 +0300
committerGitHub <noreply@github.com>2022-07-22 08:26:08 +0300
commiteed5b70f94b51c05bdbcebf39ade792213fd124b (patch)
tree82932e6c0215ec11400b2b9e7efd911d7880d285 /bgpd/rfapi
parentcb6c39645fae5211bd15b43a1b7879fb4c4b308c (diff)
parent2783a6921c8fd3917caa539df82e0d9f2a23eb0c (diff)
Merge pull request #11657 from donaldsharp/why_timer
convert thread_cancel to THREAD_OFF
Diffstat (limited to 'bgpd/rfapi')
-rw-r--r--bgpd/rfapi/rfapi_import.c57
-rw-r--r--bgpd/rfapi/rfapi_monitor.c12
-rw-r--r--bgpd/rfapi/rfapi_rib.c22
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c8
4 files changed, 47 insertions, 52 deletions
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 91b68b13d8..1d42702769 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -856,13 +856,11 @@ static void rfapiBgpInfoChainFree(struct bgp_path_info *bpi)
*/
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) {
-
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb =
+ THREAD_ARG(bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(bpi->extra->vnc.import.timer);
}
next = bpi->next;
@@ -2371,7 +2369,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
*/
static void rfapiWithdrawTimerVPN(struct thread *t)
{
- struct rfapi_withdraw *wcb = t->arg;
+ struct rfapi_withdraw *wcb = THREAD_ARG(t);
struct bgp_path_info *bpi = wcb->info;
struct bgp *bgp = bgp_get_default();
const struct prefix *p;
@@ -2672,7 +2670,7 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
static void rfapiWithdrawTimerEncap(struct thread *t)
{
- struct rfapi_withdraw *wcb = t->arg;
+ struct rfapi_withdraw *wcb = THREAD_ARG(t);
struct bgp_path_info *bpi = wcb->info;
int was_first_route = 0;
struct rfapi_monitor_encap *em;
@@ -3089,13 +3087,12 @@ static void rfapiBgpInfoFilteredImportEncap(
*/
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) {
-
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb = THREAD_ARG(
+ bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(
+ bpi->extra->vnc.import.timer);
}
if (action == FIF_ACTION_UPDATE) {
@@ -3182,12 +3179,11 @@ static void rfapiBgpInfoFilteredImportEncap(
"%s: removing holddown bpi matching NVE of new route",
__func__);
if (bpi->extra->vnc.import.timer) {
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb =
+ THREAD_ARG(bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(bpi->extra->vnc.import.timer);
}
rfapiExpireEncapNow(import_table, rn, bpi);
}
@@ -3543,13 +3539,12 @@ void rfapiBgpInfoFilteredImportVPN(
*/
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
&& bpi->extra->vnc.import.timer) {
-
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb = THREAD_ARG(
+ bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(
+ bpi->extra->vnc.import.timer);
import_table->holddown_count[afi] -= 1;
RFAPI_UPDATE_ITABLE_COUNT(
@@ -3762,12 +3757,11 @@ void rfapiBgpInfoFilteredImportVPN(
"%s: removing holddown bpi matching NVE of new route",
__func__);
if (bpi->extra->vnc.import.timer) {
- struct thread **t =
- &(bpi->extra->vnc.import.timer);
- struct rfapi_withdraw *wcb = (*t)->arg;
+ struct rfapi_withdraw *wcb =
+ THREAD_ARG(bpi->extra->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- thread_cancel(t);
+ THREAD_OFF(bpi->extra->vnc.import.timer);
}
rfapiExpireVpnNow(import_table, rn, bpi, 0);
}
@@ -4490,12 +4484,11 @@ static void rfapiDeleteRemotePrefixesIt(
if (!delete_holddown)
continue;
if (bpi->extra->vnc.import.timer) {
-
- struct thread **t =
- &(bpi->extra->vnc
- .import.timer);
struct rfapi_withdraw *wcb =
- (*t)->arg;
+ THREAD_ARG(
+ bpi->extra->vnc
+ .import
+ .timer);
wcb->import_table
->holddown_count[afi] -=
@@ -4505,7 +4498,9 @@ static void rfapiDeleteRemotePrefixesIt(
afi, 1);
XFREE(MTYPE_RFAPI_WITHDRAW,
wcb);
- thread_cancel(t);
+ THREAD_OFF(
+ bpi->extra->vnc.import
+ .timer);
}
} else {
if (!delete_active)
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index 8529676118..0e71d5d7e1 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -620,7 +620,7 @@ void rfapiMonitorDel(struct bgp *bgp, struct rfapi_descriptor *rfd,
rfapiMonitorDetachImport(m);
}
- thread_cancel(&m->timer);
+ THREAD_OFF(m->timer);
/*
* remove from rfd list
@@ -657,7 +657,7 @@ int rfapiMonitorDelHd(struct rfapi_descriptor *rfd)
rfapiMonitorDetachImport(m);
}
- thread_cancel(&m->timer);
+ THREAD_OFF(m->timer);
XFREE(MTYPE_RFAPI_MONITOR, m);
rn->info = NULL;
@@ -691,7 +691,7 @@ int rfapiMonitorDelHd(struct rfapi_descriptor *rfd)
#endif
}
- thread_cancel(&mon_eth->timer);
+ THREAD_OFF(mon_eth->timer);
/*
* remove from rfd list
@@ -733,7 +733,7 @@ void rfapiMonitorResponseRemovalOn(struct bgp *bgp)
static void rfapiMonitorTimerExpire(struct thread *t)
{
- struct rfapi_monitor_vpn *m = t->arg;
+ struct rfapi_monitor_vpn *m = THREAD_ARG(t);
/* forget reference to thread, it's gone */
m->timer = NULL;
@@ -1039,7 +1039,7 @@ void rfapiMonitorMovedUp(struct rfapi_import_table *import_table,
static void rfapiMonitorEthTimerExpire(struct thread *t)
{
- struct rfapi_monitor_eth *m = t->arg;
+ struct rfapi_monitor_eth *m = THREAD_ARG(t);
/* forget reference to thread, it's gone */
m->timer = NULL;
@@ -1400,7 +1400,7 @@ void rfapiMonitorEthDel(struct bgp *bgp, struct rfapi_descriptor *rfd,
rfapiMonitorEthDetachImport(bgp, val);
}
- thread_cancel(&val->timer);
+ THREAD_OFF(val->timer);
/*
* remove from rfd list
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index c4fc96f5ae..9d61ada7db 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -268,8 +268,8 @@ static void rfapi_info_free(struct rfapi_info *goner)
if (goner->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = goner->timer->arg;
- thread_cancel(&goner->timer);
+ tcb = THREAD_ARG(goner->timer);
+ THREAD_OFF(goner->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
}
XFREE(MTYPE_RFAPI_INFO, goner);
@@ -293,7 +293,7 @@ struct rfapi_rib_tcb {
*/
static void rfapiRibExpireTimer(struct thread *t)
{
- struct rfapi_rib_tcb *tcb = t->arg;
+ struct rfapi_rib_tcb *tcb = THREAD_ARG(t);
RFAPI_RIB_CHECK_COUNTS(1, 0);
@@ -338,8 +338,8 @@ static void rfapiRibStartTimer(struct rfapi_descriptor *rfd,
struct rfapi_rib_tcb *tcb = NULL;
if (ri->timer) {
- tcb = ri->timer->arg;
- thread_cancel(&ri->timer);
+ tcb = THREAD_ARG(ri->timer);
+ THREAD_OFF(ri->timer);
} else {
tcb = XCALLOC(MTYPE_RFAPI_RECENT_DELETE,
sizeof(struct rfapi_rib_tcb));
@@ -913,8 +913,8 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
if (ri->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = ri->timer->arg;
- thread_cancel(&ri->timer);
+ tcb = THREAD_ARG(ri->timer);
+ THREAD_OFF(ri->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
}
@@ -998,8 +998,8 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
if (ori->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = ori->timer->arg;
- thread_cancel(&ori->timer);
+ tcb = THREAD_ARG(ori->timer);
+ THREAD_OFF(ori->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
}
@@ -1342,8 +1342,8 @@ callback:
if (ri->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = ri->timer->arg;
- thread_cancel(&ri->timer);
+ tcb = THREAD_ARG(ri->timer);
+ THREAD_OFF(ri->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
}
RFAPI_RIB_CHECK_COUNTS(0, delete_list->count);
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index 2152a55ca3..05e45bc4c8 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -1712,7 +1712,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
* export expiration timer is already running on
* this route: cancel it
*/
- thread_cancel(&eti->timer);
+ THREAD_OFF(eti->timer);
bgp_update(peer, prefix, /* prefix */
0, /* addpath_id */
@@ -1726,7 +1726,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
static void vncExportWithdrawTimer(struct thread *t)
{
- struct vnc_export_info *eti = t->arg;
+ struct vnc_export_info *eti = THREAD_ARG(t);
const struct prefix *p = agg_node_get_prefix(eti->node);
/*
@@ -1943,7 +1943,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
* already running on
* this route: cancel it
*/
- thread_cancel(&eti->timer);
+ THREAD_OFF(eti->timer);
vnc_zlog_debug_verbose(
"%s: calling bgp_update",
@@ -2012,7 +2012,7 @@ void vnc_direct_bgp_rh_vpn_disable(struct bgp *bgp, afi_t afi)
ZEBRA_ROUTE_VNC_DIRECT_RH,
BGP_ROUTE_REDISTRIBUTE);
if (eti) {
- thread_cancel(&eti->timer);
+ THREAD_OFF(eti->timer);
vnc_eti_delete(eti);
}