mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
tcp: gso: fix truesize tracking
[ Upstream commit0d08c42cf9
] commit6ff50cd555
("tcp: gso: do not generate out of order packets") had an heuristic that can trigger a warning in skb_try_coalesce(), because skb->truesize of the gso segments were exactly set to mss. This breaks the requirement that skb->truesize >= skb->len + truesizeof(struct sk_buff); It can trivially be reproduced by : ifconfig lo mtu 1500 ethtool -K lo tso off netperf As the skbs are looped into the TCP networking stack, skb_try_coalesce() warns us of these skb under-estimating their truesize. Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Change-Id: Iced7cd04a2860fcc14815c4f5564e01840ac41e3
This commit is contained in:
parent
33e834ef26
commit
aedce03d5d
1 changed files with 5 additions and 8 deletions
|
@ -2747,6 +2747,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
|
|||
netdev_features_t features)
|
||||
{
|
||||
struct sk_buff *segs = ERR_PTR(-EINVAL);
|
||||
unsigned int sum_truesize = 0;
|
||||
struct tcphdr *th;
|
||||
unsigned thlen;
|
||||
unsigned int seq;
|
||||
|
@ -2828,13 +2829,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
|
|||
if (copy_destructor) {
|
||||
skb->destructor = gso_skb->destructor;
|
||||
skb->sk = gso_skb->sk;
|
||||
/* {tcp|sock}_wfree() use exact truesize accounting :
|
||||
* sum(skb->truesize) MUST be exactly be gso_skb->truesize
|
||||
* So we account mss bytes of 'true size' for each segment.
|
||||
* The last segment will contain the remaining.
|
||||
*/
|
||||
skb->truesize = mss;
|
||||
gso_skb->truesize -= mss;
|
||||
sum_truesize += skb->truesize;
|
||||
}
|
||||
skb = skb->next;
|
||||
th = tcp_hdr(skb);
|
||||
|
@ -2851,7 +2846,9 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
|
|||
if (copy_destructor) {
|
||||
swap(gso_skb->sk, skb->sk);
|
||||
swap(gso_skb->destructor, skb->destructor);
|
||||
swap(gso_skb->truesize, skb->truesize);
|
||||
sum_truesize += skb->truesize;
|
||||
atomic_add(sum_truesize - gso_skb->truesize,
|
||||
&skb->sk->sk_wmem_alloc);
|
||||
}
|
||||
|
||||
delta = htonl(oldlen + (skb->tail - skb->transport_header) +
|
||||
|
|
Loading…
Reference in a new issue