Lines Matching +full:wait +full:- +full:queue
1 // SPDX-License-Identifier: GPL-2.0
15 struct sk_buff_head queue; member
23 skb_queue_tail(&tun->queue, skb); in qrtr_tun_send()
26 wake_up_interruptible(&tun->readq); in qrtr_tun_send()
38 return -ENOMEM; in qrtr_tun_open()
40 skb_queue_head_init(&tun->queue); in qrtr_tun_open()
41 init_waitqueue_head(&tun->readq); in qrtr_tun_open()
43 tun->ep.xmit = qrtr_tun_send; in qrtr_tun_open()
45 filp->private_data = tun; in qrtr_tun_open()
47 ret = qrtr_endpoint_register(&tun->ep, QRTR_EP_NID_AUTO); in qrtr_tun_open()
54 filp->private_data = NULL; in qrtr_tun_open()
61 struct file *filp = iocb->ki_filp; in qrtr_tun_read_iter()
62 struct qrtr_tun *tun = filp->private_data; in qrtr_tun_read_iter()
66 while (!(skb = skb_dequeue(&tun->queue))) { in qrtr_tun_read_iter()
67 if (filp->f_flags & O_NONBLOCK) in qrtr_tun_read_iter()
68 return -EAGAIN; in qrtr_tun_read_iter()
70 /* Wait until we get data or the endpoint goes away */ in qrtr_tun_read_iter()
71 if (wait_event_interruptible(tun->readq, in qrtr_tun_read_iter()
72 !skb_queue_empty(&tun->queue))) in qrtr_tun_read_iter()
73 return -ERESTARTSYS; in qrtr_tun_read_iter()
76 count = min_t(size_t, iov_iter_count(to), skb->len); in qrtr_tun_read_iter()
77 if (copy_to_iter(skb->data, count, to) != count) in qrtr_tun_read_iter()
78 count = -EFAULT; in qrtr_tun_read_iter()
87 struct file *filp = iocb->ki_filp; in qrtr_tun_write_iter()
88 struct qrtr_tun *tun = filp->private_data; in qrtr_tun_write_iter()
94 return -EINVAL; in qrtr_tun_write_iter()
97 return -ENOMEM; in qrtr_tun_write_iter()
101 return -ENOMEM; in qrtr_tun_write_iter()
105 return -EFAULT; in qrtr_tun_write_iter()
108 ret = qrtr_endpoint_post(&tun->ep, kbuf, len); in qrtr_tun_write_iter()
114 static __poll_t qrtr_tun_poll(struct file *filp, poll_table *wait) in qrtr_tun_poll() argument
116 struct qrtr_tun *tun = filp->private_data; in qrtr_tun_poll()
119 poll_wait(filp, &tun->readq, wait); in qrtr_tun_poll()
121 if (!skb_queue_empty(&tun->queue)) in qrtr_tun_poll()
129 struct qrtr_tun *tun = filp->private_data; in qrtr_tun_release()
131 qrtr_endpoint_unregister(&tun->ep); in qrtr_tun_release()
134 skb_queue_purge(&tun->queue); in qrtr_tun_release()
152 "qrtr-tun",