* [PATCH net] tcp: align tcp_xmit_size_goal() on tcp_tso_autosize()
@ 2015-03-05 16:03 Eric Dumazet
2015-03-05 16:13 ` Neal Cardwell
2015-03-06 3:31 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2015-03-05 16:03 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Yuchung Cheng, Neal Cardwell
From: Eric Dumazet <edumazet@google.com>
With some mss values, it is possible tcp_xmit_size_goal() puts
one segment more in TSO packet than tcp_tso_autosize().
We send then one TSO packet followed by one single MSS.
It is not a serious bug, but we can do slightly better, especially
for drivers using netif_set_gso_max_size() to lower gso_max_size.
Using same formula avoids these corner cases and makes
tcp_xmit_size_goal() a bit faster.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: 605ad7f184b6 ("tcp: refine TSO autosizing")
---
net/ipv4/tcp.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 9d72a0fcd928..995a2259bcfc 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -835,17 +835,13 @@ static unsigned int tcp_xmit_size_goal(struct sock *sk, u32 mss_now,
int large_allowed)
{
struct tcp_sock *tp = tcp_sk(sk);
- u32 new_size_goal, size_goal, hlen;
+ u32 new_size_goal, size_goal;
if (!large_allowed || !sk_can_gso(sk))
return mss_now;
- /* Maybe we should/could use sk->sk_prot->max_header here ? */
- hlen = inet_csk(sk)->icsk_af_ops->net_header_len +
- inet_csk(sk)->icsk_ext_hdr_len +
- tp->tcp_header_len;
-
- new_size_goal = sk->sk_gso_max_size - 1 - hlen;
+ /* Note : tcp_tso_autosize() will eventually split this later */
+ new_size_goal = sk->sk_gso_max_size - 1 - MAX_TCP_HEADER;
new_size_goal = tcp_bound_to_half_wnd(tp, new_size_goal);
/* We try hard to avoid divides here */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] tcp: align tcp_xmit_size_goal() on tcp_tso_autosize()
2015-03-05 16:03 [PATCH net] tcp: align tcp_xmit_size_goal() on tcp_tso_autosize() Eric Dumazet
@ 2015-03-05 16:13 ` Neal Cardwell
2015-03-06 3:31 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Neal Cardwell @ 2015-03-05 16:13 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Yuchung Cheng
On Thu, Mar 5, 2015 at 11:03 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> With some mss values, it is possible tcp_xmit_size_goal() puts
> one segment more in TSO packet than tcp_tso_autosize().
>
> We send then one TSO packet followed by one single MSS.
>
> It is not a serious bug, but we can do slightly better, especially
> for drivers using netif_set_gso_max_size() to lower gso_max_size.
>
> Using same formula avoids these corner cases and makes
> tcp_xmit_size_goal() a bit faster.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Fixes: 605ad7f184b6 ("tcp: refine TSO autosizing")
Acked-by: Neal Cardwell <ncardwell@google.com>
neal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] tcp: align tcp_xmit_size_goal() on tcp_tso_autosize()
2015-03-05 16:03 [PATCH net] tcp: align tcp_xmit_size_goal() on tcp_tso_autosize() Eric Dumazet
2015-03-05 16:13 ` Neal Cardwell
@ 2015-03-06 3:31 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-03-06 3:31 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, ycheng, ncardwell
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 05 Mar 2015 08:03:06 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> With some mss values, it is possible tcp_xmit_size_goal() puts
> one segment more in TSO packet than tcp_tso_autosize().
>
> We send then one TSO packet followed by one single MSS.
>
> It is not a serious bug, but we can do slightly better, especially
> for drivers using netif_set_gso_max_size() to lower gso_max_size.
>
> Using same formula avoids these corner cases and makes
> tcp_xmit_size_goal() a bit faster.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Fixes: 605ad7f184b6 ("tcp: refine TSO autosizing")
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-06 3:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05 16:03 [PATCH net] tcp: align tcp_xmit_size_goal() on tcp_tso_autosize() Eric Dumazet
2015-03-05 16:13 ` Neal Cardwell
2015-03-06 3:31 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.