aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2016-04-14 01:05:39 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-15 16:45:44 -0400
commitb3d051477cf94e9d71d6acadb8a90de15237b9c1 (patch)
tree59009bc698f472b31b15059972e6904cd9272d32 /include/net/tcp.h
parentac18dd9e842294377dbaf1e8d169493567a81fa1 (diff)
tcp: do not mess with listener sk_wmem_alloc
When removing sk_refcnt manipulation on synflood, I missed that using skb_set_owner_w() was racy, if sk->sk_wmem_alloc had already transitioned to 0. We should hold sk_refcnt instead, but this is a big deal under attack. (Doing so increase performance from 3.2 Mpps to 3.8 Mpps only) In this patch, I chose to not attach a socket to syncookies skb. Performance is now 5 Mpps instead of 3.2 Mpps. Following patch will remove last known false sharing in tcp_rcv_state_process() Fixes: 3b24d854cb35 ("tcp/dccp: do not touch listener sk_refcnt under synflood") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 74d3ed5eb219..fd40f8c64d5f 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -452,10 +452,15 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
452int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); 452int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
453int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); 453int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
454int tcp_connect(struct sock *sk); 454int tcp_connect(struct sock *sk);
455enum tcp_synack_type {
456 TCP_SYNACK_NORMAL,
457 TCP_SYNACK_FASTOPEN,
458 TCP_SYNACK_COOKIE,
459};
455struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst, 460struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
456 struct request_sock *req, 461 struct request_sock *req,
457 struct tcp_fastopen_cookie *foc, 462 struct tcp_fastopen_cookie *foc,
458 bool attach_req); 463 enum tcp_synack_type synack_type);
459int tcp_disconnect(struct sock *sk, int flags); 464int tcp_disconnect(struct sock *sk, int flags);
460 465
461void tcp_finish_connect(struct sock *sk, struct sk_buff *skb); 466void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
@@ -1728,7 +1733,7 @@ struct tcp_request_sock_ops {
1728 int (*send_synack)(const struct sock *sk, struct dst_entry *dst, 1733 int (*send_synack)(const struct sock *sk, struct dst_entry *dst,
1729 struct flowi *fl, struct request_sock *req, 1734 struct flowi *fl, struct request_sock *req,
1730 struct tcp_fastopen_cookie *foc, 1735 struct tcp_fastopen_cookie *foc,
1731 bool attach_req); 1736 enum tcp_synack_type synack_type);
1732}; 1737};
1733 1738
1734#ifdef CONFIG_SYN_COOKIES 1739#ifdef CONFIG_SYN_COOKIES