aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/pg
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
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')
-rw-r--r--src/vnet/pg/cli.c2
-rw-r--r--src/vnet/pg/input.c6
-rw-r--r--src/vnet/pg/stream.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c
index bca05515379..4053887633d 100644
--- a/src/vnet/pg/cli.c
+++ b/src/vnet/pg/cli.c
@@ -341,7 +341,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_DATA_SIZE;
+ s.buffer_bytes = vlib_bufer_get_default_size (vm);
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 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);
diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c
index c91cacafe57..ba24912780b 100644
--- a/src/vnet/pg/stream.c
+++ b/src/vnet/pg/stream.c
@@ -437,7 +437,7 @@ pg_stream_add (pg_main_t * pg, pg_stream_t * s_init)
{
int n;
- s->buffer_bytes = VLIB_BUFFER_DATA_SIZE;
+ s->buffer_bytes = vlib_bufer_get_default_size (vm);
n = s->max_packet_bytes / s->buffer_bytes;
n += (s->max_packet_bytes % s->buffer_bytes) != 0;