aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-01-04 13:19:27 +0100
committerDave Barach <openvpp@barachs.net>2017-01-14 14:17:03 +0000
commit878c609889dcdc58538d40d8b3f662320f88573d (patch)
treefa241dadbdd1db60b47fe3f077ab3392716690d5 /src/vlib/buffer.h
parenteea28d78a3173341727aafee4c414bcb01001339 (diff)
vlib: add buffer and thread callbacks
Change-Id: I8e2e8f94a884ab2f9909d0c83ba00edd38cdab77 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/buffer.h')
-rw-r--r--src/vlib/buffer.h45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index 5f1e62f08c9..d270c08a602 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -46,15 +46,9 @@
#include <vppinfra/vector.h>
#include <vlib/error.h> /* for vlib_error_t */
-#if DPDK > 0
-#include <rte_config.h>
-#define VLIB_BUFFER_DATA_SIZE (2048)
-#define VLIB_BUFFER_PRE_DATA_SIZE RTE_PKTMBUF_HEADROOM
-#else
#include <vlib/config.h> /* for __PRE_DATA_SIZE */
-#define VLIB_BUFFER_DATA_SIZE (512)
+#define VLIB_BUFFER_DATA_SIZE (2048)
#define VLIB_BUFFER_PRE_DATA_SIZE __PRE_DATA_SIZE
-#endif
#if defined (CLIB_HAVE_VEC128) || defined (__aarch64__)
typedef u8x16 vlib_copy_unit_t;
@@ -298,6 +292,27 @@ typedef struct vlib_buffer_free_list_t
typedef struct
{
+ u32 (*vlib_buffer_alloc_cb) (struct vlib_main_t * vm, u32 * buffers,
+ u32 n_buffers);
+ u32 (*vlib_buffer_alloc_from_free_list_cb) (struct vlib_main_t * vm,
+ u32 * buffers, u32 n_buffers,
+ u32 free_list_index);
+ void (*vlib_buffer_free_cb) (struct vlib_main_t * vm, u32 * buffers,
+ u32 n_buffers);
+ void (*vlib_buffer_free_no_next_cb) (struct vlib_main_t * vm, u32 * buffers,
+ u32 n_buffers);
+ void (*vlib_packet_template_init_cb) (struct vlib_main_t * vm, void *t,
+ void *packet_data,
+ uword n_packet_data_bytes,
+ uword
+ min_n_buffers_each_physmem_alloc,
+ u8 * name);
+ void (*vlib_buffer_delete_free_list_cb) (struct vlib_main_t * vm,
+ u32 free_list_index);
+} vlib_buffer_callbacks_t;
+
+typedef struct
+{
/* Buffer free callback, for subversive activities */
u32 (*buffer_free_callback) (struct vlib_main_t * vm,
u32 * buffers,
@@ -323,12 +338,15 @@ typedef struct
/* List of free-lists needing Blue Light Special announcements */
vlib_buffer_free_list_t **announce_list;
- /* Vector of rte_mempools per socket */
-#if DPDK == 1
- struct rte_mempool **pktmbuf_pools;
-#endif
+ /* Callbacks */
+ vlib_buffer_callbacks_t cb;
+ int extern_buffer_mgmt;
} vlib_buffer_main_t;
+void vlib_buffer_cb_init (struct vlib_main_t *vm);
+int vlib_buffer_cb_register (struct vlib_main_t *vm,
+ vlib_buffer_callbacks_t * cb);
+
typedef struct
{
struct vlib_main_t *vlib_main;
@@ -385,11 +403,6 @@ serialize_vlib_buffer_n_bytes (serialize_main_t * m)
vec_len (s->overflow_buffer);
}
-#if DPDK > 0
-#define rte_mbuf_from_vlib_buffer(x) (((struct rte_mbuf *)x) - 1)
-#define vlib_buffer_from_rte_mbuf(x) ((vlib_buffer_t *)(x+1))
-#endif
-
/*
*/