diff options
| author | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2003-05-27 23:09:54 -0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2003-05-27 23:09:54 -0300 |
| commit | 4ea1f8303bcd69d068ff235e24840acd99afe6c6 (patch) | |
| tree | bf89e69588c4665941ab9e333d153bbddf97c81f /net/ipv4/tcp_timer.c | |
| parent | 015498d534572f8a9c3bf5f1dfc02bd02bfb2c9d (diff) | |
o net: abstract access to struct sock ->flags
This makes:
1. simpler primitive to access struct sock flags, shorter
2. we check if the flag is valid by using enum sock_flags
3. we can change the implementation to an open coded bit operations
if it proves to be faster than the more general bit manipulation
routines now used, i.e. we only have to change sock.h, not the
whole net tree like now
Diffstat (limited to 'net/ipv4/tcp_timer.c')
| -rw-r--r-- | net/ipv4/tcp_timer.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 4763edf791f7..18f5c2e2bb4a 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -189,7 +189,7 @@ static int tcp_write_timeout(struct sock *sk) } retry_until = sysctl_tcp_retries2; - if (test_bit(SOCK_DEAD, &sk->flags)) { + if (sock_flag(sk, SOCK_DEAD)) { int alive = (tp->rto < TCP_RTO_MAX); retry_until = tcp_orphan_retries(sk, alive); @@ -297,7 +297,7 @@ static void tcp_probe_timer(struct sock *sk) */ max_probes = sysctl_tcp_retries2; - if (test_bit(SOCK_DEAD, &sk->flags)) { + if (sock_flag(sk, SOCK_DEAD)) { int alive = ((tp->rto<<tp->backoff) < TCP_RTO_MAX); max_probes = tcp_orphan_retries(sk, alive); @@ -327,7 +327,7 @@ static void tcp_retransmit_timer(struct sock *sk) BUG_TRAP(!skb_queue_empty(&sk->write_queue)); - if (tp->snd_wnd == 0 && !test_bit(SOCK_DEAD, &sk->flags) && + if (!tp->snd_wnd && !sock_flag(sk, SOCK_DEAD) && !((1<<sk->state)&(TCPF_SYN_SENT|TCPF_SYN_RECV))) { /* Receiver dastardly shrinks window. Our retransmits * become zero probes, but we should not timeout this @@ -571,7 +571,7 @@ void tcp_set_keepalive(struct sock *sk, int val) if ((1<<sk->state)&(TCPF_CLOSE|TCPF_LISTEN)) return; - if (val && !test_bit(SOCK_KEEPOPEN, &sk->flags)) + if (val && !sock_flag(sk, SOCK_KEEPOPEN)) tcp_reset_keepalive_timer(sk, keepalive_time_when(tcp_sk(sk))); else if (!val) tcp_delete_keepalive_timer(sk); @@ -597,7 +597,7 @@ static void tcp_keepalive_timer (unsigned long data) goto out; } - if (sk->state == TCP_FIN_WAIT2 && test_bit(SOCK_DEAD, &sk->flags)) { + if (sk->state == TCP_FIN_WAIT2 && sock_flag(sk, SOCK_DEAD)) { if (tp->linger2 >= 0) { int tmo = tcp_fin_time(tp) - TCP_TIMEWAIT_LEN; @@ -610,7 +610,7 @@ static void tcp_keepalive_timer (unsigned long data) goto death; } - if (!test_bit(SOCK_KEEPOPEN, &sk->flags) || sk->state == TCP_CLOSE) + if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->state == TCP_CLOSE) goto out; elapsed = keepalive_time_when(tp); |
