7177bebeffbd94890571539638093c1037addbb8
[vpp.git] / src / vlib / node.h
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /*
16  * node.h: VLIB processing nodes
17  *
18  * Copyright (c) 2008 Eliot Dresselhaus
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining
21  * a copy of this software and associated documentation files (the
22  * "Software"), to deal in the Software without restriction, including
23  * without limitation the rights to use, copy, modify, merge, publish,
24  * distribute, sublicense, and/or sell copies of the Software, and to
25  * permit persons to whom the Software is furnished to do so, subject to
26  * the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be
29  * included in all copies or substantial portions of the Software.
30  *
31  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38  */
39
40 #ifndef included_vlib_node_h
41 #define included_vlib_node_h
42
43 #include <vppinfra/cpu.h>
44 #include <vppinfra/longjmp.h>
45 #include <vppinfra/lock.h>
46 #include <vlib/trace.h>         /* for vlib_trace_filter_t */
47
48 /* Forward declaration. */
49 struct vlib_node_runtime_t;
50 struct vlib_frame_t;
51
52 /* Internal nodes (including output nodes) move data from node to
53    node (or out of the graph for output nodes). */
54 typedef uword (vlib_node_function_t) (struct vlib_main_t * vm,
55                                       struct vlib_node_runtime_t * node,
56                                       struct vlib_frame_t * frame);
57
58 typedef enum
59 {
60   /* An internal node on the call graph (could be output). */
61   VLIB_NODE_TYPE_INTERNAL,
62
63   /* Nodes which input data into the processing graph.
64      Input nodes are called for each iteration of main loop. */
65   VLIB_NODE_TYPE_INPUT,
66
67   /* Nodes to be called before all input nodes.
68      Used, for example, to clean out driver TX rings before
69      processing input. */
70   VLIB_NODE_TYPE_PRE_INPUT,
71
72   /* "Process" nodes which can be suspended and later resumed. */
73   VLIB_NODE_TYPE_PROCESS,
74
75   VLIB_N_NODE_TYPE,
76 } vlib_node_type_t;
77
78 typedef struct _vlib_node_registration
79 {
80   /* Vector processing function for this node. */
81   vlib_node_function_t *function;
82
83   /* Node name. */
84   char *name;
85
86   /* Name of sibling (if applicable). */
87   char *sibling_of;
88
89   /* Node index filled in by registration. */
90   u32 index;
91
92   /* Type of this node. */
93   vlib_node_type_t type;
94
95   /* Error strings indexed by error code for this node. */
96   char **error_strings;
97
98   /* Buffer format/unformat for this node. */
99   format_function_t *format_buffer;
100   unformat_function_t *unformat_buffer;
101
102   /* Trace format/unformat for this node. */
103   format_function_t *format_trace;
104   unformat_function_t *unformat_trace;
105
106   /* Function to validate incoming frames. */
107   u8 *(*validate_frame) (struct vlib_main_t * vm,
108                          struct vlib_node_runtime_t *,
109                          struct vlib_frame_t * f);
110
111   /* Per-node runtime data. */
112   void *runtime_data;
113
114   /* Process stack size. */
115   u16 process_log2_n_stack_bytes;
116
117   /* Number of bytes of per-node run time data. */
118   u8 runtime_data_bytes;
119
120   /* State for input nodes. */
121   u8 state;
122
123   /* Node flags. */
124   u16 flags;
125
126   /* Size of scalar and vector arguments in bytes. */
127   u16 scalar_size, vector_size;
128
129   /* Number of error codes used by this node. */
130   u16 n_errors;
131
132   /* Number of next node names that follow. */
133   u16 n_next_nodes;
134
135   /* Constructor link-list, don't ask... */
136   struct _vlib_node_registration *next_registration;
137
138   /* Names of next nodes which this node feeds into. */
139   char *next_nodes[];
140
141 } vlib_node_registration_t;
142
143 #define VLIB_REGISTER_NODE(x,...)                                       \
144     __VA_ARGS__ vlib_node_registration_t x;                             \
145 static void __vlib_add_node_registration_##x (void)                     \
146     __attribute__((__constructor__)) ;                                  \
147 static void __vlib_add_node_registration_##x (void)                     \
148 {                                                                       \
149     vlib_main_t * vm = vlib_get_main();                                 \
150     x.next_registration = vm->node_main.node_registrations;             \
151     vm->node_main.node_registrations = &x;                              \
152 }                                                                       \
153 static void __vlib_rm_node_registration_##x (void)                      \
154     __attribute__((__destructor__)) ;                                   \
155 static void __vlib_rm_node_registration_##x (void)                      \
156 {                                                                       \
157     vlib_main_t * vm = vlib_get_main();                                 \
158     VLIB_REMOVE_FROM_LINKED_LIST (vm->node_main.node_registrations,     \
159                                   &x, next_registration);               \
160 }                                                                       \
161 __VA_ARGS__ vlib_node_registration_t x
162
163 #if CLIB_DEBUG > 0
164 #define VLIB_NODE_FUNCTION_CLONE_TEMPLATE(arch, fn)
165 #define VLIB_NODE_FUNCTION_MULTIARCH_CLONE(fn)
166 #define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
167 #else
168 #define VLIB_NODE_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt)                \
169   uword                                                                 \
170   __attribute__ ((flatten))                                             \
171   __attribute__ ((target (tgt)))                                        \
172   CLIB_CPU_OPTIMIZED                                                    \
173   fn ## _ ## arch ( struct vlib_main_t * vm,                            \
174                    struct vlib_node_runtime_t * node,                   \
175                    struct vlib_frame_t * frame)                         \
176   { return fn (vm, node, frame); }
177
178 #define VLIB_NODE_FUNCTION_MULTIARCH_CLONE(fn)                          \
179   foreach_march_variant(VLIB_NODE_FUNCTION_CLONE_TEMPLATE, fn)
180
181 #define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)                          \
182   VLIB_NODE_FUNCTION_MULTIARCH_CLONE(fn)                                \
183   CLIB_MULTIARCH_SELECT_FN(fn, static inline)                           \
184   static void __attribute__((__constructor__))                          \
185   __vlib_node_function_multiarch_select_##node (void)                   \
186   { node.function = fn ## _multiarch_select(); }
187 #endif
188
189 always_inline vlib_node_registration_t *
190 vlib_node_next_registered (vlib_node_registration_t * c)
191 {
192   c =
193     clib_elf_section_data_next (c,
194                                 c->n_next_nodes * sizeof (c->next_nodes[0]));
195   return c;
196 }
197
198 typedef struct
199 {
200   /* Total calls, clock ticks and vector elements processed for this node. */
201   u64 calls, vectors, clocks, suspends;
202   u64 max_clock;
203   u64 max_clock_n;
204 } vlib_node_stats_t;
205
206 #define foreach_vlib_node_state                                 \
207   /* Input node is called each iteration of main loop.          \
208      This is the default (zero). */                             \
209   _ (POLLING)                                                   \
210   /* Input node is called when device signals an interrupt. */  \
211   _ (INTERRUPT)                                                 \
212   /* Input node is never called. */                             \
213   _ (DISABLED)
214
215 typedef enum
216 {
217 #define _(f) VLIB_NODE_STATE_##f,
218   foreach_vlib_node_state
219 #undef _
220     VLIB_N_NODE_STATE,
221 } vlib_node_state_t;
222
223 typedef struct vlib_node_t
224 {
225   /* Vector processing function for this node. */
226   vlib_node_function_t *function;
227
228   /* Node name. */
229   u8 *name;
230
231   /* Node name index in elog string table. */
232   u32 name_elog_string;
233
234   /* Total statistics for this node. */
235   vlib_node_stats_t stats_total;
236
237   /* Saved values as of last clear (or zero if never cleared).
238      Current values are always stats_total - stats_last_clear. */
239   vlib_node_stats_t stats_last_clear;
240
241   /* Type of this node. */
242   vlib_node_type_t type;
243
244   /* Node index. */
245   u32 index;
246
247   /* Index of corresponding node runtime. */
248   u32 runtime_index;
249
250   /* Runtime data for this node. */
251   void *runtime_data;
252
253   /* Node flags. */
254   u16 flags;
255
256   /* Processing function keeps frame.  Tells node dispatching code not
257      to free frame after dispatch is done.  */
258 #define VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH (1 << 0)
259
260   /* Node counts as output/drop/punt node for stats purposes. */
261 #define VLIB_NODE_FLAG_IS_OUTPUT (1 << 1)
262 #define VLIB_NODE_FLAG_IS_DROP (1 << 2)
263 #define VLIB_NODE_FLAG_IS_PUNT (1 << 3)
264 #define VLIB_NODE_FLAG_IS_HANDOFF (1 << 4)
265
266   /* Set if current node runtime has traced vectors. */
267 #define VLIB_NODE_FLAG_TRACE (1 << 5)
268
269 #define VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE (1 << 6)
270 #define VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE (1 << 7)
271
272   /* State for input nodes. */
273   u8 state;
274
275   /* Number of bytes of run time data. */
276   u8 runtime_data_bytes;
277
278   /* Number of error codes used by this node. */
279   u16 n_errors;
280
281   /* Size of scalar and vector arguments in bytes. */
282   u16 scalar_size, vector_size;
283
284   /* Handle/index in error heap for this node. */
285   u32 error_heap_handle;
286   u32 error_heap_index;
287
288   /* Error strings indexed by error code for this node. */
289   char **error_strings;
290
291   /* Vector of next node names.
292      Only used before next_nodes array is initialized. */
293   char **next_node_names;
294
295   /* Next node indices for this node. */
296   u32 *next_nodes;
297
298   /* Name of node that we are sibling of. */
299   char *sibling_of;
300
301   /* Bitmap of all of this node's siblings. */
302   uword *sibling_bitmap;
303
304   /* Total number of vectors sent to each next node. */
305   u64 *n_vectors_by_next_node;
306
307   /* Hash table mapping next node index into slot in
308      next_nodes vector.  Quickly determines whether this node
309      is connected to given next node and, if so, with which slot. */
310   uword *next_slot_by_node;
311
312   /* Bitmap of node indices which feed this node. */
313   uword *prev_node_bitmap;
314
315   /* Node/next-index which own enqueue rights with to this node. */
316   u32 owner_node_index, owner_next_index;
317
318   /* Buffer format/unformat for this node. */
319   format_function_t *format_buffer;
320   unformat_function_t *unformat_buffer;
321
322   /* Trace buffer format/unformat for this node. */
323   format_function_t *format_trace;
324
325   /* Function to validate incoming frames. */
326   u8 *(*validate_frame) (struct vlib_main_t * vm,
327                          struct vlib_node_runtime_t *,
328                          struct vlib_frame_t * f);
329   /* for pretty-printing, not typically valid */
330   u8 *state_string;
331 } vlib_node_t;
332
333 #define VLIB_INVALID_NODE_INDEX ((u32) ~0)
334
335 /* Max number of vector elements to process at once per node. */
336 #define VLIB_FRAME_SIZE 256
337 #define VLIB_FRAME_ALIGN CLIB_CACHE_LINE_BYTES
338
339 /* Calling frame (think stack frame) for a node. */
340 typedef struct vlib_frame_t
341 {
342   /* Frame flags. */
343   u16 flags;
344
345   /* Number of scalar bytes in arguments. */
346   u8 scalar_size;
347
348   /* Number of bytes per vector argument. */
349   u8 vector_size;
350
351   /* Number of vector elements currently in frame. */
352   u16 n_vectors;
353
354   /* Scalar and vector arguments to next node. */
355   u8 arguments[0];
356 } vlib_frame_t;
357
358 typedef struct
359 {
360   /* Frame index. */
361   u32 frame_index;
362
363   /* Node runtime for this next. */
364   u32 node_runtime_index;
365
366   /* Next frame flags. */
367   u32 flags;
368
369   /* Reflects node frame-used flag for this next. */
370 #define VLIB_FRAME_NO_FREE_AFTER_DISPATCH \
371   VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH
372
373   /* This next frame owns enqueue to node
374      corresponding to node_runtime_index. */
375 #define VLIB_FRAME_OWNER (1 << 15)
376
377   /* Set when frame has been allocated for this next. */
378 #define VLIB_FRAME_IS_ALLOCATED VLIB_NODE_FLAG_IS_OUTPUT
379
380   /* Set when frame has been added to pending vector. */
381 #define VLIB_FRAME_PENDING VLIB_NODE_FLAG_IS_DROP
382
383   /* Set when frame is to be freed after dispatch. */
384 #define VLIB_FRAME_FREE_AFTER_DISPATCH VLIB_NODE_FLAG_IS_PUNT
385
386   /* Set when frame has traced packets. */
387 #define VLIB_FRAME_TRACE VLIB_NODE_FLAG_TRACE
388
389   /* Number of vectors enqueue to this next since last overflow. */
390   u32 vectors_since_last_overflow;
391 } vlib_next_frame_t;
392
393 always_inline void
394 vlib_next_frame_init (vlib_next_frame_t * nf)
395 {
396   memset (nf, 0, sizeof (nf[0]));
397   nf->frame_index = ~0;
398   nf->node_runtime_index = ~0;
399 }
400
401 /* A frame pending dispatch by main loop. */
402 typedef struct
403 {
404   /* Node and runtime for this frame. */
405   u32 node_runtime_index;
406
407   /* Frame index (in the heap). */
408   u32 frame_index;
409
410   /* Start of next frames for this node. */
411   u32 next_frame_index;
412
413   /* Special value for next_frame_index when there is no next frame. */
414 #define VLIB_PENDING_FRAME_NO_NEXT_FRAME ((u32) ~0)
415 } vlib_pending_frame_t;
416
417 typedef struct vlib_node_runtime_t
418 {
419   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);      /**< cacheline mark */
420
421   vlib_node_function_t *function;       /**< Node function to call. */
422
423   vlib_error_t *errors;                 /**< Vector of errors for this node. */
424
425 #if __SIZEOF_POINTER__ == 4
426   u8 pad[8];
427 #endif
428
429   u32 clocks_since_last_overflow;       /**< Number of clock cycles. */
430
431   u32 max_clock;                        /**< Maximum clock cycle for an
432                                           invocation. */
433
434   u32 max_clock_n;                      /**< Number of vectors in the recorded
435                                           max_clock. */
436
437   u32 calls_since_last_overflow;        /**< Number of calls. */
438
439   u32 vectors_since_last_overflow;      /**< Number of vector elements
440                                           processed by this node. */
441
442   u32 next_frame_index;                 /**< Start of next frames for this
443                                           node. */
444
445   u32 node_index;                       /**< Node index. */
446
447   u32 input_main_loops_per_call;        /**< For input nodes: decremented
448                                           on each main loop interation until
449                                           it reaches zero and function is
450                                           called.  Allows some input nodes to
451                                           be called more than others. */
452
453   u32 main_loop_count_last_dispatch;    /**< Saved main loop counter of last
454                                           dispatch of this node. */
455
456   u32 main_loop_vector_stats[2];
457
458   u16 flags;                            /**< Copy of main node flags. */
459
460   u16 state;                            /**< Input node state. */
461
462   u16 n_next_nodes;
463
464   u16 cached_next_index;                /**< Next frame index that vector
465                                           arguments were last enqueued to
466                                           last time this node ran. Set to
467                                           zero before first run of this
468                                           node. */
469
470   u16 thread_index;                     /**< thread this node runs on */
471
472   u8 runtime_data[0];                   /**< Function dependent
473                                           node-runtime data. This data is
474                                           thread local, and it is not
475                                           cloned from main thread. It needs
476                                           to be initialized for each thread
477                                           before it is used unless
478                                           runtime_data template exists in
479                                           vlib_node_t. */
480 }
481 vlib_node_runtime_t;
482
483 #define VLIB_NODE_RUNTIME_DATA_SIZE     (sizeof (vlib_node_runtime_t) - STRUCT_OFFSET_OF (vlib_node_runtime_t, runtime_data))
484
485 typedef struct
486 {
487   /* Number of allocated frames for this scalar/vector size. */
488   u32 n_alloc_frames;
489
490   /* Vector of free frame indices for this scalar/vector size. */
491   u32 *free_frame_indices;
492 } vlib_frame_size_t;
493
494 typedef struct
495 {
496   /* Users opaque value for event type. */
497   uword opaque;
498 } vlib_process_event_type_t;
499
500 typedef struct
501 {
502   /* Node runtime for this process. */
503   vlib_node_runtime_t node_runtime;
504
505   /* Where to longjmp when process is done. */
506   clib_longjmp_t return_longjmp;
507
508 #define VLIB_PROCESS_RETURN_LONGJMP_RETURN ((uword) ~0 - 0)
509 #define VLIB_PROCESS_RETURN_LONGJMP_SUSPEND ((uword) ~0 - 1)
510
511   /* Where to longjmp to resume node after suspend. */
512   clib_longjmp_t resume_longjmp;
513 #define VLIB_PROCESS_RESUME_LONGJMP_SUSPEND 0
514 #define VLIB_PROCESS_RESUME_LONGJMP_RESUME  1
515
516   u16 flags;
517 #define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK (1 << 0)
518 #define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT (1 << 1)
519   /* Set to indicate that this process has been added to resume vector. */
520 #define VLIB_PROCESS_RESUME_PENDING (1 << 2)
521
522   /* Process function is currently running. */
523 #define VLIB_PROCESS_IS_RUNNING (1 << 3)
524
525   /* Size of process stack. */
526   u16 log2_n_stack_bytes;
527
528   u32 suspended_process_frame_index;
529
530   /* Number of times this process was suspended. */
531   u32 n_suspends;
532
533   /* Vectors of pending event data indexed by event type index. */
534   void **pending_event_data_by_type_index;
535
536   /* Bitmap of event type-indices with non-empty vectors. */
537   uword *non_empty_event_type_bitmap;
538
539   /* Bitmap of event type-indices which are one time events. */
540   uword *one_time_event_type_bitmap;
541
542   /* Type is opaque pointer -- typically a pointer to an event handler
543      function.  Hash table to map opaque to a type index. */
544   uword *event_type_index_by_type_opaque;
545
546   /* Pool of currently valid event types. */
547   vlib_process_event_type_t *event_type_pool;
548
549   /*
550    * When suspending saves clock time (10us ticks) when process
551    * is to be resumed.
552    */
553   u64 resume_clock_interval;
554
555   /* Handle from timer code, to cancel an unexpired timer */
556   u32 stop_timer_handle;
557
558   /* Default output function and its argument for any CLI outputs
559      within the process. */
560   vlib_cli_output_function_t *output_function;
561   uword output_function_arg;
562
563 #ifdef CLIB_UNIX
564   /* Pad to a multiple of the page size so we can mprotect process stacks */
565 #define PAGE_SIZE_MULTIPLE 0x1000
566 #define ALIGN_ON_MULTIPLE_PAGE_BOUNDARY_FOR_MPROTECT  __attribute__ ((aligned (PAGE_SIZE_MULTIPLE)))
567 #else
568 #define ALIGN_ON_MULTIPLE_PAGE_BOUNDARY_FOR_MPROTECT
569 #endif
570
571   /* Process stack.  Starts here and extends 2^log2_n_stack_bytes
572      bytes. */
573
574 #define VLIB_PROCESS_STACK_MAGIC (0xdead7ead)
575   u32 stack[0] ALIGN_ON_MULTIPLE_PAGE_BOUNDARY_FOR_MPROTECT;
576 } vlib_process_t __attribute__ ((aligned (CLIB_CACHE_LINE_BYTES)));
577
578 #ifdef CLIB_UNIX
579   /* Ensure that the stack is aligned on the multiple of the page size */
580 typedef char
581   assert_process_stack_must_be_aligned_exactly_to_page_size_multiple[(sizeof
582                                                                       (vlib_process_t)
583                                                                       -
584                                                                       PAGE_SIZE_MULTIPLE)
585                                                                      ==
586                                                                      0 ? 0 :
587                                                                      -1];
588 #endif
589
590 typedef struct
591 {
592   u32 node_index;
593
594   u32 one_time_event;
595 } vlib_one_time_waiting_process_t;
596
597 typedef struct
598 {
599   u16 n_data_elts;
600
601   u16 n_data_elt_bytes;
602
603   /* n_data_elts * n_data_elt_bytes */
604   u32 n_data_bytes;
605
606   /* Process node & event type to be used to signal event. */
607   u32 process_node_index;
608
609   u32 event_type_index;
610
611   union
612   {
613     u8 inline_event_data[64 - 3 * sizeof (u32) - 2 * sizeof (u16)];
614
615     /* Vector of event data used only when data does not fit inline. */
616     u8 *event_data_as_vector;
617   };
618 }
619 vlib_signal_timed_event_data_t;
620
621 always_inline uword
622 vlib_timing_wheel_data_is_timed_event (u32 d)
623 {
624   return d & 1;
625 }
626
627 always_inline u32
628 vlib_timing_wheel_data_set_suspended_process (u32 i)
629 {
630   return 0 + 2 * i;
631 }
632
633 always_inline u32
634 vlib_timing_wheel_data_set_timed_event (u32 i)
635 {
636   return 1 + 2 * i;
637 }
638
639 always_inline uword
640 vlib_timing_wheel_data_get_index (u32 d)
641 {
642   return d / 2;
643 }
644
645 typedef struct
646 {
647   /* Public nodes. */
648   vlib_node_t **nodes;
649
650   /* Node index hashed by node name. */
651   uword *node_by_name;
652
653   u32 flags;
654 #define VLIB_NODE_MAIN_RUNTIME_STARTED (1 << 0)
655
656   /* Nodes segregated by type for cache locality.
657      Does not apply to nodes of type VLIB_NODE_TYPE_INTERNAL. */
658   vlib_node_runtime_t *nodes_by_type[VLIB_N_NODE_TYPE];
659
660   /* Node runtime indices for input nodes with pending interrupts. */
661   u32 *pending_interrupt_node_runtime_indices;
662   clib_spinlock_t pending_interrupt_lock;
663
664   /* Input nodes are switched from/to interrupt to/from polling mode
665      when average vector length goes above/below polling/interrupt
666      thresholds. */
667   u32 polling_threshold_vector_length;
668   u32 interrupt_threshold_vector_length;
669
670   /* Vector of next frames. */
671   vlib_next_frame_t *next_frames;
672
673   /* Vector of internal node's frames waiting to be called. */
674   vlib_pending_frame_t *pending_frames;
675
676   /* Timing wheel for scheduling time-based node dispatch. */
677   void *timing_wheel;
678
679   vlib_signal_timed_event_data_t *signal_timed_event_data_pool;
680
681   /* Opaque data vector added via timing_wheel_advance. */
682   u32 *data_from_advancing_timing_wheel;
683
684   /* CPU time of next process to be ready on timing wheel. */
685   f64 time_next_process_ready;
686
687   /* Vector of process nodes.
688      One for each node of type VLIB_NODE_TYPE_PROCESS. */
689   vlib_process_t **processes;
690
691   /* Current running process or ~0 if no process running. */
692   u32 current_process_index;
693
694   /* Pool of pending process frames. */
695   vlib_pending_frame_t *suspended_process_frames;
696
697   /* Vector of event data vectors pending recycle. */
698   void **recycled_event_data_vectors;
699
700   /* Current counts of nodes in each state. */
701   u32 input_node_counts_by_state[VLIB_N_NODE_STATE];
702
703   /* Hash of (scalar_size,vector_size) to frame_sizes index. */
704   uword *frame_size_hash;
705
706   /* Per-size frame allocation information. */
707   vlib_frame_size_t *frame_sizes;
708
709   /* Time of last node runtime stats clear. */
710   f64 time_last_runtime_stats_clear;
711
712   /* Node registrations added by constructors */
713   vlib_node_registration_t *node_registrations;
714 } vlib_node_main_t;
715
716
717 #define FRAME_QUEUE_MAX_NELTS 32
718 typedef struct
719 {
720   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
721   u64 head;
722   u64 head_hint;
723   u64 tail;
724   u32 n_in_use;
725   u32 nelts;
726   u32 written;
727   u32 threshold;
728   i32 n_vectors[FRAME_QUEUE_MAX_NELTS];
729 } frame_queue_trace_t;
730
731 typedef struct
732 {
733   u64 count[FRAME_QUEUE_MAX_NELTS];
734 } frame_queue_nelt_counter_t;
735
736 #endif /* included_vlib_node_h */
737
738 /*
739  * fd.io coding-style-patch-verification: ON
740  *
741  * Local Variables:
742  * eval: (c-set-style "gnu")
743  * End:
744  */