aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/pg/input.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-02-06 14:22:32 +0100
committerFlorin Coras <florin.coras@gmail.com>2019-02-06 18:00:17 +0000
commit5de3fec531691a81b3f77ed965488dc8dbf1e9a1 (patch)
tree57b8dde55804ab52a6ef40767f1fe705c1968d2a /src/vnet/pg/input.c
parent672ab690182f3d4941d2640c68bb6ced38880bc3 (diff)
buffers: make buffer data size configurable from startup config
Example: buffers { default data-size 1536 } Change-Id: I5b4436850ca18025c9fdcfc7ed648c2c2732d660 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/pg/input.c')
-rw-r--r--src/vnet/pg/input.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index 6088b91271e..6ef813f5807 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -1199,6 +1199,7 @@ pg_stream_fill_replay (pg_main_t * pg, pg_stream_t * s, u32 n_alloc)
u32 *buffers;
vlib_main_t *vm = vlib_get_main ();
vnet_main_t *vnm = vnet_get_main ();
+ u32 buf_sz = vlib_bufer_get_default_size (vm);
vnet_interface_main_t *im = &vnm->interface_main;
vnet_sw_interface_t *si;
@@ -1216,8 +1217,7 @@ pg_stream_fill_replay (pg_main_t * pg, pg_stream_t * s, u32 n_alloc)
u8 *d0;
d0 = vec_elt (s->replay_packet_templates, i);
- buffer_alloc_request += (vec_len (d0) + (VLIB_BUFFER_DATA_SIZE - 1))
- / VLIB_BUFFER_DATA_SIZE;
+ buffer_alloc_request += (vec_len (d0) + (buf_sz - 1)) / buf_sz;
i = ((i + 1) == l) ? 0 : i + 1;
n_left--;
@@ -1261,7 +1261,7 @@ pg_stream_fill_replay (pg_main_t * pg, pg_stream_t * s, u32 n_alloc)
/* Copy the data */
while (bytes_to_copy)
{
- bytes_this_chunk = clib_min (bytes_to_copy, VLIB_BUFFER_DATA_SIZE);
+ bytes_this_chunk = clib_min (bytes_to_copy, buf_sz);
ASSERT (current_buffer_index < vec_len (buffers));
b = vlib_get_buffer (vm, buffers[current_buffer_index]);
clib_memcpy_fast (b->data, d0 + data_offset, bytes_this_chunk);