direct-io.hg

changeset 12459:ba84d697b1ea

[NET] back: Fix bug in 12262:ac2097d71e06dbbf77279af10d6ae7359d921ab0.
Pointed out by Jan Beulich.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Nov 16 08:56:58 2006 +0000 (2006-11-16)
parents b276ed52616a
children 989fd189f529
files linux-2.6-xen-sparse/drivers/xen/netback/netback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Nov 16 07:48:37 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Nov 16 08:56:58 2006 +0000
     1.3 @@ -825,7 +825,9 @@ static void tx_add_credit(netif_t *netif
     1.4  	max_burst = max(max_burst, netif->credit_bytes);
     1.5  
     1.6  	/* Take care that adding a new chunk of credit doesn't wrap to zero. */
     1.7 -	max_credit = max(netif->remaining_credit + netif->credit_bytes, ~0UL);
     1.8 +	max_credit = netif->remaining_credit + netif->credit_bytes;
     1.9 +	if (max_credit < netif->remaining_credit)
    1.10 +		max_credit = ULONG_MAX; /* wrapped: clamp to ULONG_MAX */
    1.11  
    1.12  	netif->remaining_credit = min(max_credit, max_burst);
    1.13  }