aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-12-10 13:01:18 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-11 17:35:00 -0500
commit8109b02b5397ed52a32c116163a62a34f4768b26 (patch)
tree0dbeae8cc999d2f6b71807b942eda7ff686ba7d2 /net/dccp
parent1fba78b6cba14bd37fdb12c5367f1e4d58ff2e0f (diff)
[DCCP]: Whitespace cleanups
That accumulated over the last months hackaton, shame on me for not using git-apply whitespace helping hand, will do that from now on. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ackvec.c4
-rw-r--r--net/dccp/ccids/ccid2.c12
-rw-r--r--net/dccp/ccids/ccid3.c111
-rw-r--r--net/dccp/ccids/ccid3.h22
-rw-r--r--net/dccp/feat.c6
-rw-r--r--net/dccp/input.c26
-rw-r--r--net/dccp/ipv4.c26
-rw-r--r--net/dccp/ipv6.c24
-rw-r--r--net/dccp/minisocks.c2
-rw-r--r--net/dccp/output.c7
-rw-r--r--net/dccp/proto.c6
-rw-r--r--net/dccp/timer.c14
12 files changed, 136 insertions, 124 deletions
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index 1f4727ddbdbf..a086c6312d3b 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -223,7 +223,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av,
223 gap = -new_head; 223 gap = -new_head;
224 } 224 }
225 new_head += DCCP_MAX_ACKVEC_LEN; 225 new_head += DCCP_MAX_ACKVEC_LEN;
226 } 226 }
227 227
228 av->dccpav_buf_head = new_head; 228 av->dccpav_buf_head = new_head;
229 229
@@ -336,7 +336,7 @@ out_duplicate:
336void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len) 336void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len)
337{ 337{
338 dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len, 338 dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len,
339 (unsigned long long)ackno); 339 (unsigned long long)ackno);
340 340
341 while (len--) { 341 while (len--) {
342 const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6; 342 const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6;
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 2555be8f4790..fd38b05d6f79 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -351,7 +351,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len)
351 351
352 while (seqp != hctx->ccid2hctx_seqh) { 352 while (seqp != hctx->ccid2hctx_seqh) {
353 ccid2_pr_debug("out seq=%llu acked=%d time=%lu\n", 353 ccid2_pr_debug("out seq=%llu acked=%d time=%lu\n",
354 (unsigned long long)seqp->ccid2s_seq, 354 (unsigned long long)seqp->ccid2s_seq,
355 seqp->ccid2s_acked, seqp->ccid2s_sent); 355 seqp->ccid2s_acked, seqp->ccid2s_sent);
356 seqp = seqp->ccid2s_next; 356 seqp = seqp->ccid2s_next;
357 } 357 }
@@ -473,7 +473,7 @@ static inline void ccid2_new_ack(struct sock *sk,
473 /* first measurement */ 473 /* first measurement */
474 if (hctx->ccid2hctx_srtt == -1) { 474 if (hctx->ccid2hctx_srtt == -1) {
475 ccid2_pr_debug("R: %lu Time=%lu seq=%llu\n", 475 ccid2_pr_debug("R: %lu Time=%lu seq=%llu\n",
476 r, jiffies, 476 r, jiffies,
477 (unsigned long long)seqp->ccid2s_seq); 477 (unsigned long long)seqp->ccid2s_seq);
478 ccid2_change_srtt(hctx, r); 478 ccid2_change_srtt(hctx, r);
479 hctx->ccid2hctx_rttvar = r >> 1; 479 hctx->ccid2hctx_rttvar = r >> 1;
@@ -518,8 +518,8 @@ static inline void ccid2_new_ack(struct sock *sk,
518 hctx->ccid2hctx_lastrtt = jiffies; 518 hctx->ccid2hctx_lastrtt = jiffies;
519 519
520 ccid2_pr_debug("srtt: %ld rttvar: %ld rto: %ld (HZ=%d) R=%lu\n", 520 ccid2_pr_debug("srtt: %ld rttvar: %ld rto: %ld (HZ=%d) R=%lu\n",
521 hctx->ccid2hctx_srtt, hctx->ccid2hctx_rttvar, 521 hctx->ccid2hctx_srtt, hctx->ccid2hctx_rttvar,
522 hctx->ccid2hctx_rto, HZ, r); 522 hctx->ccid2hctx_rto, HZ, r);
523 hctx->ccid2hctx_sent = 0; 523 hctx->ccid2hctx_sent = 0;
524 } 524 }
525 525
@@ -667,9 +667,9 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
667 /* new packet received or marked */ 667 /* new packet received or marked */
668 if (state != DCCP_ACKVEC_STATE_NOT_RECEIVED && 668 if (state != DCCP_ACKVEC_STATE_NOT_RECEIVED &&
669 !seqp->ccid2s_acked) { 669 !seqp->ccid2s_acked) {
670 if (state == 670 if (state ==
671 DCCP_ACKVEC_STATE_ECN_MARKED) { 671 DCCP_ACKVEC_STATE_ECN_MARKED) {
672 ccid2_congestion_event(hctx, 672 ccid2_congestion_event(hctx,
673 seqp); 673 seqp);
674 } else 674 } else
675 ccid2_new_ack(sk, seqp, 675 ccid2_new_ack(sk, seqp,
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 5e817e2f1ebc..fa6b75372ed7 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -124,18 +124,18 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now)
124 if (hctx->ccid3hctx_p > 0) { 124 if (hctx->ccid3hctx_p > 0) {
125 125
126 hctx->ccid3hctx_x = min(((__u64)hctx->ccid3hctx_x_calc) << 6, 126 hctx->ccid3hctx_x = min(((__u64)hctx->ccid3hctx_x_calc) << 6,
127 hctx->ccid3hctx_x_recv * 2 ); 127 hctx->ccid3hctx_x_recv * 2);
128 hctx->ccid3hctx_x = max(hctx->ccid3hctx_x, 128 hctx->ccid3hctx_x = max(hctx->ccid3hctx_x,
129 (((__u64)hctx->ccid3hctx_s) << 6) / 129 (((__u64)hctx->ccid3hctx_s) << 6) /
130 TFRC_T_MBI); 130 TFRC_T_MBI);
131 131
132 } else if (timeval_delta(now, &hctx->ccid3hctx_t_ld) - 132 } else if (timeval_delta(now, &hctx->ccid3hctx_t_ld) -
133 (suseconds_t)hctx->ccid3hctx_rtt >= 0 ) { 133 (suseconds_t)hctx->ccid3hctx_rtt >= 0) {
134 134
135 hctx->ccid3hctx_x = 135 hctx->ccid3hctx_x =
136 max(2 * min(hctx->ccid3hctx_x, hctx->ccid3hctx_x_recv), 136 max(2 * min(hctx->ccid3hctx_x, hctx->ccid3hctx_x_recv),
137 scaled_div(((__u64)hctx->ccid3hctx_s) << 6, 137 scaled_div(((__u64)hctx->ccid3hctx_s) << 6,
138 hctx->ccid3hctx_rtt ) ); 138 hctx->ccid3hctx_rtt));
139 hctx->ccid3hctx_t_ld = *now; 139 hctx->ccid3hctx_t_ld = *now;
140 } 140 }
141 141
@@ -144,8 +144,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now)
144} 144}
145 145
146/* 146/*
147 * Track the mean packet size `s' (cf. RFC 4342, 5.3 and RFC 3448, 4.1) 147 * Track the mean packet size `s' (cf. RFC 4342, 5.3 and RFC 3448, 4.1)
148 * @len: DCCP packet payload size in bytes 148 * @len: DCCP packet payload size in bytes
149 */ 149 */
150static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len) 150static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len)
151{ 151{
@@ -163,8 +163,8 @@ static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len)
163} 163}
164 164
165/* 165/*
166 * Update Window Counter using the algorithm from [RFC 4342, 8.1]. 166 * Update Window Counter using the algorithm from [RFC 4342, 8.1].
167 * The algorithm is not applicable if RTT < 4 microseconds. 167 * The algorithm is not applicable if RTT < 4 microseconds.
168 */ 168 */
169static inline void ccid3_hc_tx_update_win_count(struct ccid3_hc_tx_sock *hctx, 169static inline void ccid3_hc_tx_update_win_count(struct ccid3_hc_tx_sock *hctx,
170 struct timeval *now) 170 struct timeval *now)
@@ -228,12 +228,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
228 */ 228 */
229 if (!hctx->ccid3hctx_idle || 229 if (!hctx->ccid3hctx_idle ||
230 (hctx->ccid3hctx_x_recv >= 4 * 230 (hctx->ccid3hctx_x_recv >= 4 *
231 scaled_div(((__u64)hctx->ccid3hctx_s) << 6, hctx->ccid3hctx_rtt))) { 231 scaled_div(((__u64)hctx->ccid3hctx_s) << 6,
232 hctx->ccid3hctx_rtt))) {
232 struct timeval now; 233 struct timeval now;
233 234
234 ccid3_pr_debug("%s(%p, state=%s), not idle\n", 235 ccid3_pr_debug("%s(%p, state=%s), not idle\n",
235 dccp_role(sk), sk, 236 dccp_role(sk), sk,
236 ccid3_tx_state_name(hctx->ccid3hctx_state)); 237 ccid3_tx_state_name(hctx->ccid3hctx_state));
237 238
238 /* 239 /*
239 * Modify the cached value of X_recv [RFC 3448, 4.4] 240 * Modify the cached value of X_recv [RFC 3448, 4.4]
@@ -248,12 +249,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
248 BUG_ON(hctx->ccid3hctx_p && !hctx->ccid3hctx_x_calc); 249 BUG_ON(hctx->ccid3hctx_p && !hctx->ccid3hctx_x_calc);
249 250
250 if (hctx->ccid3hctx_p == 0 || 251 if (hctx->ccid3hctx_p == 0 ||
251 hctx->ccid3hctx_x_calc > (hctx->ccid3hctx_x_recv >> 5)) { 252 (hctx->ccid3hctx_x_calc >
253 (hctx->ccid3hctx_x_recv >> 5))) {
252 254
253 hctx->ccid3hctx_x_recv = 255 hctx->ccid3hctx_x_recv =
254 max(hctx->ccid3hctx_x_recv / 2, 256 max(hctx->ccid3hctx_x_recv / 2,
255 (((__u64)hctx->ccid3hctx_s) << 6) / 257 (((__u64)hctx->ccid3hctx_s) << 6) /
256 (2*TFRC_T_MBI)); 258 (2 * TFRC_T_MBI));
257 259
258 if (hctx->ccid3hctx_p == 0) 260 if (hctx->ccid3hctx_p == 0)
259 dccp_timestamp(sk, &now); 261 dccp_timestamp(sk, &now);
@@ -316,7 +318,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
316 switch (hctx->ccid3hctx_state) { 318 switch (hctx->ccid3hctx_state) {
317 case TFRC_SSTATE_NO_SENT: 319 case TFRC_SSTATE_NO_SENT:
318 sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, 320 sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
319 jiffies + usecs_to_jiffies(TFRC_INITIAL_TIMEOUT)); 321 (jiffies +
322 usecs_to_jiffies(TFRC_INITIAL_TIMEOUT)));
320 hctx->ccid3hctx_last_win_count = 0; 323 hctx->ccid3hctx_last_win_count = 0;
321 hctx->ccid3hctx_t_last_win_count = now; 324 hctx->ccid3hctx_t_last_win_count = now;
322 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK); 325 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
@@ -338,7 +341,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
338 case TFRC_SSTATE_FBACK: 341 case TFRC_SSTATE_FBACK:
339 delay = timeval_delta(&hctx->ccid3hctx_t_nom, &now); 342 delay = timeval_delta(&hctx->ccid3hctx_t_nom, &now);
340 /* 343 /*
341 * Scheduling of packet transmissions [RFC 3448, 4.6] 344 * Scheduling of packet transmissions [RFC 3448, 4.6]
342 * 345 *
343 * if (t_now > t_nom - delta) 346 * if (t_now > t_nom - delta)
344 * // send the packet now 347 * // send the packet now
@@ -365,7 +368,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
365 return 0; 368 return 0;
366} 369}
367 370
368static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) 371static void ccid3_hc_tx_packet_sent(struct sock *sk, int more,
372 unsigned int len)
369{ 373{
370 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 374 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
371 struct timeval now; 375 struct timeval now;
@@ -415,12 +419,12 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
415 case TFRC_SSTATE_FBACK: 419 case TFRC_SSTATE_FBACK:
416 /* get packet from history to look up t_recvdata */ 420 /* get packet from history to look up t_recvdata */
417 packet = dccp_tx_hist_find_entry(&hctx->ccid3hctx_hist, 421 packet = dccp_tx_hist_find_entry(&hctx->ccid3hctx_hist,
418 DCCP_SKB_CB(skb)->dccpd_ack_seq); 422 DCCP_SKB_CB(skb)->dccpd_ack_seq);
419 if (unlikely(packet == NULL)) { 423 if (unlikely(packet == NULL)) {
420 DCCP_WARN("%s(%p), seqno %llu(%s) doesn't exist " 424 DCCP_WARN("%s(%p), seqno %llu(%s) doesn't exist "
421 "in history!\n", dccp_role(sk), sk, 425 "in history!\n", dccp_role(sk), sk,
422 (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, 426 (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq,
423 dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type)); 427 dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type));
424 return; 428 return;
425 } 429 }
426 430
@@ -433,13 +437,13 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
433 if (pinv == ~0U || pinv == 0) /* see RFC 4342, 8.5 */ 437 if (pinv == ~0U || pinv == 0) /* see RFC 4342, 8.5 */
434 hctx->ccid3hctx_p = 0; 438 hctx->ccid3hctx_p = 0;
435 else /* can not exceed 100% */ 439 else /* can not exceed 100% */
436 hctx->ccid3hctx_p = 1000000 / pinv; 440 hctx->ccid3hctx_p = 1000000 / pinv;
437 441
438 dccp_timestamp(sk, &now); 442 dccp_timestamp(sk, &now);
439 443
440 /* 444 /*
441 * Calculate new round trip sample as per [RFC 3448, 4.3] by 445 * Calculate new round trip sample as per [RFC 3448, 4.3] by
442 * R_sample = (now - t_recvdata) - t_elapsed 446 * R_sample = (now - t_recvdata) - t_elapsed
443 */ 447 */
444 r_sample = timeval_delta(&now, &packet->dccphtx_tstamp); 448 r_sample = timeval_delta(&now, &packet->dccphtx_tstamp);
445 t_elapsed = dp->dccps_options_received.dccpor_elapsed_time * 10; 449 t_elapsed = dp->dccps_options_received.dccpor_elapsed_time * 10;
@@ -465,7 +469,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
465 * Larger Initial Windows [RFC 4342, sec. 5] 469 * Larger Initial Windows [RFC 4342, sec. 5]
466 * We deviate in that we use `s' instead of `MSS'. 470 * We deviate in that we use `s' instead of `MSS'.
467 */ 471 */
468 __u64 w_init = min( 4 * hctx->ccid3hctx_s, 472 __u64 w_init = min(4 * hctx->ccid3hctx_s,
469 max(2 * hctx->ccid3hctx_s, 4380)); 473 max(2 * hctx->ccid3hctx_s, 4380));
470 hctx->ccid3hctx_rtt = r_sample; 474 hctx->ccid3hctx_rtt = r_sample;
471 hctx->ccid3hctx_x = scaled_div(w_init << 6, r_sample); 475 hctx->ccid3hctx_x = scaled_div(w_init << 6, r_sample);
@@ -475,13 +479,14 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
475 479
476 ccid3_pr_debug("%s(%p), s=%u, w_init=%llu, " 480 ccid3_pr_debug("%s(%p), s=%u, w_init=%llu, "
477 "R_sample=%dus, X=%u\n", dccp_role(sk), 481 "R_sample=%dus, X=%u\n", dccp_role(sk),
478 sk, hctx->ccid3hctx_s, w_init, (int)r_sample, 482 sk, hctx->ccid3hctx_s, w_init,
483 (int)r_sample,
479 (unsigned)(hctx->ccid3hctx_x >> 6)); 484 (unsigned)(hctx->ccid3hctx_x >> 6));
480 485
481 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK); 486 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
482 } else { 487 } else {
483 hctx->ccid3hctx_rtt = (9 * hctx->ccid3hctx_rtt + 488 hctx->ccid3hctx_rtt = (9 * hctx->ccid3hctx_rtt +
484 (u32)r_sample ) / 10; 489 (u32)r_sample) / 10;
485 490
486 /* Update sending rate (step 4 of [RFC 3448, 4.3]) */ 491 /* Update sending rate (step 4 of [RFC 3448, 4.3]) */
487 if (hctx->ccid3hctx_p > 0) 492 if (hctx->ccid3hctx_p > 0)
@@ -492,12 +497,13 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
492 ccid3_hc_tx_update_x(sk, &now); 497 ccid3_hc_tx_update_x(sk, &now);
493 498
494 ccid3_pr_debug("%s(%p), RTT=%uus (sample=%dus), s=%u, " 499 ccid3_pr_debug("%s(%p), RTT=%uus (sample=%dus), s=%u, "
495 "p=%u, X_calc=%u, X_recv=%u, X=%u\n", dccp_role(sk), 500 "p=%u, X_calc=%u, X_recv=%u, X=%u\n",
501 dccp_role(sk),
496 sk, hctx->ccid3hctx_rtt, (int)r_sample, 502 sk, hctx->ccid3hctx_rtt, (int)r_sample,
497 hctx->ccid3hctx_s, hctx->ccid3hctx_p, 503 hctx->ccid3hctx_s, hctx->ccid3hctx_p,
498 hctx->ccid3hctx_x_calc, 504 hctx->ccid3hctx_x_calc,
499 (unsigned)(hctx->ccid3hctx_x_recv >> 6), 505 (unsigned)(hctx->ccid3hctx_x_recv >> 6),
500 (unsigned)(hctx->ccid3hctx_x >> 6) ); 506 (unsigned)(hctx->ccid3hctx_x >> 6));
501 } 507 }
502 508
503 /* unschedule no feedback timer */ 509 /* unschedule no feedback timer */
@@ -507,20 +513,20 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
507 dccp_tx_hist_purge_older(ccid3_tx_hist, 513 dccp_tx_hist_purge_older(ccid3_tx_hist,
508 &hctx->ccid3hctx_hist, packet); 514 &hctx->ccid3hctx_hist, packet);
509 /* 515 /*
510 * As we have calculated new ipi, delta, t_nom it is possible that 516 * As we have calculated new ipi, delta, t_nom it is possible
511 * we now can send a packet, so wake up dccp_wait_for_ccid 517 * that we now can send a packet, so wake up dccp_wait_for_ccid
512 */ 518 */
513 sk->sk_write_space(sk); 519 sk->sk_write_space(sk);
514 520
515 /* 521 /*
516 * Update timeout interval for the nofeedback timer. 522 * Update timeout interval for the nofeedback timer.
517 * We use a configuration option to increase the lower bound. 523 * We use a configuration option to increase the lower bound.
518 * This can help avoid triggering the nofeedback timer too often 524 * This can help avoid triggering the nofeedback timer too
519 * ('spinning') on LANs with small RTTs. 525 * often ('spinning') on LANs with small RTTs.
520 */ 526 */
521 hctx->ccid3hctx_t_rto = max_t(u32, 4 * hctx->ccid3hctx_rtt, 527 hctx->ccid3hctx_t_rto = max_t(u32, 4 * hctx->ccid3hctx_rtt,
522 CONFIG_IP_DCCP_CCID3_RTO * 528 CONFIG_IP_DCCP_CCID3_RTO *
523 (USEC_PER_SEC/1000) ); 529 (USEC_PER_SEC/1000));
524 /* 530 /*
525 * Schedule no feedback timer to expire in 531 * Schedule no feedback timer to expire in
526 * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi) 532 * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi)
@@ -528,7 +534,8 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
528 t_nfb = max(hctx->ccid3hctx_t_rto, 2 * hctx->ccid3hctx_t_ipi); 534 t_nfb = max(hctx->ccid3hctx_t_rto, 2 * hctx->ccid3hctx_t_ipi);
529 535
530 ccid3_pr_debug("%s(%p), Scheduled no feedback timer to " 536 ccid3_pr_debug("%s(%p), Scheduled no feedback timer to "
531 "expire in %lu jiffies (%luus)\n", dccp_role(sk), 537 "expire in %lu jiffies (%luus)\n",
538 dccp_role(sk),
532 sk, usecs_to_jiffies(t_nfb), t_nfb); 539 sk, usecs_to_jiffies(t_nfb), t_nfb);
533 540
534 sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, 541 sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
@@ -538,7 +545,9 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
538 hctx->ccid3hctx_idle = 1; 545 hctx->ccid3hctx_idle = 1;
539 break; 546 break;
540 case TFRC_SSTATE_NO_SENT: 547 case TFRC_SSTATE_NO_SENT:
541 /* XXX when implementing bidirectional rx/tx check this again */ 548 /*
549 * XXX when implementing bidirectional rx/tx check this again
550 */
542 DCCP_WARN("Illegal ACK received - no packet sent\n"); 551 DCCP_WARN("Illegal ACK received - no packet sent\n");
543 /* fall through */ 552 /* fall through */
544 case TFRC_SSTATE_TERM: /* ignore feedback when closing */ 553 case TFRC_SSTATE_TERM: /* ignore feedback when closing */
@@ -575,7 +584,8 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
575 dccp_role(sk), sk, len); 584 dccp_role(sk), sk, len);
576 rc = -EINVAL; 585 rc = -EINVAL;
577 } else { 586 } else {
578 opt_recv->ccid3or_loss_event_rate = ntohl(*(__be32 *)value); 587 opt_recv->ccid3or_loss_event_rate =
588 ntohl(*(__be32 *)value);
579 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n", 589 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n",
580 dccp_role(sk), sk, 590 dccp_role(sk), sk,
581 opt_recv->ccid3or_loss_event_rate); 591 opt_recv->ccid3or_loss_event_rate);
@@ -596,7 +606,8 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
596 dccp_role(sk), sk, len); 606 dccp_role(sk), sk, len);
597 rc = -EINVAL; 607 rc = -EINVAL;
598 } else { 608 } else {
599 opt_recv->ccid3or_receive_rate = ntohl(*(__be32 *)value); 609 opt_recv->ccid3or_receive_rate =
610 ntohl(*(__be32 *)value);
600 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n", 611 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n",
601 dccp_role(sk), sk, 612 dccp_role(sk), sk,
602 opt_recv->ccid3or_receive_rate); 613 opt_recv->ccid3or_receive_rate);
@@ -616,7 +627,8 @@ static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk)
616 hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT; 627 hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT;
617 INIT_LIST_HEAD(&hctx->ccid3hctx_hist); 628 INIT_LIST_HEAD(&hctx->ccid3hctx_hist);
618 629
619 hctx->ccid3hctx_no_feedback_timer.function = ccid3_hc_tx_no_feedback_timer; 630 hctx->ccid3hctx_no_feedback_timer.function =
631 ccid3_hc_tx_no_feedback_timer;
620 hctx->ccid3hctx_no_feedback_timer.data = (unsigned long)sk; 632 hctx->ccid3hctx_no_feedback_timer.data = (unsigned long)sk;
621 init_timer(&hctx->ccid3hctx_no_feedback_timer); 633 init_timer(&hctx->ccid3hctx_no_feedback_timer);
622 634
@@ -754,9 +766,9 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb)
754 hcrx->ccid3hcrx_elapsed_time)) || 766 hcrx->ccid3hcrx_elapsed_time)) ||
755 dccp_insert_option_timestamp(sk, skb) || 767 dccp_insert_option_timestamp(sk, skb) ||
756 dccp_insert_option(sk, skb, TFRC_OPT_LOSS_EVENT_RATE, 768 dccp_insert_option(sk, skb, TFRC_OPT_LOSS_EVENT_RATE,
757 &pinv, sizeof(pinv)) || 769 &pinv, sizeof(pinv)) ||
758 dccp_insert_option(sk, skb, TFRC_OPT_RECEIVE_RATE, 770 dccp_insert_option(sk, skb, TFRC_OPT_RECEIVE_RATE,
759 &x_recv, sizeof(x_recv))) 771 &x_recv, sizeof(x_recv)))
760 return -1; 772 return -1;
761 773
762 return 0; 774 return 0;
@@ -827,9 +839,9 @@ found:
827 /* 839 /*
828 * Determine the length of the first loss interval via inverse lookup. 840 * Determine the length of the first loss interval via inverse lookup.
829 * Assume that X_recv can be computed by the throughput equation 841 * Assume that X_recv can be computed by the throughput equation
830 * s 842 * s
831 * X_recv = -------- 843 * X_recv = --------
832 * R * fval 844 * R * fval
833 * Find some p such that f(p) = fval; return 1/p [RFC 3448, 6.3.1]. 845 * Find some p such that f(p) = fval; return 1/p [RFC 3448, 6.3.1].
834 */ 846 */
835 if (rtt == 0) { /* would result in divide-by-zero */ 847 if (rtt == 0) { /* would result in divide-by-zero */
@@ -860,7 +872,7 @@ found:
860 if (p == 0) 872 if (p == 0)
861 return ~0; 873 return ~0;
862 else 874 else
863 return 1000000 / p; 875 return 1000000 / p;
864} 876}
865 877
866static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss) 878static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss)
@@ -914,7 +926,8 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
914 struct dccp_rx_hist_entry *packet) 926 struct dccp_rx_hist_entry *packet)
915{ 927{
916 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 928 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
917 struct dccp_rx_hist_entry *rx_hist = dccp_rx_hist_head(&hcrx->ccid3hcrx_hist); 929 struct dccp_rx_hist_entry *rx_hist =
930 dccp_rx_hist_head(&hcrx->ccid3hcrx_hist);
918 u64 seqno = packet->dccphrx_seqno; 931 u64 seqno = packet->dccphrx_seqno;
919 u64 tmp_seqno; 932 u64 tmp_seqno;
920 int loss = 0; 933 int loss = 0;
@@ -942,7 +955,7 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
942 dccp_inc_seqno(&tmp_seqno); 955 dccp_inc_seqno(&tmp_seqno);
943 while (dccp_rx_hist_find_entry(&hcrx->ccid3hcrx_hist, 956 while (dccp_rx_hist_find_entry(&hcrx->ccid3hcrx_hist,
944 tmp_seqno, &ccval)) { 957 tmp_seqno, &ccval)) {
945 hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno; 958 hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno;
946 hcrx->ccid3hcrx_ccval_nonloss = ccval; 959 hcrx->ccid3hcrx_ccval_nonloss = ccval;
947 dccp_inc_seqno(&tmp_seqno); 960 dccp_inc_seqno(&tmp_seqno);
948 } 961 }
@@ -1044,8 +1057,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
1044 break; 1057 break;
1045 1058
1046 dccp_timestamp(sk, &now); 1059 dccp_timestamp(sk, &now);
1047 if (timeval_delta(&now, &hcrx->ccid3hcrx_tstamp_last_ack) - 1060 if ((timeval_delta(&now, &hcrx->ccid3hcrx_tstamp_last_ack) -
1048 (suseconds_t)hcrx->ccid3hcrx_rtt >= 0) { 1061 (suseconds_t)hcrx->ccid3hcrx_rtt) >= 0) {
1049 hcrx->ccid3hcrx_tstamp_last_ack = now; 1062 hcrx->ccid3hcrx_tstamp_last_ack = now;
1050 ccid3_hc_rx_send_feedback(sk); 1063 ccid3_hc_rx_send_feedback(sk);
1051 } 1064 }
@@ -1118,9 +1131,9 @@ static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info)
1118 1131
1119 BUG_ON(hcrx == NULL); 1132 BUG_ON(hcrx == NULL);
1120 1133
1121 info->tcpi_ca_state = hcrx->ccid3hcrx_state; 1134 info->tcpi_ca_state = hcrx->ccid3hcrx_state;
1122 info->tcpi_options |= TCPI_OPT_TIMESTAMPS; 1135 info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
1123 info->tcpi_rcv_rtt = hcrx->ccid3hcrx_rtt; 1136 info->tcpi_rcv_rtt = hcrx->ccid3hcrx_rtt;
1124} 1137}
1125 1138
1126static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) 1139static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info)
@@ -1212,7 +1225,7 @@ static struct ccid_operations ccid3 = {
1212 .ccid_hc_rx_getsockopt = ccid3_hc_rx_getsockopt, 1225 .ccid_hc_rx_getsockopt = ccid3_hc_rx_getsockopt,
1213 .ccid_hc_tx_getsockopt = ccid3_hc_tx_getsockopt, 1226 .ccid_hc_tx_getsockopt = ccid3_hc_tx_getsockopt,
1214}; 1227};
1215 1228
1216#ifdef CONFIG_IP_DCCP_CCID3_DEBUG 1229#ifdef CONFIG_IP_DCCP_CCID3_DEBUG
1217module_param(ccid3_debug, int, 0444); 1230module_param(ccid3_debug, int, 0444);
1218MODULE_PARM_DESC(ccid3_debug, "Enable debug messages"); 1231MODULE_PARM_DESC(ccid3_debug, "Enable debug messages");
@@ -1235,7 +1248,7 @@ static __init int ccid3_module_init(void)
1235 goto out_free_tx; 1248 goto out_free_tx;
1236 1249
1237 rc = ccid_register(&ccid3); 1250 rc = ccid_register(&ccid3);
1238 if (rc != 0) 1251 if (rc != 0)
1239 goto out_free_loss_interval_history; 1252 goto out_free_loss_interval_history;
1240out: 1253out:
1241 return rc; 1254 return rc;
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 3e3a9cc69b10..15776a88c090 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -77,7 +77,7 @@ struct ccid3_options_received {
77 77
78/* TFRC sender states */ 78/* TFRC sender states */
79enum ccid3_hc_tx_states { 79enum ccid3_hc_tx_states {
80 TFRC_SSTATE_NO_SENT = 1, 80 TFRC_SSTATE_NO_SENT = 1,
81 TFRC_SSTATE_NO_FBACK, 81 TFRC_SSTATE_NO_FBACK,
82 TFRC_SSTATE_FBACK, 82 TFRC_SSTATE_FBACK,
83 TFRC_SSTATE_TERM, 83 TFRC_SSTATE_TERM,
@@ -96,7 +96,7 @@ enum ccid3_hc_tx_states {
96 * @ccid3hctx_state - Sender state, one of %ccid3_hc_tx_states 96 * @ccid3hctx_state - Sender state, one of %ccid3_hc_tx_states
97 * @ccid3hctx_last_win_count - Last window counter sent 97 * @ccid3hctx_last_win_count - Last window counter sent
98 * @ccid3hctx_t_last_win_count - Timestamp of earliest packet 98 * @ccid3hctx_t_last_win_count - Timestamp of earliest packet
99 * with last_win_count value sent 99 * with last_win_count value sent
100 * @ccid3hctx_no_feedback_timer - Handle to no feedback timer 100 * @ccid3hctx_no_feedback_timer - Handle to no feedback timer
101 * @ccid3hctx_idle - Flag indicating that sender is idling 101 * @ccid3hctx_idle - Flag indicating that sender is idling
102 * @ccid3hctx_t_ld - Time last doubled during slow start 102 * @ccid3hctx_t_ld - Time last doubled during slow start
@@ -115,7 +115,7 @@ struct ccid3_hc_tx_sock {
115#define ccid3hctx_t_rto ccid3hctx_tfrc.tfrctx_rto 115#define ccid3hctx_t_rto ccid3hctx_tfrc.tfrctx_rto
116#define ccid3hctx_t_ipi ccid3hctx_tfrc.tfrctx_ipi 116#define ccid3hctx_t_ipi ccid3hctx_tfrc.tfrctx_ipi
117 u16 ccid3hctx_s; 117 u16 ccid3hctx_s;
118 enum ccid3_hc_tx_states ccid3hctx_state:8; 118 enum ccid3_hc_tx_states ccid3hctx_state:8;
119 u8 ccid3hctx_last_win_count; 119 u8 ccid3hctx_last_win_count;
120 u8 ccid3hctx_idle; 120 u8 ccid3hctx_idle;
121 struct timeval ccid3hctx_t_last_win_count; 121 struct timeval ccid3hctx_t_last_win_count;
@@ -129,7 +129,7 @@ struct ccid3_hc_tx_sock {
129 129
130/* TFRC receiver states */ 130/* TFRC receiver states */
131enum ccid3_hc_rx_states { 131enum ccid3_hc_rx_states {
132 TFRC_RSTATE_NO_DATA = 1, 132 TFRC_RSTATE_NO_DATA = 1,
133 TFRC_RSTATE_DATA, 133 TFRC_RSTATE_DATA,
134 TFRC_RSTATE_TERM = 127, 134 TFRC_RSTATE_TERM = 127,
135}; 135};
@@ -157,18 +157,18 @@ struct ccid3_hc_rx_sock {
157#define ccid3hcrx_x_recv ccid3hcrx_tfrc.tfrcrx_x_recv 157#define ccid3hcrx_x_recv ccid3hcrx_tfrc.tfrcrx_x_recv
158#define ccid3hcrx_rtt ccid3hcrx_tfrc.tfrcrx_rtt 158#define ccid3hcrx_rtt ccid3hcrx_tfrc.tfrcrx_rtt
159#define ccid3hcrx_p ccid3hcrx_tfrc.tfrcrx_p 159#define ccid3hcrx_p ccid3hcrx_tfrc.tfrcrx_p
160 u64 ccid3hcrx_seqno_nonloss:48, 160 u64 ccid3hcrx_seqno_nonloss:48,
161 ccid3hcrx_ccval_nonloss:4, 161 ccid3hcrx_ccval_nonloss:4,
162 ccid3hcrx_ccval_last_counter:4; 162 ccid3hcrx_ccval_last_counter:4;
163 enum ccid3_hc_rx_states ccid3hcrx_state:8; 163 enum ccid3_hc_rx_states ccid3hcrx_state:8;
164 u32 ccid3hcrx_bytes_recv; 164 u32 ccid3hcrx_bytes_recv;
165 struct timeval ccid3hcrx_tstamp_last_feedback; 165 struct timeval ccid3hcrx_tstamp_last_feedback;
166 struct timeval ccid3hcrx_tstamp_last_ack; 166 struct timeval ccid3hcrx_tstamp_last_ack;
167 struct list_head ccid3hcrx_hist; 167 struct list_head ccid3hcrx_hist;
168 struct list_head ccid3hcrx_li_hist; 168 struct list_head ccid3hcrx_li_hist;
169 u16 ccid3hcrx_s; 169 u16 ccid3hcrx_s;
170 u32 ccid3hcrx_pinv; 170 u32 ccid3hcrx_pinv;
171 u32 ccid3hcrx_elapsed_time; 171 u32 ccid3hcrx_elapsed_time;
172}; 172};
173 173
174static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) 174static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)
diff --git a/net/dccp/feat.c b/net/dccp/feat.c
index 4dc487f27a1f..95b6927ec653 100644
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -329,7 +329,7 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk,
329 switch (type) { 329 switch (type) {
330 case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break; 330 case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break;
331 case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break; 331 case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break;
332 default: DCCP_WARN("invalid type %d\n", type); return; 332 default: DCCP_WARN("invalid type %d\n", type); return;
333 333
334 } 334 }
335 opt->dccpop_feat = feature; 335 opt->dccpop_feat = feature;
@@ -427,7 +427,7 @@ int dccp_feat_confirm_recv(struct sock *sk, u8 type, u8 feature,
427 switch (type) { 427 switch (type) {
428 case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break; 428 case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break;
429 case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break; 429 case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break;
430 default: DCCP_WARN("invalid type %d\n", type); 430 default: DCCP_WARN("invalid type %d\n", type);
431 return 1; 431 return 1;
432 432
433 } 433 }
@@ -610,7 +610,7 @@ const char *dccp_feat_typename(const u8 type)
610 case DCCPO_CHANGE_R: return("ChangeR"); 610 case DCCPO_CHANGE_R: return("ChangeR");
611 case DCCPO_CONFIRM_R: return("ConfirmR"); 611 case DCCPO_CONFIRM_R: return("ConfirmR");
612 /* the following case must not appear in feature negotation */ 612 /* the following case must not appear in feature negotation */
613 default: dccp_pr_debug("unknown type %d [BUG!]\n", type); 613 default: dccp_pr_debug("unknown type %d [BUG!]\n", type);
614 } 614 }
615 return NULL; 615 return NULL;
616} 616}
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 4a3279cd684c..565bc80557ce 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/dccp/input.c 2 * net/dccp/input.c
3 * 3 *
4 * An implementation of the DCCP protocol 4 * An implementation of the DCCP protocol
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 * 6 *
@@ -82,7 +82,7 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
82 * Otherwise, 82 * Otherwise,
83 * Drop packet and return 83 * Drop packet and return
84 */ 84 */
85 if (dh->dccph_type == DCCP_PKT_SYNC || 85 if (dh->dccph_type == DCCP_PKT_SYNC ||
86 dh->dccph_type == DCCP_PKT_SYNCACK) { 86 dh->dccph_type == DCCP_PKT_SYNCACK) {
87 if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, 87 if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
88 dp->dccps_awl, dp->dccps_awh) && 88 dp->dccps_awl, dp->dccps_awh) &&
@@ -185,8 +185,8 @@ static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
185 dccp_rcv_close(sk, skb); 185 dccp_rcv_close(sk, skb);
186 return 0; 186 return 0;
187 case DCCP_PKT_REQUEST: 187 case DCCP_PKT_REQUEST:
188 /* Step 7 188 /* Step 7
189 * or (S.is_server and P.type == Response) 189 * or (S.is_server and P.type == Response)
190 * or (S.is_client and P.type == Request) 190 * or (S.is_client and P.type == Request)
191 * or (S.state >= OPEN and P.type == Request 191 * or (S.state >= OPEN and P.type == Request
192 * and P.seqno >= S.OSR) 192 * and P.seqno >= S.OSR)
@@ -274,7 +274,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
274 const struct dccp_hdr *dh, 274 const struct dccp_hdr *dh,
275 const unsigned len) 275 const unsigned len)
276{ 276{
277 /* 277 /*
278 * Step 4: Prepare sequence numbers in REQUEST 278 * Step 4: Prepare sequence numbers in REQUEST
279 * If S.state == REQUEST, 279 * If S.state == REQUEST,
280 * If (P.type == Response or P.type == Reset) 280 * If (P.type == Response or P.type == Reset)
@@ -342,7 +342,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
342 * from the Response * / 342 * from the Response * /
343 * S.state := PARTOPEN 343 * S.state := PARTOPEN
344 * Set PARTOPEN timer 344 * Set PARTOPEN timer
345 * Continue with S.state == PARTOPEN 345 * Continue with S.state == PARTOPEN
346 * / * Step 12 will send the Ack completing the 346 * / * Step 12 will send the Ack completing the
347 * three-way handshake * / 347 * three-way handshake * /
348 */ 348 */
@@ -373,7 +373,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
373 */ 373 */
374 __kfree_skb(skb); 374 __kfree_skb(skb);
375 return 0; 375 return 0;
376 } 376 }
377 dccp_send_ack(sk); 377 dccp_send_ack(sk);
378 return -1; 378 return -1;
379 } 379 }
@@ -381,7 +381,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
381out_invalid_packet: 381out_invalid_packet:
382 /* dccp_v4_do_rcv will send a reset */ 382 /* dccp_v4_do_rcv will send a reset */
383 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR; 383 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR;
384 return 1; 384 return 1;
385} 385}
386 386
387static int dccp_rcv_respond_partopen_state_process(struct sock *sk, 387static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
@@ -488,11 +488,11 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
488 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) 488 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
489 dccp_event_ack_recv(sk, skb); 489 dccp_event_ack_recv(sk, skb);
490 490
491 if (dccp_msk(sk)->dccpms_send_ack_vector && 491 if (dccp_msk(sk)->dccpms_send_ack_vector &&
492 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, 492 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
493 DCCP_SKB_CB(skb)->dccpd_seq, 493 DCCP_SKB_CB(skb)->dccpd_seq,
494 DCCP_ACKVEC_STATE_RECEIVED)) 494 DCCP_ACKVEC_STATE_RECEIVED))
495 goto discard; 495 goto discard;
496 496
497 /* XXX see the comments in dccp_rcv_established about this */ 497 /* XXX see the comments in dccp_rcv_established about this */
498 if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER) 498 if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER)
@@ -580,7 +580,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
580 } 580 }
581 } 581 }
582 582
583 if (!queued) { 583 if (!queued) {
584discard: 584discard:
585 __kfree_skb(skb); 585 __kfree_skb(skb);
586 } 586 }
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index ff81679c9f17..90c74b4adb73 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -157,7 +157,7 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
157 /* We don't check in the destentry if pmtu discovery is forbidden 157 /* We don't check in the destentry if pmtu discovery is forbidden
158 * on this route. We just assume that no packet_to_big packets 158 * on this route. We just assume that no packet_to_big packets
159 * are send back when pmtu discovery is not active. 159 * are send back when pmtu discovery is not active.
160 * There is a small race when the user changes this flag in the 160 * There is a small race when the user changes this flag in the
161 * route, but I think that's acceptable. 161 * route, but I think that's acceptable.
162 */ 162 */
163 if ((dst = __sk_dst_check(sk, 0)) == NULL) 163 if ((dst = __sk_dst_check(sk, 0)) == NULL)
@@ -467,7 +467,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
467 .uli_u = { .ports = 467 .uli_u = { .ports =
468 { .sport = dccp_hdr(skb)->dccph_dport, 468 { .sport = dccp_hdr(skb)->dccph_dport,
469 .dport = dccp_hdr(skb)->dccph_sport } 469 .dport = dccp_hdr(skb)->dccph_sport }
470 } 470 }
471 }; 471 };
472 472
473 security_skb_classify_flow(skb, &fl); 473 security_skb_classify_flow(skb, &fl);
@@ -595,7 +595,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
595 struct inet_request_sock *ireq; 595 struct inet_request_sock *ireq;
596 struct request_sock *req; 596 struct request_sock *req;
597 struct dccp_request_sock *dreq; 597 struct dccp_request_sock *dreq;
598 const __be32 service = dccp_hdr_request(skb)->dccph_req_service; 598 const __be32 service = dccp_hdr_request(skb)->dccph_req_service;
599 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); 599 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
600 __u8 reset_code = DCCP_RESET_CODE_TOO_BUSY; 600 __u8 reset_code = DCCP_RESET_CODE_TOO_BUSY;
601 601
@@ -609,7 +609,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
609 if (dccp_bad_service_code(sk, service)) { 609 if (dccp_bad_service_code(sk, service)) {
610 reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; 610 reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE;
611 goto drop; 611 goto drop;
612 } 612 }
613 /* 613 /*
614 * TW buckets are converted to open requests without 614 * TW buckets are converted to open requests without
615 * limitations, they conserve resources and peer is 615 * limitations, they conserve resources and peer is
@@ -644,7 +644,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
644 ireq->rmt_addr = skb->nh.iph->saddr; 644 ireq->rmt_addr = skb->nh.iph->saddr;
645 ireq->opt = NULL; 645 ireq->opt = NULL;
646 646
647 /* 647 /*
648 * Step 3: Process LISTEN state 648 * Step 3: Process LISTEN state
649 * 649 *
650 * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie 650 * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie
@@ -846,15 +846,15 @@ static int dccp_v4_rcv(struct sk_buff *skb)
846 } 846 }
847 847
848 /* Step 2: 848 /* Step 2:
849 * Look up flow ID in table and get corresponding socket */ 849 * Look up flow ID in table and get corresponding socket */
850 sk = __inet_lookup(&dccp_hashinfo, 850 sk = __inet_lookup(&dccp_hashinfo,
851 skb->nh.iph->saddr, dh->dccph_sport, 851 skb->nh.iph->saddr, dh->dccph_sport,
852 skb->nh.iph->daddr, dh->dccph_dport, 852 skb->nh.iph->daddr, dh->dccph_dport,
853 inet_iif(skb)); 853 inet_iif(skb));
854 854
855 /* 855 /*
856 * Step 2: 856 * Step 2:
857 * If no socket ... 857 * If no socket ...
858 */ 858 */
859 if (sk == NULL) { 859 if (sk == NULL) {
860 dccp_pr_debug("failed to look up flow ID in table and " 860 dccp_pr_debug("failed to look up flow ID in table and "
@@ -862,9 +862,9 @@ static int dccp_v4_rcv(struct sk_buff *skb)
862 goto no_dccp_socket; 862 goto no_dccp_socket;
863 } 863 }
864 864
865 /* 865 /*
866 * Step 2: 866 * Step 2:
867 * ... or S.state == TIMEWAIT, 867 * ... or S.state == TIMEWAIT,
868 * Generate Reset(No Connection) unless P.type == Reset 868 * Generate Reset(No Connection) unless P.type == Reset
869 * Drop packet and return 869 * Drop packet and return
870 */ 870 */
@@ -876,8 +876,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
876 876
877 /* 877 /*
878 * RFC 4340, sec. 9.2.1: Minimum Checksum Coverage 878 * RFC 4340, sec. 9.2.1: Minimum Checksum Coverage
879 * o if MinCsCov = 0, only packets with CsCov = 0 are accepted 879 * o if MinCsCov = 0, only packets with CsCov = 0 are accepted
880 * o if MinCsCov > 0, also accept packets with CsCov >= MinCsCov 880 * o if MinCsCov > 0, also accept packets with CsCov >= MinCsCov
881 */ 881 */
882 min_cov = dccp_sk(sk)->dccps_pcrlen; 882 min_cov = dccp_sk(sk)->dccps_pcrlen;
883 if (dh->dccph_cscov && (min_cov == 0 || dh->dccph_cscov < min_cov)) { 883 if (dh->dccph_cscov && (min_cov == 0 || dh->dccph_cscov < min_cov)) {
@@ -900,7 +900,7 @@ no_dccp_socket:
900 goto discard_it; 900 goto discard_it;
901 /* 901 /*
902 * Step 2: 902 * Step 2:
903 * If no socket ... 903 * If no socket ...
904 * Generate Reset(No Connection) unless P.type == Reset 904 * Generate Reset(No Connection) unless P.type == Reset
905 * Drop packet and return 905 * Drop packet and return
906 */ 906 */
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index c7aaa2574f52..6b91a9dd0411 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -77,7 +77,7 @@ static inline void dccp_v6_send_check(struct sock *sk, int unused_value,
77} 77}
78 78
79static inline __u32 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr, 79static inline __u32 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
80 __be16 sport, __be16 dport ) 80 __be16 sport, __be16 dport )
81{ 81{
82 return secure_tcpv6_sequence_number(saddr, daddr, sport, dport); 82 return secure_tcpv6_sequence_number(saddr, daddr, sport, dport);
83} 83}
@@ -329,7 +329,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
329 skb = alloc_skb(dccp_v6_ctl_socket->sk->sk_prot->max_header, 329 skb = alloc_skb(dccp_v6_ctl_socket->sk->sk_prot->max_header,
330 GFP_ATOMIC); 330 GFP_ATOMIC);
331 if (skb == NULL) 331 if (skb == NULL)
332 return; 332 return;
333 333
334 skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header); 334 skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header);
335 335
@@ -353,7 +353,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
353 353
354 dccp_csum_outgoing(skb); 354 dccp_csum_outgoing(skb);
355 dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxskb->nh.ipv6h->saddr, 355 dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxskb->nh.ipv6h->saddr,
356 &rxskb->nh.ipv6h->daddr); 356 &rxskb->nh.ipv6h->daddr);
357 357
358 memset(&fl, 0, sizeof(fl)); 358 memset(&fl, 0, sizeof(fl));
359 ipv6_addr_copy(&fl.fl6_dst, &rxskb->nh.ipv6h->saddr); 359 ipv6_addr_copy(&fl.fl6_dst, &rxskb->nh.ipv6h->saddr);
@@ -424,7 +424,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
424 struct dccp_request_sock *dreq; 424 struct dccp_request_sock *dreq;
425 struct inet6_request_sock *ireq6; 425 struct inet6_request_sock *ireq6;
426 struct ipv6_pinfo *np = inet6_sk(sk); 426 struct ipv6_pinfo *np = inet6_sk(sk);
427 const __be32 service = dccp_hdr_request(skb)->dccph_req_service; 427 const __be32 service = dccp_hdr_request(skb)->dccph_req_service;
428 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); 428 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
429 __u8 reset_code = DCCP_RESET_CODE_TOO_BUSY; 429 __u8 reset_code = DCCP_RESET_CODE_TOO_BUSY;
430 430
@@ -437,7 +437,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
437 if (dccp_bad_service_code(sk, service)) { 437 if (dccp_bad_service_code(sk, service)) {
438 reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; 438 reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE;
439 goto drop; 439 goto drop;
440 } 440 }
441 /* 441 /*
442 * There are no SYN attacks on IPv6, yet... 442 * There are no SYN attacks on IPv6, yet...
443 */ 443 */
@@ -787,7 +787,7 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
787 * otherwise we just shortcircuit this and continue with 787 * otherwise we just shortcircuit this and continue with
788 * the new socket.. 788 * the new socket..
789 */ 789 */
790 if (nsk != sk) { 790 if (nsk != sk) {
791 if (dccp_child_process(sk, nsk, skb)) 791 if (dccp_child_process(sk, nsk, skb))
792 goto reset; 792 goto reset;
793 if (opt_skb != NULL) 793 if (opt_skb != NULL)
@@ -843,14 +843,14 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
843 DCCP_SKB_CB(skb)->dccpd_ack_seq = dccp_hdr_ack_seq(skb); 843 DCCP_SKB_CB(skb)->dccpd_ack_seq = dccp_hdr_ack_seq(skb);
844 844
845 /* Step 2: 845 /* Step 2:
846 * Look up flow ID in table and get corresponding socket */ 846 * Look up flow ID in table and get corresponding socket */
847 sk = __inet6_lookup(&dccp_hashinfo, &skb->nh.ipv6h->saddr, 847 sk = __inet6_lookup(&dccp_hashinfo, &skb->nh.ipv6h->saddr,
848 dh->dccph_sport, 848 dh->dccph_sport,
849 &skb->nh.ipv6h->daddr, ntohs(dh->dccph_dport), 849 &skb->nh.ipv6h->daddr, ntohs(dh->dccph_dport),
850 inet6_iif(skb)); 850 inet6_iif(skb));
851 /* 851 /*
852 * Step 2: 852 * Step 2:
853 * If no socket ... 853 * If no socket ...
854 */ 854 */
855 if (sk == NULL) { 855 if (sk == NULL) {
856 dccp_pr_debug("failed to look up flow ID in table and " 856 dccp_pr_debug("failed to look up flow ID in table and "
@@ -860,7 +860,7 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
860 860
861 /* 861 /*
862 * Step 2: 862 * Step 2:
863 * ... or S.state == TIMEWAIT, 863 * ... or S.state == TIMEWAIT,
864 * Generate Reset(No Connection) unless P.type == Reset 864 * Generate Reset(No Connection) unless P.type == Reset
865 * Drop packet and return 865 * Drop packet and return
866 */ 866 */
@@ -872,8 +872,8 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
872 872
873 /* 873 /*
874 * RFC 4340, sec. 9.2.1: Minimum Checksum Coverage 874 * RFC 4340, sec. 9.2.1: Minimum Checksum Coverage
875 * o if MinCsCov = 0, only packets with CsCov = 0 are accepted 875 * o if MinCsCov = 0, only packets with CsCov = 0 are accepted
876 * o if MinCsCov > 0, also accept packets with CsCov >= MinCsCov 876 * o if MinCsCov > 0, also accept packets with CsCov >= MinCsCov
877 */ 877 */
878 min_cov = dccp_sk(sk)->dccps_pcrlen; 878 min_cov = dccp_sk(sk)->dccps_pcrlen;
879 if (dh->dccph_cscov && (min_cov == 0 || dh->dccph_cscov < min_cov)) { 879 if (dh->dccph_cscov && (min_cov == 0 || dh->dccph_cscov < min_cov)) {
@@ -893,7 +893,7 @@ no_dccp_socket:
893 goto discard_it; 893 goto discard_it;
894 /* 894 /*
895 * Step 2: 895 * Step 2:
896 * If no socket ... 896 * If no socket ...
897 * Generate Reset(No Connection) unless P.type == Reset 897 * Generate Reset(No Connection) unless P.type == Reset
898 * Drop packet and return 898 * Drop packet and return
899 */ 899 */
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 4c9e26775f72..6656bb497c7b 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -182,7 +182,7 @@ out_free:
182 182
183EXPORT_SYMBOL_GPL(dccp_create_openreq_child); 183EXPORT_SYMBOL_GPL(dccp_create_openreq_child);
184 184
185/* 185/*
186 * Process an incoming packet for RESPOND sockets represented 186 * Process an incoming packet for RESPOND sockets represented
187 * as an request_sock. 187 * as an request_sock.
188 */ 188 */
diff --git a/net/dccp/output.c b/net/dccp/output.c
index b4df12b24161..824569659083 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/dccp/output.c 2 * net/dccp/output.c
3 * 3 *
4 * An implementation of the DCCP protocol 4 * An implementation of the DCCP protocol
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 * 6 *
@@ -338,7 +338,6 @@ EXPORT_SYMBOL_GPL(dccp_make_response);
338 338
339static struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, 339static struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst,
340 const enum dccp_reset_codes code) 340 const enum dccp_reset_codes code)
341
342{ 341{
343 struct dccp_hdr *dh; 342 struct dccp_hdr *dh;
344 struct dccp_sock *dp = dccp_sk(sk); 343 struct dccp_sock *dp = dccp_sk(sk);
@@ -419,14 +418,14 @@ static inline void dccp_connect_init(struct sock *sk)
419 418
420 dccp_sync_mss(sk, dst_mtu(dst)); 419 dccp_sync_mss(sk, dst_mtu(dst));
421 420
422 /* 421 /*
423 * SWL and AWL are initially adjusted so that they are not less than 422 * SWL and AWL are initially adjusted so that they are not less than
424 * the initial Sequence Numbers received and sent, respectively: 423 * the initial Sequence Numbers received and sent, respectively:
425 * SWL := max(GSR + 1 - floor(W/4), ISR), 424 * SWL := max(GSR + 1 - floor(W/4), ISR),
426 * AWL := max(GSS - W' + 1, ISS). 425 * AWL := max(GSS - W' + 1, ISS).
427 * These adjustments MUST be applied only at the beginning of the 426 * These adjustments MUST be applied only at the beginning of the
428 * connection. 427 * connection.
429 */ 428 */
430 dccp_update_gss(sk, dp->dccps_iss); 429 dccp_update_gss(sk, dp->dccps_iss);
431 dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss)); 430 dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss));
432 431
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 5ec47d9ee447..63b3fa20e14b 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -196,7 +196,7 @@ int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
196 sk, GFP_KERNEL); 196 sk, GFP_KERNEL);
197 dp->dccps_hc_tx_ccid = ccid_hc_tx_new(dmsk->dccpms_tx_ccid, 197 dp->dccps_hc_tx_ccid = ccid_hc_tx_new(dmsk->dccpms_tx_ccid,
198 sk, GFP_KERNEL); 198 sk, GFP_KERNEL);
199 if (unlikely(dp->dccps_hc_rx_ccid == NULL || 199 if (unlikely(dp->dccps_hc_rx_ccid == NULL ||
200 dp->dccps_hc_tx_ccid == NULL)) { 200 dp->dccps_hc_tx_ccid == NULL)) {
201 ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); 201 ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
202 ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk); 202 ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
@@ -390,7 +390,7 @@ static int dccp_setsockopt_service(struct sock *sk, const __be32 service,
390 struct dccp_sock *dp = dccp_sk(sk); 390 struct dccp_sock *dp = dccp_sk(sk);
391 struct dccp_service_list *sl = NULL; 391 struct dccp_service_list *sl = NULL;
392 392
393 if (service == DCCP_SERVICE_INVALID_VALUE || 393 if (service == DCCP_SERVICE_INVALID_VALUE ||
394 optlen > DCCP_SERVICE_LIST_MAX_LEN * sizeof(u32)) 394 optlen > DCCP_SERVICE_LIST_MAX_LEN * sizeof(u32))
395 return -EINVAL; 395 return -EINVAL;
396 396
@@ -830,7 +830,7 @@ EXPORT_SYMBOL_GPL(inet_dccp_listen);
830static const unsigned char dccp_new_state[] = { 830static const unsigned char dccp_new_state[] = {
831 /* current state: new state: action: */ 831 /* current state: new state: action: */
832 [0] = DCCP_CLOSED, 832 [0] = DCCP_CLOSED,
833 [DCCP_OPEN] = DCCP_CLOSING | DCCP_ACTION_FIN, 833 [DCCP_OPEN] = DCCP_CLOSING | DCCP_ACTION_FIN,
834 [DCCP_REQUESTING] = DCCP_CLOSED, 834 [DCCP_REQUESTING] = DCCP_CLOSED,
835 [DCCP_PARTOPEN] = DCCP_CLOSING | DCCP_ACTION_FIN, 835 [DCCP_PARTOPEN] = DCCP_CLOSING | DCCP_ACTION_FIN,
836 [DCCP_LISTEN] = DCCP_CLOSED, 836 [DCCP_LISTEN] = DCCP_CLOSED,
diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index e8f519e7f481..e5348f369c60 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/dccp/timer.c 2 * net/dccp/timer.c
3 * 3 *
4 * An implementation of the DCCP protocol 4 * An implementation of the DCCP protocol
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 * 6 *
@@ -102,13 +102,13 @@ static void dccp_retransmit_timer(struct sock *sk)
102 * sk->sk_send_head has to have one skb with 102 * sk->sk_send_head has to have one skb with
103 * DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP 103 * DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP
104 * packet types. The only packets eligible for retransmission are: 104 * packet types. The only packets eligible for retransmission are:
105 * -- Requests in client-REQUEST state (sec. 8.1.1) 105 * -- Requests in client-REQUEST state (sec. 8.1.1)
106 * -- Acks in client-PARTOPEN state (sec. 8.1.5) 106 * -- Acks in client-PARTOPEN state (sec. 8.1.5)
107 * -- CloseReq in server-CLOSEREQ state (sec. 8.3) 107 * -- CloseReq in server-CLOSEREQ state (sec. 8.3)
108 * -- Close in node-CLOSING state (sec. 8.3) */ 108 * -- Close in node-CLOSING state (sec. 8.3) */
109 BUG_TRAP(sk->sk_send_head != NULL); 109 BUG_TRAP(sk->sk_send_head != NULL);
110 110
111 /* 111 /*
112 * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was 112 * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was
113 * sent, no need to retransmit, this sock is dead. 113 * sent, no need to retransmit, this sock is dead.
114 */ 114 */
@@ -200,7 +200,7 @@ static void dccp_keepalive_timer(unsigned long data)
200 /* Only process if socket is not in use. */ 200 /* Only process if socket is not in use. */
201 bh_lock_sock(sk); 201 bh_lock_sock(sk);
202 if (sock_owned_by_user(sk)) { 202 if (sock_owned_by_user(sk)) {
203 /* Try again later. */ 203 /* Try again later. */
204 inet_csk_reset_keepalive_timer(sk, HZ / 20); 204 inet_csk_reset_keepalive_timer(sk, HZ / 20);
205 goto out; 205 goto out;
206 } 206 }