X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fipv4%2Ftcp.c;h=fbca1821b4aef3b42daf9ef5be2d630be183fa51;hb=3ec04f3d2903fdf6d9849a8633af59b8628164a5;hp=281099ffa6280f249f35f08ef0a46fdb69fe62ce;hpb=8d40237c730b8be87c1b80a5d96b9c603fefa829;p=linux-2.6.git diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 281099ffa..fbca1821b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -258,7 +258,7 @@ #include #ifdef CONFIG_CKRM -#include +#include #endif #include @@ -478,7 +478,7 @@ int tcp_listen_start(struct sock *sk) #else tp->accept_queue = tp->accept_queue_tail = NULL; #endif - rwlock_init(&tp->syn_wait_lock); + tp->syn_wait_lock = RW_LOCK_UNLOCKED; tcp_delack_init(tp); lopt = kmalloc(sizeof(struct tcp_listen_opt), GFP_KERNEL); @@ -2227,65 +2227,6 @@ int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, return err; } -/* Return information about state of tcp endpoint in API format. */ -void tcp_get_info(struct sock *sk, struct tcp_info *info) -{ - struct tcp_opt *tp = tcp_sk(sk); - u32 now = tcp_time_stamp; - - memset(info, 0, sizeof(*info)); - - info->tcpi_state = sk->sk_state; - info->tcpi_ca_state = tp->ca_state; - info->tcpi_retransmits = tp->retransmits; - info->tcpi_probes = tp->probes_out; - info->tcpi_backoff = tp->backoff; - - if (tp->tstamp_ok) - info->tcpi_options |= TCPI_OPT_TIMESTAMPS; - if (tp->sack_ok) - info->tcpi_options |= TCPI_OPT_SACK; - if (tp->wscale_ok) { - info->tcpi_options |= TCPI_OPT_WSCALE; - info->tcpi_snd_wscale = tp->snd_wscale; - info->tcpi_rcv_wscale = tp->rcv_wscale; - } - - if (tp->ecn_flags&TCP_ECN_OK) - info->tcpi_options |= TCPI_OPT_ECN; - - info->tcpi_rto = jiffies_to_usecs(tp->rto); - info->tcpi_ato = jiffies_to_usecs(tp->ack.ato); - info->tcpi_snd_mss = tp->mss_cache_std; - info->tcpi_rcv_mss = tp->ack.rcv_mss; - - info->tcpi_unacked = tcp_get_pcount(&tp->packets_out); - info->tcpi_sacked = tcp_get_pcount(&tp->sacked_out); - info->tcpi_lost = tcp_get_pcount(&tp->lost_out); - info->tcpi_retrans = tcp_get_pcount(&tp->retrans_out); - info->tcpi_fackets = tcp_get_pcount(&tp->fackets_out); - - info->tcpi_last_data_sent = jiffies_to_msecs(now - tp->lsndtime); - info->tcpi_last_data_recv = jiffies_to_msecs(now - tp->ack.lrcvtime); - info->tcpi_last_ack_recv = jiffies_to_msecs(now - tp->rcv_tstamp); - - info->tcpi_pmtu = tp->pmtu_cookie; - info->tcpi_rcv_ssthresh = tp->rcv_ssthresh; - info->tcpi_rtt = jiffies_to_usecs(tp->srtt)>>3; - info->tcpi_rttvar = jiffies_to_usecs(tp->mdev)>>2; - info->tcpi_snd_ssthresh = tp->snd_ssthresh; - info->tcpi_snd_cwnd = tp->snd_cwnd; - info->tcpi_advmss = tp->advmss; - info->tcpi_reordering = tp->reordering; - - info->tcpi_rcv_rtt = jiffies_to_usecs(tp->rcv_rtt_est.rtt)>>3; - info->tcpi_rcv_space = tp->rcvq_space.space; - - info->tcpi_total_retrans = tp->total_retrans; -} - -EXPORT_SYMBOL_GPL(tcp_get_info); - int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen) { @@ -2475,7 +2416,7 @@ void __init tcp_init(void) if (!tcp_ehash) panic("Failed to allocate TCP established hash table\n"); for (i = 0; i < (tcp_ehash_size << 1); i++) { - rwlock_init(&tcp_ehash[i].lock); + tcp_ehash[i].lock = RW_LOCK_UNLOCKED; INIT_HLIST_HEAD(&tcp_ehash[i].chain); } @@ -2491,7 +2432,7 @@ void __init tcp_init(void) if (!tcp_bhash) panic("Failed to allocate TCP bind hash table\n"); for (i = 0; i < tcp_bhash_size; i++) { - spin_lock_init(&tcp_bhash[i].lock); + tcp_bhash[i].lock = SPIN_LOCK_UNLOCKED; INIT_HLIST_HEAD(&tcp_bhash[i].chain); } @@ -2526,6 +2467,8 @@ void __init tcp_init(void) printk(KERN_INFO "TCP: Hash tables configured " "(established %d bind %d)\n", tcp_ehash_size << 1, tcp_bhash_size); + + tcpdiag_init(); } EXPORT_SYMBOL(tcp_accept);