From ceab7882f8016c2407a4383f87277bad069885b1 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Fri, 19 Jan 2018 20:56:12 +0100 Subject: vlib: epoll on worker threads This patch teaches worer threads to sleep and to be waken up by kernel if there is activity on file desctiptors assigned to that thread. It also adds counters to epoll file descriptors and new debug cli 'show unix file'. Change-Id: Iaf67869f4aa88ff5b0a08982e1c08474013107c4 Signed-off-by: Damjan Marion --- src/plugins/memif/memif.c | 7 +++++++ src/plugins/memif/socket.c | 4 ++++ 2 files changed, 11 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c index dc92e7e24ad..7267ef2e000 100644 --- a/src/plugins/memif/memif.c +++ b/src/plugins/memif/memif.c @@ -221,6 +221,9 @@ memif_connect (memif_if_t * mif) { template.file_descriptor = mq->int_fd; template.private_data = (mif->dev_instance << 16) | (i & 0xFFFF); + template.description = format (0, "%U rx %u int", + format_memif_device_name, + mif->dev_instance, i); memif_file_add (&mq->int_clib_file_index, &template); } vnet_hw_interface_assign_rx_thread (vnm, mif->hw_if_index, i, ~0); @@ -440,6 +443,9 @@ memif_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) t.file_descriptor = sock->fd; t.private_data = mif->dev_instance; memif_file_add (&sock->private_data, &t); + t.description = format (0, "%U ctl", + format_memif_device_name, + mif->dev_instance); hash_set (msf->dev_instance_by_fd, sock->fd, mif->dev_instance); mif->flags |= MEMIF_IF_FLAG_CONNECTING; @@ -805,6 +811,7 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args) template.read_function = memif_conn_fd_accept_ready; template.file_descriptor = msf->sock->fd; template.private_data = mif->socket_file_index; + template.description = format (0, "memif listener %s", msf->filename); memif_file_add (&msf->sock->private_data, &template); } diff --git a/src/plugins/memif/socket.c b/src/plugins/memif/socket.c index 9aa4a2e2e90..5e14f08ac93 100644 --- a/src/plugins/memif/socket.c +++ b/src/plugins/memif/socket.c @@ -440,6 +440,9 @@ memif_msg_receive (memif_if_t ** mifp, clib_socket_t * sock, clib_file_t * uf) if ((err = memif_msg_receive_init (mifp, &msg, sock, uf->private_data))) return err; mif = *mifp; + vec_reset_length (uf->description); + uf->description = format (uf->description, "%U ctl", + format_memif_device_name, mif->dev_instance); memif_msg_enq_ack (mif); break; @@ -645,6 +648,7 @@ memif_conn_fd_accept_ready (clib_file_t * uf) template.error_function = memif_master_conn_fd_error; template.file_descriptor = client->fd; template.private_data = uf->private_data; + template.description = format (0, "memif in conn on %s", msf->filename); memif_file_add (&client->private_data, &template); -- cgit 1.2.3-korg