Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccc9d90a authored by Wei Liu's avatar Wei Liu Committed by David Vrabel
Browse files

xenbus_client: Extend interface to support multi-page ring



Originally Xen PV drivers only use single-page ring to pass along
information. This might limit the throughput between frontend and
backend.

The patch extends Xenbus driver to support multi-page ring, which in
general should improve throughput if ring is the bottleneck. Changes to
various frontend / backend to adapt to the new interface are also
included.

Affected Xen drivers:
* blkfront/back
* netfront/back
* pcifront/back
* scsifront/back
* vtpmfront

The interface is documented, as before, in xenbus_client.c.

Signed-off-by: default avatarWei Liu <wei.liu2@citrix.com>
Signed-off-by: default avatarPaul Durrant <paul.durrant@citrix.com>
Signed-off-by: default avatarBob Liu <bob.liu@oracle.com>
Cc: Konrad Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
parent 278edfc0
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
	return ERR_PTR(-ENOMEM);
}

static int xen_blkif_map(struct xen_blkif *blkif, unsigned long shared_page,
static int xen_blkif_map(struct xen_blkif *blkif, grant_ref_t gref,
			 unsigned int evtchn)
{
	int err;
@@ -202,7 +202,8 @@ static int xen_blkif_map(struct xen_blkif *blkif, unsigned long shared_page,
	if (blkif->irq)
		return 0;

	err = xenbus_map_ring_valloc(blkif->be->dev, shared_page, &blkif->blk_ring);
	err = xenbus_map_ring_valloc(blkif->be->dev, &gref, 1,
				     &blkif->blk_ring);
	if (err < 0)
		return err;

+3 −2
Original line number Diff line number Diff line
@@ -1245,6 +1245,7 @@ static int setup_blkring(struct xenbus_device *dev,
			 struct blkfront_info *info)
{
	struct blkif_sring *sring;
	grant_ref_t gref;
	int err;

	info->ring_ref = GRANT_INVALID_REF;
@@ -1257,13 +1258,13 @@ static int setup_blkring(struct xenbus_device *dev,
	SHARED_RING_INIT(sring);
	FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE);

	err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring));
	err = xenbus_grant_ring(dev, info->ring.sring, 1, &gref);
	if (err < 0) {
		free_page((unsigned long)sring);
		info->ring.sring = NULL;
		goto fail;
	}
	info->ring_ref = err;
	info->ring_ref = gref;

	err = xenbus_alloc_evtchn(dev, &info->evtchn);
	if (err)
+3 −2
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ static int setup_ring(struct xenbus_device *dev, struct tpm_private *priv)
	struct xenbus_transaction xbt;
	const char *message = NULL;
	int rv;
	grant_ref_t gref;

	priv->shr = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
	if (!priv->shr) {
@@ -200,11 +201,11 @@ static int setup_ring(struct xenbus_device *dev, struct tpm_private *priv)
		return -ENOMEM;
	}

	rv = xenbus_grant_ring(dev, virt_to_mfn(priv->shr));
	rv = xenbus_grant_ring(dev, &priv->shr, 1, &gref);
	if (rv < 0)
		return rv;

	priv->ring_ref = rv;
	priv->ring_ref = gref;

	rv = xenbus_alloc_evtchn(dev, &priv->evtchn);
	if (rv)
+2 −2
Original line number Diff line number Diff line
@@ -1781,7 +1781,7 @@ int xenvif_map_frontend_rings(struct xenvif_queue *queue,
	int err = -ENOMEM;

	err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(queue->vif),
				     tx_ring_ref, &addr);
				     &tx_ring_ref, 1, &addr);
	if (err)
		goto err;

@@ -1789,7 +1789,7 @@ int xenvif_map_frontend_rings(struct xenvif_queue *queue,
	BACK_RING_INIT(&queue->tx, txs, PAGE_SIZE);

	err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(queue->vif),
				     rx_ring_ref, &addr);
				     &rx_ring_ref, 1, &addr);
	if (err)
		goto err;

+5 −4
Original line number Diff line number Diff line
@@ -1486,6 +1486,7 @@ static int setup_netfront(struct xenbus_device *dev,
{
	struct xen_netif_tx_sring *txs;
	struct xen_netif_rx_sring *rxs;
	grant_ref_t gref;
	int err;

	queue->tx_ring_ref = GRANT_INVALID_REF;
@@ -1502,10 +1503,10 @@ static int setup_netfront(struct xenbus_device *dev,
	SHARED_RING_INIT(txs);
	FRONT_RING_INIT(&queue->tx, txs, PAGE_SIZE);

	err = xenbus_grant_ring(dev, virt_to_mfn(txs));
	err = xenbus_grant_ring(dev, txs, 1, &gref);
	if (err < 0)
		goto grant_tx_ring_fail;
	queue->tx_ring_ref = err;
	queue->tx_ring_ref = gref;

	rxs = (struct xen_netif_rx_sring *)get_zeroed_page(GFP_NOIO | __GFP_HIGH);
	if (!rxs) {
@@ -1516,10 +1517,10 @@ static int setup_netfront(struct xenbus_device *dev,
	SHARED_RING_INIT(rxs);
	FRONT_RING_INIT(&queue->rx, rxs, PAGE_SIZE);

	err = xenbus_grant_ring(dev, virt_to_mfn(rxs));
	err = xenbus_grant_ring(dev, rxs, 1, &gref);
	if (err < 0)
		goto grant_rx_ring_fail;
	queue->rx_ring_ref = err;
	queue->rx_ring_ref = gref;

	if (feature_split_evtchn)
		err = setup_netfront_split(queue);
Loading