xen-netback: don't use last request to determine minimum Tx credit
authorDavid Vrabel <david.vrabel@citrix.com>
Fri, 30 Oct 2015 15:16:01 +0000 (15:16 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jan 2016 21:40:06 +0000 (21:40 +0000)
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.

CC: stable@vger.kernel.org
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[bwh: Backported to 3.2: s/queue/vif/g]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/xen-netback/netback.c

index b2528f6..0c0b768 100644 (file)
@@ -864,9 +864,7 @@ static void tx_add_credit(struct xenvif *vif)
         * 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(&vif->tx, vif->tx.req_cons)->size;
-       max_burst = min(max_burst, 131072UL);
-       max_burst = max(max_burst, vif->credit_bytes);
+       max_burst = max(131072UL, vif->credit_bytes);
 
        /* Take care that adding a new chunk of credit doesn't wrap to zero. */
        max_credit = vif->remaining_credit + vif->credit_bytes;