aboutsummaryrefslogtreecommitdiffstats
path: root/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-11-15 12:50:28 +0100
committerDave Barach <openvpp@barachs.net>2016-11-23 22:12:25 +0000
commit676554935a576db9f512b8b2ef81ba6723bb7ad6 (patch)
tree796b94d3320e097789c5d6bc12f442f4cea9c2a1 /vlib
parentdaa2cd1512ac46dfe116b89a34caf19a71994c45 (diff)
dpdk: remove rte_mbuf modifications at many places in the code
It is sole responsibility of dpdk tx function to fill/update rte_mbuf prior to sending packet do PMD. Change-Id: I8ca1dba3e7bef41034d36e3525831849f7ac4ac0 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vlib')
-rw-r--r--vlib/vlib/buffer.c9
-rw-r--r--vlib/vlib/buffer_funcs.h71
-rw-r--r--vlib/vlib/dpdk_buffer.c34
-rw-r--r--vlib/vlib/threads_cli.c8
4 files changed, 11 insertions, 111 deletions
diff --git a/vlib/vlib/buffer.c b/vlib/vlib/buffer.c
index e1be2005424..4b899a898cc 100644
--- a/vlib/vlib/buffer.c
+++ b/vlib/vlib/buffer.c
@@ -1277,15 +1277,6 @@ 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)
{
diff --git a/vlib/vlib/buffer_funcs.h b/vlib/vlib/buffer_funcs.h
index 29635a3fd96..60e0e28d625 100644
--- a/vlib/vlib/buffer_funcs.h
+++ b/vlib/vlib/buffer_funcs.h
@@ -42,18 +42,6 @@
#include <vppinfra/hash.h>
-#if DPDK == 1
-#undef always_inline // dpdk and clib use conflicting always_inline macros.
-#include <rte_config.h>
-#include <rte_mbuf.h>
-
-#if CLIB_DEBUG > 0
-#define always_inline static inline
-#else
-#define always_inline static inline __attribute__ ((__always_inline__))
-#endif
-#endif
-
/** \file
vlib buffer access methods.
*/
@@ -244,14 +232,6 @@ vlib_buffer_set_known_state (vlib_main_t * vm,
u8 *vlib_validate_buffer (vlib_main_t * vm, u32 buffer_index,
uword follow_chain);
-/* Validate an array of buffers. As above. */
-u8 *vlib_validate_buffers (vlib_main_t * vm,
- u32 * buffers,
- uword next_buffer_stride,
- uword n_buffers,
- vlib_buffer_known_state_t known_state,
- uword follow_chain);
-
#endif /* DPDK == 0 */
clib_error_t *vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs,
@@ -429,6 +409,7 @@ vlib_buffer_copy (vlib_main_t * vm, vlib_buffer_t * b)
vlib_buffer_t *s, *d, *fd;
uword n_alloc, n_buffers = 1;
u32 *new_buffers = 0;
+ u32 flag_mask = VLIB_BUFFER_NEXT_PRESENT | VLIB_BUFFER_TOTAL_LENGTH_VALID;
int i;
s = b;
@@ -449,20 +430,10 @@ vlib_buffer_copy (vlib_main_t * vm, vlib_buffer_t * b)
vlib_buffer_get_current (s), s->current_length);
d->current_data = s->current_data;
d->current_length = s->current_length;
- d->flags = s->flags;
+ d->flags = s->flags & flag_mask;
d->total_length_not_including_first_buffer =
s->total_length_not_including_first_buffer;
clib_memcpy (d->opaque, s->opaque, sizeof (s->opaque));
-#if DPDK > 0
- struct rte_mbuf *ms, *md;
- ms = rte_mbuf_from_vlib_buffer (s);
- md = rte_mbuf_from_vlib_buffer (d);
- rte_pktmbuf_reset (md);
- md->nb_segs = ms->nb_segs;
- md->data_len = ms->data_len;
- md->pkt_len = ms->pkt_len;
- md->data_off = ms->data_off;
-#endif
/* next segments */
for (i = 1; i < n_buffers; i++)
@@ -476,19 +447,7 @@ vlib_buffer_copy (vlib_main_t * vm, vlib_buffer_t * b)
d->current_length = s->current_length;
clib_memcpy (vlib_buffer_get_current (d),
vlib_buffer_get_current (s), s->current_length);
- d->flags = s->flags;
-#if DPDK > 0
- /* previous */
- md->next = rte_mbuf_from_vlib_buffer (d);
- /* current */
- md = rte_mbuf_from_vlib_buffer (d);
- ms = rte_mbuf_from_vlib_buffer (s);
- rte_pktmbuf_reset (md);
- md->data_len = ms->data_len;
- md->pkt_len = ms->pkt_len;
- md->data_off = ms->data_off;
- md->next = 0;
-#endif
+ d->flags = s->flags & flag_mask;
}
return fd;
@@ -507,11 +466,6 @@ vlib_buffer_chain_init (vlib_buffer_t * first)
first->current_length = 0;
first->flags &= ~VLIB_BUFFER_NEXT_PRESENT;
first->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
-#if DPDK == 1
- struct rte_mbuf *mb = rte_mbuf_from_vlib_buffer (first);
- rte_pktmbuf_reset (mb);
- mb->data_off = VLIB_BUFFER_PRE_DATA_SIZE + first->current_data;
-#endif
}
/* The provided next_bi buffer index is appended to the end of the packet. */
@@ -525,19 +479,6 @@ vlib_buffer_chain_buffer (vlib_main_t * vm,
last->flags |= VLIB_BUFFER_NEXT_PRESENT;
next_buffer->current_length = 0;
next_buffer->flags &= ~VLIB_BUFFER_NEXT_PRESENT;
-#if DPDK == 1
- struct rte_mbuf *mb;
- mb = rte_mbuf_from_vlib_buffer (first);
- mb->nb_segs++;
-
- mb = rte_mbuf_from_vlib_buffer (last);
- mb->next = rte_mbuf_from_vlib_buffer (next_buffer);
-
- mb = rte_mbuf_from_vlib_buffer (next_buffer);
- mb->data_len = 0;
- mb->data_off = VLIB_BUFFER_PRE_DATA_SIZE + next_buffer->current_data;
- mb->next = 0;
-#endif
return next_buffer;
}
@@ -552,12 +493,6 @@ vlib_buffer_chain_increase_length (vlib_buffer_t * first,
last->current_length += len;
if (first != last)
first->total_length_not_including_first_buffer += len;
-#if DPDK == 1
- struct rte_mbuf *mb_first = rte_mbuf_from_vlib_buffer (first);
- struct rte_mbuf *mb_last = rte_mbuf_from_vlib_buffer (last);
- mb_first->pkt_len += len;
- mb_last->data_len += len;
-#endif
}
/* Copy data to the end of the packet and increases its length.
diff --git a/vlib/vlib/dpdk_buffer.c b/vlib/vlib/dpdk_buffer.c
index 2f63543ec43..feb2bc6f739 100644
--- a/vlib/vlib/dpdk_buffer.c
+++ b/vlib/vlib/dpdk_buffer.c
@@ -526,9 +526,6 @@ fill_free_list (vlib_main_t * vm,
ASSERT (rte_mbuf_refcnt_read (mb) == 0);
rte_mbuf_refcnt_set (mb, 1);
- mb->next = NULL;
- mb->data_off = RTE_PKTMBUF_HEADROOM;
- mb->nb_segs = 1;
b = vlib_buffer_from_rte_mbuf (mb);
bi = vlib_get_buffer_index (vm, b);
@@ -866,12 +863,6 @@ vlib_packet_template_get_packet (vlib_main_t * vm,
t->packet_data, vec_len (t->packet_data));
b->current_length = vec_len (t->packet_data);
- /* Fix up mbuf header length fields */
- struct rte_mbuf *mb;
- mb = rte_mbuf_from_vlib_buffer (b);
- mb->data_len = b->current_length;
- mb->pkt_len = b->current_length;
-
return b->data;
}
@@ -968,31 +959,6 @@ 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_prev, *mb, *mb_first;
-
- mb_first = rte_mbuf_from_vlib_buffer (b_first);
-
- 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 = rte_mbuf_from_vlib_buffer (b);
- mb_prev = rte_mbuf_from_vlib_buffer (prev);
- mb_first->nb_segs++;
- mb_first->pkt_len += b->current_length;
- mb_prev->next = mb;
- mb->data_len = b->current_length;
- prev = b;
- }
-}
-
clib_error_t *
vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs,
unsigned socket_id)
diff --git a/vlib/vlib/threads_cli.c b/vlib/vlib/threads_cli.c
index 6651a4dd671..ee632279db5 100644
--- a/vlib/vlib/threads_cli.c
+++ b/vlib/vlib/threads_cli.c
@@ -20,6 +20,14 @@
#include <vlib/threads.h>
#include <vlib/unix/unix.h>
+#if DPDK==1
+#include <rte_config.h>
+#include <rte_common.h>
+#include <rte_eal.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#endif
+
static u8 *
format_sched_policy_and_priority (u8 * s, va_list * args)
{