Segments flagged with 'PSH' should be sent as soon as possible,
ignoring the timing set by the congestion control (if any).
This patch avoids the waiting of 'PSH' segments in the TCP queue.

Signed-off-by: Natale Patriciello <natale.patricie...@gmail.com>
Tested-by: Ahmed Said <ahmed.s...@uniroma2.it>
---
 net/ipv4/tcp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 40aca7803cf2..ebaedbf75b63 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -975,9 +975,9 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct 
page *page, int offset,
 
                if (forced_push(tp)) {
                        tcp_mark_push(tp, skb);
-                       __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_PUSH);
-               } else if (skb == tcp_send_head(sk))
                        tcp_push_one(sk, mss_now);
+               } else if (skb == tcp_send_head(sk))
+                       __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_PUSH);
                continue;
 
 wait_for_sndbuf:
@@ -1320,9 +1320,9 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, 
size_t size)
 
                if (forced_push(tp)) {
                        tcp_mark_push(tp, skb);
-                       __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_PUSH);
-               } else if (skb == tcp_send_head(sk))
                        tcp_push_one(sk, mss_now);
+               } else if (skb == tcp_send_head(sk))
+                       __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_PUSH);
                continue;
 
 wait_for_sndbuf:
-- 
2.13.2

Reply via email to