aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/punt_node.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip/punt_node.c')
-rw-r--r--src/vnet/ip/punt_node.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/vnet/ip/punt_node.c b/src/vnet/ip/punt_node.c
index 32a0884d86b..65237aaaa0e 100644
--- a/src/vnet/ip/punt_node.c
+++ b/src/vnet/ip/punt_node.c
@@ -248,13 +248,15 @@ punt_socket_inline (vlib_main_t * vm,
punt_type_t pt, ip_address_family_t af)
{
u32 *buffers = vlib_frame_vector_args (frame);
+ u32 thread_index = vm->thread_index;
uword n_packets = frame->n_vectors;
- struct iovec *iovecs = 0;
punt_main_t *pm = &punt_main;
int i;
- u32 node_index = AF_IP4 == af ? udp4_punt_socket_node.index :
- udp6_punt_socket_node.index;
+ punt_thread_data_t *ptd = &pm->thread_data[thread_index];
+ u32 node_index = (AF_IP4 == af ?
+ udp4_punt_socket_node.index :
+ udp6_punt_socket_node.index);
for (i = 0; i < n_packets; i++)
{
@@ -332,20 +334,19 @@ punt_socket_inline (vlib_main_t * vm,
clib_memcpy_fast (&t->client, c, sizeof (t->client));
}
- /* Re-set iovecs if present. */
- if (iovecs)
- _vec_len (iovecs) = 0;
+ /* Re-set iovecs */
+ vec_reset_length (ptd->iovecs);
/* Add packet descriptor */
packetdesc.sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX];
packetdesc.action = 0;
- vec_add2 (iovecs, iov, 1);
+ vec_add2 (ptd->iovecs, iov, 1);
iov->iov_base = &packetdesc;
iov->iov_len = sizeof (packetdesc);
/** VLIB buffer chain -> Unix iovec(s). */
vlib_buffer_advance (b, -(sizeof (ethernet_header_t)));
- vec_add2 (iovecs, iov, 1);
+ vec_add2 (ptd->iovecs, iov, 1);
iov->iov_base = b->data + b->current_data;
iov->iov_len = l = b->current_length;
@@ -362,7 +363,7 @@ punt_socket_inline (vlib_main_t * vm,
t->is_midchain = 1;
}
- vec_add2 (iovecs, iov, 1);
+ vec_add2 (ptd->iovecs, iov, 1);
iov->iov_base = b->data + b->current_data;
iov->iov_len = b->current_length;
@@ -374,8 +375,8 @@ punt_socket_inline (vlib_main_t * vm,
struct msghdr msg = {
.msg_name = caddr,
.msg_namelen = sizeof (*caddr),
- .msg_iov = iovecs,
- .msg_iovlen = vec_len (iovecs),
+ .msg_iov = ptd->iovecs,
+ .msg_iovlen = vec_len (ptd->iovecs),
};
if (sendmsg (pm->socket_fd, &msg, 0) < (ssize_t) l)