aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-11-24 19:06:52 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:58 -0500
commit95b21d7e9d099f1cffca08e40f292d6658a88b3c (patch)
tree23f30c58c1bbe6344c6077552b4220a442b94624 /net/dccp/ccids
parent3deeadd74bbf916b502d307222833ffcf68db557 (diff)
[CCID2]: Replace pipe assignment-function with assignment
The function ccid2_change_pipe only does an assignment. This patch simplifies the code by replacing the function with the assignment it performs. Furthermore, the type of pipe is promoted from `signed' to unsigned (increasing the range). As a result, a BUG_ON test for negative values now becomes obsolete (for safety not removed, but replaced with a less annoying `DCCP_BUG'). Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r--net/dccp/ccids/ccid2.c16
-rw-r--r--net/dccp/ccids/ccid2.h3
2 files changed, 8 insertions, 11 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 747fa1c4e42e..237007bb55a8 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -171,11 +171,6 @@ static void ccid2_change_srtt(struct ccid2_hc_tx_sock *hctx, long val)
171 hctx->ccid2hctx_srtt = val; 171 hctx->ccid2hctx_srtt = val;
172} 172}
173 173
174static void ccid2_change_pipe(struct ccid2_hc_tx_sock *hctx, long val)
175{
176 hctx->ccid2hctx_pipe = val;
177}
178
179static void ccid2_start_rto_timer(struct sock *sk); 174static void ccid2_start_rto_timer(struct sock *sk);
180 175
181static void ccid2_hc_tx_rto_expire(unsigned long data) 176static void ccid2_hc_tx_rto_expire(unsigned long data)
@@ -205,11 +200,11 @@ static void ccid2_hc_tx_rto_expire(unsigned long data)
205 ccid2_start_rto_timer(sk); 200 ccid2_start_rto_timer(sk);
206 201
207 /* adjust pipe, cwnd etc */ 202 /* adjust pipe, cwnd etc */
208 ccid2_change_pipe(hctx, 0);
209 hctx->ccid2hctx_ssthresh = hctx->ccid2hctx_cwnd / 2; 203 hctx->ccid2hctx_ssthresh = hctx->ccid2hctx_cwnd / 2;
210 if (hctx->ccid2hctx_ssthresh < 2) 204 if (hctx->ccid2hctx_ssthresh < 2)
211 hctx->ccid2hctx_ssthresh = 2; 205 hctx->ccid2hctx_ssthresh = 2;
212 hctx->ccid2hctx_cwnd = 1; 206 hctx->ccid2hctx_cwnd = 1;
207 hctx->ccid2hctx_pipe = 0;
213 208
214 /* clear state about stuff we sent */ 209 /* clear state about stuff we sent */
215 hctx->ccid2hctx_seqt = hctx->ccid2hctx_seqh; 210 hctx->ccid2hctx_seqt = hctx->ccid2hctx_seqh;
@@ -248,8 +243,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len)
248 243
249 BUG_ON(!hctx->ccid2hctx_sendwait); 244 BUG_ON(!hctx->ccid2hctx_sendwait);
250 hctx->ccid2hctx_sendwait = 0; 245 hctx->ccid2hctx_sendwait = 0;
251 ccid2_change_pipe(hctx, hctx->ccid2hctx_pipe + 1); 246 hctx->ccid2hctx_pipe++;
252 BUG_ON(hctx->ccid2hctx_pipe < 0);
253 247
254 /* There is an issue. What if another packet is sent between 248 /* There is an issue. What if another packet is sent between
255 * packet_send() and packet_sent(). Then the sequence number would be 249 * packet_send() and packet_sent(). Then the sequence number would be
@@ -519,8 +513,10 @@ static void ccid2_hc_tx_dec_pipe(struct sock *sk)
519{ 513{
520 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); 514 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
521 515
522 ccid2_change_pipe(hctx, hctx->ccid2hctx_pipe-1); 516 if (hctx->ccid2hctx_pipe == 0)
523 BUG_ON(hctx->ccid2hctx_pipe < 0); 517 DCCP_BUG("pipe == 0");
518 else
519 hctx->ccid2hctx_pipe--;
524 520
525 if (hctx->ccid2hctx_pipe == 0) 521 if (hctx->ccid2hctx_pipe == 0)
526 ccid2_hc_tx_kill_rto_timer(sk); 522 ccid2_hc_tx_kill_rto_timer(sk);
diff --git a/net/dccp/ccids/ccid2.h b/net/dccp/ccids/ccid2.h
index b72e9556a155..bc659f00cb96 100644
--- a/net/dccp/ccids/ccid2.h
+++ b/net/dccp/ccids/ccid2.h
@@ -42,6 +42,7 @@ struct ccid2_seq {
42 42
43/** struct ccid2_hc_tx_sock - CCID2 TX half connection 43/** struct ccid2_hc_tx_sock - CCID2 TX half connection
44 * 44 *
45 * @ccid2hctx_{cwnd,ssthresh,pipe}: as per RFC 4341, section 5
45 * @ccid2hctx_ssacks - ACKs recv in slow start 46 * @ccid2hctx_ssacks - ACKs recv in slow start
46 * @ccid2hctx_acks - ACKS recv in AI phase 47 * @ccid2hctx_acks - ACKS recv in AI phase
47 * @ccid2hctx_lastrtt -time RTT was last measured 48 * @ccid2hctx_lastrtt -time RTT was last measured
@@ -51,9 +52,9 @@ struct ccid2_seq {
51struct ccid2_hc_tx_sock { 52struct ccid2_hc_tx_sock {
52 u32 ccid2hctx_cwnd; 53 u32 ccid2hctx_cwnd;
53 u32 ccid2hctx_ssthresh; 54 u32 ccid2hctx_ssthresh;
55 u32 ccid2hctx_pipe;
54 int ccid2hctx_ssacks; 56 int ccid2hctx_ssacks;
55 int ccid2hctx_acks; 57 int ccid2hctx_acks;
56 int ccid2hctx_pipe;
57 struct ccid2_seq *ccid2hctx_seqbuf[CCID2_SEQBUF_MAX]; 58 struct ccid2_seq *ccid2hctx_seqbuf[CCID2_SEQBUF_MAX];
58 int ccid2hctx_seqbufc; 59 int ccid2hctx_seqbufc;
59 struct ccid2_seq *ccid2hctx_seqh; 60 struct ccid2_seq *ccid2hctx_seqh;