diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-08-10 03:03:31 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:56:18 -0400 |
commit | 6687e988d9aeaccad6774e6a8304f681f3ec0a03 (patch) | |
tree | ecd3d28f9989847aa1dcde4782de0210aeadc290 /net/ipv4/tcp_diag.c | |
parent | 64ce207306debd7157f47282be94770407bec01c (diff) |
[ICSK]: Move TCP congestion avoidance members to icsk
This changeset basically moves tcp_sk()->{ca_ops,ca_state,etc} to inet_csk(),
minimal renaming/moving done in this changeset to ease review.
Most of it is just changes of struct tcp_sock * to struct sock * parameters.
With this we move to a state closer to two interesting goals:
1. Generalisation of net/ipv4/tcp_diag.c, becoming inet_diag.c, being used
for any INET transport protocol that has struct inet_hashinfo and are
derived from struct inet_connection_sock. Keeps the userspace API, that will
just not display DCCP sockets, while newer versions of tools can support
DCCP.
2. INET generic transport pluggable Congestion Avoidance infrastructure, using
the current TCP CA infrastructure with DCCP.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_diag.c')
-rw-r--r-- | net/ipv4/tcp_diag.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c index 5f4c74f45e82..4288ecfec9a7 100644 --- a/net/ipv4/tcp_diag.c +++ b/net/ipv4/tcp_diag.c | |||
@@ -66,10 +66,10 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, | |||
66 | if (ext & (1<<(TCPDIAG_INFO-1))) | 66 | if (ext & (1<<(TCPDIAG_INFO-1))) |
67 | info = TCPDIAG_PUT(skb, TCPDIAG_INFO, sizeof(*info)); | 67 | info = TCPDIAG_PUT(skb, TCPDIAG_INFO, sizeof(*info)); |
68 | 68 | ||
69 | if (ext & (1<<(TCPDIAG_CONG-1))) { | 69 | if ((ext & (1 << (TCPDIAG_CONG - 1))) && icsk->icsk_ca_ops) { |
70 | size_t len = strlen(tp->ca_ops->name); | 70 | size_t len = strlen(icsk->icsk_ca_ops->name); |
71 | strcpy(TCPDIAG_PUT(skb, TCPDIAG_CONG, len+1), | 71 | strcpy(TCPDIAG_PUT(skb, TCPDIAG_CONG, len+1), |
72 | tp->ca_ops->name); | 72 | icsk->icsk_ca_ops->name); |
73 | } | 73 | } |
74 | } | 74 | } |
75 | r->tcpdiag_family = sk->sk_family; | 75 | r->tcpdiag_family = sk->sk_family; |
@@ -136,18 +136,17 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, | |||
136 | r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); | 136 | r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); |
137 | } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) { | 137 | } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) { |
138 | r->tcpdiag_timer = 4; | 138 | r->tcpdiag_timer = 4; |
139 | r->tcpdiag_retrans = tp->probes_out; | 139 | r->tcpdiag_retrans = icsk->icsk_probes_out; |
140 | r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); | 140 | r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); |
141 | } else if (timer_pending(&sk->sk_timer)) { | 141 | } else if (timer_pending(&sk->sk_timer)) { |
142 | r->tcpdiag_timer = 2; | 142 | r->tcpdiag_timer = 2; |
143 | r->tcpdiag_retrans = tp->probes_out; | 143 | r->tcpdiag_retrans = icsk->icsk_probes_out; |
144 | r->tcpdiag_expires = EXPIRES_IN_MS(sk->sk_timer.expires); | 144 | r->tcpdiag_expires = EXPIRES_IN_MS(sk->sk_timer.expires); |
145 | } else { | 145 | } else { |
146 | r->tcpdiag_timer = 0; | 146 | r->tcpdiag_timer = 0; |
147 | r->tcpdiag_expires = 0; | 147 | r->tcpdiag_expires = 0; |
148 | } | 148 | } |
149 | #undef EXPIRES_IN_MS | 149 | #undef EXPIRES_IN_MS |
150 | |||
151 | r->tcpdiag_rqueue = tp->rcv_nxt - tp->copied_seq; | 150 | r->tcpdiag_rqueue = tp->rcv_nxt - tp->copied_seq; |
152 | r->tcpdiag_wqueue = tp->write_seq - tp->snd_una; | 151 | r->tcpdiag_wqueue = tp->write_seq - tp->snd_una; |
153 | r->tcpdiag_uid = sock_i_uid(sk); | 152 | r->tcpdiag_uid = sock_i_uid(sk); |
@@ -163,8 +162,9 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, | |||
163 | if (info) | 162 | if (info) |
164 | tcp_get_info(sk, info); | 163 | tcp_get_info(sk, info); |
165 | 164 | ||
166 | if (sk->sk_state < TCP_TIME_WAIT && tp->ca_ops->get_info) | 165 | if (sk->sk_state < TCP_TIME_WAIT && |
167 | tp->ca_ops->get_info(tp, ext, skb); | 166 | icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info) |
167 | icsk->icsk_ca_ops->get_info(sk, ext, skb); | ||
168 | 168 | ||
169 | nlh->nlmsg_len = skb->tail - b; | 169 | nlh->nlmsg_len = skb->tail - b; |
170 | return skb->len; | 170 | return skb->len; |