summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-10-02 21:43:36 +0300
committerDavid S. Miller <davem@davemloft.net>2015-10-03 14:32:43 +0300
commit10cbc8f179177c1a6d5f56a46ebddc8f602ce5ac (patch)
treebf85cccd8ce732549605df96d909908d03e5932d /net/core
parentca6fb06518836ef9b65dc0aac02ff97704d52a05 (diff)
downloadlinux-10cbc8f179177c1a6d5f56a46ebddc8f602ce5ac.tar.xz
tcp/dccp: remove struct listen_sock
It is enough to check listener sk_state, no need for an extra condition. max_qlen_log can be moved into struct request_sock_queue We can remove syn_wait_lock and the alignment it enforced. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/request_sock.c47
1 files changed, 3 insertions, 44 deletions
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index 124f61c5bfef..ecf74189bd3f 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -37,22 +37,14 @@
int sysctl_max_syn_backlog = 256;
EXPORT_SYMBOL(sysctl_max_syn_backlog);
-int reqsk_queue_alloc(struct request_sock_queue *queue,
- unsigned int nr_table_entries)
+void reqsk_queue_alloc(struct request_sock_queue *queue,
+ unsigned int nr_table_entries)
{
- size_t lopt_size = sizeof(struct listen_sock);
- struct listen_sock *lopt = NULL;
-
nr_table_entries = min_t(u32, nr_table_entries, sysctl_max_syn_backlog);
nr_table_entries = max_t(u32, nr_table_entries, 8);
nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
- lopt = kzalloc(lopt_size, GFP_KERNEL);
- if (!lopt)
- return -ENOMEM;
-
spin_lock_init(&queue->rskq_lock);
- spin_lock_init(&queue->syn_wait_lock);
spin_lock_init(&queue->fastopenq.lock);
queue->fastopenq.rskq_rst_head = NULL;
@@ -61,40 +53,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
queue->fastopenq.max_qlen = 0;
queue->rskq_accept_head = NULL;
- lopt->max_qlen_log = ilog2(nr_table_entries);
-
- spin_lock_bh(&queue->syn_wait_lock);
- queue->listen_opt = lopt;
- spin_unlock_bh(&queue->syn_wait_lock);
-
- return 0;
-}
-
-void __reqsk_queue_destroy(struct request_sock_queue *queue)
-{
- /* This is an error recovery path only, no locking needed */
- kfree(queue->listen_opt);
-}
-
-static inline struct listen_sock *reqsk_queue_yank_listen_sk(
- struct request_sock_queue *queue)
-{
- struct listen_sock *lopt;
-
- spin_lock_bh(&queue->syn_wait_lock);
- lopt = queue->listen_opt;
- queue->listen_opt = NULL;
- spin_unlock_bh(&queue->syn_wait_lock);
-
- return lopt;
-}
-
-void reqsk_queue_destroy(struct request_sock_queue *queue)
-{
- struct listen_sock *lopt = reqsk_queue_yank_listen_sk(queue);
-
- /* cleaning is done by req timers */
- kfree(lopt);
+ queue->max_qlen_log = ilog2(nr_table_entries);
}
/*