From: David Vrabel Date: Fri, 30 Oct 2015 15:16:01 +0000 (+0000) Subject: xen-netback: don't use last request to determine minimum Tx credit X-Git-Tag: v3.16.35~746 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78db97a5e823c3f2c1479b1c1560eba7be6e8df8;p=thirdparty%2Fkernel%2Fstable.git xen-netback: don't use last request to determine minimum Tx credit commit 0f589967a73f1f30ab4ac4dd9ce0bb399b4d6357 upstream. The last from guest transmitted request gives no indication about the minimum amount of credit that the guest might need to send a packet since the last packet might have been a small one. Instead allow for the worst case 128 KiB packet. This is part of XSA155. Reviewed-by: Wei Liu Signed-off-by: David Vrabel Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Luis Henriques --- diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 09e4f4ef4eb8b..70e73907db0df 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c @@ -755,9 +755,7 @@ static void tx_add_credit(struct xenvif_queue *queue) * 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(&queue->tx, queue->tx.req_cons)->size; - max_burst = min(max_burst, 131072UL); - max_burst = max(max_burst, queue->credit_bytes); + max_burst = max(131072UL, queue->credit_bytes); /* Take care that adding a new chunk of credit doesn't wrap to zero. */ max_credit = queue->remaining_credit + queue->credit_bytes;