summaryrefslogtreecommitdiffstats
path: root/vlib
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2016-03-02 10:01:43 +0100
committerGerrit Code Review <gerrit@fd.io>2016-03-02 22:26:41 +0000
commit2df2e3d7d5226891e974207aa10d1d6e69418cbf (patch)
tree9d56d51bcd8b14491f8f395150faedbedbf64a16 /vlib
parent287d53f44d8d4b9697695d3fdaa76a94a49b1e8e (diff)
TAP: Jumbo-frame support.
Change-Id: I3a0726d7645f775738253d0a47ee04d94d138c9a Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'vlib')
-rw-r--r--vlib/vlib/buffer.c9
-rw-r--r--vlib/vlib/buffer_funcs.h1
-rw-r--r--vlib/vlib/dpdk_buffer.c19
3 files changed, 28 insertions, 1 deletions
diff --git a/vlib/vlib/buffer.c b/vlib/vlib/buffer.c
index 332b43044d3..c28a0c54889 100644
--- a/vlib/vlib/buffer.c
+++ b/vlib/vlib/buffer.c
@@ -1248,6 +1248,14 @@ vlib_buffer_chain_append_data_with_alloc(vlib_main_t *vm,
return copied;
}
+/*
+ * Fills in the required rte_mbuf fields for chained buffers given a VLIB chain.
+ */
+void vlib_buffer_chain_validate (vlib_main_t * vm, vlib_buffer_t * b_first)
+{
+ return;
+}
+
static void vlib_serialize_tx (serialize_main_header_t * m, serialize_stream_t * s)
{
vlib_main_t * vm;
@@ -1460,4 +1468,3 @@ VLIB_CLI_COMMAND (show_buffers_command, static) = {
.short_help = "Show packet buffer allocation",
.function = show_buffers,
};
-
diff --git a/vlib/vlib/buffer_funcs.h b/vlib/vlib/buffer_funcs.h
index 2ea506a094e..eea417a94f0 100644
--- a/vlib/vlib/buffer_funcs.h
+++ b/vlib/vlib/buffer_funcs.h
@@ -506,6 +506,7 @@ vlib_buffer_chain_append_data_with_alloc(vlib_main_t *vm,
vlib_buffer_t *first,
vlib_buffer_t **last,
void * data, u16 data_len);
+void vlib_buffer_chain_validate(vlib_main_t *vm, vlib_buffer_t *first);
format_function_t format_vlib_buffer, format_vlib_buffer_and_data, format_vlib_buffer_contents;
diff --git a/vlib/vlib/dpdk_buffer.c b/vlib/vlib/dpdk_buffer.c
index 145720dd7a4..04a6447d633 100644
--- a/vlib/vlib/dpdk_buffer.c
+++ b/vlib/vlib/dpdk_buffer.c
@@ -910,6 +910,25 @@ vlib_buffer_chain_append_data_with_alloc(vlib_main_t *vm,
return copied;
}
+/*
+ * Fills in the required rte_mbuf fields for chained buffers given a VLIB chain.
+ */
+void vlib_buffer_chain_validate (vlib_main_t * vm, vlib_buffer_t * b_first)
+{
+ vlib_buffer_t *b = b_first, *prev = b_first;
+ struct rte_mbuf *mb_first = ((struct rte_mbuf *) b) - 1;
+
+ mb_first->pkt_len = mb_first-> data_len = b_first->current_length;
+ while (b->flags & VLIB_BUFFER_NEXT_PRESENT) {
+ b = vlib_get_buffer(vm, b->next_buffer);
+ mb_first->nb_segs++;
+ mb_first->pkt_len += b->current_length;
+ (((struct rte_mbuf *) prev) - 1)->next = (((struct rte_mbuf *) b) - 1);
+ (((struct rte_mbuf *) b) - 1)->data_len = b->current_length;
+ prev = b;
+ }
+}
+
clib_error_t *
vlib_buffer_pool_create(vlib_main_t * vm, unsigned num_mbufs,
unsigned mbuf_size, unsigned socket_id)