netback: tx stalls with default credit_bytes
PATCH 1/1 netback: tx stalls with default credit_bytes
This situation happens when netif->credit_bytes is using the default of ~0UL, effectively -1. Once the current tx packet size is greater than the netif->remaining_credit, transmits will stall until netif->remaining_credit wraps back to ~0UL in tx_add_credit(). The min(netif->remaining_credit + netif->credit_bytes, max_burst) has the effect of decrementing netif->remaining_credit by 1. The min will continually be less than the current tx packet size until tx_add_credit() is called packet size times which allows netif->remaining_credit to wrap back to ~0UL.
The patch splits the min() into two steps to eliminate the case of adding by -1.
signed-of-by Kirk Allan <[email protected]>
linux-2.6-xen-sparse/drivers/xen/netback/netback.c +4 -3
@@ -815,6 +815,7 @@static void tx_add_credit (netif_t *netif) {unsigned long max_burst; +unsigned long max_credit;/* * Allow a burst big enough to transmit a jumbo packet of up to 128kB.
@@ -823,10 +824,10 @@ 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); + max_credit =max (netif->remaining_credit + netif->credit_bytes, + netif->credit_bytes); - netif->remaining_credit =min (netif->remaining_credit + - netif->credit_bytes, - max_burst); + netif->remaining_credit =min (max_credit, max_burst); }static void tx_credit_callback (unsigned long data)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 11 lines · Kirk Allan
This situation happens when
netif->credit_bytesis using the default of ~0UL, effectively -1. Once the current tx packet size is greater than thenetif->remaining_credit, transmits will stall untilnetif->remaining_creditwraps back to ~0UL intx_add_credit(). Themin(netif->remaining_credit + netif->credit_bytes, max_burst)has the effect of decrementingnetif->remaining_creditby 1. The min will continually be less than the current tx packet size untiltx_add_credit()is called packet size times which allowsnetif->remaining_creditto wrap back to ~0UL.The patch splits the
min()into two steps to eliminate the case of adding by -1.
Nice catch. Thanks.
-- Keir