diff options
author | Ian Campbell <Ian.Campbell@citrix.com> | 2013-01-07 00:32:06 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-07 22:51:19 -0500 |
commit | d9a58a782e396a0f04e8445b7ba3763c8a48c7fe (patch) | |
tree | 319af7e412885f2c7c9c7f45d5d7bfbc68d762cd /drivers/net | |
parent | 32fa10b24ef64b41e8ca17068fa9dc625427a05e (diff) |
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/xen-netfront.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index c26e28b4bd9f..7ffa43bd7cf9 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1015,29 +1015,10 @@ err: | |||
1015 | i = xennet_fill_frags(np, skb, &tmpq); | 1015 | i = xennet_fill_frags(np, skb, &tmpq); |
1016 | 1016 | ||
1017 | /* | 1017 | /* |
1018 | * Truesize approximates the size of true data plus | 1018 | * Truesize is the actual allocation size, even if the |
1019 | * any supervisor overheads. Adding hypervisor | 1019 | * allocation is only partially used. |
1020 | * overheads has been shown to significantly reduce | 1020 | */ |
1021 | * achievable bandwidth with the default receive | 1021 | skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags; |
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; | ||
1041 | skb->len += skb->data_len; | 1022 | skb->len += skb->data_len; |
1042 | 1023 | ||
1043 | if (rx->flags & XEN_NETRXF_csum_blank) | 1024 | if (rx->flags & XEN_NETRXF_csum_blank) |