aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/plugins/avf/device.c2
-rw-r--r--src/plugins/dpdk/buffer.c2
-rw-r--r--src/plugins/marvell/pp2/pp2.c2
-rw-r--r--src/plugins/memif/node.c4
-rw-r--r--src/plugins/pppoe/pppoe.h2
-rw-r--r--src/plugins/vmxnet3/vmxnet3.h5
-rw-r--r--src/vlib/buffer.c41
-rw-r--r--src/vlib/buffer.h4
-rw-r--r--src/vlib/buffer_funcs.h19
-rw-r--r--src/vlib/unix/mc_socket.c8
-rw-r--r--src/vnet/devices/af_packet/node.c2
-rw-r--r--src/vnet/devices/netmap/node.c2
-rw-r--r--src/vnet/devices/virtio/node.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c5
-rw-r--r--src/vnet/dhcp/dhcp6_proxy_node.c2
-rw-r--r--src/vnet/ip/ip_frag.c3
-rwxr-xr-xsrc/vnet/ip/ping.c5
-rw-r--r--src/vnet/ip/punt.c2
-rw-r--r--src/vnet/ipfix-export/flow_report.c2
-rw-r--r--src/vnet/pg/cli.c2
-rw-r--r--src/vnet/pg/input.c6
-rw-r--r--src/vnet/pg/stream.c2
-rw-r--r--src/vnet/sctp/sctp.c2
-rw-r--r--src/vnet/session/session_node.c2
-rw-r--r--src/vnet/tcp/tcp.c2
-rw-r--r--src/vnet/unix/tuntap.c4
-rw-r--r--src/vpp/conf/startup.conf4
27 files changed, 80 insertions, 58 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 039a8203edb..ede4cda69bf 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -594,7 +594,7 @@ avf_op_config_vsi_queues (vlib_main_t * vm, avf_device_t * ad)
{
avf_rxq_t *q = vec_elt_at_index (ad->rxqs, i);
rxq->ring_len = q->size;
- rxq->databuffer_size = VLIB_BUFFER_DATA_SIZE;
+ rxq->databuffer_size = vlib_bufer_get_default_size (vm);
rxq->dma_ring_addr = avf_dma_addr (vm, ad, (void *) q->descs);
avf_reg_write (ad, AVF_QRX_TAIL (i), q->size - 1);
}
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index 1894df42805..d946a0e996d 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -74,7 +74,7 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
/* Call the mempool priv initializer */
priv.mbuf_data_room_size = VLIB_BUFFER_PRE_DATA_SIZE +
- VLIB_BUFFER_DATA_SIZE;
+ vlib_bufer_get_default_size (vm);
priv.mbuf_priv_size = VLIB_BUFFER_HDR_SIZE;
rte_pktmbuf_pool_init (mp, &priv);
rte_pktmbuf_pool_init (nmp, &priv);
diff --git a/src/plugins/marvell/pp2/pp2.c b/src/plugins/marvell/pp2/pp2.c
index ec35a0d92b7..d84d12ffa45 100644
--- a/src/plugins/marvell/pp2/pp2.c
+++ b/src/plugins/marvell/pp2/pp2.c
@@ -244,7 +244,7 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args)
/* FIXME bpool bit select per pp */
s = format (s, "pool-%d:%d%c", pp2_id, pp2_id + 8, 0);
bpool_params.match = (char *) s;
- bpool_params.buff_len = VLIB_BUFFER_DATA_SIZE;
+ bpool_params.buff_len = vlib_bufer_get_default_size (vm);
/* FIXME +64 ? */
if (pp2_bpool_init (&bpool_params, &ppif->inqs[0].bpool))
{
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 28fd10ef7b5..0fd09883032 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -180,7 +180,7 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
memif_main_t *mm = &memif_main;
memif_ring_t *ring;
memif_queue_t *mq;
- u16 buffer_size = VLIB_BUFFER_DATA_SIZE;
+ u16 buffer_size = vlib_bufer_get_default_size (vm);
uword n_trace = vlib_get_trace_count (vm, node);
u16 nexts[MEMIF_RX_VECTOR_SZ], *next = nexts;
u32 _to_next_bufs[MEMIF_RX_VECTOR_SZ], *to_next_bufs = _to_next_bufs, *bi;
@@ -570,7 +570,7 @@ memif_device_input_zc_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
/* asume that somebody will want to add ethernet header on the packet
so start with IP header at offset 14 */
start_offset = (mode == MEMIF_INTERFACE_MODE_IP) ? 14 : 0;
- buffer_length = VLIB_BUFFER_DATA_SIZE - start_offset;
+ buffer_length = vlib_bufer_get_default_size (vm) - start_offset;
cur_slot = mq->last_tail;
last_slot = ring->tail;
diff --git a/src/plugins/pppoe/pppoe.h b/src/plugins/pppoe/pppoe.h
index f010750f420..5e8abfb998f 100644
--- a/src/plugins/pppoe/pppoe.h
+++ b/src/plugins/pppoe/pppoe.h
@@ -96,7 +96,7 @@ typedef enum
#define MTU 1500
-#define MTU_BUFFERS ((MTU + VLIB_BUFFER_DATA_SIZE - 1) / VLIB_BUFFER_DATA_SIZE)
+#define MTU_BUFFERS ((MTU + vlib_bufer_get_default_size(vm) - 1) / vlib_bufer_get_default_size(vm))
#define NUM_BUFFERS_TO_ALLOC 32
/*
diff --git a/src/plugins/vmxnet3/vmxnet3.h b/src/plugins/vmxnet3/vmxnet3.h
index 3333f96b85b..dbe57b331c3 100644
--- a/src/plugins/vmxnet3/vmxnet3.h
+++ b/src/plugins/vmxnet3/vmxnet3.h
@@ -615,7 +615,7 @@ vmxnet3_rxq_refill_ring0 (vlib_main_t * vm, vmxnet3_device_t * vd,
vlib_buffer_t *b = vlib_get_buffer (vm, ring->bufs[ring->produce]);
rxd = &rxq->rx_desc[0][ring->produce];
rxd->address = vlib_buffer_get_pa (vm, b);
- rxd->flags = ring->gen | VLIB_BUFFER_DATA_SIZE;
+ rxd->flags = ring->gen | vlib_bufer_get_default_size (vm);
vmxnet3_rx_ring_advance_produce (rxq, ring);
ring->fill++;
@@ -660,7 +660,8 @@ vmxnet3_rxq_refill_ring1 (vlib_main_t * vm, vmxnet3_device_t * vd,
vlib_buffer_t *b = vlib_get_buffer (vm, ring->bufs[ring->produce]);
rxd = &rxq->rx_desc[1][ring->produce];
rxd->address = vlib_buffer_get_pa (vm, b);
- rxd->flags = ring->gen | VLIB_BUFFER_DATA_SIZE | VMXNET3_RXF_BTYPE;
+ rxd->flags =
+ ring->gen | vlib_bufer_get_default_size (vm) | VMXNET3_RXF_BTYPE;
vmxnet3_rx_ring_advance_produce (rxq, ring);
ring->fill++;
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index 345cd5c564b..a45b9bf2fc7 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -192,9 +192,9 @@ vlib_validate_buffer_helper (vlib_main_t * vm,
if ((signed) b->current_data < (signed) -VLIB_BUFFER_PRE_DATA_SIZE)
return format (0, "current data %d before pre-data", b->current_data);
- if (b->current_data + b->current_length > VLIB_BUFFER_DATA_SIZE)
+ if (b->current_data + b->current_length > vlib_bufer_get_default_size (vm))
return format (0, "%d-%d beyond end of buffer %d", b->current_data,
- b->current_length, VLIB_BUFFER_DATA_SIZE);
+ b->current_length, vlib_bufer_get_default_size (vm));
if (follow_buffer_next && (b->flags & VLIB_BUFFER_NEXT_PRESENT))
{
@@ -407,7 +407,7 @@ vlib_buffer_add_data (vlib_main_t * vm, u32 * buffer_index, void *data,
d = data;
n_left = n_data_bytes;
- n_buffer_bytes = VLIB_BUFFER_DATA_SIZE;
+ n_buffer_bytes = vlib_bufer_get_default_size (vm);
b = vlib_get_buffer (vm, bi);
b->flags &= ~VLIB_BUFFER_TOTAL_LENGTH_VALID;
@@ -455,7 +455,7 @@ vlib_buffer_chain_append_data_with_alloc (vlib_main_t * vm,
u16 data_len)
{
vlib_buffer_t *l = *last;
- u32 n_buffer_bytes = VLIB_BUFFER_DATA_SIZE;
+ u32 n_buffer_bytes = vlib_bufer_get_default_size (vm);
u16 copied = 0;
ASSERT (n_buffer_bytes >= l->current_length + l->current_data);
while (data_len)
@@ -655,7 +655,7 @@ vlib_buffer_main_init_numa_node (struct vlib_main_t *vm, u32 numa_node)
u32 buffers_per_numa;
u32 buffer_size = CLIB_CACHE_LINE_ROUND (bm->ext_hdr_size +
sizeof (vlib_buffer_t) +
- VLIB_BUFFER_DATA_SIZE);
+ vlib_bufer_get_default_size (vm));
u8 *name;
pagesize = clib_mem_get_default_hugepage_size ();
@@ -690,7 +690,21 @@ retry:
name = format (name, "default-numa-%d%c", numa_node, 0);
return vlib_buffer_pool_create (vm, numa_node, (char *) name,
- VLIB_BUFFER_DATA_SIZE, physmem_map_index);
+ vlib_bufer_get_default_size (vm),
+ physmem_map_index);
+}
+
+void
+vlib_buffer_main_alloc (vlib_main_t * vm)
+{
+ vlib_buffer_main_t *bm;
+
+ if (vm->buffer_main)
+ return;
+
+ vm->buffer_main = bm = clib_mem_alloc (sizeof (bm[0]));
+ clib_memset (vm->buffer_main, 0, sizeof (bm[0]));
+ bm->default_data_size = VLIB_BUFFER_DEFAULT_DATA_SIZE;
}
clib_error_t *
@@ -701,11 +715,7 @@ vlib_buffer_main_init (struct vlib_main_t *vm)
clib_bitmap_t *bmp = 0;
u32 numa_node;
- if (vm->buffer_main == 0)
- {
- vm->buffer_main = clib_mem_alloc (sizeof (bm[0]));
- clib_memset (vm->buffer_main, 0, sizeof (bm[0]));
- }
+ vlib_buffer_main_alloc (vm);
bm = vm->buffer_main;
bm->log_default = vlib_log_register_class ("buffer", 0);
@@ -741,11 +751,7 @@ vlib_buffers_configure (vlib_main_t * vm, unformat_input_t * input)
{
vlib_buffer_main_t *bm;
- if (vm->buffer_main == 0)
- {
- vm->buffer_main = clib_mem_alloc (sizeof (bm[0]));
- clib_memset (vm->buffer_main, 0, sizeof (bm[0]));
- }
+ vlib_buffer_main_alloc (vm);
bm = vm->buffer_main;
@@ -753,6 +759,9 @@ vlib_buffers_configure (vlib_main_t * vm, unformat_input_t * input)
{
if (unformat (input, "buffers-per-numa %u", &bm->buffers_per_numa))
;
+ else if (unformat (input, "default data-size %u",
+ &bm->default_data_size))
+ ;
else
return unformat_parse_error (input);
}
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index 1adde73d4ee..31baf5fd21e 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -48,9 +48,10 @@
#include <vlib/error.h> /* for vlib_error_t */
#include <vlib/config.h> /* for __PRE_DATA_SIZE */
-#define VLIB_BUFFER_DATA_SIZE (2048)
#define VLIB_BUFFER_PRE_DATA_SIZE __PRE_DATA_SIZE
+#define VLIB_BUFFER_DEFAULT_DATA_SIZE (2048)
+
/* Minimum buffer chain segment size. Does not apply to last buffer in chain.
Dataplane code can safely asume that specified amount of data is not split
into 2 chained buffers */
@@ -413,6 +414,7 @@ typedef struct
/* config */
u32 buffers_per_numa;
u16 ext_hdr_size;
+ u32 default_data_size;
/* logging */
vlib_log_class_t log_default;
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index 09ffd06428f..97b687b8cc6 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -56,16 +56,11 @@ vlib_buffer_validate (vlib_main_t * vm, vlib_buffer_t * b)
/* reference count in allocated buffer always must be 1 or higher */
ASSERT (b->ref_count > 0);
- /* verify that buffer pointer is from buffer memory range */
- ASSERT (pointer_to_uword (b) >= bm->buffer_mem_start);
- ASSERT (pointer_to_uword (b) < bm->buffer_mem_start + bm->buffer_mem_size -
- VLIB_BUFFER_DATA_SIZE);
-
/* verify that buffer pool index is valid */
bp = vec_elt_at_index (bm->buffer_pools, b->buffer_pool_index);
ASSERT (pointer_to_uword (b) >= bp->start);
ASSERT (pointer_to_uword (b) < bp->start + bp->size -
- VLIB_BUFFER_DATA_SIZE);
+ (bp->data_size + sizeof (vlib_buffer_t)));
}
always_inline void *
@@ -93,6 +88,12 @@ vlib_get_buffer (vlib_main_t * vm, u32 buffer_index)
return b;
}
+static_always_inline u32
+vlib_bufer_get_default_size (vlib_main_t * vm)
+{
+ return vm->buffer_main->default_data_size;
+}
+
static_always_inline void
vlib_buffer_copy_indices (u32 * dst, u32 * src, u32 n_indices)
{
@@ -1161,7 +1162,7 @@ vlib_buffer_chain_append_data (vlib_main_t * vm,
vlib_buffer_t * first,
vlib_buffer_t * last, void *data, u16 data_len)
{
- u32 n_buffer_bytes = VLIB_BUFFER_DATA_SIZE;
+ u32 n_buffer_bytes = vlib_bufer_get_default_size (vm);
ASSERT (n_buffer_bytes >= last->current_length + last->current_data);
u16 len = clib_min (data_len,
n_buffer_bytes - last->current_length -
@@ -1236,7 +1237,7 @@ vlib_buffer_chain_compress (vlib_main_t * vm,
}
u32 want_first_size = clib_min (VLIB_BUFFER_CLONE_HEAD_SIZE,
- VLIB_BUFFER_DATA_SIZE -
+ vlib_bufer_get_default_size (vm) -
first->current_data);
do
{
@@ -1283,7 +1284,7 @@ always_inline int
vlib_buffer_chain_linearize (vlib_main_t * vm, vlib_buffer_t * first)
{
vlib_buffer_t *b = first;
- u32 buf_len = VLIB_BUFFER_DATA_SIZE;
+ u32 buf_len = vlib_bufer_get_default_size (vm);
// free buffer chain starting from the second buffer
int free_count = (b->flags & VLIB_BUFFER_NEXT_PRESENT) != 0;
u32 chain_to_free = b->next_buffer;
diff --git a/src/vlib/unix/mc_socket.c b/src/vlib/unix/mc_socket.c
index aaf73ae5e1e..d4f4a7fe7e3 100644
--- a/src/vlib/unix/mc_socket.c
+++ b/src/vlib/unix/mc_socket.c
@@ -165,7 +165,7 @@ recvmsg_helper (mc_socket_main_t * msm,
vlib_main_t *vm = msm->mc_main.vlib_main;
vlib_buffer_t *b;
uword n_left, n_alloc, n_mtu, i, i_rx;
- const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
+ const uword buffer_size = vlib_bufer_get_default_size (vm);
word n_bytes_left;
/* Make sure we have at least a MTU worth of buffers. */
@@ -1011,8 +1011,10 @@ mc_socket_main_init (mc_socket_main_t * msm, char **intfc_probe_list,
}
msm->rx_mtu_n_bytes = mtu;
- msm->rx_mtu_n_buffers = msm->rx_mtu_n_bytes / VLIB_BUFFER_DATA_SIZE;
- msm->rx_mtu_n_buffers += (msm->rx_mtu_n_bytes % VLIB_BUFFER_DATA_SIZE) != 0;
+ msm->rx_mtu_n_buffers =
+ msm->rx_mtu_n_bytes / vlib_bufer_get_default_size (vm);
+ msm->rx_mtu_n_buffers +=
+ (msm->rx_mtu_n_bytes % vlib_bufer_get_default_size (vm)) != 0;
error = socket_setup (msm);
if (error)
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 243a38a42b1..2fa7708ef21 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -192,7 +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_DATA_SIZE;
+ u32 n_buffer_bytes = vlib_bufer_get_default_size (vm);
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 577d4a394b2..122d8c34c59 100644
--- a/src/vnet/devices/netmap/node.c
+++ b/src/vnet/devices/netmap/node.c
@@ -99,7 +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_DATA_SIZE;
+ u32 n_buffer_bytes = vlib_bufer_get_default_size (vm);
if (nif->per_interface_next_index != ~0)
next_index = nif->per_interface_next_index;
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index 78d071a24ed..fc369e5aea9 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -120,7 +120,7 @@ more:
((vif->type == VIRTIO_IF_TYPE_PCI) ? vlib_buffer_get_current_pa (vm,
b) :
pointer_to_uword (vlib_buffer_get_current (b)));
- d->len = VLIB_BUFFER_DATA_SIZE + hdr_sz;
+ d->len = vlib_bufer_get_default_size (vm) + hdr_sz;
d->flags = VRING_DESC_F_WRITE;
vring->avail->ring[avail & mask] = next;
avail++;
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 812f9d3f6ab..465ec4462a8 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -501,7 +501,7 @@ vhost_user_if_input (vlib_main_t * vm,
/* Get more output if necessary. Or end of packet. */
if (PREDICT_FALSE
- (b_current->current_length == VLIB_BUFFER_DATA_SIZE))
+ (b_current->current_length == vlib_bufer_get_default_size (vm)))
{
if (PREDICT_FALSE (cpu->rx_buffers_len == 0))
{
@@ -534,7 +534,8 @@ vhost_user_if_input (vlib_main_t * vm,
vhost_copy_t *cpy = &cpu->copy[copy_len];
copy_len++;
u32 desc_data_l = desc_table[desc_current].len - desc_data_offset;
- cpy->len = VLIB_BUFFER_DATA_SIZE - b_current->current_length;
+ cpy->len =
+ vlib_bufer_get_default_size (vm) - b_current->current_length;
cpy->len = (cpy->len > desc_data_l) ? desc_data_l : cpy->len;
cpy->dst = (uword) (vlib_buffer_get_current (b_current) +
b_current->current_length);
diff --git a/src/vnet/dhcp/dhcp6_proxy_node.c b/src/vnet/dhcp/dhcp6_proxy_node.c
index 92e011bdbb0..e4464e0b307 100644
--- a/src/vnet/dhcp/dhcp6_proxy_node.c
+++ b/src/vnet/dhcp/dhcp6_proxy_node.c
@@ -316,7 +316,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
link_address_set:
if ((b0->current_length + sizeof (*id1) + sizeof (*vss1) +
- sizeof (*cmac)) > VLIB_BUFFER_DATA_SIZE)
+ sizeof (*cmac)) > vlib_bufer_get_default_size (vm))
{
error0 = DHCPV6_PROXY_ERROR_PKT_TOO_BIG;
next0 = DHCPV6_PROXY_TO_SERVER_INPUT_NEXT_DROP;
diff --git a/src/vnet/ip/ip_frag.c b/src/vnet/ip/ip_frag.c
index de297767a70..6ecaa3c4dce 100644
--- a/src/vnet/ip/ip_frag.c
+++ b/src/vnet/ip/ip_frag.c
@@ -106,7 +106,8 @@ ip4_frag_do_fragment (vlib_main_t * vm, u32 from_bi, u32 ** buffer,
rem = clib_net_to_host_u16 (ip4->length) - sizeof (ip4_header_t);
max =
- (clib_min (mtu, VLIB_BUFFER_DATA_SIZE) - sizeof (ip4_header_t)) & ~0x7;
+ (clib_min (mtu, vlib_bufer_get_default_size (vm)) -
+ sizeof (ip4_header_t)) & ~0x7;
if (rem >
(vlib_buffer_length_in_chain (vm, from_b) - sizeof (ip4_header_t)))
diff --git a/src/vnet/ip/ping.c b/src/vnet/ip/ping.c
index 890285f2606..90314b541c4 100755
--- a/src/vnet/ip/ping.c
+++ b/src/vnet/ip/ping.c
@@ -388,7 +388,7 @@ init_icmp46_echo_request (vlib_main_t * vm, vlib_buffer_t * b0,
int l34_len =
l4_header_offset + sizeof (icmp46_header_t) +
offsetof (icmp46_echo_request_t, data);
- int max_data_len = VLIB_BUFFER_DATA_SIZE - l34_len;
+ int max_data_len = vlib_bufer_get_default_size (vm) - l34_len;
int first_buf_data_len = data_len < max_data_len ? data_len : max_data_len;
@@ -403,7 +403,8 @@ init_icmp46_echo_request (vlib_main_t * vm, vlib_buffer_t * b0,
{
int this_buf_data_len =
remaining_data_len <
- VLIB_BUFFER_DATA_SIZE ? remaining_data_len : VLIB_BUFFER_DATA_SIZE;
+ vlib_bufer_get_default_size (vm) ? remaining_data_len :
+ vlib_bufer_get_default_size (vm);
int n_alloc = vlib_buffer_alloc (vm, &b0->next_buffer, 1);
if (n_alloc < 1)
{
diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c
index 65e62c07aba..8331a876dcb 100644
--- a/src/vnet/ip/punt.c
+++ b/src/vnet/ip/punt.c
@@ -497,7 +497,7 @@ format_punt_trace (u8 * s, va_list * va)
static uword
punt_socket_rx_fd (vlib_main_t * vm, vlib_node_runtime_t * node, u32 fd)
{
- const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
+ const uword buffer_size = vlib_bufer_get_default_size (vm);
u32 n_trace = vlib_get_trace_count (vm, node);
u32 next = node->cached_next_index;
u32 n_left_to_next, next_index;
diff --git a/src/vnet/ipfix-export/flow_report.c b/src/vnet/ipfix-export/flow_report.c
index da91a7c3dfb..9d0834b36b6 100644
--- a/src/vnet/ipfix-export/flow_report.c
+++ b/src/vnet/ipfix-export/flow_report.c
@@ -121,7 +121,7 @@ send_template_packet (flow_report_main_t * frm,
/* Initialize the buffer */
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
- ASSERT (vec_len (fr->rewrite) < VLIB_BUFFER_DATA_SIZE);
+ ASSERT (vec_len (fr->rewrite) < vlib_bufer_get_default_size (vm));
clib_memcpy_fast (b0->data, fr->rewrite, vec_len (fr->rewrite));
b0->current_data = 0;
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;
diff --git a/src/vnet/sctp/sctp.c b/src/vnet/sctp/sctp.c
index d0e28c53fe7..21cc78bccca 100644
--- a/src/vnet/sctp/sctp.c
+++ b/src/vnet/sctp/sctp.c
@@ -892,7 +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_DATA_SIZE;
+ tm->bytes_per_buffer = vlib_bufer_get_default_size (vm);
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 286bd7b32e0..09adc596d23 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -605,7 +605,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_DATA_SIZE;
+ n_bytes_per_buf = vlib_bufer_get_default_size (vm);
ASSERT (n_bytes_per_buf > TRANSPORT_MAX_HDRS_LEN);
n_bytes_per_seg = TRANSPORT_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 5fdeec608c9..ee5f27579b3 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1476,7 +1476,7 @@ tcp_main_enable (vlib_main_t * vm)
tcp_initialize_timer_wheels (tm);
tcp_initialize_iss_seed (tm);
- tm->bytes_per_buffer = VLIB_BUFFER_DATA_SIZE;
+ tm->bytes_per_buffer = vlib_bufer_get_default_size (vm);
return error;
}
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index e002a248ce4..ce7b260f393 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -243,7 +243,7 @@ tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
tuntap_main_t *tm = &tuntap_main;
vlib_buffer_t *b;
u32 bi;
- const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
+ const uword buffer_size = vlib_bufer_get_default_size (vm);
u16 thread_index = vm->thread_index;
/** Make sure we have some RX buffers. */
@@ -490,7 +490,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
u8 *name;
int flags = IFF_TUN | IFF_NO_PI;
int is_enabled = 0, is_ether = 0, have_normal_interface = 0;
- const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
+ const uword buffer_size = vlib_bufer_get_default_size (vm);
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/vpp/conf/startup.conf b/src/vpp/conf/startup.conf
index 73e9d2cfc1b..610f2486a5d 100644
--- a/src/vpp/conf/startup.conf
+++ b/src/vpp/conf/startup.conf
@@ -74,6 +74,10 @@ cpu {
## large number of interfaces and worker threads. Value is per numa node.
## Default is 16384 (8192 if running unpriviledged)
# buffers-per-numa 128000
+
+ ## Size of buffer data area
+ ## Default is 2048
+ # default data-size 2048
# }
# dpdk {