For active sockets, check the indexes and use the inflight_conn_req waitqueue to wait. For passive sockets if an accept is outstanding (PVCALLS_FLAG_ACCEPT_INFLIGHT), check if it has been answered by looking at bedata->rsp[req_id]. If so, return POLLIN. Otherwise use the inflight_accept_req waitqueue. If no accepts are inflight, send PVCALLS_POLL to the backend. If we have outstanding POLL requests awaiting for a response use the inflight_req waitqueue: inflight_req is awaken when a new response is received; on wakeup we check whether the POLL response is arrived by looking at the PVCALLS_FLAG_POLL_RET flag. We set the flag from pvcalls_front_event_handler, if the response was for a POLL command. In pvcalls_front_event_handler, get the struct sock_mapping from the poll id (we previously converted struct sock_mapping* to uintptr_t and used it as id). 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>
27 lines
782 B
C
27 lines
782 B
C
#ifndef __PVCALLS_FRONT_H__
|
|
#define __PVCALLS_FRONT_H__
|
|
|
|
#include <linux/net.h>
|
|
|
|
int pvcalls_front_socket(struct socket *sock);
|
|
int pvcalls_front_connect(struct socket *sock, struct sockaddr *addr,
|
|
int addr_len, int flags);
|
|
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);
|
|
int pvcalls_front_sendmsg(struct socket *sock,
|
|
struct msghdr *msg,
|
|
size_t len);
|
|
int pvcalls_front_recvmsg(struct socket *sock,
|
|
struct msghdr *msg,
|
|
size_t len,
|
|
int flags);
|
|
unsigned int pvcalls_front_poll(struct file *file,
|
|
struct socket *sock,
|
|
poll_table *wait);
|
|
|
|
#endif
|