ia64/xen-unstable

changeset 11777:fd80b7e1e333

[NET] back: Refcount fixes to vif rate-limiting code.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Oct 09 17:08:18 2006 +0100 (2006-10-09)
parents 6e932f32662c
children ab85c20d33e5
files linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Mon Oct 09 16:43:09 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Mon Oct 09 17:08:18 2006 +0100
     1.3 @@ -62,6 +62,7 @@ static void __netif_down(netif_t *netif)
     1.4  {
     1.5  	disable_irq(netif->irq);
     1.6  	netif_deschedule_work(netif);
     1.7 +	del_timer_sync(&netif->credit_timeout);
     1.8  }
     1.9  
    1.10  static int net_open(struct net_device *dev)
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Mon Oct 09 16:43:09 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Mon Oct 09 17:08:18 2006 +0100
     2.3 @@ -1102,6 +1102,7 @@ static void net_tx_action(unsigned long 
     2.4  		i = netif->tx.req_cons;
     2.5  		rmb(); /* Ensure that we see the request before we copy it. */
     2.6  		memcpy(&txreq, RING_GET_REQUEST(&netif->tx, i), sizeof(txreq));
     2.7 +
     2.8  		/* Credit-based scheduling. */
     2.9  		if (txreq.size > netif->remaining_credit) {
    2.10  			unsigned long now = jiffies;
    2.11 @@ -1110,8 +1111,10 @@ static void net_tx_action(unsigned long 
    2.12  				msecs_to_jiffies(netif->credit_usec / 1000);
    2.13  
    2.14  			/* Timer could already be pending in rare cases. */
    2.15 -			if (timer_pending(&netif->credit_timeout))
    2.16 -				break;
    2.17 +			if (timer_pending(&netif->credit_timeout)) {
    2.18 +				netif_put(netif);
    2.19 +				continue;
    2.20 +			}
    2.21  
    2.22  			/* Passed the point where we can replenish credit? */
    2.23  			if (time_after_eq(now, next_credit)) {
    2.24 @@ -1128,7 +1131,8 @@ static void net_tx_action(unsigned long 
    2.25  					tx_credit_callback;
    2.26  				__mod_timer(&netif->credit_timeout,
    2.27  					    next_credit);
    2.28 -				break;
    2.29 +				netif_put(netif);
    2.30 +				continue;
    2.31  			}
    2.32  		}
    2.33  		netif->remaining_credit -= txreq.size;