Skip to content

Commit d9a58a7

Browse files
Ian Campbelldavem330
authored andcommitted
xen/netfront: improve truesize tracking
Using RX_COPY_THRESHOLD is incorrect if the SKB is actually smaller than that. We have already accounted for this in NETFRONT_SKB_CB(skb)->pull_to so use that instead. Fixes WARN_ON from skb_try_coalesce. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: Sander Eikelenboom <linux@eikelenboom.it> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: annie li <annie.li@oracle.com> Cc: xen-devel@lists.xen.org Cc: netdev@vger.kernel.org Cc: stable@kernel.org # 3.7.x only Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 32fa10b commit d9a58a7

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

drivers/net/xen-netfront.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,29 +1015,10 @@ static int xennet_poll(struct napi_struct *napi, int budget)
10151015
i = xennet_fill_frags(np, skb, &tmpq);
10161016

10171017
/*
1018-
* Truesize approximates the size of true data plus
1019-
* any supervisor overheads. Adding hypervisor
1020-
* overheads has been shown to significantly reduce
1021-
* achievable bandwidth with the default receive
1022-
* buffer size. It is therefore not wise to account
1023-
* for it here.
1024-
*
1025-
* After alloc_skb(RX_COPY_THRESHOLD), truesize is set
1026-
* to RX_COPY_THRESHOLD + the supervisor
1027-
* overheads. Here, we add the size of the data pulled
1028-
* in xennet_fill_frags().
1029-
*
1030-
* We also adjust for any unused space in the main
1031-
* data area by subtracting (RX_COPY_THRESHOLD -
1032-
* len). This is especially important with drivers
1033-
* which split incoming packets into header and data,
1034-
* using only 66 bytes of the main data area (see the
1035-
* e1000 driver for example.) On such systems,
1036-
* without this last adjustement, our achievable
1037-
* receive throughout using the standard receive
1038-
* buffer size was cut by 25%(!!!).
1039-
*/
1040-
skb->truesize += skb->data_len - RX_COPY_THRESHOLD;
1018+
* Truesize is the actual allocation size, even if the
1019+
* allocation is only partially used.
1020+
*/
1021+
skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags;
10411022
skb->len += skb->data_len;
10421023

10431024
if (rx->flags & XEN_NETRXF_csum_blank)

0 commit comments

Comments
 (0)