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.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 1a0c5edb7b35..3524328db0b9 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -414,7 +414,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
414 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 414 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
415 struct ccid3_options_received *opt_recv; 415 struct ccid3_options_received *opt_recv;
416 struct dccp_tx_hist_entry *packet; 416 struct dccp_tx_hist_entry *packet;
417 struct timeval now; 417 ktime_t now, t_hist;
418 unsigned long t_nfb; 418 unsigned long t_nfb;
419 u32 pinv, r_sample; 419 u32 pinv, r_sample;
420 420
@@ -452,13 +452,13 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
452 else /* can not exceed 100% */ 452 else /* can not exceed 100% */
453 hctx->ccid3hctx_p = 1000000 / pinv; 453 hctx->ccid3hctx_p = 1000000 / pinv;
454 454
455 dccp_timestamp(sk, &now); 455 now = ktime_get_real();
456 456 t_hist = timeval_to_ktime(packet->dccphtx_tstamp);
457 /* 457 /*
458 * Calculate new round trip sample as per [RFC 3448, 4.3] by 458 * Calculate new round trip sample as per [RFC 3448, 4.3] by
459 * R_sample = (now - t_recvdata) - t_elapsed 459 * R_sample = (now - t_recvdata) - t_elapsed
460 */ 460 */
461 r_sample = dccp_sample_rtt(sk, &now, &packet->dccphtx_tstamp); 461 r_sample = dccp_sample_rtt(sk, now, &t_hist);
462 462
463 /* 463 /*
464 * Update RTT estimate by 464 * Update RTT estimate by
@@ -475,7 +475,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
475 */ 475 */
476 hctx->ccid3hctx_rtt = r_sample; 476 hctx->ccid3hctx_rtt = r_sample;
477 hctx->ccid3hctx_x = rfc3390_initial_rate(sk); 477 hctx->ccid3hctx_x = rfc3390_initial_rate(sk);
478 hctx->ccid3hctx_t_ld = timeval_to_ktime(now); 478 hctx->ccid3hctx_t_ld = now;
479 479
480 ccid3_update_send_interval(hctx); 480 ccid3_update_send_interval(hctx);
481 481
@@ -882,6 +882,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
882 struct dccp_rx_hist_entry *packet; 882 struct dccp_rx_hist_entry *packet;
883 u32 p_prev, r_sample, rtt_prev; 883 u32 p_prev, r_sample, rtt_prev;
884 int loss, payload_size; 884 int loss, payload_size;
885 ktime_t now;
885 886
886 BUG_ON(hcrx == NULL); 887 BUG_ON(hcrx == NULL);
887 888
@@ -891,14 +892,12 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
891 case DCCP_PKT_ACK: 892 case DCCP_PKT_ACK:
892 if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA) 893 if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)
893 return; 894 return;
894 case DCCP_PKT_DATAACK: { 895 case DCCP_PKT_DATAACK:
895 struct timeval now;
896
897 if (opt_recv->dccpor_timestamp_echo == 0) 896 if (opt_recv->dccpor_timestamp_echo == 0)
898 break; 897 break;
899 rtt_prev = hcrx->ccid3hcrx_rtt; 898 rtt_prev = hcrx->ccid3hcrx_rtt;
900 dccp_timestamp(sk, &now); 899 now = ktime_get_real();
901 r_sample = dccp_sample_rtt(sk, &now, NULL); 900 r_sample = dccp_sample_rtt(sk, now, NULL);
902 901
903 if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA) 902 if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)
904 hcrx->ccid3hcrx_rtt = r_sample; 903 hcrx->ccid3hcrx_rtt = r_sample;
@@ -911,7 +910,6 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
911 dccp_role(sk), sk, hcrx->ccid3hcrx_rtt, 910 dccp_role(sk), sk, hcrx->ccid3hcrx_rtt,
912 opt_recv->dccpor_elapsed_time); 911 opt_recv->dccpor_elapsed_time);
913 break; 912 break;
914 }
915 case DCCP_PKT_DATA: 913 case DCCP_PKT_DATA:
916 break; 914 break;
917 default: /* We're not interested in other packet types, move along */ 915 default: /* We're not interested in other packet types, move along */
@@ -942,9 +940,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
942 ccid3_hc_rx_send_feedback(sk); 940 ccid3_hc_rx_send_feedback(sk);
943 ccid3_hc_rx_set_state(sk, TFRC_RSTATE_DATA); 941 ccid3_hc_rx_set_state(sk, TFRC_RSTATE_DATA);
944 return; 942 return;
945 case TFRC_RSTATE_DATA: { 943 case TFRC_RSTATE_DATA:
946 ktime_t now;
947
948 hcrx->ccid3hcrx_bytes_recv += payload_size; 944 hcrx->ccid3hcrx_bytes_recv += payload_size;
949 if (loss) 945 if (loss)
950 break; 946 break;
@@ -956,7 +952,6 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
956 ccid3_hc_rx_send_feedback(sk); 952 ccid3_hc_rx_send_feedback(sk);
957 } 953 }
958 return; 954 return;
959 }
960 case TFRC_RSTATE_TERM: 955 case TFRC_RSTATE_TERM:
961 DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk); 956 DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk);
962 return; 957 return;