Lines Matching refs:socket_client
46 static void batadv_socket_add_packet(struct batadv_socket_client *socket_client,
61 struct batadv_socket_client *socket_client; in batadv_socket_open() local
70 socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL); in batadv_socket_open()
71 if (!socket_client) { in batadv_socket_open()
78 batadv_socket_client_hash[i] = socket_client; in batadv_socket_open()
85 kfree(socket_client); in batadv_socket_open()
90 INIT_LIST_HEAD(&socket_client->queue_list); in batadv_socket_open()
91 socket_client->queue_len = 0; in batadv_socket_open()
92 socket_client->index = i; in batadv_socket_open()
93 socket_client->bat_priv = inode->i_private; in batadv_socket_open()
94 spin_lock_init(&socket_client->lock); in batadv_socket_open()
95 init_waitqueue_head(&socket_client->queue_wait); in batadv_socket_open()
97 file->private_data = socket_client; in batadv_socket_open()
127 struct batadv_socket_client *socket_client = file->private_data; in batadv_socket_read() local
132 if ((file->f_flags & O_NONBLOCK) && socket_client->queue_len == 0) in batadv_socket_read()
138 error = wait_event_interruptible(socket_client->queue_wait, in batadv_socket_read()
139 socket_client->queue_len); in batadv_socket_read()
144 spin_lock_bh(&socket_client->lock); in batadv_socket_read()
146 socket_packet = list_first_entry(&socket_client->queue_list, in batadv_socket_read()
149 socket_client->queue_len--; in batadv_socket_read()
151 spin_unlock_bh(&socket_client->lock); in batadv_socket_read()
167 struct batadv_socket_client *socket_client = file->private_data; in batadv_socket_write() local
168 struct batadv_priv *bat_priv = socket_client->bat_priv; in batadv_socket_write()
259 icmp_header->uid = socket_client->index; in batadv_socket_write()
264 batadv_socket_add_packet(socket_client, icmp_header, in batadv_socket_write()
276 batadv_socket_add_packet(socket_client, icmp_header, packet_len); in batadv_socket_write()
291 struct batadv_socket_client *socket_client = file->private_data; in batadv_socket_poll() local
293 poll_wait(file, &socket_client->queue_wait, wait); in batadv_socket_poll()
295 if (socket_client->queue_len > 0) in batadv_socket_poll()
328 static void batadv_socket_add_packet(struct batadv_socket_client *socket_client, in batadv_socket_add_packet() argument
349 spin_lock_bh(&socket_client->lock); in batadv_socket_add_packet()
355 spin_unlock_bh(&socket_client->lock); in batadv_socket_add_packet()
360 list_add_tail(&socket_packet->list, &socket_client->queue_list); in batadv_socket_add_packet()
361 socket_client->queue_len++; in batadv_socket_add_packet()
363 if (socket_client->queue_len > 100) { in batadv_socket_add_packet()
364 socket_packet = list_first_entry(&socket_client->queue_list, in batadv_socket_add_packet()
370 socket_client->queue_len--; in batadv_socket_add_packet()
373 spin_unlock_bh(&socket_client->lock); in batadv_socket_add_packet()
375 wake_up(&socket_client->queue_wait); in batadv_socket_add_packet()