57 boolean_t st_oneshot; /* Is timer a one shot? */
58 uint32_t st_value; /* periodic or one-shot time */
59 /* Fields below here are private to the svp_timer implementaiton */
60 uint64_t st_expire; /* Next expiration */
61 boolean_t st_delivering; /* Are we currently delivering this */
62 avl_node_t st_link;
63 } svp_timer_t;
64
65 /*
66 * Note, both the svp_log_ack_t and svp_lrm_req_t are not part of this structure
67 * as they are rather variable sized data and we don't want to constrain their
68 * size. Instead, the rdata and wdata members must be set appropriately.
69 */
70 typedef union svp_query_data {
71 svp_vl2_req_t sqd_vl2r;
72 svp_vl2_ack_t sqd_vl2a;
73 svp_vl3_req_t sdq_vl3r;
74 svp_vl3_ack_t sdq_vl3a;
75 svp_log_req_t sdq_logr;
76 svp_lrm_ack_t sdq_lrma;
77 svp_rvl3_req_t sqd_rvl3r;
78 svp_rvl3_ack_t sqd_rvl3a;
79 } svp_query_data_t;
80
81 typedef void (*svp_query_f)(svp_query_t *, void *);
82
83 typedef enum svp_query_state {
84 SVP_QUERY_INIT = 0x00,
85 SVP_QUERY_WRITING = 0x01,
86 SVP_QUERY_READING = 0x02,
87 SVP_QUERY_FINISHED = 0x03
88 } svp_query_state_t;
89
90 /*
91 * The query structure is usable for all forms of svp queries that end up
92 * getting passed across. Right now it's optimized for the fixed size data
93 * requests as opposed to requests whose responses will always be streaming in
94 * nature. Though, the streaming requests are the less common ones we have. We
95 * may need to make additional changes for those.
96 */
97 struct svp_query {
98 list_node_t sq_lnode; /* List entry */
230
231 /*
232 * We have a bunch of different things that we get back from the API at the
233 * plug-in layer. These include:
234 *
235 * o OOB Shootdowns
236 * o VL3->VL2 Lookups
237 * o VL2->UL3 Lookups
238 * o VL2 Log invalidations
239 * o VL3 Log injections
240 */
241 typedef void (*svp_vl2_lookup_f)(svp_t *, svp_status_t, const struct in6_addr *,
242 const uint16_t, void *);
243 typedef void (*svp_vl3_lookup_f)(svp_t *, svp_status_t, const uint8_t *,
244 const struct in6_addr *, const uint16_t, void *);
245 typedef void (*svp_vl2_invalidation_f)(svp_t *, const uint8_t *);
246 typedef void (*svp_vl3_inject_f)(svp_t *, const uint16_t,
247 const struct in6_addr *, const uint8_t *, const uint8_t *);
248 typedef void (*svp_shootdown_f)(svp_t *, const uint8_t *,
249 const struct in6_addr *, const uint16_t uport);
250 /* XXX KEBE SAYS FILL ME IN! */
251 typedef void (*svp_rvl3_lookup_f)(svp_t *, svp_status_t, void *);
252
253 typedef struct svp_cb {
254 svp_vl2_lookup_f scb_vl2_lookup;
255 svp_vl3_lookup_f scb_vl3_lookup;
256 svp_vl2_invalidation_f scb_vl2_invalidate;
257 svp_vl3_inject_f scb_vl3_inject;
258 svp_shootdown_f scb_shootdown;
259 svp_rvl3_lookup_f scb_rvl3_lookup;
260 } svp_cb_t;
261
262 /*
263 * Core implementation structure.
264 */
265 struct svp {
266 overlay_plugin_dest_t svp_dest; /* RO */
267 varpd_provider_handle_t *svp_hdl; /* RO */
268 svp_cb_t svp_cb; /* RO */
269 uint64_t svp_vid; /* RO */
270 avl_node_t svp_rlink; /* Owned by svp_remote */
271 svp_remote_t *svp_remote; /* RO iff started */
272 mutex_t svp_lock;
273 char *svp_host; /* svp_lock */
274 uint16_t svp_port; /* svp_lock */
275 uint16_t svp_uport; /* svp_lock */
276 uint32_t svp_dcid; /* svp_lock (but write-once?) */
277 boolean_t svp_huip; /* svp_lock */
278 struct in6_addr svp_uip; /* svp_lock */
279 struct ether_addr svp_router_mac; /* svp_lock (but write-once?) */
280 };
281
282 extern bunyan_logger_t *svp_bunyan;
283
284 extern int svp_remote_find(char *, uint16_t, struct in6_addr *,
285 svp_remote_t **);
286 extern int svp_remote_attach(svp_remote_t *, svp_t *);
287 extern void svp_remote_detach(svp_t *);
288 extern void svp_remote_release(svp_remote_t *);
289 extern void svp_remote_vl3_lookup(svp_t *, svp_query_t *,
290 const struct sockaddr *, void *);
291 extern void svp_remote_vl2_lookup(svp_t *, svp_query_t *, const uint8_t *,
292 void *);
293 extern void svp_remote_rvl3_lookup(svp_t *, svp_query_t *,
294 const struct in6_addr *, const struct in6_addr *, uint32_t, uint32_t,
295 uint16_t, void *);
296
297
298 /*
299 * Init functions
300 */
301 extern int svp_remote_init(void);
302 extern void svp_remote_fini(void);
303 extern int svp_event_init(void);
304 extern int svp_event_timer_init(svp_event_t *);
305 extern void svp_event_fini(void);
306 extern int svp_host_init(void);
307 extern int svp_timer_init(void);
308
309 /*
310 * Timers
311 */
312 extern int svp_tickrate;
313 extern void svp_timer_add(svp_timer_t *);
314 extern void svp_timer_remove(svp_timer_t *);
|
57 boolean_t st_oneshot; /* Is timer a one shot? */
58 uint32_t st_value; /* periodic or one-shot time */
59 /* Fields below here are private to the svp_timer implementaiton */
60 uint64_t st_expire; /* Next expiration */
61 boolean_t st_delivering; /* Are we currently delivering this */
62 avl_node_t st_link;
63 } svp_timer_t;
64
65 /*
66 * Note, both the svp_log_ack_t and svp_lrm_req_t are not part of this structure
67 * as they are rather variable sized data and we don't want to constrain their
68 * size. Instead, the rdata and wdata members must be set appropriately.
69 */
70 typedef union svp_query_data {
71 svp_vl2_req_t sqd_vl2r;
72 svp_vl2_ack_t sqd_vl2a;
73 svp_vl3_req_t sdq_vl3r;
74 svp_vl3_ack_t sdq_vl3a;
75 svp_log_req_t sdq_logr;
76 svp_lrm_ack_t sdq_lrma;
77 svp_route_req_t sqd_rr;
78 svp_route_ack_t sqd_ra;
79 } svp_query_data_t;
80
81 typedef void (*svp_query_f)(svp_query_t *, void *);
82
83 typedef enum svp_query_state {
84 SVP_QUERY_INIT = 0x00,
85 SVP_QUERY_WRITING = 0x01,
86 SVP_QUERY_READING = 0x02,
87 SVP_QUERY_FINISHED = 0x03
88 } svp_query_state_t;
89
90 /*
91 * The query structure is usable for all forms of svp queries that end up
92 * getting passed across. Right now it's optimized for the fixed size data
93 * requests as opposed to requests whose responses will always be streaming in
94 * nature. Though, the streaming requests are the less common ones we have. We
95 * may need to make additional changes for those.
96 */
97 struct svp_query {
98 list_node_t sq_lnode; /* List entry */
230
231 /*
232 * We have a bunch of different things that we get back from the API at the
233 * plug-in layer. These include:
234 *
235 * o OOB Shootdowns
236 * o VL3->VL2 Lookups
237 * o VL2->UL3 Lookups
238 * o VL2 Log invalidations
239 * o VL3 Log injections
240 */
241 typedef void (*svp_vl2_lookup_f)(svp_t *, svp_status_t, const struct in6_addr *,
242 const uint16_t, void *);
243 typedef void (*svp_vl3_lookup_f)(svp_t *, svp_status_t, const uint8_t *,
244 const struct in6_addr *, const uint16_t, void *);
245 typedef void (*svp_vl2_invalidation_f)(svp_t *, const uint8_t *);
246 typedef void (*svp_vl3_inject_f)(svp_t *, const uint16_t,
247 const struct in6_addr *, const uint8_t *, const uint8_t *);
248 typedef void (*svp_shootdown_f)(svp_t *, const uint8_t *,
249 const struct in6_addr *, const uint16_t uport);
250 typedef void (*svp_route_lookup_f)(svp_t *, svp_status_t, uint32_t, uint32_t,
251 uint16_t, uint8_t *, uint8_t *, uint16_t, uint8_t *, uint8_t, uint8_t,
252 void *);
253
254 typedef struct svp_cb {
255 svp_vl2_lookup_f scb_vl2_lookup;
256 svp_vl3_lookup_f scb_vl3_lookup;
257 svp_vl2_invalidation_f scb_vl2_invalidate;
258 svp_vl3_inject_f scb_vl3_inject;
259 svp_shootdown_f scb_shootdown;
260 svp_route_lookup_f scb_route_lookup;
261 } svp_cb_t;
262
263 /*
264 * Core implementation structure.
265 */
266 struct svp {
267 overlay_plugin_dest_t svp_dest; /* RO */
268 varpd_provider_handle_t *svp_hdl; /* RO */
269 svp_cb_t svp_cb; /* RO */
270 uint64_t svp_vid; /* RO */
271 avl_node_t svp_rlink; /* Owned by svp_remote */
272 svp_remote_t *svp_remote; /* RO iff started */
273 mutex_t svp_lock;
274 char *svp_host; /* svp_lock */
275 uint16_t svp_port; /* svp_lock */
276 uint16_t svp_uport; /* svp_lock */
277 uint32_t svp_dcid; /* svp_lock (but write-once?) */
278 boolean_t svp_huip; /* svp_lock */
279 struct in6_addr svp_uip; /* svp_lock */
280 /* NOTE: lower-3 bytes are 0s. */
281 uint8_t svp_router_oui[6]; /* svp_lock (but write-once?) */
282 };
283
284 extern bunyan_logger_t *svp_bunyan;
285
286 extern int svp_remote_find(char *, uint16_t, struct in6_addr *,
287 svp_remote_t **);
288 extern int svp_remote_attach(svp_remote_t *, svp_t *);
289 extern void svp_remote_detach(svp_t *);
290 extern void svp_remote_release(svp_remote_t *);
291 extern void svp_remote_vl3_lookup(svp_t *, svp_query_t *,
292 const struct sockaddr *, void *);
293 extern void svp_remote_vl2_lookup(svp_t *, svp_query_t *, const uint8_t *,
294 void *);
295 extern void svp_remote_route_lookup(svp_t *, svp_query_t *,
296 const struct in6_addr *, const struct in6_addr *, uint32_t,
297 uint16_t, void *);
298
299
300 /*
301 * Init functions
302 */
303 extern int svp_remote_init(void);
304 extern void svp_remote_fini(void);
305 extern int svp_event_init(void);
306 extern int svp_event_timer_init(svp_event_t *);
307 extern void svp_event_fini(void);
308 extern int svp_host_init(void);
309 extern int svp_timer_init(void);
310
311 /*
312 * Timers
313 */
314 extern int svp_tickrate;
315 extern void svp_timer_add(svp_timer_t *);
316 extern void svp_timer_remove(svp_timer_t *);
|