Skip to contentSkip to conversation

Use xenbus API for mapping foreign pages

PATCH New David Vrabel 2 participants 5 messages Sep 13, 2011 – Sep 14, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Xenbus provides an API for mapping foreign pages. Make use of it in the netback and blkback drivers so when the method for mapping foreign pages is changed it only need to be updated in one place.

David

#1 lore raw

PATCH 1/2 block: xen-blkback: use API provided by xenbus module to map rings

From: David Vrabel <[email protected]>

The xenbus module provides xenbus_map_ring_valloc() and xenbus_map_ring_vfree(). Use these to map the ring pages granted by the frontend.

---
 drivers/block/xen-blkback/common.h |    5 +--
 drivers/block/xen-blkback/xenbus.c |   54 ++++-------------------------------
 2 files changed, 8 insertions(+), 51 deletions(-)
drivers/block/xen-blkback/common.h +1 -4
index 9e40b28..07dd177 100644
@@ -139,7 +139,7 @@ struct xen_blkif {
 	/* Comms information. */
 	enum blkif_protocol	blk_protocol;
 	union blkif_back_rings	blk_rings;
-	struct vm_struct	*blk_ring_area;
+	void			*blk_ring;
 	/* The VBD attached to this interface. */
 	struct xen_vbd		vbd;
 	/* Back pointer to the backend_info. */
@@ -163,9 +163,6 @@ struct xen_blkif {
 	int			st_wr_sect;
 
 	wait_queue_head_t	waiting_to_free;
-
-	grant_handle_t		shmem_handle;
-	grant_ref_t		shmem_ref;
 };
 
 
drivers/block/xen-blkback/xenbus.c +7 -47

96 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 2/2 net: xen-netback: use API provided by xenbus module to map rings

In reply to David Vrabel

From: David Vrabel <[email protected]>

The xenbus module provides xenbus_map_ring_valloc() and xenbus_map_ring_vfree(). Use these to map the Tx and Rx ring pages granted by the frontend.

---
 drivers/net/xen-netback/common.h  |   11 ++---
 drivers/net/xen-netback/netback.c |   80 ++++++++-----------------------------
 2 files changed, 22 insertions(+), 69 deletions(-)
drivers/net/xen-netback/common.h +5 -6
index 161f207..94b79c3 100644
@@ -58,10 +58,6 @@ struct xenvif {
 	u8               fe_dev_addr[6];
 
 	/* Physical parameters of the comms window. */
-	grant_handle_t   tx_shmem_handle;
-	grant_ref_t      tx_shmem_ref;
-	grant_handle_t   rx_shmem_handle;
-	grant_ref_t      rx_shmem_ref;
 	unsigned int     irq;
 
 	/* List of frontends to notify after a batch of frames sent. */
@@ -70,8 +66,6 @@ struct xenvif {
 	/* The shared rings and indexes. */
 	struct xen_netif_tx_back_ring tx;
 	struct xen_netif_rx_back_ring rx;
-	struct vm_struct *tx_comms_area;
-	struct vm_struct *rx_comms_area;
 
 	/* Frontend feature information. */
 	u8 can_sg:1;
@@ -106,6 +100,11 @@ struct xenvif {
 	wait_queue_head_t waiting_to_free;
 };
 
+static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif)
+{
+	return to_xenbus_device(vif->dev->dev.parent);
+}
+
 #define XEN_NETIF_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE)
 #define XEN_NETIF_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE)
 
drivers/net/xen-netback/netback.c +17 -63

105 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#3 lore raw
In reply to David Vrabel
Quoted 3 lines · David Vrabel

Xenbus provides an API for mapping foreign pages. Make use of it in the netback and blkback drivers so when the method for mapping foreign pages is changed it only need to be updated in one place.ak

Don't apply these. I've taken a different approach that obsoletes xenbus_map_ring_valloc() and xenbus_map_ring_vfree().

David

#4 lore raw
Quoted 7 lines · David Vrabel
Quoted 3 lines · David Vrabel

Xenbus provides an API for mapping foreign pages. Make use of it in the netback and blkback drivers so when the method for mapping foreign pages is changed it only need to be updated in one place.ak

Don't apply these. I've taken a different approach that obsoletes xenbus_map_ring_valloc() and xenbus_map_ring_vfree().

Ok.