summaryrefslogtreecommitdiffstats
path: root/vlib/vlib/dpdk_buffer.c
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2016-02-12 13:18:42 +0000
committerGerrit Code Review <gerrit@fd.io>2016-02-18 00:50:55 +0000
commit328e99b1e28b56dec2dedc4cae68bbaa49454429 (patch)
treecf8c7ddfd045fda67e742ca9b02c1d088754b6ff /vlib/vlib/dpdk_buffer.c
parentce8debfe0faaea959aed846f83a0e1ade5f5acd2 (diff)
Add jumbo frames support to non-dpdk vhost interfaces.
This code provided inter-VM (2 cores per VM) throughput of 22Gbps using iperf through VPP (1 core) with 9k frames. With the same setup and pktgen running on both sides, it reached 5Mpps with no packets drop (Equivalent to before the patch). During the tests the average vector length was about 1, which likely means that VPP is not the bottleneck. The patch also includes some generic functions for vlib buffers allowing for chained buffer construction whether or not DPDK is enabled. Change-Id: Icfd1803e84b2b4578f305ab730576211f6242d6a Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'vlib/vlib/dpdk_buffer.c')
-rw-r--r--vlib/vlib/dpdk_buffer.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/vlib/vlib/dpdk_buffer.c b/vlib/vlib/dpdk_buffer.c
index 9db84a16d38..145720dd7a4 100644
--- a/vlib/vlib/dpdk_buffer.c
+++ b/vlib/vlib/dpdk_buffer.c
@@ -882,6 +882,34 @@ u32 vlib_buffer_add_data (vlib_main_t * vm,
return bi;
}
+u16
+vlib_buffer_chain_append_data_with_alloc(vlib_main_t *vm,
+ u32 free_list_index,
+ vlib_buffer_t *first,
+ vlib_buffer_t **last,
+ void * data, u16 data_len) {
+ vlib_buffer_t *l = *last;
+ u32 n_buffer_bytes = vlib_buffer_free_list_buffer_size (vm, free_list_index);
+ u16 copied = 0;
+ ASSERT(n_buffer_bytes >= l->current_length + l->current_data);
+ while (data_len) {
+ u16 max = n_buffer_bytes - l->current_length - l->current_data;
+ if (max == 0) {
+ if (1 != vlib_buffer_alloc_from_free_list (vm, &l->next_buffer, 1, free_list_index))
+ return copied;
+ *last = l = vlib_buffer_chain_buffer(vm, first, l, l->next_buffer);
+ max = n_buffer_bytes - l->current_length - l->current_data;
+ }
+
+ u16 len = (data_len > max)?max:data_len;
+ rte_memcpy(vlib_buffer_get_current (l) + l->current_length, data + copied, len);
+ vlib_buffer_chain_increase_length(first, l, len);
+ data_len -= len;
+ copied += len;
+ }
+ return copied;
+}
+
clib_error_t *
vlib_buffer_pool_create(vlib_main_t * vm, unsigned num_mbufs,
unsigned mbuf_size, unsigned socket_id)