FD.io VPP  v18.10-34-gcce845e
Vector Packet Processing
buffer.h
Go to the documentation of this file.
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  * buffer.h: VLIB buffers
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_buffer_h
41 #define included_vlib_buffer_h
42 
43 #include <vppinfra/types.h>
44 #include <vppinfra/cache.h>
45 #include <vppinfra/serialize.h>
46 #include <vppinfra/vector.h>
47 #include <vppinfra/lock.h>
48 #include <vlib/error.h> /* for vlib_error_t */
49 
50 #include <vlib/config.h> /* for __PRE_DATA_SIZE */
51 #define VLIB_BUFFER_DATA_SIZE (2048)
52 #define VLIB_BUFFER_PRE_DATA_SIZE __PRE_DATA_SIZE
53 
54 /* Minimum buffer chain segment size. Does not apply to last buffer in chain.
55  Dataplane code can safely asume that specified amount of data is not split
56  into 2 chained buffers */
57 #define VLIB_BUFFER_MIN_CHAIN_SEG_SIZE (128)
58 
59 /* Amount of head buffer data copied to each replica head buffer */
60 #define VLIB_BUFFER_CLONE_HEAD_SIZE (256)
61 
63 
64 /** \file
65  vlib buffer structure definition and a few select
66  access methods. This structure and the buffer allocation
67  mechanism should perhaps live in vnet, but it would take a lot
68  of typing to make it so.
69 */
70 
71 /**
72  * Buffer Flags
73  */
74 #define foreach_vlib_buffer_flag \
75  _( 0, NON_DEFAULT_FREELIST, "non-default-fl") \
76  _( 1, IS_TRACED, 0) \
77  _( 2, NEXT_PRESENT, 0) \
78  _( 3, TOTAL_LENGTH_VALID, 0) \
79  _( 4, EXT_HDR_VALID, "ext-hdr-valid")
80 
81 /* NOTE: only buffer generic flags should be defined here, please consider
82  using user flags. i.e. src/vnet/buffer.h */
83 
84 enum
85 {
86 #define _(bit, name, v) VLIB_BUFFER_##name = (1 << (bit)),
88 #undef _
89 };
90 
91 enum
92 {
93 #define _(bit, name, v) VLIB_BUFFER_LOG2_##name = (bit),
95 #undef _
96 };
97 
98  /* User defined buffer flags. */
99 #define LOG2_VLIB_BUFFER_FLAG_USER(n) (32 - (n))
100 #define VLIB_BUFFER_FLAG_USER(n) (1 << LOG2_VLIB_BUFFER_FLAG_USER(n))
101 
102 /* VLIB buffer representation. */
103 typedef struct
104 {
105  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
106  STRUCT_MARK (template_start);
107  /* Offset within data[] that we are currently processing.
108  If negative current header points into predata area. */
109  i16 current_data; /**< signed offset in data[], pre_data[]
110  that we are currently processing.
111  If negative current header points into predata area.
112  */
113  u16 current_length; /**< Nbytes between current data and
114  the end of this buffer.
115  */
116  u32 flags; /**< buffer flags:
117  <br> VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,
118  <br> VLIB_BUFFER_IS_TRACED: trace this buffer.
119  <br> VLIB_BUFFER_NEXT_PRESENT: this is a multi-chunk buffer.
120  <br> VLIB_BUFFER_TOTAL_LENGTH_VALID: as it says
121  <br> VLIB_BUFFER_EXT_HDR_VALID: buffer contains valid external buffer manager header,
122  set to avoid adding it to a flow report
123  <br> VLIB_BUFFER_FLAG_USER(n): user-defined bit N
124  */
125 
126  u32 flow_id; /**< Generic flow identifier */
127 
128 
129  u32 next_buffer; /**< Next buffer for this linked-list of buffers.
130  Only valid if VLIB_BUFFER_NEXT_PRESENT flag is set.
131  */
132 
133  STRUCT_MARK (template_end);
134 
135  u32 current_config_index; /**< Used by feature subgraph arcs to
136  visit enabled feature nodes
137  */
138  vlib_error_t error; /**< Error code for buffers to be enqueued
139  to error handler.
140  */
141  u8 n_add_refs; /**< Number of additional references to this buffer. */
142 
143  u8 buffer_pool_index; /**< index of buffer pool this buffer belongs. */
144 
145  u32 opaque[10]; /**< Opaque data used by sub-graphs for their own purposes.
146  See .../vnet/vnet/buffer.h
147  */
148  CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
149 
150  u32 trace_index; /**< Specifies index into trace buffer
151  if VLIB_PACKET_IS_TRACED flag is set.
152  */
153  u32 recycle_count; /**< Used by L2 path recycle code */
154 
156  /**< Only valid for first buffer in chain. Current length plus
157  total length given here give total number of bytes in buffer chain.
158  */
159  vlib_buffer_free_list_index_t free_list_index; /** < only used if
160  VLIB_BUFFER_NON_DEFAULT_FREELIST
161  flag is set */
162  u8 align_pad[3]; /**< available */
163  u32 opaque2[12]; /**< More opaque data, see ../vnet/vnet/buffer.h */
164 
165  /***** end of second cache line */
166  CLIB_CACHE_LINE_ALIGN_MARK (cacheline2);
167  u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]; /**< Space for inserting data
168  before buffer start.
169  Packet rewrite string will be
170  rewritten backwards and may extend
171  back before buffer->data[0].
172  Must come directly before packet data.
173  */
174 
175  u8 data[0]; /**< Packet data. Hardware DMA here */
176 } vlib_buffer_t; /* Must be a multiple of 64B. */
177 
178 #define VLIB_BUFFER_HDR_SIZE (sizeof(vlib_buffer_t) - VLIB_BUFFER_PRE_DATA_SIZE)
179 
180 /** \brief Prefetch buffer metadata.
181  The first 64 bytes of buffer contains most header information
182 
183  @param b - (vlib_buffer_t *) pointer to the buffer
184  @param type - LOAD, STORE. In most cases, STORE is the right answer
185 */
186 
187 #define vlib_prefetch_buffer_header(b,type) CLIB_PREFETCH (b, 64, type)
188 
189 always_inline void
191 {
192  ASSERT (sizeof (b[0]) % 64 == 0);
193 
194  /* Rewrite data must be before and contiguous with packet data. */
196 }
197 
198 /** \brief Get pointer to current data to process
199 
200  @param b - (vlib_buffer_t *) pointer to the buffer
201  @return - (void *) (b->data + b->current_data)
202 */
203 
204 always_inline void *
206 {
207  /* Check bounds. */
208  ASSERT ((signed) b->current_data >= (signed) -VLIB_BUFFER_PRE_DATA_SIZE);
209  return b->data + b->current_data;
210 }
211 
212 /** \brief Advance current data pointer by the supplied (signed!) amount
213 
214  @param b - (vlib_buffer_t *) pointer to the buffer
215  @param l - (word) signed increment
216 */
217 always_inline void
219 {
220  ASSERT (b->current_length >= l);
221  b->current_data += l;
222  b->current_length -= l;
223 
224  ASSERT ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0 ||
226 }
227 
228 /** \brief Check if there is enough space in buffer to advance
229 
230  @param b - (vlib_buffer_t *) pointer to the buffer
231  @param l - (word) size to check
232  @return - 0 if there is less space than 'l' in buffer
233 */
236 {
237  return b->current_length >= l;
238 }
239 
240 /** \brief Reset current header & length to state they were in when
241  packet was received.
242 
243  @param b - (vlib_buffer_t *) pointer to the buffer
244 */
245 
246 always_inline void
248 {
249  b->current_length += clib_max (b->current_data, 0);
250  b->current_data = 0;
251 }
252 
253 /** \brief Get pointer to buffer's opaque data array
254 
255  @param b - (vlib_buffer_t *) pointer to the buffer
256  @return - (void *) b->opaque
257 */
258 always_inline void *
260 {
261  return (void *) b->opaque;
262 }
263 
264 /** \brief Get pointer to buffer's opaque2 data array
265 
266  @param b - (vlib_buffer_t *) pointer to the buffer
267  @return - (void *) b->opaque2
268 */
269 always_inline void *
271 {
272  return (void *) b->opaque2;
273 }
274 
275 /** \brief Get pointer to the end of buffer's data
276  * @param b pointer to the buffer
277  * @return pointer to tail of packet's data
278  */
281 {
282  return b->data + b->current_data + b->current_length;
283 }
284 
285 /** \brief Append uninitialized data to buffer
286  * @param b pointer to the buffer
287  * @param size number of uninitialized bytes
288  * @return pointer to beginning of uninitialized data
289  */
290 always_inline void *
292 {
293  void *p = vlib_buffer_get_tail (b);
294  /* XXX make sure there's enough space */
295  b->current_length += size;
296  return p;
297 }
298 
299 /** \brief Prepend uninitialized data to buffer
300  * @param b pointer to the buffer
301  * @param size number of uninitialized bytes
302  * @return pointer to beginning of uninitialized data
303  */
304 always_inline void *
306 {
308  b->current_data -= size;
309  b->current_length += size;
310 
311  return vlib_buffer_get_current (b);
312 }
313 
314 /** \brief Make head room, typically for packet headers
315  * @param b pointer to the buffer
316  * @param size number of head room bytes
317  * @return pointer to start of buffer (current data)
318  */
319 always_inline void *
321 {
323  b->current_data += size;
324  return vlib_buffer_get_current (b);
325 }
326 
327 /** \brief Retrieve bytes from buffer head
328  * @param b pointer to the buffer
329  * @param size number of bytes to pull
330  * @return pointer to start of buffer (current data)
331  */
332 always_inline void *
334 {
336  return 0;
337 
338  void *data = vlib_buffer_get_current (b);
339  vlib_buffer_advance (b, size);
340  return data;
341 }
342 
343 /* Forward declaration. */
344 struct vlib_main_t;
345 
347 {
348  /* Template buffer used to initialize first 16 bytes of buffers
349  allocated on this free list. */
351 
352  /* Our index into vlib_main_t's buffer_free_list_pool. */
353  vlib_buffer_free_list_index_t index;
354 
355  /* Number of data bytes for buffers in this free list. */
357 
358  /* Number of buffers to allocate when we need to allocate new buffers */
360 
361  /* Total number of buffers allocated from this free list. */
363 
364  /* Vector of free buffers. Each element is a byte offset into I/O heap. */
366 
367  /* index of buffer pool used to get / put buffers */
369 
370  /* Free list name. */
372 
373  /* Callback functions to initialize newly allocated buffers.
374  If null buffers are zeroed. */
376  struct vlib_buffer_free_list_t * fl,
377  u32 * buffers, u32 n_buffers);
378 
380 } __attribute__ ((aligned (16))) vlib_buffer_free_list_t;
381 
384  uword min_free_buffers);
385 typedef void (vlib_buffer_free_cb_t) (struct vlib_main_t * vm, u32 * buffers,
386  u32 n_buffers);
387 typedef void (vlib_buffer_free_no_next_cb_t) (struct vlib_main_t * vm,
388  u32 * buffers, u32 n_buffers);
389 
390 typedef struct
391 {
395  void (*vlib_packet_template_init_cb) (struct vlib_main_t * vm, void *t,
396  void *packet_data,
397  uword n_packet_data_bytes,
398  uword
399  min_n_buffers_each_physmem_alloc,
400  u8 * name);
401  void (*vlib_buffer_delete_free_list_cb) (struct vlib_main_t * vm,
402  vlib_buffer_free_list_index_t
403  free_list_index);
405 
407 
408 typedef struct
409 {
410  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
415 
417 
426 
427 typedef struct
428 {
429  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
430  /* Virtual memory address and size of buffer memory, used for calculating
431  buffer index */
435 
436  /* Buffer free callback, for subversive activities */
437  u32 (*buffer_free_callback) (struct vlib_main_t * vm,
438  u32 * buffers,
439  u32 n_buffers, u32 follow_buffer_next);
440 #define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX (0)
441 #define VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES VLIB_BUFFER_DATA_SIZE
442 
443  /* Hash table mapping buffer size (rounded to next unit of
444  sizeof (vlib_buffer_t)) to free list index. */
446 
447  /* Hash table mapping buffer index into number
448  0 => allocated but free, 1 => allocated and not-free.
449  If buffer index is not in hash table then this buffer
450  has never been allocated. */
453 
454  /* Callbacks */
458 
460 
463 {
465  return vec_elt_at_index (bm->buffer_pools, buffer_pool_index);
466 }
467 
470  u16 buffer_size);
471 
473 
474 typedef struct
475 {
477 
478  u32 first_buffer, last_buffer;
479 
480  union
481  {
482  struct
483  {
484  /* Total accumulated bytes in chain starting with first_buffer. */
486 
487  /* Max number of bytes to accumulate in chain starting with first_buffer.
488  As this limit is reached buffers are enqueued to next node. */
490 
491  /* Next node to enqueue buffers to relative to current process node. */
493 
494  /* Free list to use to allocate new buffers. */
495  vlib_buffer_free_list_index_t free_list_index;
496  } tx;
497 
498  struct
499  {
500  /* CLIB fifo of buffer indices waiting to be unserialized. */
502 
503  /* Event type used to signal that RX buffers have been added to fifo. */
505  } rx;
506  };
508 
512  struct vlib_main_t *vm,
514 
517 void *vlib_set_buffer_free_callback (struct vlib_main_t *vm, void *fp);
518 
521 {
522  serialize_stream_t *s = &m->stream;
526  return sm->tx.n_total_data_bytes + s->current_buffer_index +
528 }
529 
530 /*
531  */
532 
533 /** \brief Compile time buffer trajectory tracing option
534  Turn this on if you run into "bad monkey" contexts,
535  and you want to know exactly which nodes they've visited...
536  See vlib/main.c...
537 */
538 #define VLIB_BUFFER_TRACE_TRAJECTORY 0
539 
540 #if VLIB_BUFFER_TRACE_TRAJECTORY > 0
541 extern void (*vlib_buffer_trace_trajectory_cb) (vlib_buffer_t * b, u32 index);
542 extern void (*vlib_buffer_trace_trajectory_init_cb) (vlib_buffer_t * b);
543 extern void vlib_buffer_trace_trajectory_init (vlib_buffer_t * b);
544 #define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b) \
545  vlib_buffer_trace_trajectory_init (b);
546 #else
547 #define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
548 #endif /* VLIB_BUFFER_TRACE_TRAJECTORY */
549 
550 #endif /* included_vlib_buffer_h */
551 
552 #define VLIB_BUFFER_REGISTER_CALLBACKS(x,...) \
553  __VA_ARGS__ vlib_buffer_callbacks_t __##x##_buffer_callbacks; \
554 static void __vlib_add_buffer_callbacks_t_##x (void) \
555  __attribute__((__constructor__)) ; \
556 static void __vlib_add_buffer_callbacks_t_##x (void) \
557 { \
558  if (vlib_buffer_callbacks) \
559  clib_panic ("vlib buffer callbacks already registered"); \
560  vlib_buffer_callbacks = &__##x##_buffer_callbacks; \
561 } \
562 static void __vlib_rm_buffer_callbacks_t_##x (void) \
563  __attribute__((__destructor__)) ; \
564 static void __vlib_rm_buffer_callbacks_t_##x (void) \
565 { vlib_buffer_callbacks = 0; } \
566 __VA_ARGS__ vlib_buffer_callbacks_t __##x##_buffer_callbacks
567 
568 /*
569  * fd.io coding-style-patch-verification: ON
570  *
571  * Local Variables:
572  * eval: (c-set-style "gnu")
573  * End:
574  */
vlib_physmem_region_index_t physmem_region
Definition: buffer.h:414
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition: cache.h:60
static u8 * vlib_buffer_get_tail(vlib_buffer_t *b)
Get pointer to the end of buffer&#39;s data.
Definition: buffer.h:280
static void vlib_buffer_reset(vlib_buffer_t *b)
Reset current header & length to state they were in when packet was received.
Definition: buffer.h:247
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
Definition: buffer.h:135
vlib_buffer_free_list_index_t free_list_index
Definition: buffer.h:495
u32 opaque[10]
Opaque data used by sub-graphs for their own purposes.
Definition: buffer.h:145
vlib_buffer_callbacks_t cb
Definition: buffer.h:455
vlib_buffer_t buffer_init_template
Definition: buffer.h:350
struct vlib_main_t * vlib_main
Definition: buffer.h:476
#define VLIB_BUFFER_PRE_DATA_SIZE
Definition: buffer.h:52
u8 buffer_pool_index
index of buffer pool this buffer belongs.
Definition: buffer.h:143
u16 vlib_error_t
Definition: error.h:44
#define STRUCT_MARK(mark)
Definition: clib.h:69
u32 recycle_count
Used by L2 path recycle code.
Definition: buffer.h:153
void unserialize_open_vlib_buffer(serialize_main_t *m, struct vlib_main_t *vm, vlib_serialize_buffer_main_t *sm)
void unserialize_close_vlib_buffer(serialize_main_t *m)
void( vlib_buffer_free_cb_t)(struct vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Definition: buffer.h:385
uword log2_page_size
Definition: buffer.h:413
vlib_buffer_free_list_index_t index
Definition: buffer.h:353
u32 serialize_close_vlib_buffer(serialize_main_t *m)
unsigned char u8
Definition: types.h:56
u8 vlib_buffer_pool_create(struct vlib_main_t *vm, vlib_physmem_region_index_t region, u16 buffer_size)
Definition: buffer.c:869
vlib_buffer_main_t buffer_main
Definition: buffer.c:52
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Definition: buffer.h:109
#define static_always_inline
Definition: clib.h:95
i64 word
Definition: types.h:111
void(* buffer_init_function)(struct vlib_main_t *vm, struct vlib_buffer_free_list_t *fl, u32 *buffers, u32 n_buffers)
Definition: buffer.h:375
#define always_inline
Definition: clib.h:94
void serialize_open_vlib_buffer(serialize_main_t *m, struct vlib_main_t *vm, vlib_serialize_buffer_main_t *sm)
void * vlib_set_buffer_free_callback(struct vlib_main_t *vm, void *fp)
Definition: buffer.c:561
uword buffer_mem_size
Definition: buffer.h:433
vlib_buffer_free_no_next_cb_t * vlib_buffer_free_no_next_cb
Definition: buffer.h:394
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
Definition: buffer.h:167
unsigned int u32
Definition: types.h:88
static u32 serialize_vlib_buffer_n_bytes(serialize_main_t *m)
Definition: buffer.h:520
#define fl(x, y)
int callbacks_registered
Definition: buffer.h:456
uword next_clear
Definition: buffer.h:422
uword size
u16 current_length
Nbytes between current data and the end of this buffer.
Definition: buffer.h:113
static void * vlib_buffer_make_headroom(vlib_buffer_t *b, u8 size)
Make head room, typically for packet headers.
Definition: buffer.h:320
static void * vlib_buffer_put_uninit(vlib_buffer_t *b, u8 size)
Append uninitialized data to buffer.
Definition: buffer.h:291
unsigned short u16
Definition: types.h:57
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:205
vlib_buffer_pool_t * buffer_pools
Definition: buffer.h:434
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:138
serialize_stream_t stream
Definition: serialize.h:147
clib_spinlock_t buffer_known_hash_lockp
Definition: buffer.h:452
vlib_buffer_fill_free_list_cb_t * vlib_buffer_fill_free_list_cb
Definition: buffer.h:392
u32 current_buffer_index
Definition: serialize.h:62
u32 flow_id
Generic flow identifier.
Definition: buffer.h:126
vlib_main_t * vm
Definition: buffer.c:294
clib_spinlock_t lock
Definition: buffer.h:424
static void * vlib_get_buffer_opaque2(vlib_buffer_t *b)
Get pointer to buffer&#39;s opaque2 data array.
Definition: buffer.h:270
uword data_function_opaque
Definition: serialize.h:74
uword * bitmap
Definition: buffer.h:423
void( vlib_buffer_free_no_next_cb_t)(struct vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Definition: buffer.h:387
#define uword_to_pointer(u, type)
Definition: types.h:136
#define ASSERT(truth)
vlib_buffer_free_cb_t * vlib_buffer_free_cb
Definition: buffer.h:393
uword buffers_per_page
Definition: buffer.h:419
u32 next_buffer
Next buffer for this linked-list of buffers.
Definition: buffer.h:129
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:218
u8 n_add_refs
Number of additional references to this buffer.
Definition: buffer.h:141
#define clib_max(x, y)
Definition: clib.h:284
struct vlib_serialize_buffer_main_t::@32::@34 tx
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
Definition: buffer.h:155
static void * vlib_buffer_push_uninit(vlib_buffer_t *b, u8 size)
Prepend uninitialized data to buffer.
Definition: buffer.h:305
static u8 vlib_buffer_has_space(vlib_buffer_t *b, word l)
Check if there is enough space in buffer to advance.
Definition: buffer.h:235
u32 opaque2[12]
More opaque data, see ../vnet/vnet/buffer.h.
Definition: buffer.h:163
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void * vlib_get_buffer_opaque(vlib_buffer_t *b)
Get pointer to buffer&#39;s opaque data array.
Definition: buffer.h:259
u64 uword
Definition: types.h:112
uword buffer_mem_start
Definition: buffer.h:432
uword * buffer_known_hash
Definition: buffer.h:451
#define VLIB_BUFFER_MIN_CHAIN_SEG_SIZE
Definition: buffer.h:57
clib_error_t * vlib_buffer_main_init(struct vlib_main_t *vm)
Definition: buffer.c:983
u8 data[0]
Packet data.
Definition: buffer.h:175
static void * vlib_buffer_pull(vlib_buffer_t *b, u8 size)
Retrieve bytes from buffer head.
Definition: buffer.h:333
static_always_inline vlib_buffer_pool_t * vlib_buffer_pool_get(u8 buffer_pool_index)
Definition: buffer.h:462
u8 vlib_buffer_free_list_index_t
Definition: buffer.h:62
#define foreach_vlib_buffer_flag
Buffer Flags.
Definition: buffer.h:74
uword buffer_init_function_opaque
Definition: buffer.h:379
uword( vlib_buffer_fill_free_list_cb_t)(struct vlib_main_t *vm, vlib_buffer_free_list_t *fl, uword min_free_buffers)
Definition: buffer.h:382
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:116
u8 vlib_physmem_region_index_t
Definition: physmem.h:43
static void vlib_buffer_struct_is_sane(vlib_buffer_t *b)
Definition: buffer.h:190
u32 trace_index
Specifies index into trace buffer if VLIB_PACKET_IS_TRACED flag is set.
Definition: buffer.h:150
uword * free_list_by_size
Definition: buffer.h:445
vlib_buffer_callbacks_t * vlib_buffer_callbacks
Definition: buffer.c:49
signed short i16
Definition: types.h:46
vlib_buffer_free_list_index_t free_list_index
Definition: buffer.h:159