[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1710191828130.27209@sstabellini-ThinkPad-X260>
Date: Thu, 19 Oct 2017 18:31:16 -0700 (PDT)
From: Stefano Stabellini <sstabellini@...nel.org>
To: Boris Ostrovsky <boris.ostrovsky@...cle.com>
cc: Stefano Stabellini <sstabellini@...nel.org>,
xen-devel@...ts.xen.org, linux-kernel@...r.kernel.org,
jgross@...e.com, Stefano Stabellini <stefano@...reto.com>
Subject: Re: [PATCH v5 06/13] xen/pvcalls: implement bind command
On Tue, 17 Oct 2017, Boris Ostrovsky wrote:
> On 10/06/2017 08:30 PM, Stefano Stabellini wrote:
> > Send PVCALLS_BIND to the backend. Introduce a new structure, part of
> > struct sock_mapping, to store information specific to passive sockets.
> >
> > Introduce a status field to keep track of the status of the passive
> > socket.
> >
> > Signed-off-by: Stefano Stabellini <stefano@...reto.com>
> > CC: boris.ostrovsky@...cle.com
> > CC: jgross@...e.com
> > ---
> > drivers/xen/pvcalls-front.c | 66 +++++++++++++++++++++++++++++++++++++++++++++
> > drivers/xen/pvcalls-front.h | 3 +++
> > 2 files changed, 69 insertions(+)
> >
> > diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
> > index 7c9261b..4cafd9b 100644
> > --- a/drivers/xen/pvcalls-front.c
> > +++ b/drivers/xen/pvcalls-front.c
> > @@ -71,6 +71,13 @@ struct sock_mapping {
> >
> > wait_queue_head_t inflight_conn_req;
> > } active;
> > + struct {
> > + /* Socket status */
> > +#define PVCALLS_STATUS_UNINITALIZED 0
> > +#define PVCALLS_STATUS_BIND 1
> > +#define PVCALLS_STATUS_LISTEN 2
> > + uint8_t status;
> > + } passive;
> > };
> > };
> >
> > @@ -347,6 +354,65 @@ int pvcalls_front_connect(struct socket *sock, struct sockaddr *addr,
> > return ret;
> > }
> >
> > +int pvcalls_front_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
> > +{
> > + struct pvcalls_bedata *bedata;
> > + struct sock_mapping *map = NULL;
> > + struct xen_pvcalls_request *req;
> > + int notify, req_id, ret;
> > +
> > + if (addr->sa_family != AF_INET || sock->type != SOCK_STREAM)
> > + return -ENOTSUPP;
> > +
> > + pvcalls_enter();
> > + if (!pvcalls_front_dev) {
> > + pvcalls_exit();
> > + return -ENOTCONN;
>
> The connect patch returns -ENETUNREACH here. Is there a deliberate
> distinction between these cases?
No, there isn't a deliberate distinction. Actually, all other commands
return ENOTCONN for this error, we might as well be consistent and
change ENETUNREACH to ENOTCONN for connect.
If you agree, I'll make the change to the connect patch, and add your
reviewed-by here.
> Other than that
>
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Powered by blists - more mailing lists