summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dpdk/buffer.c18
-rw-r--r--src/vlib/CMakeLists.txt1
-rw-r--r--src/vlib/buffer.c64
-rw-r--r--src/vlib/buffer.h61
-rw-r--r--src/vlib/buffer_funcs.h79
-rw-r--r--src/vlib/buffer_serialize.c248
-rw-r--r--src/vnet/devices/af_packet/node.c3
-rw-r--r--src/vnet/devices/netmap/node.c3
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c5
-rwxr-xr-xsrc/vnet/ip/ip6_neighbor.c8
-rw-r--r--src/vnet/pg/cli.c2
-rw-r--r--src/vnet/pg/input.c12
-rw-r--r--src/vnet/pg/pg.h2
-rw-r--r--src/vnet/pg/stream.c6
-rw-r--r--src/vnet/sctp/sctp.c3
-rw-r--r--src/vnet/session/session_node.c3
-rw-r--r--src/vnet/tcp/tcp.c3
-rw-r--r--src/vnet/unix/tapcli.c7
18 files changed, 22 insertions, 506 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index 145221a902b..ee63f76b0d4 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -373,23 +373,6 @@ CLIB_MULTIARCH_FN (dpdk_buffer_free_no_next) (vlib_main_t * vm, u32 * buffers,
}
#ifndef CLIB_MARCH_VARIANT
-static void
-dpdk_packet_template_init (vlib_main_t * vm,
- void *vt,
- void *packet_data,
- uword n_packet_data_bytes,
- uword min_n_buffers_each_alloc, u8 * name)
-{
- vlib_packet_template_t *t = (vlib_packet_template_t *) vt;
-
- vlib_worker_thread_barrier_sync (vm);
- clib_memset (t, 0, sizeof (t[0]));
-
- vec_add (t->packet_data, packet_data, n_packet_data_bytes);
-
- vlib_worker_thread_barrier_release (vm);
-}
-
clib_error_t *
dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size,
u32 num_elts, u32 pool_priv_size, u16 cache_size, u8 numa,
@@ -626,7 +609,6 @@ VLIB_BUFFER_REGISTER_CALLBACKS (dpdk, static) = {
.vlib_buffer_fill_free_list_cb = &dpdk_buffer_fill_free_list,
.vlib_buffer_free_cb = &dpdk_buffer_free,
.vlib_buffer_free_no_next_cb = &dpdk_buffer_free_no_next,
- .vlib_packet_template_init_cb = &dpdk_packet_template_init,
.vlib_buffer_delete_free_list_cb = &dpdk_buffer_delete_free_list,
};
/* *INDENT-ON* */
diff --git a/src/vlib/CMakeLists.txt b/src/vlib/CMakeLists.txt
index 2209923547a..86fc965ba97 100644
--- a/src/vlib/CMakeLists.txt
+++ b/src/vlib/CMakeLists.txt
@@ -47,7 +47,6 @@ endif()
add_vpp_library(vlib
SOURCES
buffer.c
- buffer_serialize.c
cli.c
counter.c
error.c
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index 3c117c1523f..d024aba1e0f 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -661,26 +661,6 @@ vlib_buffer_free_no_next_internal (vlib_main_t * vm, u32 * buffers,
0);
}
-/* Copy template packet data into buffers as they are allocated. */
-static void __attribute__ ((unused))
-vlib_packet_template_buffer_init (vlib_main_t * vm,
- vlib_buffer_free_list_t * fl,
- u32 * buffers, u32 n_buffers)
-{
- vlib_packet_template_t *t =
- uword_to_pointer (fl->buffer_init_function_opaque,
- vlib_packet_template_t *);
- uword i;
-
- for (i = 0; i < n_buffers; i++)
- {
- vlib_buffer_t *b = vlib_get_buffer (vm, buffers[i]);
- ASSERT (b->current_length == vec_len (t->packet_data));
- clib_memcpy_fast (vlib_buffer_get_current (b), t->packet_data,
- b->current_length);
- }
-}
-
void
vlib_packet_template_init (vlib_main_t * vm,
vlib_packet_template_t * t,
@@ -688,20 +668,12 @@ vlib_packet_template_init (vlib_main_t * vm,
uword n_packet_data_bytes,
uword min_n_buffers_each_alloc, char *fmt, ...)
{
- vlib_buffer_main_t *bm = &buffer_main;
va_list va;
- u8 *name;
- vlib_buffer_free_list_t *fl;
va_start (va, fmt);
- name = va_format (0, fmt, &va);
+ t->name = va_format (0, fmt, &va);
va_end (va);
- if (bm->cb.vlib_packet_template_init_cb)
- bm->cb.vlib_packet_template_init_cb (vm, (void *) t, packet_data,
- n_packet_data_bytes,
- min_n_buffers_each_alloc, name);
-
vlib_worker_thread_barrier_sync (vm);
clib_memset (t, 0, sizeof (t[0]));
@@ -709,23 +681,6 @@ vlib_packet_template_init (vlib_main_t * vm,
vec_add (t->packet_data, packet_data, n_packet_data_bytes);
t->min_n_buffers_each_alloc = min_n_buffers_each_alloc;
- t->free_list_index = vlib_buffer_create_free_list_helper
- (vm, n_packet_data_bytes,
- /* is_public */ 1,
- /* is_default */ 0,
- name);
-
- ASSERT (t->free_list_index != 0);
- fl = vlib_buffer_get_free_list (vm, t->free_list_index);
- fl->min_n_buffers_each_alloc = t->min_n_buffers_each_alloc;
-
- fl->buffer_init_function = vlib_packet_template_buffer_init;
- fl->buffer_init_function_opaque = pointer_to_uword (t);
-
- fl->buffer_init_template.current_data = 0;
- fl->buffer_init_template.current_length = n_packet_data_bytes;
- fl->buffer_init_template.flags = 0;
- fl->buffer_init_template.n_add_refs = 0;
vlib_worker_thread_barrier_release (vm);
}
@@ -749,23 +704,6 @@ vlib_packet_template_get_packet (vlib_main_t * vm,
return b->data;
}
-void
-vlib_packet_template_get_packet_helper (vlib_main_t * vm,
- vlib_packet_template_t * t)
-{
- word n = t->min_n_buffers_each_alloc;
- word l = vec_len (t->packet_data);
- word n_alloc;
-
- ASSERT (l > 0);
- ASSERT (vec_len (t->free_buffers) == 0);
-
- vec_validate (t->free_buffers, n - 1);
- n_alloc = vlib_buffer_alloc_from_free_list (vm, t->free_buffers,
- n, t->free_list_index);
- _vec_len (t->free_buffers) = n_alloc;
-}
-
/* Append given data to end of buffer, possibly allocating new buffers. */
u32
vlib_buffer_add_data (vlib_main_t * vm,
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index ceab94f25fd..2c8d5a046a7 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -407,12 +407,6 @@ typedef struct
vlib_buffer_fill_free_list_cb_t *vlib_buffer_fill_free_list_cb;
vlib_buffer_free_cb_t *vlib_buffer_free_cb;
vlib_buffer_free_no_next_cb_t *vlib_buffer_free_no_next_cb;
- 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,
vlib_buffer_free_list_index_t
free_list_index);
@@ -478,61 +472,8 @@ u8 vlib_buffer_register_physmem_map (struct vlib_main_t * vm,
clib_error_t *vlib_buffer_main_init (struct vlib_main_t *vm);
-typedef struct
-{
- struct vlib_main_t *vlib_main;
-
- u32 first_buffer, last_buffer;
-
- union
- {
- struct
- {
- /* Total accumulated bytes in chain starting with first_buffer. */
- u32 n_total_data_bytes;
-
- /* Max number of bytes to accumulate in chain starting with first_buffer.
- As this limit is reached buffers are enqueued to next node. */
- u32 max_n_data_bytes_per_chain;
-
- /* Next node to enqueue buffers to relative to current process node. */
- u32 next_index;
-
- /* Free list to use to allocate new buffers. */
- vlib_buffer_free_list_index_t free_list_index;
- } tx;
-
- struct
- {
- /* CLIB fifo of buffer indices waiting to be unserialized. */
- u32 *buffer_fifo;
-
- /* Event type used to signal that RX buffers have been added to fifo. */
- uword ready_one_time_event;
- } rx;
- };
-} vlib_serialize_buffer_main_t;
-
-void serialize_open_vlib_buffer (serialize_main_t * m, struct vlib_main_t *vm,
- vlib_serialize_buffer_main_t * sm);
-void unserialize_open_vlib_buffer (serialize_main_t * m,
- struct vlib_main_t *vm,
- vlib_serialize_buffer_main_t * sm);
-
-u32 serialize_close_vlib_buffer (serialize_main_t * m);
-void unserialize_close_vlib_buffer (serialize_main_t * m);
-void *vlib_set_buffer_free_callback (struct vlib_main_t *vm, void *fp);
-always_inline u32
-serialize_vlib_buffer_n_bytes (serialize_main_t * m)
-{
- serialize_stream_t *s = &m->stream;
- vlib_serialize_buffer_main_t *sm
- = uword_to_pointer (m->stream.data_function_opaque,
- vlib_serialize_buffer_main_t *);
- return sm->tx.n_total_data_bytes + s->current_buffer_index +
- vec_len (s->overflow_buffer);
-}
+void *vlib_set_buffer_free_callback (struct vlib_main_t *vm, void *fp);
/*
*/
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index c201fd672a5..54fc1f61598 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -340,28 +340,6 @@ vlib_buffer_get_current_pa (vlib_main_t * vm, vlib_buffer_t * b)
vlib_prefetch_buffer_header (_b, type); \
} while (0)
-#if 0
-/* Iterate over known allocated vlib bufs. You probably do not want
- * to do this!
- @param vm the vlib_main_t
- @param bi found allocated buffer index
- @param body operation to perform on buffer index
- function executes body for each allocated buffer index
- */
-#define vlib_buffer_foreach_allocated(vm,bi,body) \
-do { \
- vlib_main_t * _vmain = (vm); \
- vlib_buffer_main_t * _bmain = &_vmain->buffer_main; \
- hash_pair_t * _vbpair; \
- hash_foreach_pair(_vbpair, _bmain->buffer_known_hash, ({ \
- if (VLIB_BUFFER_KNOWN_ALLOCATED == _vbpair->value[0]) { \
- (bi) = _vbpair->key; \
- body; \
- } \
- })); \
-} while (0)
-#endif
-
typedef enum
{
/* Index is unknown. */
@@ -693,31 +671,6 @@ vlib_buffer_free_list_buffer_size (vlib_main_t * vm,
return f->n_data_bytes;
}
-void vlib_aligned_memcpy (void *_dst, void *_src, int n_bytes);
-
-/* Reasonably fast buffer copy routine. */
-always_inline void
-vlib_copy_buffers (u32 * dst, u32 * src, u32 n)
-{
- while (n >= 4)
- {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst += 4;
- src += 4;
- n -= 4;
- }
- while (n > 0)
- {
- dst[0] = src[0];
- dst += 1;
- src += 1;
- n -= 1;
- }
-}
-
/* Append given data to end of buffer, possibly allocating new buffers. */
u32 vlib_buffer_add_data (vlib_main_t * vm,
vlib_buffer_free_list_index_t free_list_index,
@@ -1017,6 +970,8 @@ typedef struct
vlib_buffer_free_list_index_t free_list_index;
u32 *free_buffers;
+
+ u8 *name;
} vlib_packet_template_t;
void vlib_packet_template_get_packet_helper (vlib_main_t * vm,
@@ -1039,36 +994,6 @@ vlib_packet_template_free (vlib_main_t * vm, vlib_packet_template_t * t)
vec_free (t->packet_data);
}
-always_inline u32
-unserialize_vlib_buffer_n_bytes (serialize_main_t * m)
-{
- serialize_stream_t *s = &m->stream;
- vlib_serialize_buffer_main_t *sm
- = uword_to_pointer (m->stream.data_function_opaque,
- vlib_serialize_buffer_main_t *);
- vlib_main_t *vm = sm->vlib_main;
- u32 n, *f;
-
- n = s->n_buffer_bytes - s->current_buffer_index;
- if (sm->last_buffer != ~0)
- {
- vlib_buffer_t *b = vlib_get_buffer (vm, sm->last_buffer);
- while (b->flags & VLIB_BUFFER_NEXT_PRESENT)
- {
- b = vlib_get_buffer (vm, b->next_buffer);
- n += b->current_length;
- }
- }
-
- /* *INDENT-OFF* */
- clib_fifo_foreach (f, sm->rx.buffer_fifo, ({
- n += vlib_buffer_index_length_in_chain (vm, f[0]);
- }));
-/* *INDENT-ON* */
-
- return n;
-}
-
/* Set a buffer quickly into "uninitialized" state. We want this to
be extremely cheap and arrange for all fields that need to be
initialized to be in the first 128 bits of the buffer. */
diff --git a/src/vlib/buffer_serialize.c b/src/vlib/buffer_serialize.c
deleted file mode 100644
index 5696882ae0d..00000000000
--- a/src/vlib/buffer_serialize.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * buffer.c: allocate/free network buffers.
- *
- * Copyright (c) 2008 Eliot Dresselhaus
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <vlib/vlib.h>
-
-static void
-vlib_serialize_tx (serialize_main_header_t * m, serialize_stream_t * s)
-{
- vlib_main_t *vm;
- vlib_serialize_buffer_main_t *sm;
- uword n, n_bytes_to_write;
- vlib_buffer_t *last;
-
- n_bytes_to_write = s->current_buffer_index;
- sm =
- uword_to_pointer (s->data_function_opaque,
- vlib_serialize_buffer_main_t *);
- vm = sm->vlib_main;
-
- ASSERT (sm->tx.max_n_data_bytes_per_chain > 0);
- if (serialize_stream_is_end_of_stream (s)
- || sm->tx.n_total_data_bytes + n_bytes_to_write >
- sm->tx.max_n_data_bytes_per_chain)
- {
- vlib_process_t *p = vlib_get_current_process (vm);
-
- last = vlib_get_buffer (vm, sm->last_buffer);
- last->current_length = n_bytes_to_write;
-
- vlib_set_next_frame_buffer (vm, &p->node_runtime, sm->tx.next_index,
- sm->first_buffer);
-
- sm->first_buffer = sm->last_buffer = ~0;
- sm->tx.n_total_data_bytes = 0;
- }
-
- else if (n_bytes_to_write == 0 && s->n_buffer_bytes == 0)
- {
- ASSERT (sm->first_buffer == ~0);
- ASSERT (sm->last_buffer == ~0);
- n =
- vlib_buffer_alloc_from_free_list (vm, &sm->first_buffer, 1,
- sm->tx.free_list_index);
- if (n != 1)
- serialize_error (m,
- clib_error_create
- ("vlib_buffer_alloc_from_free_list fails"));
- sm->last_buffer = sm->first_buffer;
- s->n_buffer_bytes =
- vlib_buffer_free_list_buffer_size (vm, sm->tx.free_list_index);
- }
-
- if (n_bytes_to_write > 0)
- {
- vlib_buffer_t *prev = vlib_get_buffer (vm, sm->last_buffer);
- n =
- vlib_buffer_alloc_from_free_list (vm, &sm->last_buffer, 1,
- sm->tx.free_list_index);
- if (n != 1)
- serialize_error (m,
- clib_error_create
- ("vlib_buffer_alloc_from_free_list fails"));
- sm->tx.n_total_data_bytes += n_bytes_to_write;
- prev->current_length = n_bytes_to_write;
- prev->next_buffer = sm->last_buffer;
- prev->flags |= VLIB_BUFFER_NEXT_PRESENT;
- }
-
- if (sm->last_buffer != ~0)
- {
- last = vlib_get_buffer (vm, sm->last_buffer);
- s->buffer = vlib_buffer_get_current (last);
- s->current_buffer_index = 0;
- ASSERT (last->current_data == s->current_buffer_index);
- }
-}
-
-static void
-vlib_serialize_rx (serialize_main_header_t * m, serialize_stream_t * s)
-{
- vlib_main_t *vm;
- vlib_serialize_buffer_main_t *sm;
- vlib_buffer_t *last;
-
- sm =
- uword_to_pointer (s->data_function_opaque,
- vlib_serialize_buffer_main_t *);
- vm = sm->vlib_main;
-
- if (serialize_stream_is_end_of_stream (s))
- return;
-
- if (sm->last_buffer != ~0)
- {
- last = vlib_get_buffer (vm, sm->last_buffer);
-
- if (last->flags & VLIB_BUFFER_NEXT_PRESENT)
- sm->last_buffer = last->next_buffer;
- else
- {
- vlib_buffer_free (vm, &sm->first_buffer, /* count */ 1);
- sm->first_buffer = sm->last_buffer = ~0;
- }
- }
-
- if (sm->last_buffer == ~0)
- {
- while (clib_fifo_elts (sm->rx.buffer_fifo) == 0)
- {
- sm->rx.ready_one_time_event =
- vlib_process_create_one_time_event (vm, vlib_current_process (vm),
- ~0);
- vlib_process_wait_for_one_time_event (vm, /* no event data */ 0,
- sm->rx.ready_one_time_event);
- }
-
- clib_fifo_sub1 (sm->rx.buffer_fifo, sm->first_buffer);
- sm->last_buffer = sm->first_buffer;
- }
-
- ASSERT (sm->last_buffer != ~0);
-
- last = vlib_get_buffer (vm, sm->last_buffer);
- s->current_buffer_index = 0;
- s->buffer = vlib_buffer_get_current (last);
- s->n_buffer_bytes = last->current_length;
-}
-
-static void
-serialize_open_vlib_helper (serialize_main_t * m,
- vlib_main_t * vm,
- vlib_serialize_buffer_main_t * sm, uword is_read)
-{
- /* Initialize serialize main but save overflow buffer for re-use between calls. */
- {
- u8 *save = m->stream.overflow_buffer;
- clib_memset (m, 0, sizeof (m[0]));
- m->stream.overflow_buffer = save;
- if (save)
- _vec_len (save) = 0;
- }
-
- sm->first_buffer = sm->last_buffer = ~0;
- if (is_read)
- clib_fifo_reset (sm->rx.buffer_fifo);
- else
- sm->tx.n_total_data_bytes = 0;
- sm->vlib_main = vm;
- m->header.data_function = is_read ? vlib_serialize_rx : vlib_serialize_tx;
- m->stream.data_function_opaque = pointer_to_uword (sm);
-}
-
-void
-serialize_open_vlib_buffer (serialize_main_t * m, vlib_main_t * vm,
- vlib_serialize_buffer_main_t * sm)
-{
- serialize_open_vlib_helper (m, vm, sm, /* is_read */ 0);
-}
-
-void
-unserialize_open_vlib_buffer (serialize_main_t * m, vlib_main_t * vm,
- vlib_serialize_buffer_main_t * sm)
-{
- serialize_open_vlib_helper (m, vm, sm, /* is_read */ 1);
-}
-
-u32
-serialize_close_vlib_buffer (serialize_main_t * m)
-{
- vlib_serialize_buffer_main_t *sm
- = uword_to_pointer (m->stream.data_function_opaque,
- vlib_serialize_buffer_main_t *);
- vlib_buffer_t *last;
- serialize_stream_t *s = &m->stream;
-
- last = vlib_get_buffer (sm->vlib_main, sm->last_buffer);
- last->current_length = s->current_buffer_index;
-
- if (vec_len (s->overflow_buffer) > 0)
- {
- sm->last_buffer
- = vlib_buffer_add_data (sm->vlib_main, sm->tx.free_list_index,
- sm->last_buffer,
- s->overflow_buffer,
- vec_len (s->overflow_buffer));
- _vec_len (s->overflow_buffer) = 0;
- }
-
- return sm->first_buffer;
-}
-
-void
-unserialize_close_vlib_buffer (serialize_main_t * m)
-{
- vlib_serialize_buffer_main_t *sm
- = uword_to_pointer (m->stream.data_function_opaque,
- vlib_serialize_buffer_main_t *);
- if (sm->first_buffer != ~0)
- vlib_buffer_free_one (sm->vlib_main, sm->first_buffer);
- clib_fifo_reset (sm->rx.buffer_fifo);
- if (m->stream.overflow_buffer)
- _vec_len (m->stream.overflow_buffer) = 0;
-}
-
-/** @endcond */
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 97aa170c0a6..243a38a42b1 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -192,8 +192,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u8 *block_start = apif->rx_ring + block * block_size;
uword n_trace = vlib_get_trace_count (vm, node);
u32 thread_index = vm->thread_index;
- u32 n_buffer_bytes = vlib_buffer_free_list_buffer_size (vm,
- VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ u32 n_buffer_bytes = VLIB_BUFFER_DATA_SIZE;
u32 min_bufs = apif->rx_req->tp_frame_size / n_buffer_bytes;
if (apif->per_interface_next_index != ~0)
diff --git a/src/vnet/devices/netmap/node.c b/src/vnet/devices/netmap/node.c
index dde706f20c7..577d4a394b2 100644
--- a/src/vnet/devices/netmap/node.c
+++ b/src/vnet/devices/netmap/node.c
@@ -99,8 +99,7 @@ netmap_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
struct netmap_ring *ring;
int cur_ring;
u32 thread_index = vm->thread_index;
- u32 n_buffer_bytes = vlib_buffer_free_list_buffer_size (vm,
- VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ u32 n_buffer_bytes = VLIB_BUFFER_DATA_SIZE;
if (nif->per_interface_next_index != ~0)
next_index = nif->per_interface_next_index;
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 97303ce3791..812f9d3f6ab 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -349,9 +349,8 @@ vhost_user_if_input (vlib_main_t * vm,
{
u32 curr_len = cpu->rx_buffers_len;
cpu->rx_buffers_len +=
- vlib_buffer_alloc_from_free_list (vm, cpu->rx_buffers + curr_len,
- VHOST_USER_RX_BUFFERS_N - curr_len,
- VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ vlib_buffer_alloc (vm, cpu->rx_buffers + curr_len,
+ VHOST_USER_RX_BUFFERS_N - curr_len);
if (PREDICT_FALSE
(cpu->rx_buffers_len < VHOST_USER_RX_BUFFER_STARVATION))
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index 9be57207572..a7ce2798f2a 100755
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -2758,10 +2758,7 @@ ip6_neighbor_send_mldpv2_report (u32 sw_if_index)
return;
/* send report now - build a mldpv2 report packet */
- n_allocated = vlib_buffer_alloc_from_free_list (vm,
- &bo0,
- n_to_alloc,
- VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ n_allocated = vlib_buffer_alloc (vm, &bo0, n_to_alloc);
if (PREDICT_FALSE (n_allocated == 0))
{
clib_warning ("buffer allocation failure");
@@ -2954,8 +2951,7 @@ ip6_neighbor_process_timer_event (vlib_main_t * vm,
radv_info->last_multicast_time = now;
/* send advert now - build a "solicted" router advert with unspecified source address */
- n_allocated = vlib_buffer_alloc_from_free_list
- (vm, &bo0, n_to_alloc, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ n_allocated = vlib_buffer_alloc (vm, &bo0, n_to_alloc);
if (PREDICT_FALSE(n_allocated == 0))
{
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c
index 8b543d3ca38..a09107c50c5 100644
--- a/src/vnet/pg/cli.c
+++ b/src/vnet/pg/cli.c
@@ -305,7 +305,7 @@ new_stream (vlib_main_t * vm,
s.sw_if_index[VLIB_RX] = s.sw_if_index[VLIB_TX] = ~0;
s.node_index = ~0;
s.max_packet_bytes = s.min_packet_bytes = 64;
- s.buffer_bytes = VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES;
+ s.buffer_bytes = VLIB_BUFFER_DATA_SIZE;
s.if_id = 0;
pcap_file_name = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index ee6aad4995e..4db4b45edcb 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -1190,10 +1190,7 @@ pg_stream_fill_helper (pg_main_t * pg,
uword is_start_of_packet = bi == s->buffer_indices;
u32 n_allocated;
- n_allocated = vlib_buffer_alloc_from_free_list (vm,
- buffers,
- n_alloc,
- bi->free_list_index);
+ n_allocated = vlib_buffer_alloc (vm, buffers, n_alloc);
if (n_allocated == 0)
return 0;
@@ -1525,12 +1522,13 @@ pg_generate_packets (vlib_node_runtime_t * node,
head = clib_fifo_head (bi0->buffer_fifo);
if (head + n_this_frame <= end)
- vlib_copy_buffers (to_next, head, n_this_frame);
+ clib_memcpy_fast (to_next, head, n_this_frame * sizeof (u32));
else
{
u32 n = end - head;
- vlib_copy_buffers (to_next + 0, head, n);
- vlib_copy_buffers (to_next + n, start, n_this_frame - n);
+ clib_memcpy_fast (to_next + 0, head, n * sizeof (u32));
+ clib_memcpy_fast (to_next + n, start,
+ (n_this_frame - n) * sizeof (u32));
}
vec_foreach (bi, s->buffer_indices)
diff --git a/src/vnet/pg/pg.h b/src/vnet/pg/pg.h
index 99652b43981..0b06803d384 100644
--- a/src/vnet/pg/pg.h
+++ b/src/vnet/pg/pg.h
@@ -89,8 +89,6 @@ typedef struct
/* Buffers pre-initialized with fixed buffer data for this stream. */
u32 *buffer_fifo;
- /* Buffer free list for this buffer index in stream. */
- vlib_buffer_free_list_index_t free_list_index;
} pg_buffer_index_t;
typedef struct pg_stream_t
diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c
index bf0eac370aa..ddd15d66406 100644
--- a/src/vnet/pg/stream.c
+++ b/src/vnet/pg/stream.c
@@ -435,17 +435,13 @@ pg_stream_add (pg_main_t * pg, pg_stream_t * s_init)
s->last_increment_packet_size = s->min_packet_bytes;
{
- pg_buffer_index_t *bi;
int n;
- s->buffer_bytes = VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES;
+ s->buffer_bytes = VLIB_BUFFER_DATA_SIZE;
n = s->max_packet_bytes / s->buffer_bytes;
n += (s->max_packet_bytes % s->buffer_bytes) != 0;
vec_resize (s->buffer_indices, n);
-
- vec_foreach (bi, s->buffer_indices)
- bi->free_list_index = VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX;
}
/* Find an interface to use. */
diff --git a/src/vnet/sctp/sctp.c b/src/vnet/sctp/sctp.c
index 10ec7700a2c..86aef88f432 100644
--- a/src/vnet/sctp/sctp.c
+++ b/src/vnet/sctp/sctp.c
@@ -892,8 +892,7 @@ sctp_main_enable (vlib_main_t * vm)
vec_validate (tm->ip_lookup_tx_frames[0], num_threads - 1);
vec_validate (tm->ip_lookup_tx_frames[1], num_threads - 1);
- tm->bytes_per_buffer = vlib_buffer_free_list_buffer_size
- (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ tm->bytes_per_buffer = VLIB_BUFFER_DATA_SIZE;
vec_validate (tm->time_now, num_threads - 1);
return error;
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 45018daf45a..a01f01c8bcb 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -541,8 +541,7 @@ session_tx_set_dequeue_params (vlib_main_t * vm, session_tx_context_t * ctx,
ctx->max_len_to_snd = max_segs * ctx->snd_mss;
}
- n_bytes_per_buf = vlib_buffer_free_list_buffer_size (vm,
- VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ n_bytes_per_buf = VLIB_BUFFER_DATA_SIZE;
ASSERT (n_bytes_per_buf > MAX_HDRS_LEN);
n_bytes_per_seg = MAX_HDRS_LEN + ctx->snd_mss;
ctx->n_bufs_per_seg = ceil ((f64) n_bytes_per_seg / n_bytes_per_buf);
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 7f6a087b2f3..8c3e8b10df0 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1445,8 +1445,7 @@ tcp_main_enable (vlib_main_t * vm)
tcp_initialize_timer_wheels (tm);
- tm->bytes_per_buffer = vlib_buffer_free_list_buffer_size
- (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ tm->bytes_per_buffer = VLIB_BUFFER_DATA_SIZE;
return error;
}
diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c
index 83ac33f49dc..b4df8e84fe4 100644
--- a/src/vnet/unix/tapcli.c
+++ b/src/vnet/unix/tapcli.c
@@ -297,11 +297,8 @@ tapcli_rx_iface (vlib_main_t * vm,
{
uword len = vec_len (tm->threads[thread_index].rx_buffers);
_vec_len (tm->threads[thread_index].rx_buffers) +=
- vlib_buffer_alloc_from_free_list (vm,
- &tm->threads[thread_index].
- rx_buffers[len],
- VLIB_FRAME_SIZE - len,
- VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ vlib_buffer_alloc (vm, &tm->threads[thread_index].rx_buffers[len],
+ VLIB_FRAME_SIZE - len);
if (PREDICT_FALSE
(vec_len (tm->threads[thread_index].rx_buffers) <
tm->mtu_buffers))