aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-12-14 02:15:52 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-03 16:10:38 -0500
commit8292a17a399ffb7c5c8b083db4ad994e090055f7 (patch)
tree1544436169ba1dc2eface34664a203c2c17a8d65
parentca304b6104ffdd120bb6687a88a0625e58bc71cd (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>
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/net/inet_connection_sock.h26
-rw-r--r--include/net/tcp.h50
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--net/ipv4/syncookies.c4
-rw-r--r--net/ipv4/tcp.c8
-rw-r--r--net/ipv4/tcp_input.c11
-rw-r--r--net/ipv4/tcp_ipv4.c11
-rw-r--r--net/ipv4/tcp_minisocks.c8
-rw-r--r--net/ipv4/tcp_output.c17
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/tcp_ipv6.c28
12 files changed, 71 insertions, 98 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e1da6602e05..4e1434007f44 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -295,8 +295,6 @@ struct tcp_sock {
295 295
296 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 296 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
297 297
298 struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */
299
300 __u32 rcv_wnd; /* Current receiver window */ 298 __u32 rcv_wnd; /* Current receiver window */
301 __u32 rcv_wup; /* rcv_nxt on last window update sent */ 299 __u32 rcv_wup; /* rcv_nxt on last window update sent */
302 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 300 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index ccc81a1c550c..9e20d201e951 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -15,6 +15,7 @@
15#ifndef _INET_CONNECTION_SOCK_H 15#ifndef _INET_CONNECTION_SOCK_H
16#define _INET_CONNECTION_SOCK_H 16#define _INET_CONNECTION_SOCK_H
17 17
18#include <linux/compiler.h>
18#include <linux/ip.h> 19#include <linux/ip.h>
19#include <linux/string.h> 20#include <linux/string.h>
20#include <linux/timer.h> 21#include <linux/timer.h>
@@ -29,6 +30,29 @@ struct inet_bind_bucket;
29struct inet_hashinfo; 30struct inet_hashinfo;
30struct tcp_congestion_ops; 31struct tcp_congestion_ops;
31 32
33/*
34 * Pointers to address related TCP functions
35 * (i.e. things that depend on the address family)
36 */
37struct inet_connection_sock_af_ops {
38 int (*queue_xmit)(struct sk_buff *skb, int ipfragok);
39 void (*send_check)(struct sock *sk, int len,
40 struct sk_buff *skb);
41 int (*rebuild_header)(struct sock *sk);
42 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
43 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
44 struct request_sock *req,
45 struct dst_entry *dst);
46 int (*remember_stamp)(struct sock *sk);
47 __u16 net_header_len;
48 int (*setsockopt)(struct sock *sk, int level, int optname,
49 char __user *optval, int optlen);
50 int (*getsockopt)(struct sock *sk, int level, int optname,
51 char __user *optval, int __user *optlen);
52 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
53 int sockaddr_len;
54};
55
32/** inet_connection_sock - INET connection oriented sock 56/** inet_connection_sock - INET connection oriented sock
33 * 57 *
34 * @icsk_accept_queue: FIFO of established children 58 * @icsk_accept_queue: FIFO of established children
@@ -37,6 +61,7 @@ struct tcp_congestion_ops;
37 * @icsk_retransmit_timer: Resend (no ack) 61 * @icsk_retransmit_timer: Resend (no ack)
38 * @icsk_rto: Retransmit timeout 62 * @icsk_rto: Retransmit timeout
39 * @icsk_ca_ops Pluggable congestion control hook 63 * @icsk_ca_ops Pluggable congestion control hook
64 * @icsk_af_ops Operations which are AF_INET{4,6} specific
40 * @icsk_ca_state: Congestion control state 65 * @icsk_ca_state: Congestion control state
41 * @icsk_retransmits: Number of unrecovered [RTO] timeouts 66 * @icsk_retransmits: Number of unrecovered [RTO] timeouts
42 * @icsk_pending: Scheduled timer event 67 * @icsk_pending: Scheduled timer event
@@ -55,6 +80,7 @@ struct inet_connection_sock {
55 struct timer_list icsk_delack_timer; 80 struct timer_list icsk_delack_timer;
56 __u32 icsk_rto; 81 __u32 icsk_rto;
57 struct tcp_congestion_ops *icsk_ca_ops; 82 struct tcp_congestion_ops *icsk_ca_ops;
83 struct inet_connection_sock_af_ops *icsk_af_ops;
58 __u8 icsk_ca_state; 84 __u8 icsk_ca_state;
59 __u8 icsk_retransmits; 85 __u8 icsk_retransmits;
60 __u8 icsk_pending; 86 __u8 icsk_pending;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d78025f9fbea..83b117a25c2a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -225,53 +225,6 @@ extern atomic_t tcp_sockets_allocated;
225extern int tcp_memory_pressure; 225extern int tcp_memory_pressure;
226 226
227/* 227/*
228 * Pointers to address related TCP functions
229 * (i.e. things that depend on the address family)
230 */
231
232struct tcp_func {
233 int (*queue_xmit) (struct sk_buff *skb,
234 int ipfragok);
235
236 void (*send_check) (struct sock *sk,
237 struct tcphdr *th,
238 int len,
239 struct sk_buff *skb);
240
241 int (*rebuild_header) (struct sock *sk);
242
243 int (*conn_request) (struct sock *sk,
244 struct sk_buff *skb);
245
246 struct sock * (*syn_recv_sock) (struct sock *sk,
247 struct sk_buff *skb,
248 struct request_sock *req,
249 struct dst_entry *dst);
250
251 int (*remember_stamp) (struct sock *sk);
252
253 __u16 net_header_len;
254
255 int (*setsockopt) (struct sock *sk,
256 int level,
257 int optname,
258 char __user *optval,
259 int optlen);
260
261 int (*getsockopt) (struct sock *sk,
262 int level,
263 int optname,
264 char __user *optval,
265 int __user *optlen);
266
267
268 void (*addr2sockaddr) (struct sock *sk,
269 struct sockaddr *);
270
271 int sockaddr_len;
272};
273
274/*
275 * The next routines deal with comparing 32 bit unsigned ints 228 * The next routines deal with comparing 32 bit unsigned ints
276 * and worry about wraparound (automatic with unsigned arithmetic). 229 * and worry about wraparound (automatic with unsigned arithmetic).
277 */ 230 */
@@ -405,8 +358,7 @@ extern void tcp_parse_options(struct sk_buff *skb,
405 * TCP v4 functions exported for the inet6 API 358 * TCP v4 functions exported for the inet6 API
406 */ 359 */
407 360
408extern void tcp_v4_send_check(struct sock *sk, 361extern void tcp_v4_send_check(struct sock *sk, int len,
409 struct tcphdr *th, int len,
410 struct sk_buff *skb); 362 struct sk_buff *skb);
411 363
412extern int tcp_v4_conn_request(struct sock *sk, 364extern int tcp_v4_conn_request(struct sock *sk,
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 4e86f2de6638..61f724c1036f 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -44,7 +44,7 @@ extern int datagram_send_ctl(struct msghdr *msg,
44/* 44/*
45 * address family specific functions 45 * address family specific functions
46 */ 46 */
47extern struct tcp_func ipv4_specific; 47extern struct inet_connection_sock_af_ops ipv4_specific;
48 48
49extern int inet6_destroy_sock(struct sock *sk); 49extern int inet6_destroy_sock(struct sock *sk);
50 50
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 */
87static struct socket *tcp_socket; 87static struct socket *tcp_socket;
88 88
89void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, 89void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
90 struct sk_buff *skb);
91 90
92struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { 91struct 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. */
648void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, 647void 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
1386struct tcp_func ipv4_specific = { 1385struct 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:
274void tcp_time_wait(struct sock *sk, int state, int timeo) 274void 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)
638unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) 638unsigned 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
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 3620718defe6..b6b63fa8454c 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -170,7 +170,7 @@ int ipv6_setsockopt(struct sock *sk, int level, int optname,
170 sock_prot_inc_use(&tcp_prot); 170 sock_prot_inc_use(&tcp_prot);
171 local_bh_enable(); 171 local_bh_enable();
172 sk->sk_prot = &tcp_prot; 172 sk->sk_prot = &tcp_prot;
173 tp->af_specific = &ipv4_specific; 173 inet_csk(sk)->icsk_af_ops = &ipv4_specific;
174 sk->sk_socket->ops = &inet_stream_ops; 174 sk->sk_socket->ops = &inet_stream_ops;
175 sk->sk_family = PF_INET; 175 sk->sk_family = PF_INET;
176 tcp_sync_mss(sk, tp->pmtu_cookie); 176 tcp_sync_mss(sk, tp->pmtu_cookie);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index c2472d771664..8ce8a1359d2b 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -68,14 +68,14 @@
68 68
69static void tcp_v6_send_reset(struct sk_buff *skb); 69static void tcp_v6_send_reset(struct sk_buff *skb);
70static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); 70static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req);
71static void tcp_v6_send_check(struct sock *sk, struct tcphdr *th, int len, 71static void tcp_v6_send_check(struct sock *sk, int len,
72 struct sk_buff *skb); 72 struct sk_buff *skb);
73 73
74static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); 74static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb);
75static int tcp_v6_xmit(struct sk_buff *skb, int ipfragok); 75static int tcp_v6_xmit(struct sk_buff *skb, int ipfragok);
76 76
77static struct tcp_func ipv6_mapped; 77static struct inet_connection_sock_af_ops ipv6_mapped;
78static struct tcp_func ipv6_specific; 78static struct inet_connection_sock_af_ops ipv6_specific;
79 79
80int inet6_csk_bind_conflict(const struct sock *sk, 80int inet6_csk_bind_conflict(const struct sock *sk,
81 const struct inet_bind_bucket *tb) 81 const struct inet_bind_bucket *tb)
@@ -107,9 +107,7 @@ static int tcp_v6_get_port(struct sock *sk, unsigned short snum)
107static void tcp_v6_hash(struct sock *sk) 107static void tcp_v6_hash(struct sock *sk)
108{ 108{
109 if (sk->sk_state != TCP_CLOSE) { 109 if (sk->sk_state != TCP_CLOSE) {
110 struct tcp_sock *tp = tcp_sk(sk); 110 if (inet_csk(sk)->icsk_af_ops == &ipv6_mapped) {
111
112 if (tp->af_specific == &ipv6_mapped) {
113 tcp_prot.hash(sk); 111 tcp_prot.hash(sk);
114 return; 112 return;
115 } 113 }
@@ -417,14 +415,14 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
417 sin.sin_port = usin->sin6_port; 415 sin.sin_port = usin->sin6_port;
418 sin.sin_addr.s_addr = usin->sin6_addr.s6_addr32[3]; 416 sin.sin_addr.s_addr = usin->sin6_addr.s6_addr32[3];
419 417
420 tp->af_specific = &ipv6_mapped; 418 inet_csk(sk)->icsk_af_ops = &ipv6_mapped;
421 sk->sk_backlog_rcv = tcp_v4_do_rcv; 419 sk->sk_backlog_rcv = tcp_v4_do_rcv;
422 420
423 err = tcp_v4_connect(sk, (struct sockaddr *)&sin, sizeof(sin)); 421 err = tcp_v4_connect(sk, (struct sockaddr *)&sin, sizeof(sin));
424 422
425 if (err) { 423 if (err) {
426 tp->ext_header_len = exthdrlen; 424 tp->ext_header_len = exthdrlen;
427 tp->af_specific = &ipv6_specific; 425 inet_csk(sk)->icsk_af_ops = &ipv6_specific;
428 sk->sk_backlog_rcv = tcp_v6_do_rcv; 426 sk->sk_backlog_rcv = tcp_v6_do_rcv;
429 goto failure; 427 goto failure;
430 } else { 428 } else {
@@ -751,10 +749,10 @@ static int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb)
751} 749}
752 750
753 751
754static void tcp_v6_send_check(struct sock *sk, struct tcphdr *th, int len, 752static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb)
755 struct sk_buff *skb)
756{ 753{
757 struct ipv6_pinfo *np = inet6_sk(sk); 754 struct ipv6_pinfo *np = inet6_sk(sk);
755 struct tcphdr *th = skb->h.th;
758 756
759 if (skb->ip_summed == CHECKSUM_HW) { 757 if (skb->ip_summed == CHECKSUM_HW) {
760 th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); 758 th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0);
@@ -1070,7 +1068,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1070 1068
1071 ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); 1069 ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr);
1072 1070
1073 newtp->af_specific = &ipv6_mapped; 1071 inet_csk(newsk)->icsk_af_ops = &ipv6_mapped;
1074 newsk->sk_backlog_rcv = tcp_v4_do_rcv; 1072 newsk->sk_backlog_rcv = tcp_v4_do_rcv;
1075 newnp->pktoptions = NULL; 1073 newnp->pktoptions = NULL;
1076 newnp->opt = NULL; 1074 newnp->opt = NULL;
@@ -1084,7 +1082,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1084 */ 1082 */
1085 1083
1086 /* It is tricky place. Until this moment IPv4 tcp 1084 /* It is tricky place. Until this moment IPv4 tcp
1087 worked with IPv6 af_tcp.af_specific. 1085 worked with IPv6 icsk.icsk_af_ops.
1088 Sync it now. 1086 Sync it now.
1089 */ 1087 */
1090 tcp_sync_mss(newsk, newtp->pmtu_cookie); 1088 tcp_sync_mss(newsk, newtp->pmtu_cookie);
@@ -1631,7 +1629,7 @@ static int tcp_v6_remember_stamp(struct sock *sk)
1631 return 0; 1629 return 0;
1632} 1630}
1633 1631
1634static struct tcp_func ipv6_specific = { 1632static struct inet_connection_sock_af_ops ipv6_specific = {
1635 .queue_xmit = tcp_v6_xmit, 1633 .queue_xmit = tcp_v6_xmit,
1636 .send_check = tcp_v6_send_check, 1634 .send_check = tcp_v6_send_check,
1637 .rebuild_header = tcp_v6_rebuild_header, 1635 .rebuild_header = tcp_v6_rebuild_header,
@@ -1650,7 +1648,7 @@ static struct tcp_func ipv6_specific = {
1650 * TCP over IPv4 via INET6 API 1648 * TCP over IPv4 via INET6 API
1651 */ 1649 */
1652 1650
1653static struct tcp_func ipv6_mapped = { 1651static struct inet_connection_sock_af_ops ipv6_mapped = {
1654 .queue_xmit = ip_queue_xmit, 1652 .queue_xmit = ip_queue_xmit,
1655 .send_check = tcp_v4_send_check, 1653 .send_check = tcp_v4_send_check,
1656 .rebuild_header = inet_sk_rebuild_header, 1654 .rebuild_header = inet_sk_rebuild_header,
@@ -1700,7 +1698,7 @@ static int tcp_v6_init_sock(struct sock *sk)
1700 1698
1701 sk->sk_state = TCP_CLOSE; 1699 sk->sk_state = TCP_CLOSE;
1702 1700
1703 tp->af_specific = &ipv6_specific; 1701 icsk->icsk_af_ops = &ipv6_specific;
1704 icsk->icsk_ca_ops = &tcp_init_congestion_ops; 1702 icsk->icsk_ca_ops = &tcp_init_congestion_ops;
1705 sk->sk_write_space = sk_stream_write_space; 1703 sk->sk_write_space = sk_stream_write_space;
1706 sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); 1704 sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);