Move dpdk (un)format functions to separate c file

Change-Id: Idb1b1bf6c1b3b3d66672cc715e45aec299fb7592
Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:
Damjan Marion
2016-02-25 16:00:11 +01:00
parent d9bf9abbab
commit 7f620976e2
7 changed files with 806 additions and 767 deletions

View File

@ -570,6 +570,7 @@ if WITH_DPDK
libvnet_la_SOURCES += \
vnet/devices/dpdk/dpdk_priv.h \
vnet/devices/dpdk/device.c \
vnet/devices/dpdk/format.c \
vnet/devices/dpdk/init.c \
vnet/devices/dpdk/node.c \
vnet/devices/dpdk/threads.c \

File diff suppressed because it is too large Load Diff

View File

@ -403,6 +403,23 @@ typedef enum {
DPDK_RX_N_NEXT,
} dpdk_rx_next_t;
typedef struct {
u32 buffer_index;
u16 device_index;
u8 queue_index;
struct rte_mbuf mb;
/* Copy of VLIB buffer; packet data stored in pre_data. */
vlib_buffer_t buffer;
} dpdk_tx_dma_trace_t;
typedef struct {
u32 buffer_index;
u16 device_index;
u16 queue_index;
struct rte_mbuf mb;
vlib_buffer_t buffer; /* Copy of VLIB buffer; pkt data stored in pre_data. */
} dpdk_rx_dma_trace_t;
void vnet_buffer_needs_dpdk_mb (vlib_buffer_t * b);
void dpdk_set_next_node (dpdk_rx_next_t, char *);
@ -535,4 +552,12 @@ u32 dpdk_get_admin_up_down_in_progress (void);
uword
dpdk_input_rss (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * f);
format_function_t format_dpdk_device_name;
format_function_t format_dpdk_device;
format_function_t format_dpdk_tx_dma_trace;
format_function_t format_dpdk_rx_dma_trace;
format_function_t format_dpdk_rte_mbuf;
format_function_t format_dpdk_rx_rte_mbuf;
unformat_function_t unformat_socket_mem;
#endif /* __included_dpdk_h__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -920,33 +920,6 @@ static clib_error_t * dpdk_bind_eth_kernel_drivers (vlib_main_t * vm,
return error;
}
static uword
unformat_socket_mem (unformat_input_t * input, va_list * va)
{
uword ** r = va_arg (* va, uword **);
int i = 0;
u32 mem;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, ","))
hash_set (*r, i, 1024);
else if (unformat (input, "%u,", &mem))
hash_set (*r, i, mem);
else if (unformat (input, "%u", &mem))
hash_set (*r, i, mem);
else
{
unformat_put_input (input);
goto done;
}
i++;
}
done:
return 1;
}
static u32
get_node_free_hugepages_num (u32 node, u32 page_size)
{

View File

@ -68,7 +68,7 @@ static u8 * format_handoff_dispatch_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
handoff_dispatch_trace_t * t = va_arg (*args, handoff_dispatch_trace_t *);
s = format (s, "HANDOFF_DISPATCH: sw_if_index %d next_index %d buffer 0x%x",
t->sw_if_index,
t->next_index,
@ -268,53 +268,6 @@ static char * dpdk_error_strings[] = {
#undef _
};
typedef struct {
u32 buffer_index;
u16 device_index;
u16 queue_index;
struct rte_mbuf mb;
vlib_buffer_t buffer; /* Copy of VLIB buffer; pkt data stored in pre_data. */
} dpdk_rx_dma_trace_t;
static u8 * format_dpdk_rx_dma_trace (u8 * s, va_list * va)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*va, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *);
CLIB_UNUSED (vnet_main_t * vnm) = vnet_get_main();
dpdk_rx_dma_trace_t * t = va_arg (*va, dpdk_rx_dma_trace_t *);
dpdk_main_t * dm = &dpdk_main;
dpdk_device_t * xd = vec_elt_at_index (dm->devices, t->device_index);
format_function_t * f;
uword indent = format_get_indent (s);
vnet_sw_interface_t * sw = vnet_get_sw_interface (vnm, xd->vlib_sw_if_index);
s = format (s, "%U rx queue %d",
format_vnet_sw_interface_name, vnm, sw,
t->queue_index);
s = format (s, "\n%Ubuffer 0x%x: %U",
format_white_space, indent,
t->buffer_index,
format_vlib_buffer, &t->buffer);
#ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS
s = format (s, "\n%U%U",
format_white_space, indent,
format_dpdk_rx_rte_mbuf, &t->mb);
#else
s = format (s, "\n%U%U",
format_white_space, indent,
format_dpdk_rte_mbuf, &t->mb);
#endif /* RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS */
f = node->format_buffer;
if (!f)
f = format_hex_bytes;
s = format (s, "\n%U%U", format_white_space, indent,
f, t->buffer.pre_data, sizeof (t->buffer.pre_data));
return s;
}
always_inline void
dpdk_rx_next_and_error_from_mb_flags_x1 (dpdk_device_t *xd, struct rte_mbuf *mb,
vlib_buffer_t *b0,