aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2016-02-02 00:03:08 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-06 03:11:59 -0500
commit9d691539eea2d977e3eb86766c389a19a9c13146 (patch)
tree21f14703c42c81bc67063ab7fd9fe0cdda86265b /net/ipv4/tcp.c
parent61d2bcae99f66a640b3dd9632180209143fb5512 (diff)
tcp: do not enqueue skb with SYN flag
If we remove the SYN flag from the skbs that tcp_fastopen_add_skb() places in socket receive queue, then we can remove the test that tcp_recvmsg() has to perform in fast path. All we have to do is to adjust SEQ in the slow path. For the moment, we place an unlikely() and output a message if we find an skb having SYN flag set. Goal would be to get rid of the test completely. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 19746b3fcbbe..c5075779e017 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1466,8 +1466,10 @@ static struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off)
1466 1466
1467 while ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) { 1467 while ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) {
1468 offset = seq - TCP_SKB_CB(skb)->seq; 1468 offset = seq - TCP_SKB_CB(skb)->seq;
1469 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN) 1469 if (unlikely(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) {
1470 pr_err_once("%s: found a SYN, please report !\n", __func__);
1470 offset--; 1471 offset--;
1472 }
1471 if (offset < skb->len || (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)) { 1473 if (offset < skb->len || (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)) {
1472 *off = offset; 1474 *off = offset;
1473 return skb; 1475 return skb;
@@ -1657,8 +1659,10 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
1657 break; 1659 break;
1658 1660
1659 offset = *seq - TCP_SKB_CB(skb)->seq; 1661 offset = *seq - TCP_SKB_CB(skb)->seq;
1660 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN) 1662 if (unlikely(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) {
1663 pr_err_once("%s: found a SYN, please report !\n", __func__);
1661 offset--; 1664 offset--;
1665 }
1662 if (offset < skb->len) 1666 if (offset < skb->len)
1663 goto found_ok_skb; 1667 goto found_ok_skb;
1664 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 1668 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)