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] [xen-unstable] [NET] front: Fix receive path for auto-tr

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [NET] front: Fix receive path for auto-translated guests, so that
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 19 Aug 2006 10:50:13 +0000
Delivery-date: Sat, 19 Aug 2006 03:50:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID a629952ac766c781a71a310e5f8325c2b609f597
# Parent  03fd2accb4d9cbb50c69e6b183a76ac83fff0145
[NET] front: Fix receive path for auto-translated guests, so that
driver balloon allowance is properly accounted.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |   59 ++++++++++---------
 1 files changed, 33 insertions(+), 26 deletions(-)

diff -r 03fd2accb4d9 -r a629952ac766 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sat Aug 19 
11:13:17 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sat Aug 19 
11:39:04 2006 +0100
@@ -1018,8 +1018,10 @@ int xennet_get_extras(struct netfront_in
                                WPRINTK("Invalid extra type: %d\n",
                                        extra->type);
                        err = -EINVAL;
-               } else
-                       memcpy(&extras[extra->type - 1], extra, sizeof(*extra));
+               } else {
+                       memcpy(&extras[extra->type - 1], extra,
+                              sizeof(*extra));
+               }
 
                skb = xennet_get_rx_skb(np, cons);
                ref = xennet_get_rx_ref(np, cons);
@@ -1032,9 +1034,10 @@ int xennet_get_extras(struct netfront_in
 
 static int xennet_get_responses(struct netfront_info *np,
                                struct netfront_rx_info *rinfo, RING_IDX rp,
-                               struct sk_buff_head *list, int *mcl_offset_p)
-{
-       int mcl_offset = *mcl_offset_p;
+                               struct sk_buff_head *list,
+                               int *pages_flipped_p)
+{
+       int pages_flipped = *pages_flipped_p;
        struct mmu_update *mmu;
        struct multicall_entry *mcl;
        struct netif_rx_response *rx = &rinfo->rx;
@@ -1080,7 +1083,8 @@ static int xennet_get_responses(struct n
                         * headroom, ... */
                        if (!(mfn = gnttab_end_foreign_transfer_ref(ref))) {
                                if (net_ratelimit())
-                                       WPRINTK("Unfulfilled rx req (id=%d, 
st=%d).\n",
+                                       WPRINTK("Unfulfilled rx req "
+                                               "(id=%d, st=%d).\n",
                                                rx->id, rx->status);
                                xennet_move_rx_slot(np, skb, ref);
                                err = -ENOMEM;
@@ -1094,8 +1098,8 @@ static int xennet_get_responses(struct n
                                unsigned long pfn = page_to_pfn(page);
                                void *vaddr = page_address(page);
 
-                               mcl = np->rx_mcl + mcl_offset;
-                               mmu = np->rx_mmu + mcl_offset;
+                               mcl = np->rx_mcl + pages_flipped;
+                               mmu = np->rx_mmu + pages_flipped;
 
                                MULTI_update_va_mapping(mcl,
                                                        (unsigned long)vaddr,
@@ -1106,10 +1110,9 @@ static int xennet_get_responses(struct n
                                        | MMU_MACHPHYS_UPDATE;
                                mmu->val = pfn;
 
-                               mcl_offset++;
-
                                set_phys_to_machine(pfn, mfn);
                        }
+                       pages_flipped++;
                } else {
                        ret = gnttab_end_foreign_access_ref(ref, 0);
                        BUG_ON(!ret);
@@ -1142,7 +1145,7 @@ next:
                err = -E2BIG;
        }
 
-       *mcl_offset_p = mcl_offset;
+       *pages_flipped_p = pages_flipped;
 
        return err;
 }
@@ -1225,7 +1228,7 @@ static int netif_poll(struct net_device 
        struct sk_buff_head tmpq;
        unsigned long flags;
        unsigned int len;
-       int pages_done;
+       int pages_flipped = 0;
        int err;
 
        spin_lock(&np->rx_lock);
@@ -1244,13 +1247,14 @@ static int netif_poll(struct net_device 
        rp = np->rx.sring->rsp_prod;
        rmb(); /* Ensure we see queued responses up to 'rp'. */
 
-       for (i = np->rx.rsp_cons, work_done = 0, pages_done = 0;
+       for (i = np->rx.rsp_cons, work_done = 0;
             (i != rp) && (work_done < budget);
             np->rx.rsp_cons = ++i, work_done++) {
                memcpy(rx, RING_GET_RESPONSE(&np->rx, i), sizeof(*rx));
                memset(extras, 0, sizeof(extras));
 
-               err = xennet_get_responses(np, &rinfo, rp, &tmpq, &pages_done);
+               err = xennet_get_responses(np, &rinfo, rp, &tmpq,
+                                          &pages_flipped);
 
                if (unlikely(err)) {
 err:
@@ -1335,18 +1339,21 @@ err:
                __skb_queue_tail(&rxq, skb);
        }
 
-       /* Some pages are no longer absent... */
-       balloon_update_driver_allowance(-pages_done);
-
-       /* Do all the remapping work, and M2P updates, in one big hypercall. */
-       if (likely(pages_done)) {
-               mcl = np->rx_mcl + pages_done;
-               mcl->op = __HYPERVISOR_mmu_update;
-               mcl->args[0] = (unsigned long)np->rx_mmu;
-               mcl->args[1] = pages_done;
-               mcl->args[2] = 0;
-               mcl->args[3] = DOMID_SELF;
-               (void)HYPERVISOR_multicall(np->rx_mcl, pages_done + 1);
+       if (pages_flipped) {
+               /* Some pages are no longer absent... */
+               balloon_update_driver_allowance(-pages_flipped);
+
+               /* Do all the remapping work and M2P updates. */
+               if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+                       mcl = np->rx_mcl + pages_flipped;
+                       mcl->op = __HYPERVISOR_mmu_update;
+                       mcl->args[0] = (unsigned long)np->rx_mmu;
+                       mcl->args[1] = pages_flipped;
+                       mcl->args[2] = 0;
+                       mcl->args[3] = DOMID_SELF;
+                       (void)HYPERVISOR_multicall(np->rx_mcl,
+                                                  pages_flipped + 1);
+               }
        }
 
        while ((skb = __skb_dequeue(&errq)))

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [NET] front: Fix receive path for auto-translated guests, so that, Xen patchbot-unstable <=