WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Allow use of grant tables for netdev tx+rx rings. Code i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Allow use of grant tables for netdev tx+rx rings. Code is kinda
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 14 Aug 2005 16:34:09 -0400
Delivery-date: Sun, 14 Aug 2005 20:34:39 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User smh22@xxxxxxxxxxxxxxxxxxxx
# Node ID e59f045986205ca5ce4b95e47ed4440e9ab47e67
# Parent  da515995a281c2b6831ce4f1cee5ee4b10f24b31
Allow use of grant tables for netdev tx+rx rings. Code is kinda 
ugly due at least in part to the fact that we still have separate 
_TX and _RX grant config options - expect this to be unified soon. 

Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx>

diff -r da515995a281 -r e59f04598620 
linux-2.6-xen-sparse/drivers/xen/netback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h Sun Aug 14 17:44:30 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h Sun Aug 14 20:34:13 2005
@@ -20,6 +20,13 @@
 #include <asm/io.h>
 #include <asm/pgalloc.h>
 
+#if defined(CONFIG_XEN_NETDEV_GRANT_TX) || defined(CONFIG_XEN_NETDEV_GRANT_RX)
+#include <asm-xen/xen-public/grant_table.h>
+#include <asm-xen/gnttab.h>
+#endif
+
+
+
 #if 0
 #define ASSERT(_p) \
     if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
@@ -40,7 +47,17 @@
 
     /* Physical parameters of the comms window. */
     unsigned long    tx_shmem_frame;
+#ifdef CONFIG_XEN_NETDEV_GRANT_TX
+    u16              tx_shmem_handle;
+    memory_t         tx_shmem_vaddr; 
+    grant_ref_t      tx_shmem_ref; 
+#endif
     unsigned long    rx_shmem_frame;
+#ifdef CONFIG_XEN_NETDEV_GRANT_RX
+    u16              rx_shmem_handle;
+    memory_t         rx_shmem_vaddr; 
+    grant_ref_t      rx_shmem_ref; 
+#endif
     unsigned int     evtchn;
 
     /* The shared rings and indexes. */
diff -r da515995a281 -r e59f04598620 
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Sun Aug 14 
17:44:30 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Sun Aug 14 
20:34:13 2005
@@ -71,12 +71,31 @@
     netif_t              *netif = (netif_t *)arg;
     ctrl_msg_t            cmsg;
     netif_be_disconnect_t disc;
+#if defined(CONFIG_XEN_NETDEV_GRANT_RX) || defined(CONFIG_XEN_NETDEV_GRANT_TX)
+    struct gnttab_unmap_grant_ref op;
+#endif
 
     /*
      * These can't be done in netif_disconnect() because at that point there
      * may be outstanding requests in the network stack whose asynchronous
      * responses must still be notified to the remote driver.
      */
+
+#ifdef CONFIG_XEN_NETDEV_GRANT_TX
+    op.host_addr    = netif->tx_shmem_vaddr;
+    op.handle       = netif->tx_shmem_handle;
+    op.dev_bus_addr = 0;
+    BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
+#endif
+
+#ifdef CONFIG_XEN_NETDEV_GRANT_RX
+    op.host_addr    = netif->rx_shmem_vaddr;
+    op.handle       = netif->rx_shmem_handle;
+    op.dev_bus_addr = 0;
+    BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
+#endif
+
+
     vfree(netif->tx); /* Frees netif->rx as well. */
 
     /* Construct the deferred response message. */
@@ -275,40 +294,61 @@
     unsigned long tx_shmem_frame = connect->tx_shmem_frame;
     unsigned long rx_shmem_frame = connect->rx_shmem_frame;
     struct vm_struct *vma;
-    pgprot_t      prot;
+#if !defined(CONFIG_XEN_NETDEV_GRANT_TX)||!defined(CONFIG_XEN_NETDEV_GRANT_RX)
+    pgprot_t      prot = __pgprot(_KERNPG_TABLE);
     int           error;
+#endif
     netif_t      *netif;
 
     netif = netif_find_by_handle(domid, handle);
-    if ( unlikely(netif == NULL) )
-    {
+    if ( unlikely(netif == NULL) ) {
         DPRINTK("netif_connect attempted for non-existent netif (%u,%u)\n", 
                 connect->domid, connect->netif_handle); 
         connect->status = NETIF_BE_STATUS_INTERFACE_NOT_FOUND;
         return;
     }
 
-    if ( netif->status != DISCONNECTED )
-    {
+    if ( netif->status != DISCONNECTED ) {
         connect->status = NETIF_BE_STATUS_INTERFACE_CONNECTED;
         return;
     }
 
-    if ( (vma = get_vm_area(2*PAGE_SIZE, VM_IOREMAP)) == NULL )
-    {
+    if ( (vma = get_vm_area(2*PAGE_SIZE, VM_IOREMAP)) == NULL ) {
         connect->status = NETIF_BE_STATUS_OUT_OF_MEMORY;
         return;
     }
 
-    prot = __pgprot(_KERNPG_TABLE);
-    error  = direct_remap_area_pages(&init_mm, 
-                                     VMALLOC_VMADDR(vma->addr),
-                                     tx_shmem_frame<<PAGE_SHIFT, PAGE_SIZE,
-                                     prot, domid);
-    error |= direct_remap_area_pages(&init_mm, 
-                                     VMALLOC_VMADDR(vma->addr) + PAGE_SIZE,
-                                     rx_shmem_frame<<PAGE_SHIFT, PAGE_SIZE,
-                                     prot, domid);
+
+#if defined(CONFIG_XEN_NETDEV_GRANT_TX)
+    {
+        struct gnttab_map_grant_ref op;
+        int tx_ref = connect->tx_shmem_ref; 
+
+        /* Map: Use the Grant table reference */
+        op.host_addr = VMALLOC_VMADDR(vma->addr);
+        op.flags     = GNTMAP_host_map;
+        op.ref       = tx_ref;
+        op.dom       = domid;
+       
+        if ((HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1) < 0) || 
+            (op.handle < 0)) { 
+            DPRINTK(" Grant table operation failure !\n");
+            connect->status = NETIF_BE_STATUS_MAPPING_ERROR;
+            vfree(vma->addr);
+            return;
+        }
+
+        netif->tx_shmem_ref    = tx_ref;
+        netif->tx_shmem_handle = op.handle;
+        netif->tx_shmem_vaddr  = VMALLOC_VMADDR(vma->addr);
+    }
+        
+
+#else 
+    error = direct_remap_area_pages(&init_mm, 
+                                    VMALLOC_VMADDR(vma->addr),
+                                    tx_shmem_frame<<PAGE_SHIFT, PAGE_SIZE,
+                                    prot, domid); 
     if ( error != 0 )
     {
         if ( error == -ENOMEM )
@@ -320,6 +360,57 @@
         vfree(vma->addr);
         return;
     }
+#endif
+
+
+#if defined(CONFIG_XEN_NETDEV_GRANT_RX)
+    {
+        struct gnttab_map_grant_ref op;
+        int rx_ref = connect->rx_shmem_ref; 
+
+
+        /* Map: Use the Grant table reference */
+        op.host_addr = VMALLOC_VMADDR(vma->addr) + PAGE_SIZE;
+        op.flags     = GNTMAP_host_map;
+        op.ref       = rx_ref;
+        op.dom       = domid;
+
+        if ((HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1) < 0) || 
+            (op.handle < 0)) { 
+            DPRINTK(" Grant table operation failure !\n");
+            connect->status = NETIF_BE_STATUS_MAPPING_ERROR;
+            vfree(vma->addr);
+            return;
+        }
+
+            DPRINTK(" Grant table operation failure !\n");
+            connect->status = NETIF_BE_STATUS_MAPPING_ERROR;
+            vfree(vma->addr);
+            return;
+        }
+
+        netif->rx_shmem_ref    = rx_ref;
+        netif->rx_shmem_handle = handle;
+        netif->rx_shmem_vaddr  = VMALLOC_VMADDR(vma->addr) + PAGE_SIZE;
+    }
+#else 
+    error = direct_remap_area_pages(&init_mm, 
+                                     VMALLOC_VMADDR(vma->addr) + PAGE_SIZE,
+                                     rx_shmem_frame<<PAGE_SHIFT, PAGE_SIZE,
+                                     prot, domid);
+    if ( error != 0 )
+    {
+        if ( error == -ENOMEM )
+            connect->status = NETIF_BE_STATUS_OUT_OF_MEMORY;
+        else if ( error == -EFAULT )
+            connect->status = NETIF_BE_STATUS_MAPPING_ERROR;
+        else
+            connect->status = NETIF_BE_STATUS_ERROR;
+        vfree(vma->addr);
+        return;
+    }
+
+#endif
 
     netif->evtchn         = evtchn;
     netif->tx_shmem_frame = tx_shmem_frame;
diff -r da515995a281 -r e59f04598620 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Sun Aug 14 
17:44:30 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Sun Aug 14 
20:34:13 2005
@@ -518,7 +518,7 @@
         gop++;
     }
     BUG_ON(HYPERVISOR_grant_table_op(
-        GNTTABOP_unmap_grant_ref, tx_unmap_ops, gop - tx_unmap_ops));
+               GNTTABOP_unmap_grant_ref, tx_unmap_ops, gop - tx_unmap_ops));
 #else
     mcl = tx_mcl;
     while ( dc != dp )
@@ -697,9 +697,9 @@
         skb_reserve(skb, 16);
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
         mop->host_addr = MMAP_VADDR(pending_idx);
-        mop->dom = netif->domid;
-        mop->ref = txreq.addr >> PAGE_SHIFT;
-        mop->flags = GNTMAP_host_map | GNTMAP_readonly;
+        mop->dom       = netif->domid;
+        mop->ref       = txreq.addr >> PAGE_SHIFT;
+        mop->flags     = GNTMAP_host_map | GNTMAP_readonly;
         mop++;
 #else
        MULTI_update_va_mapping_otherdomain(
@@ -752,7 +752,12 @@
 
         /* Check the remap error code. */
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-        if ( unlikely(mop->dev_bus_addr == 0) )
+        /* 
+           XXX SMH: error returns from grant operations are pretty poorly
+           specified/thought out, but the below at least conforms with 
+           what the rest of the code uses. 
+        */
+        if ( unlikely(mop->handle < 0) )
         {
             printk(KERN_ALERT "#### netback grant fails\n");
             make_tx_response(netif, txreq.id, NETIF_RSP_ERROR);
diff -r da515995a281 -r e59f04598620 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sun Aug 14 
17:44:30 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sun Aug 14 
20:34:13 2005
@@ -59,7 +59,7 @@
 #include <asm-xen/gnttab.h>
 #ifdef GRANT_DEBUG
 static void
-dump_packet(int tag, u32 addr, u32 ap)
+dump_packet(int tag, void *addr, u32 ap)
 {
     unsigned char *p = (unsigned char *)ap;
     int i;
@@ -200,7 +200,7 @@
     [BEST_CONNECTED]    = "connected",
 };
 
-#if DEBUG
+#ifdef DEBUG
 #define DPRINTK(fmt, args...) \
     printk(KERN_ALERT "xen_net (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
 #else
@@ -356,8 +356,12 @@
             id  = np->tx->ring[MASK_NETIF_TX_IDX(i)].resp.id;
             skb = np->tx_skbs[id];
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-            if (gnttab_query_foreign_access(grant_tx_ref[id]) != 0) {
-                printk(KERN_ALERT "netfront: query foreign access\n");
+            if (unlikey(gnttab_query_foreign_access(grant_tx_ref[id]) != 0)) {
+                /* other domain is still using this grant - shouldn't happen
+                   but if it does, we'll try to reclaim the grant later */
+                printk(KERN_ALERT "network_tx_buf_gc: warning -- grant "
+                       "still in use by backend domain.\n");
+                goto out; 
             }
             gnttab_end_foreign_access(grant_tx_ref[id], GNTMAP_readonly);
             gnttab_release_grant_reference(&gref_tx_head, grant_tx_ref[id]);
@@ -382,6 +386,7 @@
         mb();
     } while (prod != np->tx->resp_prod);
 
+  out: 
     if (np->tx_full && ((np->tx->req_prod - prod) < NETIF_TX_RING_SIZE)) {
         np->tx_full = 0;
         if (np->user_state == UST_OPEN)
@@ -433,13 +438,15 @@
         
         np->rx->ring[MASK_NETIF_RX_IDX(req_prod + i)].req.id = id;
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
-        if ((ref = gnttab_claim_grant_reference(&gref_rx_head, 
gref_rx_terminal)) < 0) {
+        if (unlikely((ref = gnttab_claim_grant_reference(&gref_rx_head, 
+                                                gref_rx_terminal)) < 0)) {
             printk(KERN_ALERT "#### netfront can't claim rx reference\n");
             BUG();
         }
         grant_rx_ref[id] = ref;
         gnttab_grant_foreign_transfer_ref(ref, rdomid,
-        virt_to_machine(skb->head) >> PAGE_SHIFT);
+                                          virt_to_machine(
+                                              skb->head) >> PAGE_SHIFT);
         np->rx->ring[MASK_NETIF_RX_IDX(req_prod + i)].req.gref = ref;
 #endif
         rx_pfn_array[i] = virt_to_machine(skb->head) >> PAGE_SHIFT;
@@ -528,7 +535,8 @@
 
     tx->id   = id;
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-    if ((ref = gnttab_claim_grant_reference(&gref_tx_head, gref_tx_terminal)) 
< 0) {
+    if (unlikely((ref = gnttab_claim_grant_reference(&gref_tx_head, 
+                                                     gref_tx_terminal)) < 0)) {
         printk(KERN_ALERT "#### netfront can't claim tx grant reference\n");
         BUG();
     }
@@ -638,7 +646,6 @@
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
         ref = grant_rx_ref[rx->id];
         grant_rx_ref[rx->id] = GRANT_INVALID_REF;
-
         mfn = gnttab_end_foreign_transfer(ref);
         gnttab_release_grant_reference(&gref_rx_head, ref);
 #endif
@@ -674,18 +681,20 @@
                                pfn_pte_ma(mfn, PAGE_KERNEL), 0);
 #else
        MULTI_update_va_mapping(mcl, (unsigned long)skb->head,
-                               pfn_pte_ma(rx->addr >> PAGE_SHIFT, 
PAGE_KERNEL), 0);
+                               pfn_pte_ma(rx->addr >> PAGE_SHIFT, 
+                                           PAGE_KERNEL), 0);
 #endif
         mcl++;
 
+#ifdef CONFIG_XEN_NETDEV_GRANT_RX
+        phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = mfn;
+#else
         phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = 
-#ifdef CONFIG_XEN_NETDEV_GRANT_RX
-            mfn;
-#else
             rx->addr >> PAGE_SHIFT;
 #endif
+
 #ifdef GRANT_DEBUG
-        printk(KERN_ALERT "#### rx_poll     enqueue vdata=%08x mfn=%08x 
ref=%04x\n",
+        printk(KERN_ALERT "#### rx_poll     enqueue vdata=%p mfn=%lu ref=%x\n",
                skb->data, mfn, ref);
 #endif
         __skb_queue_tail(&rxq, skb);
@@ -707,9 +716,9 @@
 
     while ((skb = __skb_dequeue(&rxq)) != NULL) {
 #ifdef GRANT_DEBUG
-         printk(KERN_ALERT "#### rx_poll     dequeue vdata=%08x mfn=%08x\n",
-                skb->data, virt_to_machine(skb->data)>>PAGE_SHIFT);
-         dump_packet('d', skb->data, (unsigned long)skb->data);
+        printk(KERN_ALERT "#### rx_poll     dequeue vdata=%p mfn=%lu\n",
+               skb->data, virt_to_machine(skb->data)>>PAGE_SHIFT);
+        dump_packet('d', skb->data, (unsigned long)skb->data);
 #endif
         /*
          * Enough room in skbuff for the data we were passed? Also, Linux 
@@ -884,7 +893,7 @@
 
 static void vif_show(struct net_private *np)
 {
-#if DEBUG
+#ifdef DEBUG
     if (np) {
         IPRINTK("<vif handle=%u %s(%s) evtchn=%u tx=%p rx=%p>\n",
                np->handle,
@@ -911,8 +920,29 @@
 
     msg->handle = np->handle;
     msg->tx_shmem_frame = (virt_to_machine(np->tx) >> PAGE_SHIFT);
+#ifdef CONFIG_XEN_NETDEV_GRANT_TX
+    msg->tx_shmem_ref   = (u32)gnttab_claim_grant_reference(&gref_tx_head, 
+                                                            gref_tx_terminal);
+    if(msg->tx_shmem_ref < 0) { 
+        printk(KERN_ALERT "#### netfront can't claim tx_shmem reference\n");
+        BUG();
+    }
+    gnttab_grant_foreign_access_ref (msg->tx_shmem_ref, rdomid, 
+                                     msg->tx_shmem_frame, 0);
+#endif
+
     msg->rx_shmem_frame = (virt_to_machine(np->rx) >> PAGE_SHIFT);
-        
+#ifdef CONFIG_XEN_NETDEV_GRANT_RX
+    msg->rx_shmem_ref   = (u32)gnttab_claim_grant_reference(&gref_rx_head, 
+                                                            gref_rx_terminal);
+    if(msg->rx_shmem_ref < 0) {
+        printk(KERN_ALERT "#### netfront can't claim rx_shmem reference\n");
+        BUG();
+    }
+    gnttab_grant_foreign_access_ref (msg->rx_shmem_ref, rdomid, 
+                                     msg->rx_shmem_frame, 0);
+#endif
+
     ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
 }
 
@@ -1380,20 +1410,22 @@
     if (xen_start_info.flags & SIF_INITDOMAIN)
         return 0;
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-    if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE,
+    /* A grant for every ring slot, plus one for the ring itself */
+    if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE + 1,
                                       &gref_tx_head, &gref_tx_terminal) < 0) {
         printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n");
         return 1;
     }
-    printk(KERN_ALERT "#### netfront tx using grant tables\n");
+    printk(KERN_ALERT "Netdev frontend (TX) is using grant tables.\n"); 
 #endif
 #ifdef CONFIG_XEN_NETDEV_GRANT_RX
-    if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE,
+    /* A grant for every ring slot, plus one for the ring itself */
+    if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE + 1,
                                       &gref_rx_head, &gref_rx_terminal) < 0) {
         printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n");
         return 1;
     }
-    printk(KERN_ALERT "#### netfront rx using grant tables\n");
+    printk(KERN_ALERT "Netdev frontend (RX) is using grant tables.\n"); 
 #endif
 
     if ((err = xennet_proc_init()) != 0)
diff -r da515995a281 -r e59f04598620 tools/python/xen/lowlevel/xu/xu.c
--- a/tools/python/xen/lowlevel/xu/xu.c Sun Aug 14 17:44:30 2005
+++ b/tools/python/xen/lowlevel/xu/xu.c Sun Aug 14 20:34:13 2005
@@ -655,7 +655,9 @@
     case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_CONNECT):
         C2P(netif_fe_interface_connect_t, handle,         Int, Long);
         C2P(netif_fe_interface_connect_t, tx_shmem_frame, Int, Long);
+        C2P(netif_fe_interface_connect_t, tx_shmem_ref,   Int, Long);
         C2P(netif_fe_interface_connect_t, rx_shmem_frame, Int, Long);
+        C2P(netif_fe_interface_connect_t, rx_shmem_ref,   Int, Long);
         return dict;
     case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_DISCONNECT):
         C2P(netif_fe_interface_disconnect_t, handle, Int, Long);
@@ -681,7 +683,9 @@
         C2P(netif_be_connect_t, domid,          Int, Long);
         C2P(netif_be_connect_t, netif_handle,   Int, Long);
         C2P(netif_be_connect_t, tx_shmem_frame, Int, Long);
+        C2P(netif_be_connect_t, tx_shmem_ref,   Int, Long);
         C2P(netif_be_connect_t, rx_shmem_frame, Int, Long);
+        C2P(netif_be_connect_t, rx_shmem_ref,   Int, Long);
         C2P(netif_be_connect_t, evtchn,         Int, Long);
         C2P(netif_be_connect_t, status,         Int, Long);
         return dict;
@@ -903,8 +907,10 @@
         P2C(netif_be_connect_t, domid,          u32);
         P2C(netif_be_connect_t, netif_handle,   u32);
         P2C(netif_be_connect_t, tx_shmem_frame, memory_t);
+        P2C(netif_be_connect_t, tx_shmem_ref,   u32); 
         P2C(netif_be_connect_t, rx_shmem_frame, memory_t);
-        P2C(netif_be_connect_t, evtchn,         u16);
+        P2C(netif_be_connect_t, rx_shmem_ref,   u32); 
+        P2C(netif_be_connect_t, evtchn,         u16); 
         break;
     case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DISCONNECT):
         P2C(netif_be_disconnect_t, domid,        u32);
diff -r da515995a281 -r e59f04598620 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Sun Aug 14 17:44:30 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Sun Aug 14 20:34:13 2005
@@ -593,7 +593,7 @@
     def delete(self):
         """Delete the vm's db.
         """
-        if self.dom_get(self.id):
+        if dom_get(self.id):
             return
         self.id = None
         self.saveToDB(sync=True)
diff -r da515995a281 -r e59f04598620 tools/python/xen/xend/server/netif.py
--- a/tools/python/xen/xend/server/netif.py     Sun Aug 14 17:44:30 2005
+++ b/tools/python/xen/xend/server/netif.py     Sun Aug 14 20:34:13 2005
@@ -421,7 +421,9 @@
                         'netif_handle'   : self.vif,
                         'evtchn'         : self.getEventChannelBackend(),
                         'tx_shmem_frame' : val['tx_shmem_frame'],
-                        'rx_shmem_frame' : val['rx_shmem_frame'] })
+                        'tx_shmem_ref'   : val['tx_shmem_ref'],
+                        'rx_shmem_frame' : val['rx_shmem_frame'],
+                        'rx_shmem_ref'   : val['rx_shmem_ref'] })
         msg = self.backendChannel.requestResponse(msg)
         #todo: check return status
         self.status = NETIF_INTERFACE_STATUS_CONNECTED
diff -r da515995a281 -r e59f04598620 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Sun Aug 14 17:44:30 2005
+++ b/xen/common/grant_table.c  Sun Aug 14 20:34:13 2005
@@ -771,9 +771,8 @@
         if ( sha_copy.flags )
         {
             DPRINTK("Grant: dom (%hu) SHARED (%d) flags:(%hx) "
-                    "dom:(%hu) frame:(%lx)\n",
-                    op.dom, i, sha_copy.flags, sha_copy.domid, 
-                    (unsigned long) sha_copy.frame);
+                    "dom:(%hu) frame:(%x)\n",
+                    op.dom, i, sha_copy.flags, sha_copy.domid, sha_copy.frame);
         }
     }
 
@@ -826,8 +825,8 @@
     for (i = 0; i < count; i++) {
         gnttab_donate_t *gop = &uop[i];
 #if GRANT_DEBUG
-        printk("gnttab_donate: i=%d mfn=%08x domid=%d gref=%08x\n",
-               i, (unsigned int)gop->mfn, gop->domid, gop->handle);
+        printk("gnttab_donate: i=%d mfn=%lx domid=%d gref=%08x\n",
+               i, gop->mfn, gop->domid, gop->handle);
 #endif
         page = &frame_table[gop->mfn];
 
@@ -1033,8 +1032,8 @@
 #if GRANT_DEBUG_VERBOSE
     if ( ld->domain_id != 0 )
     {
-        DPRINTK("Foreign unref rd(%d) ld(%d) frm(%x) flgs(%x).\n",
-                rd->domain_id, ld->domain_id, (unsigned int)frame, readonly);
+        DPRINTK("Foreign unref rd(%d) ld(%d) frm(%lx) flgs(%x).\n",
+                rd->domain_id, ld->domain_id, frame, readonly);
     }
 #endif
 
diff -r da515995a281 -r e59f04598620 xen/include/public/io/domain_controller.h
--- a/xen/include/public/io/domain_controller.h Sun Aug 14 17:44:30 2005
+++ b/xen/include/public/io/domain_controller.h Sun Aug 14 20:34:13 2005
@@ -365,8 +365,10 @@
  */
 typedef struct netif_fe_interface_connect {
     u32        handle;
-    memory_t   tx_shmem_frame;
+    memory_t   tx_shmem_frame; 
+    int        tx_shmem_ref;
     memory_t   rx_shmem_frame;
+    int        rx_shmem_ref;
 } netif_fe_interface_connect_t;
 
 /*
@@ -487,7 +489,9 @@
     domid_t    domid;          /* Domain attached to new interface.   */
     u32        netif_handle;   /* Domain-specific interface handle.   */
     memory_t   tx_shmem_frame; /* Page cont. tx shared comms window.  */
+    int        tx_shmem_ref;   /* Grant reference for above           */
     memory_t   rx_shmem_frame; /* Page cont. rx shared comms window.  */
+    int        rx_shmem_ref;   /* Grant reference for above           */
     u16        evtchn;         /* Event channel for notifications.    */
     /* OUT */
     u32        status;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Allow use of grant tables for netdev tx+rx rings. Code is kinda, Xen patchbot -unstable <=