Commit d9a58a78 authored by Ian Campbell's avatar Ian Campbell Committed by David S. Miller

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: default avatarIan 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: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 32fa10b2
...@@ -1015,29 +1015,10 @@ static int xennet_poll(struct napi_struct *napi, int budget) ...@@ -1015,29 +1015,10 @@ static int xennet_poll(struct napi_struct *napi, int budget)
i = xennet_fill_frags(np, skb, &tmpq); i = xennet_fill_frags(np, skb, &tmpq);
/* /*
* Truesize approximates the size of true data plus * Truesize is the actual allocation size, even if the
* any supervisor overheads. Adding hypervisor * allocation is only partially used.
* overheads has been shown to significantly reduce */
* achievable bandwidth with the default receive skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags;
* buffer size. It is therefore not wise to account
* for it here.
*
* After alloc_skb(RX_COPY_THRESHOLD), truesize is set
* to RX_COPY_THRESHOLD + the supervisor
* overheads. Here, we add the size of the data pulled
* in xennet_fill_frags().
*
* We also adjust for any unused space in the main
* data area by subtracting (RX_COPY_THRESHOLD -
* len). This is especially important with drivers
* which split incoming packets into header and data,
* using only 66 bytes of the main data area (see the
* e1000 driver for example.) On such systems,
* without this last adjustement, our achievable
* receive throughout using the standard receive
* buffer size was cut by 25%(!!!).
*/
skb->truesize += skb->data_len - RX_COPY_THRESHOLD;
skb->len += skb->data_len; skb->len += skb->data_len;
if (rx->flags & XEN_NETRXF_csum_blank) if (rx->flags & XEN_NETRXF_csum_blank)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment