]>
Commit | Line | Data |
---|---|---|
ea1c14f6 MS |
1 | /* |
2 | * Zebra dataplane layer api interfaces. | |
3 | * Copyright (c) 2018 Volta Networks, Inc. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, but | |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License along | |
16 | * with this program; see the file COPYING; if not, write to the Free Software | |
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | */ | |
19 | ||
20 | #ifndef _ZEBRA_DPLANE_H | |
21 | #define _ZEBRA_DPLANE_H 1 | |
22 | ||
7cdb1a84 MS |
23 | #include "lib/zebra.h" |
24 | #include "lib/prefix.h" | |
25 | #include "lib/nexthop.h" | |
26 | #include "lib/nexthop_group.h" | |
214fc2bd | 27 | #include "lib/queue.h" |
7cdb1a84 MS |
28 | #include "zebra/zebra_ns.h" |
29 | #include "zebra/rib.h" | |
30 | #include "zebra/zserv.h" | |
0f461727 | 31 | #include "zebra/zebra_mpls.h" |
ea1c14f6 | 32 | |
51e94aa7 EDP |
33 | #ifdef __cplusplus |
34 | extern "C" { | |
35 | #endif | |
36 | ||
85a75f1e MS |
37 | /* Key netlink info from zebra ns */ |
38 | struct zebra_dplane_info { | |
39 | ns_id_t ns_id; | |
40 | ||
41 | #if defined(HAVE_NETLINK) | |
7cdb1a84 | 42 | struct nlsock nls; |
85a75f1e MS |
43 | bool is_cmd; |
44 | #endif | |
45 | }; | |
46 | ||
47 | /* Utility to fill in zns info from main zns struct */ | |
48 | static inline void | |
49 | zebra_dplane_info_from_zns(struct zebra_dplane_info *zns_info, | |
50 | const struct zebra_ns *zns, bool is_cmd) | |
51 | { | |
52 | zns_info->ns_id = zns->ns_id; | |
53 | ||
54 | #if defined(HAVE_NETLINK) | |
55 | zns_info->is_cmd = is_cmd; | |
56 | if (is_cmd) { | |
7cdb1a84 | 57 | zns_info->nls = zns->netlink_cmd; |
85a75f1e | 58 | } else { |
7cdb1a84 | 59 | zns_info->nls = zns->netlink; |
85a75f1e MS |
60 | } |
61 | #endif /* NETLINK */ | |
62 | } | |
63 | ||
ea1c14f6 MS |
64 | /* |
65 | * Result codes used when returning status back to the main zebra context. | |
66 | */ | |
67 | ||
68 | /* | |
69 | * Philosophy Note: | |
70 | * | |
71 | * Flags being SET/UNSET do not belong in the South Bound | |
72 | * Interface. This Setting belongs at the calling level | |
73 | * because we can and will have multiple different interfaces | |
74 | * and we will have potentially multiple different | |
75 | * modules/filters to call. As such Setting/Unsetting | |
76 | * success failure should be handled by the caller. | |
77 | */ | |
78 | enum zebra_dplane_status { | |
79 | ZEBRA_DPLANE_STATUS_NONE = 0, | |
80 | ZEBRA_DPLANE_INSTALL_SUCCESS, | |
81 | ZEBRA_DPLANE_INSTALL_FAILURE, | |
82 | ZEBRA_DPLANE_DELETE_SUCCESS, | |
83 | ZEBRA_DPLANE_DELETE_FAILURE, | |
84 | ||
85 | }; | |
86 | ||
87 | enum zebra_dplane_result { | |
88 | ZEBRA_DPLANE_REQUEST_QUEUED, | |
89 | ZEBRA_DPLANE_REQUEST_SUCCESS, | |
90 | ZEBRA_DPLANE_REQUEST_FAILURE, | |
91 | }; | |
92 | ||
7cdb1a84 MS |
93 | /* |
94 | * API between the zebra dataplane system and the main zebra processing | |
95 | * context. | |
96 | */ | |
97 | ||
98 | /* | |
99 | * Enqueue a route install or update for the dataplane. | |
100 | */ | |
5709131c | 101 | enum dplane_op_e { |
7cdb1a84 MS |
102 | DPLANE_OP_NONE = 0, |
103 | ||
104 | /* Route update */ | |
105 | DPLANE_OP_ROUTE_INSTALL, | |
106 | DPLANE_OP_ROUTE_UPDATE, | |
107 | DPLANE_OP_ROUTE_DELETE, | |
54818e3b | 108 | DPLANE_OP_ROUTE_NOTIFY, |
7cdb1a84 | 109 | |
16c628de MS |
110 | /* LSP update */ |
111 | DPLANE_OP_LSP_INSTALL, | |
112 | DPLANE_OP_LSP_UPDATE, | |
97d8d05a MS |
113 | DPLANE_OP_LSP_DELETE, |
114 | ||
115 | /* Pseudowire update */ | |
116 | DPLANE_OP_PW_INSTALL, | |
117 | DPLANE_OP_PW_UNINSTALL, | |
cf363e1b MS |
118 | |
119 | /* System route notification */ | |
120 | DPLANE_OP_SYS_ROUTE_ADD, | |
121 | DPLANE_OP_SYS_ROUTE_DELETE, | |
a4a4802a MS |
122 | |
123 | /* Interface address update */ | |
124 | DPLANE_OP_ADDR_INSTALL, | |
125 | DPLANE_OP_ADDR_UNINSTALL, | |
5709131c | 126 | }; |
7cdb1a84 | 127 | |
cf363e1b MS |
128 | /* Enable system route notifications */ |
129 | void dplane_enable_sys_route_notifs(void); | |
130 | ||
7cdb1a84 | 131 | /* |
25779064 | 132 | * The dataplane context struct is used to exchange info between the main zebra |
7cdb1a84 MS |
133 | * context and the dataplane module(s). If these are two independent pthreads, |
134 | * they cannot share existing global data structures safely. | |
135 | */ | |
7cdb1a84 MS |
136 | |
137 | /* Define a tailq list type for context blocks. The list is exposed/public, | |
138 | * but the internal linkage in the context struct is private, so there | |
139 | * are accessor apis that support enqueue and dequeue. | |
140 | */ | |
25779064 | 141 | TAILQ_HEAD(dplane_ctx_q, zebra_dplane_ctx); |
7cdb1a84 | 142 | |
7cdb1a84 MS |
143 | /* Return a dataplane results context block after use; the caller's pointer will |
144 | * be cleared. | |
145 | */ | |
25779064 | 146 | void dplane_ctx_fini(struct zebra_dplane_ctx **pctx); |
7cdb1a84 | 147 | |
14b0bc8e | 148 | /* Enqueue a context block to caller's tailq. This exists so that the |
7cdb1a84 MS |
149 | * context struct can remain opaque. |
150 | */ | |
25779064 MS |
151 | void dplane_ctx_enqueue_tail(struct dplane_ctx_q *q, |
152 | const struct zebra_dplane_ctx *ctx); | |
7cdb1a84 | 153 | |
c831033f MS |
154 | /* Append a list of context blocks to another list - again, just keeping |
155 | * the context struct opaque. | |
156 | */ | |
157 | void dplane_ctx_list_append(struct dplane_ctx_q *to_list, | |
158 | struct dplane_ctx_q *from_list); | |
159 | ||
7cdb1a84 | 160 | /* Dequeue a context block from the head of caller's tailq */ |
68b375e0 | 161 | struct zebra_dplane_ctx *dplane_ctx_dequeue(struct dplane_ctx_q *q); |
7cdb1a84 MS |
162 | |
163 | /* | |
164 | * Accessors for information from the context object | |
165 | */ | |
25779064 MS |
166 | enum zebra_dplane_result dplane_ctx_get_status( |
167 | const struct zebra_dplane_ctx *ctx); | |
c831033f MS |
168 | void dplane_ctx_set_status(struct zebra_dplane_ctx *ctx, |
169 | enum zebra_dplane_result status); | |
f183e380 | 170 | const char *dplane_res2str(enum zebra_dplane_result res); |
7cdb1a84 | 171 | |
25779064 | 172 | enum dplane_op_e dplane_ctx_get_op(const struct zebra_dplane_ctx *ctx); |
5709131c | 173 | const char *dplane_op2str(enum dplane_op_e op); |
7cdb1a84 | 174 | |
25779064 | 175 | const struct prefix *dplane_ctx_get_dest(const struct zebra_dplane_ctx *ctx); |
7cdb1a84 | 176 | |
c831033f MS |
177 | /* Retrieve last/current provider id */ |
178 | uint32_t dplane_ctx_get_provider(const struct zebra_dplane_ctx *ctx); | |
179 | ||
180 | /* Providers running before the kernel can control whether a kernel | |
181 | * update should be done. | |
182 | */ | |
183 | void dplane_ctx_set_skip_kernel(struct zebra_dplane_ctx *ctx); | |
184 | bool dplane_ctx_is_skip_kernel(const struct zebra_dplane_ctx *ctx); | |
185 | ||
5709131c MS |
186 | /* Source prefix is a little special - use convention to return NULL |
187 | * to mean "no src prefix" | |
7cdb1a84 | 188 | */ |
25779064 MS |
189 | const struct prefix *dplane_ctx_get_src(const struct zebra_dplane_ctx *ctx); |
190 | ||
191 | bool dplane_ctx_is_update(const struct zebra_dplane_ctx *ctx); | |
192 | uint32_t dplane_ctx_get_seq(const struct zebra_dplane_ctx *ctx); | |
193 | uint32_t dplane_ctx_get_old_seq(const struct zebra_dplane_ctx *ctx); | |
194 | vrf_id_t dplane_ctx_get_vrf(const struct zebra_dplane_ctx *ctx); | |
0f461727 MS |
195 | |
196 | /* Accessors for route update information */ | |
25779064 MS |
197 | int dplane_ctx_get_type(const struct zebra_dplane_ctx *ctx); |
198 | int dplane_ctx_get_old_type(const struct zebra_dplane_ctx *ctx); | |
199 | afi_t dplane_ctx_get_afi(const struct zebra_dplane_ctx *ctx); | |
200 | safi_t dplane_ctx_get_safi(const struct zebra_dplane_ctx *ctx); | |
201 | uint32_t dplane_ctx_get_table(const struct zebra_dplane_ctx *ctx); | |
202 | route_tag_t dplane_ctx_get_tag(const struct zebra_dplane_ctx *ctx); | |
203 | route_tag_t dplane_ctx_get_old_tag(const struct zebra_dplane_ctx *ctx); | |
204 | uint16_t dplane_ctx_get_instance(const struct zebra_dplane_ctx *ctx); | |
205 | uint16_t dplane_ctx_get_old_instance(const struct zebra_dplane_ctx *ctx); | |
206 | uint32_t dplane_ctx_get_metric(const struct zebra_dplane_ctx *ctx); | |
207 | uint32_t dplane_ctx_get_old_metric(const struct zebra_dplane_ctx *ctx); | |
208 | uint32_t dplane_ctx_get_mtu(const struct zebra_dplane_ctx *ctx); | |
209 | uint32_t dplane_ctx_get_nh_mtu(const struct zebra_dplane_ctx *ctx); | |
210 | uint8_t dplane_ctx_get_distance(const struct zebra_dplane_ctx *ctx); | |
211 | uint8_t dplane_ctx_get_old_distance(const struct zebra_dplane_ctx *ctx); | |
212 | ||
213 | const struct nexthop_group *dplane_ctx_get_ng( | |
214 | const struct zebra_dplane_ctx *ctx); | |
215 | const struct nexthop_group *dplane_ctx_get_old_ng( | |
216 | const struct zebra_dplane_ctx *ctx); | |
217 | ||
0f461727 MS |
218 | /* Accessors for LSP information */ |
219 | mpls_label_t dplane_ctx_get_in_label(const struct zebra_dplane_ctx *ctx); | |
220 | uint8_t dplane_ctx_get_addr_family(const struct zebra_dplane_ctx *ctx); | |
221 | uint32_t dplane_ctx_get_lsp_flags(const struct zebra_dplane_ctx *ctx); | |
81793ac1 MS |
222 | const zebra_nhlfe_t *dplane_ctx_get_nhlfe(const struct zebra_dplane_ctx *ctx); |
223 | const zebra_nhlfe_t *dplane_ctx_get_best_nhlfe( | |
224 | const struct zebra_dplane_ctx *ctx); | |
0f461727 MS |
225 | uint32_t dplane_ctx_get_lsp_num_ecmp(const struct zebra_dplane_ctx *ctx); |
226 | ||
d613b8e1 MS |
227 | /* Accessors for pseudowire information */ |
228 | const char *dplane_ctx_get_pw_ifname(const struct zebra_dplane_ctx *ctx); | |
229 | mpls_label_t dplane_ctx_get_pw_local_label(const struct zebra_dplane_ctx *ctx); | |
230 | mpls_label_t dplane_ctx_get_pw_remote_label(const struct zebra_dplane_ctx *ctx); | |
231 | int dplane_ctx_get_pw_type(const struct zebra_dplane_ctx *ctx); | |
232 | int dplane_ctx_get_pw_af(const struct zebra_dplane_ctx *ctx); | |
233 | uint32_t dplane_ctx_get_pw_flags(const struct zebra_dplane_ctx *ctx); | |
234 | int dplane_ctx_get_pw_status(const struct zebra_dplane_ctx *ctx); | |
16d69787 | 235 | const union g_addr *dplane_ctx_get_pw_dest( |
d613b8e1 MS |
236 | const struct zebra_dplane_ctx *ctx); |
237 | const union pw_protocol_fields *dplane_ctx_get_pw_proto( | |
238 | const struct zebra_dplane_ctx *ctx); | |
09cd307c MS |
239 | const struct nexthop_group *dplane_ctx_get_pw_nhg( |
240 | const struct zebra_dplane_ctx *ctx); | |
d613b8e1 | 241 | |
a4a4802a MS |
242 | /* Accessors for interface information */ |
243 | const char *dplane_ctx_get_ifname(const struct zebra_dplane_ctx *ctx); | |
244 | ifindex_t dplane_ctx_get_ifindex(const struct zebra_dplane_ctx *ctx); | |
245 | uint32_t dplane_ctx_get_intf_metric(const struct zebra_dplane_ctx *ctx); | |
246 | /* Is interface addr p2p? */ | |
247 | bool dplane_ctx_intf_is_connected(const struct zebra_dplane_ctx *ctx); | |
248 | bool dplane_ctx_intf_is_secondary(const struct zebra_dplane_ctx *ctx); | |
990b0d09 | 249 | bool dplane_ctx_intf_is_broadcast(const struct zebra_dplane_ctx *ctx); |
a4a4802a MS |
250 | const struct prefix *dplane_ctx_get_intf_addr( |
251 | const struct zebra_dplane_ctx *ctx); | |
252 | bool dplane_ctx_intf_has_dest(const struct zebra_dplane_ctx *ctx); | |
253 | const struct prefix *dplane_ctx_get_intf_dest( | |
254 | const struct zebra_dplane_ctx *ctx); | |
255 | bool dplane_ctx_intf_has_label(const struct zebra_dplane_ctx *ctx); | |
256 | const char *dplane_ctx_get_intf_label(const struct zebra_dplane_ctx *ctx); | |
257 | ||
0f461727 | 258 | /* Namespace info - esp. for netlink communication */ |
25779064 MS |
259 | const struct zebra_dplane_info *dplane_ctx_get_ns( |
260 | const struct zebra_dplane_ctx *ctx); | |
7cdb1a84 | 261 | |
4dfd7a02 MS |
262 | /* Indicates zebra shutdown/exit is in progress. Some operations may be |
263 | * simplified or skipped during shutdown processing. | |
264 | */ | |
265 | bool dplane_is_in_shutdown(void); | |
266 | ||
7cdb1a84 MS |
267 | /* |
268 | * Enqueue route change operations for the dataplane. | |
269 | */ | |
655d681a MS |
270 | enum zebra_dplane_result dplane_route_add(struct route_node *rn, |
271 | struct route_entry *re); | |
7cdb1a84 | 272 | |
655d681a MS |
273 | enum zebra_dplane_result dplane_route_update(struct route_node *rn, |
274 | struct route_entry *re, | |
275 | struct route_entry *old_re); | |
7cdb1a84 | 276 | |
655d681a MS |
277 | enum zebra_dplane_result dplane_route_delete(struct route_node *rn, |
278 | struct route_entry *re); | |
7cdb1a84 | 279 | |
cf363e1b MS |
280 | /* Notify the dplane when system/connected routes change */ |
281 | enum zebra_dplane_result dplane_sys_route_add(struct route_node *rn, | |
282 | struct route_entry *re); | |
283 | enum zebra_dplane_result dplane_sys_route_del(struct route_node *rn, | |
284 | struct route_entry *re); | |
285 | ||
16c628de MS |
286 | /* |
287 | * Enqueue LSP change operations for the dataplane. | |
288 | */ | |
289 | enum zebra_dplane_result dplane_lsp_add(zebra_lsp_t *lsp); | |
290 | enum zebra_dplane_result dplane_lsp_update(zebra_lsp_t *lsp); | |
291 | enum zebra_dplane_result dplane_lsp_delete(zebra_lsp_t *lsp); | |
292 | ||
97d8d05a MS |
293 | /* |
294 | * Enqueue pseudowire operations for the dataplane. | |
295 | */ | |
296 | enum zebra_dplane_result dplane_pw_install(struct zebra_pw *pw); | |
297 | enum zebra_dplane_result dplane_pw_uninstall(struct zebra_pw *pw); | |
298 | ||
a4a4802a MS |
299 | /* |
300 | * Enqueue interface address changes for the dataplane. | |
301 | */ | |
302 | enum zebra_dplane_result dplane_intf_addr_set(const struct interface *ifp, | |
303 | const struct connected *ifc); | |
304 | enum zebra_dplane_result dplane_intf_addr_unset(const struct interface *ifp, | |
305 | const struct connected *ifc); | |
306 | ||
307 | ||
91f16812 MS |
308 | /* Retrieve the limit on the number of pending, unprocessed updates. */ |
309 | uint32_t dplane_get_in_queue_limit(void); | |
310 | ||
311 | /* Configure limit on the number of pending, queued updates. If 'unset', reset | |
312 | * to default value. | |
313 | */ | |
314 | void dplane_set_in_queue_limit(uint32_t limit, bool set); | |
315 | ||
316 | /* Retrieve the current queue depth of incoming, unprocessed updates */ | |
317 | uint32_t dplane_get_in_queue_len(void); | |
318 | ||
1d11b21f MS |
319 | /* |
320 | * Vty/cli apis | |
321 | */ | |
322 | int dplane_show_helper(struct vty *vty, bool detailed); | |
323 | int dplane_show_provs_helper(struct vty *vty, bool detailed); | |
324 | ||
325 | ||
326 | /* | |
c831033f | 327 | * Dataplane providers: modules that process or consume dataplane events. |
1d11b21f MS |
328 | */ |
329 | ||
c831033f MS |
330 | struct zebra_dplane_provider; |
331 | ||
fe2c53d4 | 332 | /* Support string name for a dataplane provider */ |
7cdb1a84 MS |
333 | #define DPLANE_PROVIDER_NAMELEN 64 |
334 | ||
335 | /* Priority or ordering values for providers. The idea is that there may be | |
336 | * some pre-processing, followed by an external or remote dataplane, | |
337 | * followed by the kernel, followed by some post-processing step (such as | |
338 | * the fpm output stream.) | |
339 | */ | |
c831033f | 340 | enum dplane_provider_prio { |
7cdb1a84 MS |
341 | DPLANE_PRIO_NONE = 0, |
342 | DPLANE_PRIO_PREPROCESS, | |
343 | DPLANE_PRIO_PRE_KERNEL, | |
344 | DPLANE_PRIO_KERNEL, | |
345 | DPLANE_PRIO_POSTPROCESS, | |
b8e0423d | 346 | DPLANE_PRIO_LAST |
5709131c | 347 | }; |
7cdb1a84 | 348 | |
c831033f MS |
349 | /* Flags values used during provider registration. */ |
350 | #define DPLANE_PROV_FLAGS_DEFAULT 0x0 | |
351 | ||
352 | /* Provider will be spawning its own worker thread */ | |
353 | #define DPLANE_PROV_FLAG_THREADED 0x1 | |
7cdb1a84 | 354 | |
18c37974 | 355 | |
c831033f | 356 | /* Provider registration: ordering or priority value, callbacks, and optional |
1ff8a248 MS |
357 | * opaque data value. If 'prov_p', return the newly-allocated provider object |
358 | * on success. | |
c831033f | 359 | */ |
4c206c8f MS |
360 | |
361 | /* Providers offer an entry-point for incoming work, called in the context of | |
362 | * the dataplane pthread. The dataplane pthread enqueues any new work to the | |
363 | * provider's 'inbound' queue, then calls the callback. The dataplane | |
364 | * then checks the provider's outbound queue for completed work. | |
365 | */ | |
366 | ||
1dd4ea8a MS |
367 | /* |
368 | * Providers can offer a 'start' callback; if present, the dataplane will | |
369 | * call it when it is starting - when its pthread and event-scheduling | |
370 | * thread_master are available. | |
371 | */ | |
372 | ||
373 | /* Providers can offer an entry-point for shutdown and cleanup. This is called | |
4c206c8f MS |
374 | * with 'early' during shutdown, to indicate that the dataplane subsystem |
375 | * is allowing work to move through the providers and finish. | |
376 | * When called without 'early', the provider should release | |
377 | * all resources (if it has any allocated). | |
378 | */ | |
7cdb1a84 | 379 | int dplane_provider_register(const char *name, |
c831033f MS |
380 | enum dplane_provider_prio prio, |
381 | int flags, | |
1dd4ea8a | 382 | int (*start_fp)(struct zebra_dplane_provider *), |
4c206c8f MS |
383 | int (*fp)(struct zebra_dplane_provider *), |
384 | int (*fini_fp)(struct zebra_dplane_provider *, | |
385 | bool early), | |
1ff8a248 MS |
386 | void *data, |
387 | struct zebra_dplane_provider **prov_p); | |
7cdb1a84 | 388 | |
c831033f MS |
389 | /* Accessors for provider attributes */ |
390 | const char *dplane_provider_get_name(const struct zebra_dplane_provider *prov); | |
391 | uint32_t dplane_provider_get_id(const struct zebra_dplane_provider *prov); | |
392 | void *dplane_provider_get_data(const struct zebra_dplane_provider *prov); | |
393 | bool dplane_provider_is_threaded(const struct zebra_dplane_provider *prov); | |
394 | ||
ad6aad4d MS |
395 | /* Lock/unlock a provider's mutex - iff the provider was registered with |
396 | * the THREADED flag. | |
397 | */ | |
398 | void dplane_provider_lock(struct zebra_dplane_provider *prov); | |
399 | void dplane_provider_unlock(struct zebra_dplane_provider *prov); | |
400 | ||
401 | /* Obtain thread_master for dataplane thread */ | |
402 | struct thread_master *dplane_get_thread_master(void); | |
403 | ||
404 | /* Providers should (generally) limit number of updates per work cycle */ | |
c831033f MS |
405 | int dplane_provider_get_work_limit(const struct zebra_dplane_provider *prov); |
406 | ||
407 | /* Provider api to signal that work/events are available | |
408 | * for the dataplane pthread. | |
7cdb1a84 | 409 | */ |
c831033f MS |
410 | int dplane_provider_work_ready(void); |
411 | ||
412 | /* Dequeue, maintain associated counter and locking */ | |
413 | struct zebra_dplane_ctx *dplane_provider_dequeue_in_ctx( | |
414 | struct zebra_dplane_provider *prov); | |
415 | ||
416 | /* Dequeue work to a list, maintain counter and locking, return count */ | |
417 | int dplane_provider_dequeue_in_list(struct zebra_dplane_provider *prov, | |
418 | struct dplane_ctx_q *listp); | |
419 | ||
420 | /* Enqueue, maintain associated counter and locking */ | |
421 | void dplane_provider_enqueue_out_ctx(struct zebra_dplane_provider *prov, | |
422 | struct zebra_dplane_ctx *ctx); | |
7cdb1a84 | 423 | |
7cdb1a84 | 424 | /* |
1d11b21f | 425 | * Initialize the dataplane modules at zebra startup. This is currently called |
4c206c8f MS |
426 | * by the rib module. Zebra registers a results callback with the dataplane. |
427 | * The callback is called in the dataplane pthread context, | |
428 | * so the expectation is that the contexts are queued for the zebra | |
429 | * main pthread. | |
7cdb1a84 | 430 | */ |
4c206c8f | 431 | void zebra_dplane_init(int (*) (struct dplane_ctx_q *)); |
7cdb1a84 | 432 | |
e5a60d82 MS |
433 | /* |
434 | * Start the dataplane pthread. This step needs to be run later than the | |
435 | * 'init' step, in case zebra has fork-ed. | |
436 | */ | |
437 | void zebra_dplane_start(void); | |
438 | ||
4dfd7a02 MS |
439 | /* Finalize/cleanup apis, one called early as shutdown is starting, |
440 | * one called late at the end of zebra shutdown, and then one called | |
c831033f MS |
441 | * from the zebra main pthread to stop the dplane pthread and |
442 | * free all resources. | |
4dfd7a02 | 443 | * |
1d11b21f MS |
444 | * Zebra expects to try to clean up all vrfs and all routes during |
445 | * shutdown, so the dplane must be available until very late. | |
446 | */ | |
4dfd7a02 | 447 | void zebra_dplane_pre_finish(void); |
1d11b21f | 448 | void zebra_dplane_finish(void); |
4dfd7a02 | 449 | void zebra_dplane_shutdown(void); |
1d11b21f | 450 | |
51e94aa7 EDP |
451 | #ifdef __cplusplus |
452 | } | |
453 | #endif | |
454 | ||
ea1c14f6 | 455 | #endif /* _ZEBRA_DPLANE_H */ |