ccid3.c (8dbc16033e35c7443cd56cb5ba308bb19cb7b469) ccid3.c (66a377c5041e1e399633153c8b500d457281e7c1)
1/*
2 * net/dccp/ccids/ccid3.c
3 *
4 * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand.
5 * Copyright (c) 2005-6 Ian McDonald <ian.mcdonald@jandi.co.nz>
6 *
7 * An implementation of the DCCP protocol
8 *

--- 328 unchanged lines hidden (view full) ---

337 }
338
339 /* Can we send? if so add options and add to packet history */
340 if (rc == 0) {
341 dp->dccps_hc_tx_insert_options = 1;
342 new_packet->dccphtx_ccval =
343 DCCP_SKB_CB(skb)->dccpd_ccval =
344 hctx->ccid3hctx_last_win_count;
1/*
2 * net/dccp/ccids/ccid3.c
3 *
4 * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand.
5 * Copyright (c) 2005-6 Ian McDonald <ian.mcdonald@jandi.co.nz>
6 *
7 * An implementation of the DCCP protocol
8 *

--- 328 unchanged lines hidden (view full) ---

337 }
338
339 /* Can we send? if so add options and add to packet history */
340 if (rc == 0) {
341 dp->dccps_hc_tx_insert_options = 1;
342 new_packet->dccphtx_ccval =
343 DCCP_SKB_CB(skb)->dccpd_ccval =
344 hctx->ccid3hctx_last_win_count;
345 timeval_add_usecs(&hctx->ccid3hctx_t_nom,
346 hctx->ccid3hctx_t_ipi);
345 }
346out:
347 return rc;
348}
349
350static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len)
351{
352 const struct dccp_sock *dp = dccp_sk(sk);

--- 55 unchanged lines hidden (view full) ---

408 if (len != 0)
409 printk(KERN_CRIT "%s: %s, First packet sent is noted "
410 "as a data packet\n",
411 __FUNCTION__, dccp_role(sk));
412 return;
413 case TFRC_SSTATE_NO_FBACK:
414 case TFRC_SSTATE_FBACK:
415 if (len > 0) {
347 }
348out:
349 return rc;
350}
351
352static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len)
353{
354 const struct dccp_sock *dp = dccp_sk(sk);

--- 55 unchanged lines hidden (view full) ---

410 if (len != 0)
411 printk(KERN_CRIT "%s: %s, First packet sent is noted "
412 "as a data packet\n",
413 __FUNCTION__, dccp_role(sk));
414 return;
415 case TFRC_SSTATE_NO_FBACK:
416 case TFRC_SSTATE_FBACK:
417 if (len > 0) {
416 hctx->ccid3hctx_t_nom = now;
418 timeval_sub_usecs(&hctx->ccid3hctx_t_nom,
419 hctx->ccid3hctx_t_ipi);
417 ccid3_calc_new_t_ipi(hctx);
418 ccid3_calc_new_delta(hctx);
419 timeval_add_usecs(&hctx->ccid3hctx_t_nom,
420 hctx->ccid3hctx_t_ipi);
421 }
422 break;
423 default:
424 printk(KERN_CRIT "%s: %s, sk=%p, Illegal state (%d)!\n",

--- 327 unchanged lines hidden (view full) ---

752 if (unlikely(packet == NULL)) {
753 LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, no data packet "
754 "in history!\n",
755 __FUNCTION__, dccp_role(sk), sk);
756 return;
757 }
758
759 hcrx->ccid3hcrx_tstamp_last_feedback = now;
420 ccid3_calc_new_t_ipi(hctx);
421 ccid3_calc_new_delta(hctx);
422 timeval_add_usecs(&hctx->ccid3hctx_t_nom,
423 hctx->ccid3hctx_t_ipi);
424 }
425 break;
426 default:
427 printk(KERN_CRIT "%s: %s, sk=%p, Illegal state (%d)!\n",

--- 327 unchanged lines hidden (view full) ---

755 if (unlikely(packet == NULL)) {
756 LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, no data packet "
757 "in history!\n",
758 __FUNCTION__, dccp_role(sk), sk);
759 return;
760 }
761
762 hcrx->ccid3hcrx_tstamp_last_feedback = now;
760 hcrx->ccid3hcrx_last_counter = packet->dccphrx_ccval;
761 hcrx->ccid3hcrx_seqno_last_counter = packet->dccphrx_seqno;
763 hcrx->ccid3hcrx_ccval_last_counter = packet->dccphrx_ccval;
762 hcrx->ccid3hcrx_bytes_recv = 0;
763
764 /* Convert to multiples of 10us */
765 hcrx->ccid3hcrx_elapsed_time =
766 timeval_delta(&now, &packet->dccphrx_tstamp) / 10;
767 if (hcrx->ccid3hcrx_p == 0)
768 hcrx->ccid3hcrx_pinv = ~0;
769 else

--- 7 unchanged lines hidden (view full) ---

777 const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
778 __be32 x_recv, pinv;
779
780 BUG_ON(hcrx == NULL);
781
782 if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN))
783 return 0;
784
764 hcrx->ccid3hcrx_bytes_recv = 0;
765
766 /* Convert to multiples of 10us */
767 hcrx->ccid3hcrx_elapsed_time =
768 timeval_delta(&now, &packet->dccphrx_tstamp) / 10;
769 if (hcrx->ccid3hcrx_p == 0)
770 hcrx->ccid3hcrx_pinv = ~0;
771 else

--- 7 unchanged lines hidden (view full) ---

779 const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
780 __be32 x_recv, pinv;
781
782 BUG_ON(hcrx == NULL);
783
784 if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN))
785 return 0;
786
785 DCCP_SKB_CB(skb)->dccpd_ccval = hcrx->ccid3hcrx_last_counter;
787 DCCP_SKB_CB(skb)->dccpd_ccval = hcrx->ccid3hcrx_ccval_last_counter;
786
787 if (dccp_packet_without_ack(skb))
788 return 0;
789
790 x_recv = htonl(hcrx->ccid3hcrx_x_recv);
791 pinv = htonl(hcrx->ccid3hcrx_pinv);
792
793 if ((hcrx->ccid3hcrx_elapsed_time != 0 &&

--- 55 unchanged lines hidden (view full) ---

849
850 if (unlikely(interval == 0)) {
851 LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, Could not find a "
852 "win_count interval > 0. Defaulting to 1\n",
853 __FUNCTION__, dccp_role(sk), sk);
854 interval = 1;
855 }
856found:
788
789 if (dccp_packet_without_ack(skb))
790 return 0;
791
792 x_recv = htonl(hcrx->ccid3hcrx_x_recv);
793 pinv = htonl(hcrx->ccid3hcrx_pinv);
794
795 if ((hcrx->ccid3hcrx_elapsed_time != 0 &&

--- 55 unchanged lines hidden (view full) ---

851
852 if (unlikely(interval == 0)) {
853 LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, Could not find a "
854 "win_count interval > 0. Defaulting to 1\n",
855 __FUNCTION__, dccp_role(sk), sk);
856 interval = 1;
857 }
858found:
859 if (!tail) {
860 LIMIT_NETDEBUG(KERN_WARNING "%s: tail is null\n",
861 __FUNCTION__);
862 return ~0;
863 }
857 rtt = timeval_delta(&tstamp, &tail->dccphrx_tstamp) * 4 / interval;
858 ccid3_pr_debug("%s, sk=%p, approximated RTT to %uus\n",
859 dccp_role(sk), sk, rtt);
860 if (rtt == 0)
861 rtt = 1;
862
863 dccp_timestamp(sk, &tstamp);
864 delta = timeval_delta(&tstamp, &hcrx->ccid3hcrx_tstamp_last_feedback);
865 x_recv = usecs_div(hcrx->ccid3hcrx_bytes_recv, delta);
866
864 rtt = timeval_delta(&tstamp, &tail->dccphrx_tstamp) * 4 / interval;
865 ccid3_pr_debug("%s, sk=%p, approximated RTT to %uus\n",
866 dccp_role(sk), sk, rtt);
867 if (rtt == 0)
868 rtt = 1;
869
870 dccp_timestamp(sk, &tstamp);
871 delta = timeval_delta(&tstamp, &hcrx->ccid3hcrx_tstamp_last_feedback);
872 x_recv = usecs_div(hcrx->ccid3hcrx_bytes_recv, delta);
873
874 if (x_recv == 0)
875 x_recv = hcrx->ccid3hcrx_x_recv;
876
867 tmp1 = (u64)x_recv * (u64)rtt;
868 do_div(tmp1,10000000);
869 tmp2 = (u32)tmp1;
877 tmp1 = (u64)x_recv * (u64)rtt;
878 do_div(tmp1,10000000);
879 tmp2 = (u32)tmp1;
880
881 if (!tmp2) {
882 LIMIT_NETDEBUG(KERN_WARNING "tmp2 = 0 "
883 "%s: x_recv = %u, rtt =%u\n",
884 __FUNCTION__, x_recv, rtt);
885 return ~0;
886 }
887
870 fval = (hcrx->ccid3hcrx_s * 100000) / tmp2;
871 /* do not alter order above or you will get overflow on 32 bit */
872 p = tfrc_calc_x_reverse_lookup(fval);
873 ccid3_pr_debug("%s, sk=%p, receive rate=%u bytes/s, implied "
874 "loss rate=%u\n", dccp_role(sk), sk, x_recv, p);
875
876 if (p == 0)
877 return ~0;
878 else
879 return 1000000 / p;
880}
881
882static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss)
883{
884 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
888 fval = (hcrx->ccid3hcrx_s * 100000) / tmp2;
889 /* do not alter order above or you will get overflow on 32 bit */
890 p = tfrc_calc_x_reverse_lookup(fval);
891 ccid3_pr_debug("%s, sk=%p, receive rate=%u bytes/s, implied "
892 "loss rate=%u\n", dccp_role(sk), sk, x_recv, p);
893
894 if (p == 0)
895 return ~0;
896 else
897 return 1000000 / p;
898}
899
900static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss)
901{
902 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
903 struct dccp_li_hist_entry *next, *head;
904 u64 seq_temp;
885
905
886 if (seq_loss != DCCP_MAX_SEQNO + 1 &&
887 list_empty(&hcrx->ccid3hcrx_li_hist)) {
888 struct dccp_li_hist_entry *li_tail;
906 if (list_empty(&hcrx->ccid3hcrx_li_hist)) {
907 if (!dccp_li_hist_interval_new(ccid3_li_hist,
908 &hcrx->ccid3hcrx_li_hist, seq_loss, win_loss))
909 return;
889
910
890 li_tail = dccp_li_hist_interval_new(ccid3_li_hist,
891 &hcrx->ccid3hcrx_li_hist,
892 seq_loss, win_loss);
893 if (li_tail == NULL)
911 next = (struct dccp_li_hist_entry *)
912 hcrx->ccid3hcrx_li_hist.next;
913 next->dccplih_interval = ccid3_hc_rx_calc_first_li(sk);
914 } else {
915 struct dccp_li_hist_entry *entry;
916 struct list_head *tail;
917
918 head = (struct dccp_li_hist_entry *)
919 hcrx->ccid3hcrx_li_hist.next;
920 /* FIXME win count check removed as was wrong */
921 /* should make this check with receive history */
922 /* and compare there as per section 10.2 of RFC4342 */
923
924 /* new loss event detected */
925 /* calculate last interval length */
926 seq_temp = dccp_delta_seqno(head->dccplih_seqno, seq_loss);
927 entry = dccp_li_hist_entry_new(ccid3_li_hist, SLAB_ATOMIC);
928
929 if (entry == NULL) {
930 printk(KERN_CRIT "%s: out of memory\n",__FUNCTION__);
931 dump_stack();
894 return;
932 return;
895 li_tail->dccplih_interval = ccid3_hc_rx_calc_first_li(sk);
896 } else
897 LIMIT_NETDEBUG(KERN_WARNING "%s: FIXME: find end of "
898 "interval\n", __FUNCTION__);
933 }
934
935 list_add(&entry->dccplih_node, &hcrx->ccid3hcrx_li_hist);
936
937 tail = hcrx->ccid3hcrx_li_hist.prev;
938 list_del(tail);
939 kmem_cache_free(ccid3_li_hist->dccplih_slab, tail);
940
941 /* Create the newest interval */
942 entry->dccplih_seqno = seq_loss;
943 entry->dccplih_interval = seq_temp;
944 entry->dccplih_win_count = win_loss;
945 }
899}
900
946}
947
901static void ccid3_hc_rx_detect_loss(struct sock *sk)
948static int ccid3_hc_rx_detect_loss(struct sock *sk,
949 struct dccp_rx_hist_entry *packet)
902{
903 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
950{
951 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
904 u8 win_loss;
905 const u64 seq_loss = dccp_rx_hist_detect_loss(&hcrx->ccid3hcrx_hist,
906 &hcrx->ccid3hcrx_li_hist,
907 &win_loss);
952 struct dccp_rx_hist_entry *rx_hist = dccp_rx_hist_head(&hcrx->ccid3hcrx_hist);
953 u64 seqno = packet->dccphrx_seqno;
954 u64 tmp_seqno;
955 int loss = 0;
956 u8 ccval;
908
957
909 ccid3_hc_rx_update_li(sk, seq_loss, win_loss);
958
959 tmp_seqno = hcrx->ccid3hcrx_seqno_nonloss;
960
961 if (!rx_hist ||
962 follows48(packet->dccphrx_seqno, hcrx->ccid3hcrx_seqno_nonloss)) {
963 hcrx->ccid3hcrx_seqno_nonloss = seqno;
964 hcrx->ccid3hcrx_ccval_nonloss = packet->dccphrx_ccval;
965 goto detect_out;
966 }
967
968
969 while (dccp_delta_seqno(hcrx->ccid3hcrx_seqno_nonloss, seqno)
970 > TFRC_RECV_NUM_LATE_LOSS) {
971 loss = 1;
972 ccid3_hc_rx_update_li(sk, hcrx->ccid3hcrx_seqno_nonloss,
973 hcrx->ccid3hcrx_ccval_nonloss);
974 tmp_seqno = hcrx->ccid3hcrx_seqno_nonloss;
975 dccp_inc_seqno(&tmp_seqno);
976 hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno;
977 dccp_inc_seqno(&tmp_seqno);
978 while (dccp_rx_hist_find_entry(&hcrx->ccid3hcrx_hist,
979 tmp_seqno, &ccval)) {
980 hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno;
981 hcrx->ccid3hcrx_ccval_nonloss = ccval;
982 dccp_inc_seqno(&tmp_seqno);
983 }
984 }
985
986 /* FIXME - this code could be simplified with above while */
987 /* but works at moment */
988 if (follows48(packet->dccphrx_seqno, hcrx->ccid3hcrx_seqno_nonloss)) {
989 hcrx->ccid3hcrx_seqno_nonloss = seqno;
990 hcrx->ccid3hcrx_ccval_nonloss = packet->dccphrx_ccval;
991 }
992
993detect_out:
994 dccp_rx_hist_add_packet(ccid3_rx_hist, &hcrx->ccid3hcrx_hist,
995 &hcrx->ccid3hcrx_li_hist, packet,
996 hcrx->ccid3hcrx_seqno_nonloss);
997 return loss;
910}
911
912static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
913{
914 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
915 const struct dccp_options_received *opt_recv;
916 struct dccp_rx_hist_entry *packet;
917 struct timeval now;
918 u8 win_count;
998}
999
1000static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
1001{
1002 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
1003 const struct dccp_options_received *opt_recv;
1004 struct dccp_rx_hist_entry *packet;
1005 struct timeval now;
1006 u8 win_count;
919 u32 p_prev, r_sample, t_elapsed;
920 int ins;
1007 u32 p_prev, rtt_prev, r_sample, t_elapsed;
1008 int loss;
921
922 BUG_ON(hcrx == NULL ||
923 !(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA ||
924 hcrx->ccid3hcrx_state == TFRC_RSTATE_DATA));
925
926 opt_recv = &dccp_sk(sk)->dccps_options_received;
927
928 switch (DCCP_SKB_CB(skb)->dccpd_type) {
929 case DCCP_PKT_ACK:
930 if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)
931 return;
932 case DCCP_PKT_DATAACK:
933 if (opt_recv->dccpor_timestamp_echo == 0)
934 break;
1009
1010 BUG_ON(hcrx == NULL ||
1011 !(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA ||
1012 hcrx->ccid3hcrx_state == TFRC_RSTATE_DATA));
1013
1014 opt_recv = &dccp_sk(sk)->dccps_options_received;
1015
1016 switch (DCCP_SKB_CB(skb)->dccpd_type) {
1017 case DCCP_PKT_ACK:
1018 if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)
1019 return;
1020 case DCCP_PKT_DATAACK:
1021 if (opt_recv->dccpor_timestamp_echo == 0)
1022 break;
935 p_prev = hcrx->ccid3hcrx_rtt;
1023 rtt_prev = hcrx->ccid3hcrx_rtt;
936 dccp_timestamp(sk, &now);
937 timeval_sub_usecs(&now, opt_recv->dccpor_timestamp_echo * 10);
938 r_sample = timeval_usecs(&now);
939 t_elapsed = opt_recv->dccpor_elapsed_time * 10;
940
941 if (unlikely(r_sample <= t_elapsed))
942 LIMIT_NETDEBUG(KERN_WARNING "%s: r_sample=%uus, "
943 "t_elapsed=%uus\n",
944 __FUNCTION__, r_sample, t_elapsed);
945 else
946 r_sample -= t_elapsed;
947
948 if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)
949 hcrx->ccid3hcrx_rtt = r_sample;
950 else
951 hcrx->ccid3hcrx_rtt = (hcrx->ccid3hcrx_rtt * 9) / 10 +
952 r_sample / 10;
953
1024 dccp_timestamp(sk, &now);
1025 timeval_sub_usecs(&now, opt_recv->dccpor_timestamp_echo * 10);
1026 r_sample = timeval_usecs(&now);
1027 t_elapsed = opt_recv->dccpor_elapsed_time * 10;
1028
1029 if (unlikely(r_sample <= t_elapsed))
1030 LIMIT_NETDEBUG(KERN_WARNING "%s: r_sample=%uus, "
1031 "t_elapsed=%uus\n",
1032 __FUNCTION__, r_sample, t_elapsed);
1033 else
1034 r_sample -= t_elapsed;
1035
1036 if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)
1037 hcrx->ccid3hcrx_rtt = r_sample;
1038 else
1039 hcrx->ccid3hcrx_rtt = (hcrx->ccid3hcrx_rtt * 9) / 10 +
1040 r_sample / 10;
1041
954 if (p_prev != hcrx->ccid3hcrx_rtt)
955 ccid3_pr_debug("%s, New RTT=%luus, elapsed time=%u\n",
1042 if (rtt_prev != hcrx->ccid3hcrx_rtt)
1043 ccid3_pr_debug("%s, New RTT=%uus, elapsed time=%u\n",
956 dccp_role(sk), hcrx->ccid3hcrx_rtt,
957 opt_recv->dccpor_elapsed_time);
958 break;
959 case DCCP_PKT_DATA:
960 break;
961 default: /* We're not interested in other packet types, move along */
962 return;
963 }

--- 4 unchanged lines hidden (view full) ---

968 LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, Not enough mem to "
969 "add rx packet to history, consider it lost!\n",
970 __FUNCTION__, dccp_role(sk), sk);
971 return;
972 }
973
974 win_count = packet->dccphrx_ccval;
975
1044 dccp_role(sk), hcrx->ccid3hcrx_rtt,
1045 opt_recv->dccpor_elapsed_time);
1046 break;
1047 case DCCP_PKT_DATA:
1048 break;
1049 default: /* We're not interested in other packet types, move along */
1050 return;
1051 }

--- 4 unchanged lines hidden (view full) ---

1056 LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, Not enough mem to "
1057 "add rx packet to history, consider it lost!\n",
1058 __FUNCTION__, dccp_role(sk), sk);
1059 return;
1060 }
1061
1062 win_count = packet->dccphrx_ccval;
1063
976 ins = dccp_rx_hist_add_packet(ccid3_rx_hist, &hcrx->ccid3hcrx_hist,
977 &hcrx->ccid3hcrx_li_hist, packet);
1064 loss = ccid3_hc_rx_detect_loss(sk, packet);
978
979 if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK)
980 return;
981
982 switch (hcrx->ccid3hcrx_state) {
983 case TFRC_RSTATE_NO_DATA:
984 ccid3_pr_debug("%s, sk=%p(%s), skb=%p, sending initial "
985 "feedback\n",
986 dccp_role(sk), sk,
987 dccp_state_name(sk->sk_state), skb);
988 ccid3_hc_rx_send_feedback(sk);
989 ccid3_hc_rx_set_state(sk, TFRC_RSTATE_DATA);
990 return;
991 case TFRC_RSTATE_DATA:
992 hcrx->ccid3hcrx_bytes_recv += skb->len -
993 dccp_hdr(skb)->dccph_doff * 4;
1065
1066 if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK)
1067 return;
1068
1069 switch (hcrx->ccid3hcrx_state) {
1070 case TFRC_RSTATE_NO_DATA:
1071 ccid3_pr_debug("%s, sk=%p(%s), skb=%p, sending initial "
1072 "feedback\n",
1073 dccp_role(sk), sk,
1074 dccp_state_name(sk->sk_state), skb);
1075 ccid3_hc_rx_send_feedback(sk);
1076 ccid3_hc_rx_set_state(sk, TFRC_RSTATE_DATA);
1077 return;
1078 case TFRC_RSTATE_DATA:
1079 hcrx->ccid3hcrx_bytes_recv += skb->len -
1080 dccp_hdr(skb)->dccph_doff * 4;
994 if (ins != 0)
1081 if (loss)
995 break;
996
997 dccp_timestamp(sk, &now);
998 if (timeval_delta(&now, &hcrx->ccid3hcrx_tstamp_last_ack) >=
999 hcrx->ccid3hcrx_rtt) {
1000 hcrx->ccid3hcrx_tstamp_last_ack = now;
1001 ccid3_hc_rx_send_feedback(sk);
1002 }

--- 4 unchanged lines hidden (view full) ---

1007 dump_stack();
1008 return;
1009 }
1010
1011 /* Dealing with packet loss */
1012 ccid3_pr_debug("%s, sk=%p(%s), data loss! Reacting...\n",
1013 dccp_role(sk), sk, dccp_state_name(sk->sk_state));
1014
1082 break;
1083
1084 dccp_timestamp(sk, &now);
1085 if (timeval_delta(&now, &hcrx->ccid3hcrx_tstamp_last_ack) >=
1086 hcrx->ccid3hcrx_rtt) {
1087 hcrx->ccid3hcrx_tstamp_last_ack = now;
1088 ccid3_hc_rx_send_feedback(sk);
1089 }

--- 4 unchanged lines hidden (view full) ---

1094 dump_stack();
1095 return;
1096 }
1097
1098 /* Dealing with packet loss */
1099 ccid3_pr_debug("%s, sk=%p(%s), data loss! Reacting...\n",
1100 dccp_role(sk), sk, dccp_state_name(sk->sk_state));
1101
1015 ccid3_hc_rx_detect_loss(sk);
1016 p_prev = hcrx->ccid3hcrx_p;
1017
1018 /* Calculate loss event rate */
1019 if (!list_empty(&hcrx->ccid3hcrx_li_hist)) {
1020 u32 i_mean = dccp_li_hist_calc_i_mean(&hcrx->ccid3hcrx_li_hist);
1021
1022 /* Scaling up by 1000000 as fixed decimal */
1023 if (i_mean != 0)
1024 hcrx->ccid3hcrx_p = 1000000 / i_mean;
1102 p_prev = hcrx->ccid3hcrx_p;
1103
1104 /* Calculate loss event rate */
1105 if (!list_empty(&hcrx->ccid3hcrx_li_hist)) {
1106 u32 i_mean = dccp_li_hist_calc_i_mean(&hcrx->ccid3hcrx_li_hist);
1107
1108 /* Scaling up by 1000000 as fixed decimal */
1109 if (i_mean != 0)
1110 hcrx->ccid3hcrx_p = 1000000 / i_mean;
1111 } else {
1112 printk(KERN_CRIT "%s: empty loss hist\n",__FUNCTION__);
1113 dump_stack();
1025 }
1026
1027 if (hcrx->ccid3hcrx_p > p_prev) {
1028 ccid3_hc_rx_send_feedback(sk);
1029 return;
1030 }
1031}
1032

--- 205 unchanged lines hidden ---
1114 }
1115
1116 if (hcrx->ccid3hcrx_p > p_prev) {
1117 ccid3_hc_rx_send_feedback(sk);
1118 return;
1119 }
1120}
1121

--- 205 unchanged lines hidden ---