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

[Xen-changelog] [xen-unstable] [NET] back: Fix wrap to zero in transmit credit scheduler.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID ac2097d71e06dbbf77279af10d6ae7359d921ab0
# Parent  9d981f3480b149529e494c4673ef01a597d13fe9
[NET] back: Fix wrap to zero in transmit credit scheduler.
This could happen when credit_bytes == ~0UL (i.e., scheduling is 'disabled').
Signed-off-by: Kirk Allan <kallan@xxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff -r 9d981f3480b1 -r ac2097d71e06 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Tue Nov 07 
09:35:57 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Tue Nov 07 
09:48:19 2006 +0000
@@ -814,7 +814,7 @@ void netif_deschedule_work(netif_t *neti
 
 static void tx_add_credit(netif_t *netif)
 {
-       unsigned long max_burst;
+       unsigned long max_burst, max_credit;
 
        /*
         * Allow a burst big enough to transmit a jumbo packet of up to 128kB.
@@ -824,9 +824,10 @@ static void tx_add_credit(netif_t *netif
        max_burst = min(max_burst, 131072UL);
        max_burst = max(max_burst, netif->credit_bytes);
 
-       netif->remaining_credit = min(netif->remaining_credit +
-                                     netif->credit_bytes,
-                                     max_burst);
+       /* Take care that adding a new chunk of credit doesn't wrap to zero. */
+       max_credit = max(netif->remaining_credit + netif->credit_bytes, ~0UL);
+
+       netif->remaining_credit = min(max_credit, max_burst);
 }
 
 static void tx_credit_callback(unsigned long data)

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