diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-12-14 02:15:52 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:10:38 -0500 |
commit | 8292a17a399ffb7c5c8b083db4ad994e090055f7 (patch) | |
tree | 1544436169ba1dc2eface34664a203c2c17a8d65 /net/ipv4 | |
parent | ca304b6104ffdd120bb6687a88a0625e58bc71cd (diff) |
[ICSK]: Rename struct tcp_func to struct inet_connection_sock_af_ops
And move it to struct inet_connection_sock. DCCP will use it in the
upcoming changesets.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/syncookies.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 8 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 11 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 11 | ||||
-rw-r--r-- | net/ipv4/tcp_minisocks.c | 8 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 17 |
6 files changed, 29 insertions, 30 deletions
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index a34e60ea48a1..e20be3331f67 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -173,10 +173,10 @@ static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb, | |||
173 | struct request_sock *req, | 173 | struct request_sock *req, |
174 | struct dst_entry *dst) | 174 | struct dst_entry *dst) |
175 | { | 175 | { |
176 | struct tcp_sock *tp = tcp_sk(sk); | 176 | struct inet_connection_sock *icsk = inet_csk(sk); |
177 | struct sock *child; | 177 | struct sock *child; |
178 | 178 | ||
179 | child = tp->af_specific->syn_recv_sock(sk, skb, req, dst); | 179 | child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst); |
180 | if (child) | 180 | if (child) |
181 | inet_csk_reqsk_queue_add(sk, req, child); | 181 | inet_csk_reqsk_queue_add(sk, req, child); |
182 | else | 182 | else |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index ef98b14ac56d..eacfe6a3442c 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1696,8 +1696,8 @@ int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
1696 | int err = 0; | 1696 | int err = 0; |
1697 | 1697 | ||
1698 | if (level != SOL_TCP) | 1698 | if (level != SOL_TCP) |
1699 | return tp->af_specific->setsockopt(sk, level, optname, | 1699 | return icsk->icsk_af_ops->setsockopt(sk, level, optname, |
1700 | optval, optlen); | 1700 | optval, optlen); |
1701 | 1701 | ||
1702 | /* This is a string value all the others are int's */ | 1702 | /* This is a string value all the others are int's */ |
1703 | if (optname == TCP_CONGESTION) { | 1703 | if (optname == TCP_CONGESTION) { |
@@ -1939,8 +1939,8 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
1939 | int val, len; | 1939 | int val, len; |
1940 | 1940 | ||
1941 | if (level != SOL_TCP) | 1941 | if (level != SOL_TCP) |
1942 | return tp->af_specific->getsockopt(sk, level, optname, | 1942 | return icsk->icsk_af_ops->getsockopt(sk, level, optname, |
1943 | optval, optlen); | 1943 | optval, optlen); |
1944 | 1944 | ||
1945 | if (get_user(len, optlen)) | 1945 | if (get_user(len, optlen)) |
1946 | return -EFAULT; | 1946 | return -EFAULT; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index bf2e23086bce..7de6184d4bd8 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4071,8 +4071,10 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, | |||
4071 | mb(); | 4071 | mb(); |
4072 | tcp_set_state(sk, TCP_ESTABLISHED); | 4072 | tcp_set_state(sk, TCP_ESTABLISHED); |
4073 | 4073 | ||
4074 | icsk = inet_csk(sk); | ||
4075 | |||
4074 | /* Make sure socket is routed, for correct metrics. */ | 4076 | /* Make sure socket is routed, for correct metrics. */ |
4075 | tp->af_specific->rebuild_header(sk); | 4077 | icsk->icsk_af_ops->rebuild_header(sk); |
4076 | 4078 | ||
4077 | tcp_init_metrics(sk); | 4079 | tcp_init_metrics(sk); |
4078 | 4080 | ||
@@ -4098,8 +4100,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, | |||
4098 | sk_wake_async(sk, 0, POLL_OUT); | 4100 | sk_wake_async(sk, 0, POLL_OUT); |
4099 | } | 4101 | } |
4100 | 4102 | ||
4101 | icsk = inet_csk(sk); | ||
4102 | |||
4103 | if (sk->sk_write_pending || | 4103 | if (sk->sk_write_pending || |
4104 | icsk->icsk_accept_queue.rskq_defer_accept || | 4104 | icsk->icsk_accept_queue.rskq_defer_accept || |
4105 | icsk->icsk_ack.pingpong) { | 4105 | icsk->icsk_ack.pingpong) { |
@@ -4220,6 +4220,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
4220 | struct tcphdr *th, unsigned len) | 4220 | struct tcphdr *th, unsigned len) |
4221 | { | 4221 | { |
4222 | struct tcp_sock *tp = tcp_sk(sk); | 4222 | struct tcp_sock *tp = tcp_sk(sk); |
4223 | struct inet_connection_sock *icsk = inet_csk(sk); | ||
4223 | int queued = 0; | 4224 | int queued = 0; |
4224 | 4225 | ||
4225 | tp->rx_opt.saw_tstamp = 0; | 4226 | tp->rx_opt.saw_tstamp = 0; |
@@ -4236,7 +4237,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
4236 | goto discard; | 4237 | goto discard; |
4237 | 4238 | ||
4238 | if(th->syn) { | 4239 | if(th->syn) { |
4239 | if(tp->af_specific->conn_request(sk, skb) < 0) | 4240 | if (icsk->icsk_af_ops->conn_request(sk, skb) < 0) |
4240 | return 1; | 4241 | return 1; |
4241 | 4242 | ||
4242 | /* Now we have several options: In theory there is | 4243 | /* Now we have several options: In theory there is |
@@ -4349,7 +4350,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
4349 | /* Make sure socket is routed, for | 4350 | /* Make sure socket is routed, for |
4350 | * correct metrics. | 4351 | * correct metrics. |
4351 | */ | 4352 | */ |
4352 | tp->af_specific->rebuild_header(sk); | 4353 | icsk->icsk_af_ops->rebuild_header(sk); |
4353 | 4354 | ||
4354 | tcp_init_metrics(sk); | 4355 | tcp_init_metrics(sk); |
4355 | 4356 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 2aa19c89a94a..704cf2105795 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -86,8 +86,7 @@ int sysctl_tcp_low_latency; | |||
86 | /* Socket used for sending RSTs */ | 86 | /* Socket used for sending RSTs */ |
87 | static struct socket *tcp_socket; | 87 | static struct socket *tcp_socket; |
88 | 88 | ||
89 | void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, | 89 | void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); |
90 | struct sk_buff *skb); | ||
91 | 90 | ||
92 | struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { | 91 | struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { |
93 | .lhash_lock = RW_LOCK_UNLOCKED, | 92 | .lhash_lock = RW_LOCK_UNLOCKED, |
@@ -645,10 +644,10 @@ out: | |||
645 | } | 644 | } |
646 | 645 | ||
647 | /* This routine computes an IPv4 TCP checksum. */ | 646 | /* This routine computes an IPv4 TCP checksum. */ |
648 | void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, | 647 | void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) |
649 | struct sk_buff *skb) | ||
650 | { | 648 | { |
651 | struct inet_sock *inet = inet_sk(sk); | 649 | struct inet_sock *inet = inet_sk(sk); |
650 | struct tcphdr *th = skb->h.th; | ||
652 | 651 | ||
653 | if (skb->ip_summed == CHECKSUM_HW) { | 652 | if (skb->ip_summed == CHECKSUM_HW) { |
654 | th->check = ~tcp_v4_check(th, len, inet->saddr, inet->daddr, 0); | 653 | th->check = ~tcp_v4_check(th, len, inet->saddr, inet->daddr, 0); |
@@ -1383,7 +1382,7 @@ int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw) | |||
1383 | return 0; | 1382 | return 0; |
1384 | } | 1383 | } |
1385 | 1384 | ||
1386 | struct tcp_func ipv4_specific = { | 1385 | struct inet_connection_sock_af_ops ipv4_specific = { |
1387 | .queue_xmit = ip_queue_xmit, | 1386 | .queue_xmit = ip_queue_xmit, |
1388 | .send_check = tcp_v4_send_check, | 1387 | .send_check = tcp_v4_send_check, |
1389 | .rebuild_header = inet_sk_rebuild_header, | 1388 | .rebuild_header = inet_sk_rebuild_header, |
@@ -1434,7 +1433,7 @@ static int tcp_v4_init_sock(struct sock *sk) | |||
1434 | sk->sk_write_space = sk_stream_write_space; | 1433 | sk->sk_write_space = sk_stream_write_space; |
1435 | sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); | 1434 | sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); |
1436 | 1435 | ||
1437 | tp->af_specific = &ipv4_specific; | 1436 | icsk->icsk_af_ops = &ipv4_specific; |
1438 | 1437 | ||
1439 | sk->sk_sndbuf = sysctl_tcp_wmem[1]; | 1438 | sk->sk_sndbuf = sysctl_tcp_wmem[1]; |
1440 | sk->sk_rcvbuf = sysctl_tcp_rmem[1]; | 1439 | sk->sk_rcvbuf = sysctl_tcp_rmem[1]; |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 1b66a2ac4321..9c029683a626 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -274,18 +274,18 @@ kill: | |||
274 | void tcp_time_wait(struct sock *sk, int state, int timeo) | 274 | void tcp_time_wait(struct sock *sk, int state, int timeo) |
275 | { | 275 | { |
276 | struct inet_timewait_sock *tw = NULL; | 276 | struct inet_timewait_sock *tw = NULL; |
277 | const struct inet_connection_sock *icsk = inet_csk(sk); | ||
277 | const struct tcp_sock *tp = tcp_sk(sk); | 278 | const struct tcp_sock *tp = tcp_sk(sk); |
278 | int recycle_ok = 0; | 279 | int recycle_ok = 0; |
279 | 280 | ||
280 | if (tcp_death_row.sysctl_tw_recycle && tp->rx_opt.ts_recent_stamp) | 281 | if (tcp_death_row.sysctl_tw_recycle && tp->rx_opt.ts_recent_stamp) |
281 | recycle_ok = tp->af_specific->remember_stamp(sk); | 282 | recycle_ok = icsk->icsk_af_ops->remember_stamp(sk); |
282 | 283 | ||
283 | if (tcp_death_row.tw_count < tcp_death_row.sysctl_max_tw_buckets) | 284 | if (tcp_death_row.tw_count < tcp_death_row.sysctl_max_tw_buckets) |
284 | tw = inet_twsk_alloc(sk, state); | 285 | tw = inet_twsk_alloc(sk, state); |
285 | 286 | ||
286 | if (tw != NULL) { | 287 | if (tw != NULL) { |
287 | struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); | 288 | struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); |
288 | const struct inet_connection_sock *icsk = inet_csk(sk); | ||
289 | const int rto = (icsk->icsk_rto << 2) - (icsk->icsk_rto >> 1); | 289 | const int rto = (icsk->icsk_rto << 2) - (icsk->icsk_rto >> 1); |
290 | 290 | ||
291 | tw->tw_rcv_wscale = tp->rx_opt.rcv_wscale; | 291 | tw->tw_rcv_wscale = tp->rx_opt.rcv_wscale; |
@@ -456,7 +456,6 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
456 | struct request_sock **prev) | 456 | struct request_sock **prev) |
457 | { | 457 | { |
458 | struct tcphdr *th = skb->h.th; | 458 | struct tcphdr *th = skb->h.th; |
459 | struct tcp_sock *tp = tcp_sk(sk); | ||
460 | u32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); | 459 | u32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); |
461 | int paws_reject = 0; | 460 | int paws_reject = 0; |
462 | struct tcp_options_received tmp_opt; | 461 | struct tcp_options_received tmp_opt; |
@@ -613,7 +612,8 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
613 | * ESTABLISHED STATE. If it will be dropped after | 612 | * ESTABLISHED STATE. If it will be dropped after |
614 | * socket is created, wait for troubles. | 613 | * socket is created, wait for troubles. |
615 | */ | 614 | */ |
616 | child = tp->af_specific->syn_recv_sock(sk, skb, req, NULL); | 615 | child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, |
616 | req, NULL); | ||
617 | if (child == NULL) | 617 | if (child == NULL) |
618 | goto listen_overflow; | 618 | goto listen_overflow; |
619 | 619 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index b7325e0b406a..af1946c52c37 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -371,7 +371,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
371 | TCP_ECN_send(sk, tp, skb, tcp_header_size); | 371 | TCP_ECN_send(sk, tp, skb, tcp_header_size); |
372 | } | 372 | } |
373 | 373 | ||
374 | tp->af_specific->send_check(sk, th, skb->len, skb); | 374 | icsk->icsk_af_ops->send_check(sk, skb->len, skb); |
375 | 375 | ||
376 | if (likely(tcb->flags & TCPCB_FLAG_ACK)) | 376 | if (likely(tcb->flags & TCPCB_FLAG_ACK)) |
377 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); | 377 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); |
@@ -381,7 +381,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
381 | 381 | ||
382 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | 382 | TCP_INC_STATS(TCP_MIB_OUTSEGS); |
383 | 383 | ||
384 | err = tp->af_specific->queue_xmit(skb, 0); | 384 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
385 | if (unlikely(err <= 0)) | 385 | if (unlikely(err <= 0)) |
386 | return err; | 386 | return err; |
387 | 387 | ||
@@ -638,12 +638,11 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) | |||
638 | unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) | 638 | unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) |
639 | { | 639 | { |
640 | struct tcp_sock *tp = tcp_sk(sk); | 640 | struct tcp_sock *tp = tcp_sk(sk); |
641 | int mss_now; | ||
642 | |||
643 | /* Calculate base mss without TCP options: | 641 | /* Calculate base mss without TCP options: |
644 | It is MMS_S - sizeof(tcphdr) of rfc1122 | 642 | It is MMS_S - sizeof(tcphdr) of rfc1122 |
645 | */ | 643 | */ |
646 | mss_now = pmtu - tp->af_specific->net_header_len - sizeof(struct tcphdr); | 644 | int mss_now = (pmtu - inet_csk(sk)->icsk_af_ops->net_header_len - |
645 | sizeof(struct tcphdr)); | ||
647 | 646 | ||
648 | /* Clamp it (mss_clamp does not include tcp options) */ | 647 | /* Clamp it (mss_clamp does not include tcp options) */ |
649 | if (mss_now > tp->rx_opt.mss_clamp) | 648 | if (mss_now > tp->rx_opt.mss_clamp) |
@@ -705,9 +704,9 @@ unsigned int tcp_current_mss(struct sock *sk, int large_allowed) | |||
705 | xmit_size_goal = mss_now; | 704 | xmit_size_goal = mss_now; |
706 | 705 | ||
707 | if (doing_tso) { | 706 | if (doing_tso) { |
708 | xmit_size_goal = 65535 - | 707 | xmit_size_goal = (65535 - |
709 | tp->af_specific->net_header_len - | 708 | inet_csk(sk)->icsk_af_ops->net_header_len - |
710 | tp->ext_header_len - tp->tcp_header_len; | 709 | tp->ext_header_len - tp->tcp_header_len); |
711 | 710 | ||
712 | if (tp->max_window && | 711 | if (tp->max_window && |
713 | (xmit_size_goal > (tp->max_window >> 1))) | 712 | (xmit_size_goal > (tp->max_window >> 1))) |
@@ -1422,7 +1421,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
1422 | (sysctl_tcp_retrans_collapse != 0)) | 1421 | (sysctl_tcp_retrans_collapse != 0)) |
1423 | tcp_retrans_try_collapse(sk, skb, cur_mss); | 1422 | tcp_retrans_try_collapse(sk, skb, cur_mss); |
1424 | 1423 | ||
1425 | if(tp->af_specific->rebuild_header(sk)) | 1424 | if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk)) |
1426 | return -EHOSTUNREACH; /* Routing failure or similar. */ | 1425 | return -EHOSTUNREACH; /* Routing failure or similar. */ |
1427 | 1426 | ||
1428 | /* Some Solaris stacks overoptimize and ignore the FIN on a | 1427 | /* Some Solaris stacks overoptimize and ignore the FIN on a |