diff options
author | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2005-08-09 23:01:14 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:38:48 -0400 |
commit | a55ebcc4c4532107ad9eee1c9bb698ab5f12c00f (patch) | |
tree | 964be5918610e6f89cc7f2fee48418979b48773b /net/ipv4/tcp_minisocks.c | |
parent | 77d8bf9c6208eb535f05718168ffcc476be0ca8c (diff) |
[INET]: Move bind_hash from tcp_sk to inet_sk
This should really be in a inet_connection_sock, but I'm leaving it
for a later optimization, when some more fields common to INET
transport protocols now in tcp_sk or inet_sk will be chunked out into
inet_connection_sock, for now its better to concentrate on getting the
changes in the core merged to leave the DCCP tree with only DCCP
specific code.
Next changesets will take advantage of this move to generalise things
like tcp_bind_hash, tcp_put_port, tcp_inherit_port, making the later
receive a inet_hashinfo parameter, and even __tcp_tw_hashdance, etc in
the future, when tcp_tw_bucket gets transformed into the struct
timewait_sock hierarchy.
tcp_destroy_sock also is eligible as soon as tcp_orphan_count gets
moved to sk_prot.
A cascade of incremental changes will ultimately make the tcp_lookup
functions be fully generic.
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_minisocks.c')
-rw-r--r-- | net/ipv4/tcp_minisocks.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 1df6cd46066b..267cea1087e5 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -296,17 +296,17 @@ kill: | |||
296 | */ | 296 | */ |
297 | static void __tcp_tw_hashdance(struct sock *sk, struct tcp_tw_bucket *tw) | 297 | static void __tcp_tw_hashdance(struct sock *sk, struct tcp_tw_bucket *tw) |
298 | { | 298 | { |
299 | const struct inet_sock *inet = inet_sk(sk); | ||
299 | struct inet_ehash_bucket *ehead = &tcp_ehash[sk->sk_hashent]; | 300 | struct inet_ehash_bucket *ehead = &tcp_ehash[sk->sk_hashent]; |
300 | struct inet_bind_hashbucket *bhead; | 301 | struct inet_bind_hashbucket *bhead; |
301 | |||
302 | /* Step 1: Put TW into bind hash. Original socket stays there too. | 302 | /* Step 1: Put TW into bind hash. Original socket stays there too. |
303 | Note, that any socket with inet_sk(sk)->num != 0 MUST be bound in | 303 | Note, that any socket with inet->num != 0 MUST be bound in |
304 | binding cache, even if it is closed. | 304 | binding cache, even if it is closed. |
305 | */ | 305 | */ |
306 | bhead = &tcp_bhash[inet_bhashfn(inet_sk(sk)->num, tcp_bhash_size)]; | 306 | bhead = &tcp_bhash[inet_bhashfn(inet->num, tcp_bhash_size)]; |
307 | spin_lock(&bhead->lock); | 307 | spin_lock(&bhead->lock); |
308 | tw->tw_tb = tcp_sk(sk)->bind_hash; | 308 | tw->tw_tb = inet->bind_hash; |
309 | BUG_TRAP(tcp_sk(sk)->bind_hash); | 309 | BUG_TRAP(inet->bind_hash); |
310 | tw_add_bind_node(tw, &tw->tw_tb->owners); | 310 | tw_add_bind_node(tw, &tw->tw_tb->owners); |
311 | spin_unlock(&bhead->lock); | 311 | spin_unlock(&bhead->lock); |
312 | 312 | ||
@@ -694,6 +694,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, | |||
694 | if(newsk != NULL) { | 694 | if(newsk != NULL) { |
695 | struct inet_request_sock *ireq = inet_rsk(req); | 695 | struct inet_request_sock *ireq = inet_rsk(req); |
696 | struct tcp_request_sock *treq = tcp_rsk(req); | 696 | struct tcp_request_sock *treq = tcp_rsk(req); |
697 | struct inet_sock *newinet = inet_sk(newsk); | ||
697 | struct tcp_sock *newtp; | 698 | struct tcp_sock *newtp; |
698 | struct sk_filter *filter; | 699 | struct sk_filter *filter; |
699 | 700 | ||
@@ -702,10 +703,10 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, | |||
702 | 703 | ||
703 | /* SANITY */ | 704 | /* SANITY */ |
704 | sk_node_init(&newsk->sk_node); | 705 | sk_node_init(&newsk->sk_node); |
705 | tcp_sk(newsk)->bind_hash = NULL; | 706 | newinet->bind_hash = NULL; |
706 | 707 | ||
707 | /* Clone the TCP header template */ | 708 | /* Clone the TCP header template */ |
708 | inet_sk(newsk)->dport = ireq->rmt_port; | 709 | newinet->dport = ireq->rmt_port; |
709 | 710 | ||
710 | sock_lock_init(newsk); | 711 | sock_lock_init(newsk); |
711 | bh_lock_sock(newsk); | 712 | bh_lock_sock(newsk); |