[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Don't use the grant pre-allocation system for the ring grants.



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID ccfc31779d36e7d3628ebb2e3fdce1d611419ff9
# Parent  ac57c81692b24685345603ea5892d89451b6ef31
Don't use the grant pre-allocation system for the ring grants.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r ac57c81692b2 -r ccfc31779d36 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed Aug 24 
08:55:14 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed Aug 24 
09:31:52 2005
@@ -200,6 +200,7 @@
     [BEST_CONNECTED]    = "connected",
 };
 
+#define DEBUG
 #ifdef DEBUG
 #define DPRINTK(fmt, args...) \
     printk(KERN_ALERT "xen_net (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
@@ -919,6 +920,7 @@
 /* Send a connect message to xend to tell it to bring up the interface. */
 static void send_interface_connect(struct net_private *np)
 {
+    int err;
     ctrl_msg_t cmsg = {
         .type    = CMSG_NETIF_FE,
         .subtype = CMSG_NETIF_FE_INTERFACE_CONNECT,
@@ -929,24 +931,22 @@
     msg->handle = np->handle;
     msg->tx_shmem_frame = virt_to_mfn(np->tx);
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-    msg->tx_shmem_ref   = (u32)gnttab_claim_grant_reference(&gref_tx_head);
-    if(msg->tx_shmem_ref < 0) { 
-        printk(KERN_ALERT "#### netfront can't claim tx_shmem reference\n");
+    err = gnttab_grant_foreign_access(rdomid, msg->tx_shmem_frame, 0);
+    if (err < 0) {
+        printk(KERN_ALERT "#### netfront can't grant access to tx_shmem\n");
         BUG();
     }
-    gnttab_grant_foreign_access_ref (msg->tx_shmem_ref, rdomid, 
-                                     msg->tx_shmem_frame, 0);
+    msg->tx_shmem_ref = err;
 #endif
 
     msg->rx_shmem_frame = virt_to_mfn(np->rx);
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
-    msg->rx_shmem_ref   = (u32)gnttab_claim_grant_reference(&gref_rx_head);
-    if(msg->rx_shmem_ref < 0) {
-        printk(KERN_ALERT "#### netfront can't claim rx_shmem reference\n");
+    err = gnttab_grant_foreign_access(rdomid, msg->rx_shmem_frame, 0);
+    if (err < 0) {
+        printk(KERN_ALERT "#### netfront can't grant access to rx_shmem\n");
         BUG();
     }
-    gnttab_grant_foreign_access_ref (msg->rx_shmem_ref, rdomid, 
-                                     msg->rx_shmem_frame, 0);
+    msg->rx_shmem_ref = err;
 #endif
 
     ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
@@ -1416,8 +1416,8 @@
     if (xen_start_info.flags & SIF_INITDOMAIN)
         return 0;
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-    /* A grant for every ring slot, plus one for the ring itself */
-    if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE + 1,
+    /* A grant for every ring slot */
+    if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE,
                                       &gref_tx_head) < 0) {
         printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n");
         return 1;
@@ -1425,8 +1425,8 @@
     printk(KERN_ALERT "Netdev frontend (TX) is using grant tables.\n"); 
 #endif
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
-    /* A grant for every ring slot, plus one for the ring itself */
-    if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE + 1,
+    /* A grant for every ring slot */
+    if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE,
                                       &gref_rx_head) < 0) {
         printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n");
         return 1;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.