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-ppc-devel

[XenPPC] [xenppc-unstable] [NET] back: Add a few comments to the goriest

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [NET] back: Add a few comments to the goriest parts of the scatter-gather patch.
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 06 Jun 2006 20:05:37 +0000
Delivery-date: Tue, 06 Jun 2006 13:07:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e3af1912794bcd4d6266e969fba3029e8d3a20ab
# Parent  aecdb4c52fa78dc2824f6be011689a2c4de4de11
[NET] back: Add a few comments to the goriest parts of the scatter-gather patch.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c |   47 ++++++++++-----------
 1 files changed, 23 insertions(+), 24 deletions(-)

diff -r aecdb4c52fa7 -r e3af1912794b 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Jun 05 
16:33:49 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Jun 05 
17:03:19 2006 +0100
@@ -543,17 +543,14 @@ static gnttab_map_grant_ref_t *netbk_get
        skb_frag_t *frags = shinfo->frags;
        netif_tx_request_t *txp;
        unsigned long pending_idx = *((u16 *)skb->data);
-       int nr_frags = shinfo->nr_frags;
        RING_IDX cons = netif->tx.req_cons + 1;
-       int i;
-
-       if ((unsigned long)shinfo->frags[0].page == pending_idx) {
-               frags++;
-               nr_frags--;
-       }
-
-       for (i = 0; i < nr_frags; i++) {
-               txp = RING_GET_REQUEST(&netif->tx, cons + i);
+       int i, start;
+
+       /* Skip first skb fragment if it is on same page as header fragment. */
+       start = ((unsigned long)shinfo->frags[0].page == pending_idx);
+
+       for (i = start; i < shinfo->nr_frags; i++) {
+               txp = RING_GET_REQUEST(&netif->tx, cons++);
                pending_idx = pending_ring[MASK_PEND_IDX(pending_cons++)];
 
                gnttab_set_map_op(mop++, MMAP_VADDR(pending_idx),
@@ -578,10 +575,9 @@ static int netbk_tx_check_mop(struct sk_
        netif_tx_request_t *txp;
        struct skb_shared_info *shinfo = skb_shinfo(skb);
        int nr_frags = shinfo->nr_frags;
-       int start;
-       int err;
-       int i;
-
+       int i, err, start;
+
+       /* Check status of header. */
        err = mop->status;
        if (unlikely(err)) {
                txp = &pending_tx_info[pending_idx].req;
@@ -595,44 +591,47 @@ static int netbk_tx_check_mop(struct sk_
                grant_tx_handle[pending_idx] = mop->handle;
        }
 
-       start = 0;
-       if ((unsigned long)shinfo->frags[0].page == pending_idx)
-               start++;
+       /* Skip first skb fragment if it is on same page as header fragment. */
+       start = ((unsigned long)shinfo->frags[0].page == pending_idx);
 
        for (i = start; i < nr_frags; i++) {
-               int newerr;
-               int j;
+               int j, newerr;
 
                pending_idx = (unsigned long)shinfo->frags[i].page;
 
+               /* Check error status: if okay then remember grant handle. */
                newerr = (++mop)->status;
                if (likely(!newerr)) {
                        set_phys_to_machine(
-                               __pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT,
-                               FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT));
+                               __pa(MMAP_VADDR(pending_idx))>>PAGE_SHIFT,
+                               FOREIGN_FRAME(mop->dev_bus_addr>>PAGE_SHIFT));
                        grant_tx_handle[pending_idx] = mop->handle;
-
+                       /* Had a previous error? Invalidate this fragment. */
                        if (unlikely(err))
                                netif_idx_release(pending_idx);
                        continue;
                }
 
+               /* Error on this fragment: respond to client with an error. */
                txp = &pending_tx_info[pending_idx].req;
                make_tx_response(netif, txp->id, NETIF_RSP_ERROR);
                pending_ring[MASK_PEND_IDX(pending_prod++)] = pending_idx;
                netif_put(netif);
 
+               /* Not the first error? Preceding frags already invalidated. */
                if (err)
                        continue;
 
+               /* First error: invalidate header and preceding fragments. */
                pending_idx = *((u16 *)skb->data);
                netif_idx_release(pending_idx);
-
                for (j = start; j < i; j++) {
                        pending_idx = (unsigned long)shinfo->frags[i].page;
                        netif_idx_release(pending_idx);
                }
-               err |= newerr;
+
+               /* Remember the error: invalidate all subsequent fragments. */
+               err = newerr;
        }
 
        *mopp = mop + 1;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [xenppc-unstable] [NET] back: Add a few comments to the goriest parts of the scatter-gather patch., Xen patchbot-xenppc-unstable <=