diff options
-rw-r--r-- | net/dccp/ccids/ccid3.c | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index ef68c35183ed..d23af7b475a0 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -201,18 +201,17 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
201 | goto restart_timer; | 201 | goto restart_timer; |
202 | } | 202 | } |
203 | 203 | ||
204 | ccid3_pr_debug("%s, sk=%p, state=%s\n", dccp_role(sk), sk, | 204 | ccid3_pr_debug("%s(%p, state=%s) - entry \n", dccp_role(sk), sk, |
205 | ccid3_tx_state_name(hctx->ccid3hctx_state)); | 205 | ccid3_tx_state_name(hctx->ccid3hctx_state)); |
206 | 206 | ||
207 | switch (hctx->ccid3hctx_state) { | 207 | switch (hctx->ccid3hctx_state) { |
208 | case TFRC_SSTATE_NO_FBACK: | 208 | case TFRC_SSTATE_NO_FBACK: |
209 | /* RFC 3448, 4.4: Halve send rate directly */ | 209 | /* RFC 3448, 4.4: Halve send rate directly */ |
210 | hctx->ccid3hctx_x = max_t(u32, hctx->ccid3hctx_x / 2, | 210 | hctx->ccid3hctx_x = max_t(u32, hctx->ccid3hctx_x / 2, |
211 | (hctx->ccid3hctx_s << 6)/TFRC_T_MBI); | 211 | (hctx->ccid3hctx_s << 6)/TFRC_T_MBI); |
212 | 212 | ||
213 | ccid3_pr_debug("%s, sk=%p, state=%s, updated tx rate to %u " | 213 | ccid3_pr_debug("%s(%p, state=%s), updated tx rate to %u " |
214 | "bytes/s\n", | 214 | "bytes/s\n", dccp_role(sk), sk, |
215 | dccp_role(sk), sk, | ||
216 | ccid3_tx_state_name(hctx->ccid3hctx_state), | 215 | ccid3_tx_state_name(hctx->ccid3hctx_state), |
217 | (unsigned)(hctx->ccid3hctx_x >> 6)); | 216 | (unsigned)(hctx->ccid3hctx_x >> 6)); |
218 | /* The value of R is still undefined and so we can not recompute | 217 | /* The value of R is still undefined and so we can not recompute |
@@ -230,7 +229,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
230 | scaled_div(hctx->ccid3hctx_s << 6, hctx->ccid3hctx_rtt))) { | 229 | scaled_div(hctx->ccid3hctx_s << 6, hctx->ccid3hctx_rtt))) { |
231 | struct timeval now; | 230 | struct timeval now; |
232 | 231 | ||
233 | ccid3_pr_debug("%s, sk=%p, state=%s, not idle\n", | 232 | ccid3_pr_debug("%s(%p, state=%s), not idle\n", |
234 | dccp_role(sk), sk, | 233 | dccp_role(sk), sk, |
235 | ccid3_tx_state_name(hctx->ccid3hctx_state)); | 234 | ccid3_tx_state_name(hctx->ccid3hctx_state)); |
236 | 235 | ||
@@ -270,7 +269,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
270 | t_nfb = max(hctx->ccid3hctx_t_rto, 2 * hctx->ccid3hctx_t_ipi); | 269 | t_nfb = max(hctx->ccid3hctx_t_rto, 2 * hctx->ccid3hctx_t_ipi); |
271 | break; | 270 | break; |
272 | case TFRC_SSTATE_NO_SENT: | 271 | case TFRC_SSTATE_NO_SENT: |
273 | DCCP_BUG("Illegal %s state NO_SENT, sk=%p", dccp_role(sk), sk); | 272 | DCCP_BUG("%s(%p) - Illegal state NO_SENT", dccp_role(sk), sk); |
274 | /* fall through */ | 273 | /* fall through */ |
275 | case TFRC_SSTATE_TERM: | 274 | case TFRC_SSTATE_TERM: |
276 | goto out; | 275 | goto out; |
@@ -348,7 +347,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) | |||
348 | ccid3_hc_tx_update_win_count(hctx, &now); | 347 | ccid3_hc_tx_update_win_count(hctx, &now); |
349 | break; | 348 | break; |
350 | case TFRC_SSTATE_TERM: | 349 | case TFRC_SSTATE_TERM: |
351 | DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk); | 350 | DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk); |
352 | return -EINVAL; | 351 | return -EINVAL; |
353 | } | 352 | } |
354 | 353 | ||
@@ -521,13 +520,12 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
521 | * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi) | 520 | * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi) |
522 | */ | 521 | */ |
523 | t_nfb = max(hctx->ccid3hctx_t_rto, 2 * hctx->ccid3hctx_t_ipi); | 522 | t_nfb = max(hctx->ccid3hctx_t_rto, 2 * hctx->ccid3hctx_t_ipi); |
524 | |||
525 | ccid3_pr_debug("%s, sk=%p, Scheduled no feedback timer to " | ||
526 | "expire in %lu jiffies (%luus)\n", | ||
527 | dccp_role(sk), sk, | ||
528 | usecs_to_jiffies(t_nfb), t_nfb); | ||
529 | 523 | ||
530 | sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, | 524 | ccid3_pr_debug("%s(%p), Scheduled no feedback timer to " |
525 | "expire in %lu jiffies (%luus)\n", dccp_role(sk), | ||
526 | sk, usecs_to_jiffies(t_nfb), t_nfb); | ||
527 | |||
528 | sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, | ||
531 | jiffies + usecs_to_jiffies(t_nfb)); | 529 | jiffies + usecs_to_jiffies(t_nfb)); |
532 | 530 | ||
533 | /* set idle flag */ | 531 | /* set idle flag */ |
@@ -566,13 +564,13 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option, | |||
566 | switch (option) { | 564 | switch (option) { |
567 | case TFRC_OPT_LOSS_EVENT_RATE: | 565 | case TFRC_OPT_LOSS_EVENT_RATE: |
568 | if (unlikely(len != 4)) { | 566 | if (unlikely(len != 4)) { |
569 | DCCP_WARN("%s, sk=%p, invalid len %d " | 567 | DCCP_WARN("%s(%p), invalid len %d " |
570 | "for TFRC_OPT_LOSS_EVENT_RATE\n", | 568 | "for TFRC_OPT_LOSS_EVENT_RATE\n", |
571 | dccp_role(sk), sk, len); | 569 | dccp_role(sk), sk, len); |
572 | rc = -EINVAL; | 570 | rc = -EINVAL; |
573 | } else { | 571 | } else { |
574 | opt_recv->ccid3or_loss_event_rate = ntohl(*(__be32 *)value); | 572 | opt_recv->ccid3or_loss_event_rate = ntohl(*(__be32 *)value); |
575 | ccid3_pr_debug("%s, sk=%p, LOSS_EVENT_RATE=%u\n", | 573 | ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n", |
576 | dccp_role(sk), sk, | 574 | dccp_role(sk), sk, |
577 | opt_recv->ccid3or_loss_event_rate); | 575 | opt_recv->ccid3or_loss_event_rate); |
578 | } | 576 | } |
@@ -580,20 +578,20 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option, | |||
580 | case TFRC_OPT_LOSS_INTERVALS: | 578 | case TFRC_OPT_LOSS_INTERVALS: |
581 | opt_recv->ccid3or_loss_intervals_idx = idx; | 579 | opt_recv->ccid3or_loss_intervals_idx = idx; |
582 | opt_recv->ccid3or_loss_intervals_len = len; | 580 | opt_recv->ccid3or_loss_intervals_len = len; |
583 | ccid3_pr_debug("%s, sk=%p, LOSS_INTERVALS=(%u, %u)\n", | 581 | ccid3_pr_debug("%s(%p), LOSS_INTERVALS=(%u, %u)\n", |
584 | dccp_role(sk), sk, | 582 | dccp_role(sk), sk, |
585 | opt_recv->ccid3or_loss_intervals_idx, | 583 | opt_recv->ccid3or_loss_intervals_idx, |
586 | opt_recv->ccid3or_loss_intervals_len); | 584 | opt_recv->ccid3or_loss_intervals_len); |
587 | break; | 585 | break; |
588 | case TFRC_OPT_RECEIVE_RATE: | 586 | case TFRC_OPT_RECEIVE_RATE: |
589 | if (unlikely(len != 4)) { | 587 | if (unlikely(len != 4)) { |
590 | DCCP_WARN("%s, sk=%p, invalid len %d " | 588 | DCCP_WARN("%s(%p), invalid len %d " |
591 | "for TFRC_OPT_RECEIVE_RATE\n", | 589 | "for TFRC_OPT_RECEIVE_RATE\n", |
592 | dccp_role(sk), sk, len); | 590 | dccp_role(sk), sk, len); |
593 | rc = -EINVAL; | 591 | rc = -EINVAL; |
594 | } else { | 592 | } else { |
595 | opt_recv->ccid3or_receive_rate = ntohl(*(__be32 *)value); | 593 | opt_recv->ccid3or_receive_rate = ntohl(*(__be32 *)value); |
596 | ccid3_pr_debug("%s, sk=%p, RECEIVE_RATE=%u\n", | 594 | ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n", |
597 | dccp_role(sk), sk, | 595 | dccp_role(sk), sk, |
598 | opt_recv->ccid3or_receive_rate); | 596 | opt_recv->ccid3or_receive_rate); |
599 | } | 597 | } |
@@ -679,7 +677,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk) | |||
679 | struct timeval now; | 677 | struct timeval now; |
680 | suseconds_t delta; | 678 | suseconds_t delta; |
681 | 679 | ||
682 | ccid3_pr_debug("%s, sk=%p\n", dccp_role(sk), sk); | 680 | ccid3_pr_debug("%s(%p) - entry \n", dccp_role(sk), sk); |
683 | 681 | ||
684 | dccp_timestamp(sk, &now); | 682 | dccp_timestamp(sk, &now); |
685 | 683 | ||
@@ -695,13 +693,13 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk) | |||
695 | scaled_div32(hcrx->ccid3hcrx_bytes_recv, delta); | 693 | scaled_div32(hcrx->ccid3hcrx_bytes_recv, delta); |
696 | break; | 694 | break; |
697 | case TFRC_RSTATE_TERM: | 695 | case TFRC_RSTATE_TERM: |
698 | DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk); | 696 | DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk); |
699 | return; | 697 | return; |
700 | } | 698 | } |
701 | 699 | ||
702 | packet = dccp_rx_hist_find_data_packet(&hcrx->ccid3hcrx_hist); | 700 | packet = dccp_rx_hist_find_data_packet(&hcrx->ccid3hcrx_hist); |
703 | if (unlikely(packet == NULL)) { | 701 | if (unlikely(packet == NULL)) { |
704 | DCCP_WARN("%s, sk=%p, no data packet in history!\n", | 702 | DCCP_WARN("%s(%p), no data packet in history!\n", |
705 | dccp_role(sk), sk); | 703 | dccp_role(sk), sk); |
706 | return; | 704 | return; |
707 | } | 705 | } |
@@ -797,13 +795,13 @@ static u32 ccid3_hc_rx_calc_first_li(struct sock *sk) | |||
797 | } | 795 | } |
798 | 796 | ||
799 | if (unlikely(step == 0)) { | 797 | if (unlikely(step == 0)) { |
800 | DCCP_WARN("%s, sk=%p, packet history has no data packets!\n", | 798 | DCCP_WARN("%s(%p), packet history has no data packets!\n", |
801 | dccp_role(sk), sk); | 799 | dccp_role(sk), sk); |
802 | return ~0; | 800 | return ~0; |
803 | } | 801 | } |
804 | 802 | ||
805 | if (unlikely(interval == 0)) { | 803 | if (unlikely(interval == 0)) { |
806 | DCCP_WARN("%s, sk=%p, Could not find a win_count interval > 0." | 804 | DCCP_WARN("%s(%p), Could not find a win_count interval > 0." |
807 | "Defaulting to 1\n", dccp_role(sk), sk); | 805 | "Defaulting to 1\n", dccp_role(sk), sk); |
808 | interval = 1; | 806 | interval = 1; |
809 | } | 807 | } |
@@ -817,7 +815,7 @@ found: | |||
817 | DCCP_BUG_ON(delta < 0); | 815 | DCCP_BUG_ON(delta < 0); |
818 | 816 | ||
819 | rtt = delta * 4 / interval; | 817 | rtt = delta * 4 / interval; |
820 | ccid3_pr_debug("%s, sk=%p, approximated RTT to %ldus\n", | 818 | ccid3_pr_debug("%s(%p), approximated RTT to %ldus\n", |
821 | dccp_role(sk), sk, rtt); | 819 | dccp_role(sk), sk, rtt); |
822 | 820 | ||
823 | /* | 821 | /* |
@@ -850,7 +848,7 @@ found: | |||
850 | fval = scaled_div32(fval, x_recv); | 848 | fval = scaled_div32(fval, x_recv); |
851 | p = tfrc_calc_x_reverse_lookup(fval); | 849 | p = tfrc_calc_x_reverse_lookup(fval); |
852 | 850 | ||
853 | ccid3_pr_debug("%s, sk=%p, receive rate=%u bytes/s, implied " | 851 | ccid3_pr_debug("%s(%p), receive rate=%u bytes/s, implied " |
854 | "loss rate=%u\n", dccp_role(sk), sk, x_recv, p); | 852 | "loss rate=%u\n", dccp_role(sk), sk, x_recv, p); |
855 | 853 | ||
856 | if (p == 0) | 854 | if (p == 0) |
@@ -1000,8 +998,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1000 | r_sample / 10; | 998 | r_sample / 10; |
1001 | 999 | ||
1002 | if (rtt_prev != hcrx->ccid3hcrx_rtt) | 1000 | if (rtt_prev != hcrx->ccid3hcrx_rtt) |
1003 | ccid3_pr_debug("%s, New RTT=%uus, elapsed time=%u\n", | 1001 | ccid3_pr_debug("%s(%p), New RTT=%uus, elapsed time=%u\n", |
1004 | dccp_role(sk), hcrx->ccid3hcrx_rtt, | 1002 | dccp_role(sk), sk, hcrx->ccid3hcrx_rtt, |
1005 | opt_recv->dccpor_elapsed_time); | 1003 | opt_recv->dccpor_elapsed_time); |
1006 | break; | 1004 | break; |
1007 | case DCCP_PKT_DATA: | 1005 | case DCCP_PKT_DATA: |
@@ -1013,7 +1011,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1013 | packet = dccp_rx_hist_entry_new(ccid3_rx_hist, sk, opt_recv->dccpor_ndp, | 1011 | packet = dccp_rx_hist_entry_new(ccid3_rx_hist, sk, opt_recv->dccpor_ndp, |
1014 | skb, GFP_ATOMIC); | 1012 | skb, GFP_ATOMIC); |
1015 | if (unlikely(packet == NULL)) { | 1013 | if (unlikely(packet == NULL)) { |
1016 | DCCP_WARN("%s, sk=%p, Not enough mem to add rx packet " | 1014 | DCCP_WARN("%s(%p), Not enough mem to add rx packet " |
1017 | "to history, consider it lost!\n", dccp_role(sk), sk); | 1015 | "to history, consider it lost!\n", dccp_role(sk), sk); |
1018 | return; | 1016 | return; |
1019 | } | 1017 | } |
@@ -1028,9 +1026,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1028 | 1026 | ||
1029 | switch (hcrx->ccid3hcrx_state) { | 1027 | switch (hcrx->ccid3hcrx_state) { |
1030 | case TFRC_RSTATE_NO_DATA: | 1028 | case TFRC_RSTATE_NO_DATA: |
1031 | ccid3_pr_debug("%s, sk=%p(%s), skb=%p, sending initial " | 1029 | ccid3_pr_debug("%s(%p, state=%s), skb=%p, sending initial " |
1032 | "feedback\n", | 1030 | "feedback\n", dccp_role(sk), sk, |
1033 | dccp_role(sk), sk, | ||
1034 | dccp_state_name(sk->sk_state), skb); | 1031 | dccp_state_name(sk->sk_state), skb); |
1035 | ccid3_hc_rx_send_feedback(sk); | 1032 | ccid3_hc_rx_send_feedback(sk); |
1036 | ccid3_hc_rx_set_state(sk, TFRC_RSTATE_DATA); | 1033 | ccid3_hc_rx_set_state(sk, TFRC_RSTATE_DATA); |
@@ -1048,12 +1045,12 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1048 | } | 1045 | } |
1049 | return; | 1046 | return; |
1050 | case TFRC_RSTATE_TERM: | 1047 | case TFRC_RSTATE_TERM: |
1051 | DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk); | 1048 | DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk); |
1052 | return; | 1049 | return; |
1053 | } | 1050 | } |
1054 | 1051 | ||
1055 | /* Dealing with packet loss */ | 1052 | /* Dealing with packet loss */ |
1056 | ccid3_pr_debug("%s, sk=%p(%s), data loss! Reacting...\n", | 1053 | ccid3_pr_debug("%s(%p, state=%s), data loss! Reacting...\n", |
1057 | dccp_role(sk), sk, dccp_state_name(sk->sk_state)); | 1054 | dccp_role(sk), sk, dccp_state_name(sk->sk_state)); |
1058 | 1055 | ||
1059 | p_prev = hcrx->ccid3hcrx_p; | 1056 | p_prev = hcrx->ccid3hcrx_p; |
@@ -1078,7 +1075,7 @@ static int ccid3_hc_rx_init(struct ccid *ccid, struct sock *sk) | |||
1078 | { | 1075 | { |
1079 | struct ccid3_hc_rx_sock *hcrx = ccid_priv(ccid); | 1076 | struct ccid3_hc_rx_sock *hcrx = ccid_priv(ccid); |
1080 | 1077 | ||
1081 | ccid3_pr_debug("%s, sk=%p\n", dccp_role(sk), sk); | 1078 | ccid3_pr_debug("entry\n"); |
1082 | 1079 | ||
1083 | hcrx->ccid3hcrx_state = TFRC_RSTATE_NO_DATA; | 1080 | hcrx->ccid3hcrx_state = TFRC_RSTATE_NO_DATA; |
1084 | INIT_LIST_HEAD(&hcrx->ccid3hcrx_hist); | 1081 | INIT_LIST_HEAD(&hcrx->ccid3hcrx_hist); |