Eric Dumazet a181ceb501 tcp: autocork should not hold first packet in write queue
Willem noticed a TCP_RR regression caused by TCP autocorking
on a Mellanox test bed. MLX4_EN_TX_COAL_TIME is 16 us, which can be
right above RTT between hosts.

We can receive a ACK for a packet still in NIC TX ring buffer or in a
softnet completion queue.

Fix this by always pushing the skb if it is at the head of write queue.

Also, as TX completion is lockless, it's safer to perform sk_wmem_alloc
test after setting TSQ_THROTTLED.

erd:~# MIB="MIN_LATENCY,MEAN_LATENCY,MAX_LATENCY,P99_LATENCY,STDDEV_LATENCY"
erd:~#  ./netperf -H remote -t TCP_RR -- -o $MIB | tail -n 1
(repeat 3 times)

Before patch :

18,1049.87,41004,39631,6295.47
17,239.52,40804,48,2912.79
18,348.40,40877,54,3573.39

After patch :

18,22.84,4606,38,16.39
17,21.56,2871,36,13.51
17,22.46,2705,37,11.83

Reported-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: f54b311142a9 ("tcp: auto corking")
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-12-20 17:56:25 -05:00
..
2013-12-06 07:24:39 +01:00
2013-12-14 00:58:22 -05:00
2013-10-19 19:36:19 -04:00
2013-10-17 15:02:02 -04:00
2013-10-08 23:19:24 -04:00
2012-10-08 17:42:36 -04:00
2013-12-10 21:57:11 -05:00
2013-10-19 19:36:19 -04:00
2013-09-03 21:41:43 -04:00
2013-11-29 16:37:36 -05:00
2013-12-06 12:51:41 -05:00
2013-12-06 07:24:39 +01:00
2013-12-06 07:24:39 +01:00
2013-12-17 15:15:25 -05:00
2013-03-21 11:47:50 -04:00
2012-03-11 23:42:51 -07:00
2013-10-19 19:36:19 -04:00
2013-05-31 17:19:05 -07:00