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

[Xen-changelog] [xen-unstable] [NET] front: Clean up rx ring recovery.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 762ae310d878c286a43110499326dfb7e1e13d53
# Parent  1fb835267a50551fc071673fa27eb1490b90ec91
[NET] front: Clean up rx ring recovery.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

This is an update to c/s
10855:03c8002068d9d60c7bbfc2f41af975e09b2e2211
which should have contained the following changeset message
(rather than 'Merge.').

[NET] front: Stop using rx->id

With the current protocol for transferring packets from dom0 to domU,
the
rx->id field is useless because it can be derived from the rx request
ring
ID.  In particular,

        rx->id = (ring_id & NET_RX_RING_SIZE - 1) + 1;

This formula works because the rx response to each request always
occupies
the same slot that the request arrived in.  This in turn is a
consequence
of the fact that each packet only occupies one slot.

The other important reason that this works for dom0=>domU but not
domU=>dom0
is that the resource associated with the rx->id is freed immediately
while
in the domU=>dom0 case the resource is held until the skb is liberated
by
dom0.

Using this formula we can essentially remove rx->id from the protocol,
freeing up space that could be instead be used by things like TSO.
The
only constraint is that the backend must obey the rule that each id
must
only be used in the response that occupies the same slot as the
request.

The actual field of rx->id is still maintained for compatibility with
older backends.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |   21 ++++++++-----------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff -r 1fb835267a50 -r 762ae310d878 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Jul 28 
16:54:17 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Jul 28 
17:00:10 2006 +0100
@@ -1193,19 +1193,16 @@ static void network_connect(struct net_d
                if (!np->rx_skbs[i])
                        continue;
 
+               skb = np->rx_skbs[requeue_idx] = xennet_get_rx_skb(np, i);
+               ref = np->grant_rx_ref[requeue_idx] = xennet_get_rx_ref(np, i);
+
                gnttab_grant_foreign_transfer_ref(
-                       np->grant_rx_ref[i], np->xbdev->otherend_id,
-                       __pa(np->rx_skbs[i]->data) >> PAGE_SHIFT);
-               RING_GET_REQUEST(&np->rx, requeue_idx)->gref =
-                       np->grant_rx_ref[i];
-               RING_GET_REQUEST(&np->rx, requeue_idx)->id = requeue_idx;
-
-               if (requeue_idx < i) {
-                       np->rx_skbs[requeue_idx] = np->rx_skbs[i];
-                       np->grant_rx_ref[requeue_idx] = np->grant_rx_ref[i];
-                       np->rx_skbs[i] = NULL;
-                       np->grant_rx_ref[i] = GRANT_INVALID_REF;
-               }
+                       ref, np->xbdev->otherend_id,
+                       __pa(skb->data) >> PAGE_SHIFT);
+
+               RING_GET_REQUEST(&np->rx, requeue_idx)->gref = ref;
+               RING_GET_REQUEST(&np->rx, requeue_idx)->id   = requeue_idx;
+
                requeue_idx++;
        }
 

_______________________________________________
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®.