[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [NET] back: Fix netif rate limiting.
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Node ID cb337b2f817b19d7b558c8f43e90274622056931 # Parent f028e3732803d61fdf9511f66521dc7b0fa3275c [NET] back: Fix netif rate limiting. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- linux-2.6-xen-sparse/drivers/xen/netback/interface.c | 1 linux-2.6-xen-sparse/drivers/xen/netback/netback.c | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff -r f028e3732803 -r cb337b2f817b linux-2.6-xen-sparse/drivers/xen/netback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Tue Oct 10 10:06:56 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Tue Oct 10 13:47:09 2006 +0100 @@ -153,6 +153,7 @@ netif_t *netif_alloc(domid_t domid, unsi netif->credit_bytes = netif->remaining_credit = ~0UL; netif->credit_usec = 0UL; init_timer(&netif->credit_timeout); + netif->credit_timeout.expires = jiffies; dev->hard_start_xmit = netif_be_start_xmit; dev->get_stats = netif_be_get_stats; diff -r f028e3732803 -r cb337b2f817b linux-2.6-xen-sparse/drivers/xen/netback/netback.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Oct 10 10:06:56 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Oct 10 13:47:09 2006 +0100 @@ -793,10 +793,27 @@ void netif_deschedule_work(netif_t *neti } +static void tx_add_credit(netif_t *netif) +{ + unsigned long max_burst; + + /* + * Allow a burst big enough to transmit a jumbo packet of up to 128kB. + * Otherwise the interface can seize up due to insufficient credit. + */ + max_burst = RING_GET_REQUEST(&netif->tx, netif->tx.req_cons)->size; + 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); +} + static void tx_credit_callback(unsigned long data) { netif_t *netif = (netif_t *)data; - netif->remaining_credit = netif->credit_bytes; + tx_add_credit(netif); netif_schedule_work(netif); } @@ -1119,12 +1136,11 @@ static void net_tx_action(unsigned long /* Passed the point where we can replenish credit? */ if (time_after_eq(now, next_credit)) { netif->credit_timeout.expires = now; - netif->remaining_credit = netif->credit_bytes; + tx_add_credit(netif); } /* Still too big to send right now? Set a callback. */ if (txreq.size > netif->remaining_credit) { - netif->remaining_credit = 0; netif->credit_timeout.data = (unsigned long)netif; netif->credit_timeout.function = _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |