aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-10-09 18:21:29 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-10 00:08:07 -0400
commit634fb979e8f3a70f04c1f2f519d0cd1142eb5c1a (patch)
treeffd7f7ef4a313c94859180d1bc20f2713a11f987 /net/ipv4/tcp_ipv4.c
parent8a29111c7ca68d928dfab58636f3f6acf0ac04f7 (diff)
inet: includes a sock_common in request_sock
TCP listener refactoring, part 5 : We want to be able to insert request sockets (SYN_RECV) into main ehash table instead of the per listener hash table to allow RCU lookups and remove listener lock contention. This patch includes the needed struct sock_common in front of struct request_sock This means there is no more inet6_request_sock IPv6 specific structure. Following inet_request_sock fields were renamed as they became macros to reference fields from struct sock_common. Prefix ir_ was chosen to avoid name collisions. loc_port -> ir_loc_port loc_addr -> ir_loc_addr rmt_addr -> ir_rmt_addr rmt_port -> ir_rmt_port iif -> ir_iif Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index e4695dde1af6..114d1b748cbb 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -835,11 +835,11 @@ static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst,
835 skb = tcp_make_synack(sk, dst, req, NULL); 835 skb = tcp_make_synack(sk, dst, req, NULL);
836 836
837 if (skb) { 837 if (skb) {
838 __tcp_v4_send_check(skb, ireq->loc_addr, ireq->rmt_addr); 838 __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr);
839 839
840 skb_set_queue_mapping(skb, queue_mapping); 840 skb_set_queue_mapping(skb, queue_mapping);
841 err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr, 841 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr,
842 ireq->rmt_addr, 842 ireq->ir_rmt_addr,
843 ireq->opt); 843 ireq->opt);
844 err = net_xmit_eval(err); 844 err = net_xmit_eval(err);
845 if (!tcp_rsk(req)->snt_synack && !err) 845 if (!tcp_rsk(req)->snt_synack && !err)
@@ -972,7 +972,7 @@ static struct tcp_md5sig_key *tcp_v4_reqsk_md5_lookup(struct sock *sk,
972{ 972{
973 union tcp_md5_addr *addr; 973 union tcp_md5_addr *addr;
974 974
975 addr = (union tcp_md5_addr *)&inet_rsk(req)->rmt_addr; 975 addr = (union tcp_md5_addr *)&inet_rsk(req)->ir_rmt_addr;
976 return tcp_md5_do_lookup(sk, addr, AF_INET); 976 return tcp_md5_do_lookup(sk, addr, AF_INET);
977} 977}
978 978
@@ -1149,8 +1149,8 @@ int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1149 saddr = inet_sk(sk)->inet_saddr; 1149 saddr = inet_sk(sk)->inet_saddr;
1150 daddr = inet_sk(sk)->inet_daddr; 1150 daddr = inet_sk(sk)->inet_daddr;
1151 } else if (req) { 1151 } else if (req) {
1152 saddr = inet_rsk(req)->loc_addr; 1152 saddr = inet_rsk(req)->ir_loc_addr;
1153 daddr = inet_rsk(req)->rmt_addr; 1153 daddr = inet_rsk(req)->ir_rmt_addr;
1154 } else { 1154 } else {
1155 const struct iphdr *iph = ip_hdr(skb); 1155 const struct iphdr *iph = ip_hdr(skb);
1156 saddr = iph->saddr; 1156 saddr = iph->saddr;
@@ -1366,8 +1366,8 @@ static int tcp_v4_conn_req_fastopen(struct sock *sk,
1366 kfree_skb(skb_synack); 1366 kfree_skb(skb_synack);
1367 return -1; 1367 return -1;
1368 } 1368 }
1369 err = ip_build_and_send_pkt(skb_synack, sk, ireq->loc_addr, 1369 err = ip_build_and_send_pkt(skb_synack, sk, ireq->ir_loc_addr,
1370 ireq->rmt_addr, ireq->opt); 1370 ireq->ir_rmt_addr, ireq->opt);
1371 err = net_xmit_eval(err); 1371 err = net_xmit_eval(err);
1372 if (!err) 1372 if (!err)
1373 tcp_rsk(req)->snt_synack = tcp_time_stamp; 1373 tcp_rsk(req)->snt_synack = tcp_time_stamp;
@@ -1502,8 +1502,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1502 tcp_openreq_init(req, &tmp_opt, skb); 1502 tcp_openreq_init(req, &tmp_opt, skb);
1503 1503
1504 ireq = inet_rsk(req); 1504 ireq = inet_rsk(req);
1505 ireq->loc_addr = daddr; 1505 ireq->ir_loc_addr = daddr;
1506 ireq->rmt_addr = saddr; 1506 ireq->ir_rmt_addr = saddr;
1507 ireq->no_srccheck = inet_sk(sk)->transparent; 1507 ireq->no_srccheck = inet_sk(sk)->transparent;
1508 ireq->opt = tcp_v4_save_options(skb); 1508 ireq->opt = tcp_v4_save_options(skb);
1509 1509
@@ -1578,15 +1578,15 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1578 fastopen_cookie_present(&valid_foc) ? &valid_foc : NULL); 1578 fastopen_cookie_present(&valid_foc) ? &valid_foc : NULL);
1579 1579
1580 if (skb_synack) { 1580 if (skb_synack) {
1581 __tcp_v4_send_check(skb_synack, ireq->loc_addr, ireq->rmt_addr); 1581 __tcp_v4_send_check(skb_synack, ireq->ir_loc_addr, ireq->ir_rmt_addr);
1582 skb_set_queue_mapping(skb_synack, skb_get_queue_mapping(skb)); 1582 skb_set_queue_mapping(skb_synack, skb_get_queue_mapping(skb));
1583 } else 1583 } else
1584 goto drop_and_free; 1584 goto drop_and_free;
1585 1585
1586 if (likely(!do_fastopen)) { 1586 if (likely(!do_fastopen)) {
1587 int err; 1587 int err;
1588 err = ip_build_and_send_pkt(skb_synack, sk, ireq->loc_addr, 1588 err = ip_build_and_send_pkt(skb_synack, sk, ireq->ir_loc_addr,
1589 ireq->rmt_addr, ireq->opt); 1589 ireq->ir_rmt_addr, ireq->opt);
1590 err = net_xmit_eval(err); 1590 err = net_xmit_eval(err);
1591 if (err || want_cookie) 1591 if (err || want_cookie)
1592 goto drop_and_free; 1592 goto drop_and_free;
@@ -1644,9 +1644,9 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1644 newtp = tcp_sk(newsk); 1644 newtp = tcp_sk(newsk);
1645 newinet = inet_sk(newsk); 1645 newinet = inet_sk(newsk);
1646 ireq = inet_rsk(req); 1646 ireq = inet_rsk(req);
1647 newinet->inet_daddr = ireq->rmt_addr; 1647 newinet->inet_daddr = ireq->ir_rmt_addr;
1648 newinet->inet_rcv_saddr = ireq->loc_addr; 1648 newinet->inet_rcv_saddr = ireq->ir_loc_addr;
1649 newinet->inet_saddr = ireq->loc_addr; 1649 newinet->inet_saddr = ireq->ir_loc_addr;
1650 inet_opt = ireq->opt; 1650 inet_opt = ireq->opt;
1651 rcu_assign_pointer(newinet->inet_opt, inet_opt); 1651 rcu_assign_pointer(newinet->inet_opt, inet_opt);
1652 ireq->opt = NULL; 1652 ireq->opt = NULL;
@@ -2548,10 +2548,10 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req,
2548 seq_printf(f, "%4d: %08X:%04X %08X:%04X" 2548 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
2549 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK%n", 2549 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK%n",
2550 i, 2550 i,
2551 ireq->loc_addr, 2551 ireq->ir_loc_addr,
2552 ntohs(inet_sk(sk)->inet_sport), 2552 ntohs(inet_sk(sk)->inet_sport),
2553 ireq->rmt_addr, 2553 ireq->ir_rmt_addr,
2554 ntohs(ireq->rmt_port), 2554 ntohs(ireq->ir_rmt_port),
2555 TCP_SYN_RECV, 2555 TCP_SYN_RECV,
2556 0, 0, /* could print option size, but that is af dependent. */ 2556 0, 0, /* could print option size, but that is af dependent. */
2557 1, /* timers active (only the expire timer) */ 2557 1, /* timers active (only the expire timer) */