diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-10-09 17:08:18 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-10-09 17:08:18 +0100 |
commit | d55292850af39832fdbc7540f387e598bd02fc56 (patch) | |
tree | 1cd26e78b1a79138a567d81f08eb0e17ee2cf318 | |
parent | f6d48164732a1a69cd114facfabf9ca594566f46 (diff) | |
download | xen-d55292850af39832fdbc7540f387e598bd02fc56.tar.gz xen-d55292850af39832fdbc7540f387e598bd02fc56.tar.bz2 xen-d55292850af39832fdbc7540f387e598bd02fc56.zip |
[NET] back: Refcount fixes to vif rate-limiting code.
Signed-off-by: Keir Fraser <keir@xensource.com>
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/netback/interface.c | 1 | ||||
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/netback/netback.c | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c index 5d122cf41b..2785f4d895 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c @@ -62,6 +62,7 @@ static void __netif_down(netif_t *netif) { disable_irq(netif->irq); netif_deschedule_work(netif); + del_timer_sync(&netif->credit_timeout); } static int net_open(struct net_device *dev) diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c index a75a4c9bc2..49f6013d44 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c @@ -1102,6 +1102,7 @@ static void net_tx_action(unsigned long unused) i = netif->tx.req_cons; rmb(); /* Ensure that we see the request before we copy it. */ memcpy(&txreq, RING_GET_REQUEST(&netif->tx, i), sizeof(txreq)); + /* Credit-based scheduling. */ if (txreq.size > netif->remaining_credit) { unsigned long now = jiffies; @@ -1110,8 +1111,10 @@ static void net_tx_action(unsigned long unused) msecs_to_jiffies(netif->credit_usec / 1000); /* Timer could already be pending in rare cases. */ - if (timer_pending(&netif->credit_timeout)) - break; + if (timer_pending(&netif->credit_timeout)) { + netif_put(netif); + continue; + } /* Passed the point where we can replenish credit? */ if (time_after_eq(now, next_credit)) { @@ -1128,7 +1131,8 @@ static void net_tx_action(unsigned long unused) tx_credit_callback; __mod_timer(&netif->credit_timeout, next_credit); - break; + netif_put(netif); + continue; } } netif->remaining_credit -= txreq.size; |