summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2018-08-30 19:48:05 +0200
committerMark Stapp <mjs@voltanet.io>2018-11-21 16:25:57 +0100
commitd8c16a951998b354ef3be124cc97eafef20c5ff0 (patch)
tree47d37862185290b27fe45ea2a6ff0cb557317e16 /zebra
parentMerge pull request #3339 from opensourcerouting/bugfix/isis-flooding-issues (diff)
downloadfrr-d8c16a951998b354ef3be124cc97eafef20c5ff0.tar.xz
frr-d8c16a951998b354ef3be124cc97eafef20c5ff0.zip
zebra: introduce dedicated dataplane pthread
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/main.c6
-rw-r--r--zebra/zebra_dplane.c29
2 files changed, 26 insertions, 9 deletions
diff --git a/zebra/main.c b/zebra/main.c
index 5628b5e02..20a2185b1 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -390,6 +390,9 @@ int main(int argc, char **argv)
vty_config_lockless();
zebrad.master = frr_init();
+ /* Initialize pthread library */
+ frr_pthread_init();
+
/* Zebra related initialize. */
zebra_router_init();
zserv_init();
@@ -445,9 +448,6 @@ int main(int argc, char **argv)
/* Needed for BSD routing socket. */
pid = getpid();
- /* Intialize pthread library */
- frr_pthread_init();
-
/* Start Zebra API server */
zserv_start(zserv_path);
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 3e61418b6..98db3ca7e 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -176,6 +176,9 @@ static struct zebra_dplane_globals {
_Atomic uint32_t dg_routes_queued_max;
_Atomic uint32_t dg_route_errors;
+ /* Dataplane pthread */
+ struct frr_pthread *dg_pthread;
+
/* Event-delivery context 'master' for the dplane */
struct thread_master *dg_master;
@@ -1004,13 +1007,23 @@ static void zebra_dplane_init_internal(struct zebra_t *zebra)
zdplane_info.dg_max_queued_updates = DPLANE_DEFAULT_MAX_QUEUED;
/* TODO -- register default kernel 'provider' during init */
+ zdplane_info.dg_run = true;
+
+ /* Start dataplane pthread */
zdplane_info.dg_run = true;
- /* TODO -- start dataplane pthread. We're using the zebra
- * core/main thread temporarily
- */
- zdplane_info.dg_master = zebra->master;
+ struct frr_pthread_attr pattr = {
+ .start = frr_pthread_attr_default.start,
+ .stop = frr_pthread_attr_default.stop
+ };
+
+ zdplane_info.dg_pthread = frr_pthread_new(&pattr, "Zebra dplane thread",
+ "Zebra dplane");
+
+ zdplane_info.dg_master = zdplane_info.dg_pthread->master;
+
+ frr_pthread_run(zdplane_info.dg_pthread, NULL);
}
/* Indicates zebra shutdown/exit is in progress. Some operations may be
@@ -1122,8 +1135,12 @@ void zebra_dplane_shutdown(void)
THREAD_OFF(zdplane_info.dg_t_update);
- /* TODO */
- /* frr_pthread_stop(...) */
+ frr_pthread_stop(zdplane_info.dg_pthread, NULL);
+
+ /* Destroy pthread */
+ frr_pthread_destroy(zdplane_info.dg_pthread);
+ zdplane_info.dg_pthread = NULL;
+ zdplane_info.dg_master = NULL;
/* Notify provider(s) of final shutdown */