From: Juergen Gross <jgross@suse.com>
To: Stefano Stabellini <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org
Cc: linux-kernel@vger.kernel.org, groug@kaod.org,
Stefano Stabellini <stefano@aporeto.com>,
boris.ostrovsky@oracle.com,
Eric Van Hensbergen <ericvh@gmail.com>,
Ron Minnich <rminnich@sandia.gov>,
Latchesar Ionkov <lucho@ionkov.net>,
v9fs-developer@lists.sourceforge.net
Subject: Re: [PATCH v4 4/7] xen/9pfs: connect to the backend
Date: Thu, 16 Mar 2017 07:31:02 +0100 [thread overview]
Message-ID: <98c4078f-80cd-c1b2-0c41-57b20d764ce2@suse.com> (raw)
In-Reply-To: <1489605821-29649-4-git-send-email-sstabellini@kernel.org>
On 15/03/17 20:23, Stefano Stabellini wrote:
> Implement functions to handle the xenbus handshake. Upon connection,
> allocate the rings according to the protocol specification.
>
> Initialize a work_struct and a wait_queue. The work_struct will be used
> to schedule work upon receiving an event channel notification from the
> backend. The wait_queue will be used to wait when the ring is full and
> we need to send a new request.
>
> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
> CC: groug@kaod.org
> CC: boris.ostrovsky@oracle.com
> CC: jgross@suse.com
> CC: Eric Van Hensbergen <ericvh@gmail.com>
> CC: Ron Minnich <rminnich@sandia.gov>
> CC: Latchesar Ionkov <lucho@ionkov.net>
> CC: v9fs-developer@lists.sourceforge.net
> ---
> net/9p/trans_xen.c | 248 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 248 insertions(+)
>
> diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
> index b1333b2..ada2b0c 100644
> --- a/net/9p/trans_xen.c
> +++ b/net/9p/trans_xen.c
> static int xen_9pfs_front_probe(struct xenbus_device *dev,
> const struct xenbus_device_id *id)
> {
> + int ret, i;
> + struct xenbus_transaction xbt;
> + struct xen_9pfs_front_priv *priv = NULL;
> + char *versions;
> + unsigned int max_rings, max_ring_order, len;
> +
> + versions = xenbus_read(XBT_NIL, dev->otherend, "versions", &len);
> + if (!len)
> + return -EINVAL;
> + if (strcmp(versions, "1")) {
> + kfree(versions);
> + return -EINVAL;
> + }
> + kfree(versions);
> + max_rings = xenbus_read_unsigned(dev->otherend, "max-rings", 0);
> + if (max_rings < XEN_9PFS_NUM_RINGS)
> + return -EINVAL;
> + max_ring_order = xenbus_read_unsigned(dev->otherend, "max-ring-page-order", 0);
> + if (max_ring_order < XEN_9PFS_RING_ORDER)
> + return -EINVAL;
> +
> +
> + priv = kzalloc(sizeof(struct xen_9pfs_front_priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->dev = dev;
> + priv->num_rings = XEN_9PFS_NUM_RINGS;
> + priv->rings = kzalloc(sizeof(struct xen_9pfs_dataring) * priv->num_rings,
> + GFP_KERNEL);
> + if (!priv->rings) {
> + kfree(priv);
> + return -ENOMEM;
> + }
> +
> + for (i = 0; i < priv->num_rings; i++) {
> + priv->rings[i].priv = priv;
> + ret = xen_9pfs_front_alloc_dataring(dev, &priv->rings[i]);
> + if (ret < 0)
> + goto error;
> + }
> +
> + again:
> + ret = xenbus_transaction_start(&xbt);
> + if (ret) {
> + xenbus_dev_fatal(dev, ret, "starting transaction");
> + goto error;
> + }
> + ret = xenbus_printf(xbt, dev->nodename, "version", "%u", 1);
> + if (ret)
> + goto error_xenbus;
> + ret = xenbus_printf(xbt, dev->nodename, "num-rings", "%u", priv->num_rings);
> + if (ret)
> + goto error_xenbus;
> + for (i = 0; i < priv->num_rings; i++) {
> + char str[16];
> +
> + BUILD_BUG_ON(XEN_9PFS_NUM_RINGS > 9);
> + sprintf(str, "ring-ref%u", i);
> + ret = xenbus_printf(xbt, dev->nodename, str, "%d", priv->rings[i].ref);
> + if (ret)
> + goto error_xenbus;
> +
> + sprintf(str, "event-channel-%u", i);
> + ret = xenbus_printf(xbt, dev->nodename, str, "%u", priv->rings[i].evtchn);
> + if (ret)
> + goto error_xenbus;
> + }
> + priv->tag = xenbus_read(xbt, dev->nodename, "tag", NULL);
> + if (ret)
> + goto error_xenbus;
Shouldn't you test priv->tag instead?
Juergen
next prev parent reply other threads:[~2017-03-16 6:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-15 19:23 [PATCH v4 0/7] Xen transport for 9pfs frontend driver Stefano Stabellini
2017-03-15 19:23 ` [PATCH v4 1/7] xen: import new ring macros in ring.h Stefano Stabellini
2017-03-15 19:23 ` [PATCH v4 2/7] xen: introduce the header file for the Xen 9pfs transport protocol Stefano Stabellini
2017-03-15 19:23 ` [PATCH v4 3/7] xen/9pfs: introduce Xen 9pfs transport driver Stefano Stabellini
2017-03-15 19:23 ` [PATCH v4 4/7] xen/9pfs: connect to the backend Stefano Stabellini
2017-03-16 6:31 ` Juergen Gross [this message]
2017-03-16 18:04 ` Stefano Stabellini
2017-03-15 19:23 ` [PATCH v4 5/7] xen/9pfs: send requests " Stefano Stabellini
2017-03-15 19:23 ` [PATCH v4 6/7] xen/9pfs: receive responses Stefano Stabellini
2017-03-15 19:23 ` [PATCH v4 7/7] xen/9pfs: build 9pfs Xen transport driver Stefano Stabellini
2017-03-16 6:19 ` [PATCH v4 0/7] Xen transport for 9pfs frontend driver Juergen Gross
2017-03-16 17:47 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98c4078f-80cd-c1b2-0c41-57b20d764ce2@suse.com \
--to=jgross@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=ericvh@gmail.com \
--cc=groug@kaod.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=rminnich@sandia.gov \
--cc=sstabellini@kernel.org \
--cc=stefano@aporeto.com \
--cc=v9fs-developer@lists.sourceforge.net \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®