summaryrefslogtreecommitdiff
path: root/drivers/xen/pvcalls-front.h
diff options
context:
space:
mode:
authorStefano Stabellini <sstabellini@kernel.org>2017-10-30 15:40:58 -0700
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2017-10-31 09:05:53 -0400
commit9774c6cca26610d065a75d2ac8c5e3fcf0a209b3 (patch)
treed46c59c17e79e05cd72c749b659c65d781da0c14 /drivers/xen/pvcalls-front.h
parent1853f11d72ed46310ff3c5a60264b2f8a53f8c25 (diff)
xen/pvcalls: implement accept command
Introduce a waitqueue to allow only one outstanding accept command at any given time and to implement polling on the passive socket. Introduce a flags field to keep track of in-flight accept and poll commands. Send PVCALLS_ACCEPT to the backend. Allocate a new active socket. Make sure that only one accept command is executed at any given time by setting PVCALLS_FLAG_ACCEPT_INFLIGHT and waiting on the inflight_accept_req waitqueue. Convert the new struct sock_mapping pointer into an uintptr_t and use it as id for the new socket to pass to the backend. Check if the accept call is non-blocking: in that case after sending the ACCEPT command to the backend store the sock_mapping pointer of the new struct and the inflight req_id then return -EAGAIN (which will respond only when there is something to accept). Next time accept is called, we'll check if the ACCEPT command has been answered, if so we'll pick up where we left off, otherwise we return -EAGAIN again. Note that, differently from the other commands, we can use wait_event_interruptible (instead of wait_event) in the case of accept as we are able to track the req_id of the ACCEPT response that we are waiting. Signed-off-by: Stefano Stabellini <stefano@aporeto.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> CC: boris.ostrovsky@oracle.com CC: jgross@suse.com Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'drivers/xen/pvcalls-front.h')
-rw-r--r--drivers/xen/pvcalls-front.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/xen/pvcalls-front.h b/drivers/xen/pvcalls-front.h
index aa8fe1007da5..ab4f1dad3142 100644
--- a/drivers/xen/pvcalls-front.h
+++ b/drivers/xen/pvcalls-front.h
@@ -10,5 +10,8 @@ int pvcalls_front_bind(struct socket *sock,
struct sockaddr *addr,
int addr_len);
int pvcalls_front_listen(struct socket *sock, int backlog);
+int pvcalls_front_accept(struct socket *sock,
+ struct socket *newsock,
+ int flags);
#endif