aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid3.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids/ccid3.c')
-rw-r--r--net/dccp/ccids/ccid3.c111
1 files changed, 62 insertions, 49 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 5e817e2f1eb..fa6b75372ed 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;