udp_connection_t *uc = &t->udp_connection;
u32 indent = format_get_indent (s);
- s = format (s, "%U\n%U%U", format_udp_connection, uc, format_white_space,
+ s = format (s, "%U\n%U%U", format_udp_connection, uc, 1, format_white_space,
indent, format_udp_header, &t->udp_header, 128);
return s;
}
+always_inline udp_connection_t *
+udp_output_get_connection (vlib_buffer_t *b, u32 thread_index)
+{
+ if (PREDICT_FALSE (vnet_buffer (b)->tcp.flags & UDP_CONN_F_LISTEN))
+ return udp_listener_get (vnet_buffer (b)->tcp.connection_index);
+
+ return udp_connection_get (vnet_buffer (b)->tcp.connection_index,
+ thread_index);
+}
+
static void
udp46_output_trace_frame (vlib_main_t *vm, vlib_node_runtime_t *node,
u32 *to_next, u32 n_bufs)
if (!(b->flags & VLIB_BUFFER_IS_TRACED))
continue;
uh = vlib_buffer_get_current (b);
- uc = udp_connection_get (vnet_buffer (b)->tcp.connection_index,
- vm->thread_index);
+ uc = udp_output_get_connection (b, vm->thread_index);
t = vlib_add_trace (vm, node, b, sizeof (*t));
clib_memcpy_fast (&t->udp_header, uh, sizeof (t->udp_header));
clib_memcpy_fast (&t->udp_connection, uc, sizeof (t->udp_connection));
}
}
-always_inline void
-udp_output_push_ip (vlib_main_t *vm, vlib_buffer_t *b, udp_connection_t *uc,
- u8 is_ip4)
-{
- if (uc->c_is_ip4)
- vlib_buffer_push_ip4_custom (vm, b, &uc->c_lcl_ip4, &uc->c_rmt_ip4,
- IP_PROTOCOL_UDP, udp_csum_offload (uc),
- 0 /* is_df */, uc->c_dscp);
- else
- vlib_buffer_push_ip6 (vm, b, &uc->c_lcl_ip6, &uc->c_rmt_ip6,
- IP_PROTOCOL_UDP);
- vnet_buffer (b)->sw_if_index[VLIB_RX] = uc->sw_if_index;
- vnet_buffer (b)->sw_if_index[VLIB_TX] = uc->c_fib_index;
-}
-
always_inline void
udp_output_handle_packet (udp_connection_t *uc0, vlib_buffer_t *b0,
vlib_node_runtime_t *error_node, u16 *next0,
vlib_prefetch_buffer_header (b[3], STORE);
CLIB_PREFETCH (b[3]->data, 2 * CLIB_CACHE_LINE_BYTES, STORE);
- uc0 = udp_connection_get (vnet_buffer (b[0])->tcp.connection_index,
- thread_index);
- uc1 = udp_connection_get (vnet_buffer (b[1])->tcp.connection_index,
- thread_index);
+ uc0 = udp_output_get_connection (b[0], thread_index);
+ uc1 = udp_output_get_connection (b[1], thread_index);
if (PREDICT_TRUE (!uc0 + !uc1 == 0))
{
- udp_output_push_ip (vm, b[0], uc0, is_ip4);
- udp_output_push_ip (vm, b[1], uc1, is_ip4);
-
udp_output_handle_packet (uc0, b[0], node, &next[0], is_ip4);
udp_output_handle_packet (uc1, b[1], node, &next[1], is_ip4);
}
{
if (uc0 != 0)
{
- udp_output_push_ip (vm, b[0], uc0, is_ip4);
udp_output_handle_packet (uc0, b[0], node, &next[0], is_ip4);
}
else
}
if (uc1 != 0)
{
- udp_output_push_ip (vm, b[1], uc1, is_ip4);
udp_output_handle_packet (uc1, b[1], node, &next[1], is_ip4);
}
else
CLIB_PREFETCH (b[1]->data, 2 * CLIB_CACHE_LINE_BYTES, STORE);
}
- uc0 = udp_connection_get (vnet_buffer (b[0])->tcp.connection_index,
- thread_index);
+ uc0 = udp_output_get_connection (b[0], thread_index);
if (PREDICT_TRUE (uc0 != 0))
{
- udp_output_push_ip (vm, b[0], uc0, is_ip4);
udp_output_handle_packet (uc0, b[0], node, &next[0], is_ip4);
}
else