diff options
Diffstat (limited to 'net/dccp/ccids/ccid3.c')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 122 |
1 files changed, 2 insertions, 120 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index a215c46d6f1b..849f5580efbd 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -744,125 +744,6 @@ static inline void ccid3_hc_rx_set_state(struct sock *sk, | |||
744 | hcrx->ccid3hcrx_state = state; | 744 | hcrx->ccid3hcrx_state = state; |
745 | } | 745 | } |
746 | 746 | ||
747 | static int ccid3_hc_rx_add_hist(struct sock *sk, | ||
748 | struct dccp_rx_hist_entry *packet) | ||
749 | { | ||
750 | struct dccp_sock *dp = dccp_sk(sk); | ||
751 | struct ccid3_hc_rx_sock *hcrx = dp->dccps_hc_rx_ccid_private; | ||
752 | struct dccp_rx_hist_entry *entry, *next, *iter; | ||
753 | u8 num_later = 0; | ||
754 | |||
755 | iter = dccp_rx_hist_head(&hcrx->ccid3hcrx_hist); | ||
756 | if (iter == NULL) | ||
757 | dccp_rx_hist_add_entry(&hcrx->ccid3hcrx_hist, packet); | ||
758 | else { | ||
759 | const u64 seqno = packet->dccphrx_seqno; | ||
760 | |||
761 | if (after48(seqno, iter->dccphrx_seqno)) | ||
762 | dccp_rx_hist_add_entry(&hcrx->ccid3hcrx_hist, packet); | ||
763 | else { | ||
764 | if (dccp_rx_hist_entry_data_packet(iter)) | ||
765 | num_later = 1; | ||
766 | |||
767 | list_for_each_entry_continue(iter, | ||
768 | &hcrx->ccid3hcrx_hist, | ||
769 | dccphrx_node) { | ||
770 | if (after48(seqno, iter->dccphrx_seqno)) { | ||
771 | dccp_rx_hist_add_entry(&iter->dccphrx_node, | ||
772 | packet); | ||
773 | goto trim_history; | ||
774 | } | ||
775 | |||
776 | if (dccp_rx_hist_entry_data_packet(iter)) | ||
777 | num_later++; | ||
778 | |||
779 | if (num_later == TFRC_RECV_NUM_LATE_LOSS) { | ||
780 | dccp_rx_hist_entry_delete(ccid3_rx_hist, | ||
781 | packet); | ||
782 | ccid3_pr_debug("%s, sk=%p, packet" | ||
783 | "(%llu) already lost!\n", | ||
784 | dccp_role(sk), sk, | ||
785 | seqno); | ||
786 | return 1; | ||
787 | } | ||
788 | } | ||
789 | |||
790 | if (num_later < TFRC_RECV_NUM_LATE_LOSS) | ||
791 | dccp_rx_hist_add_entry(&hcrx->ccid3hcrx_hist, | ||
792 | packet); | ||
793 | /* | ||
794 | * FIXME: else what? should we destroy the packet | ||
795 | * like above? | ||
796 | */ | ||
797 | } | ||
798 | } | ||
799 | |||
800 | trim_history: | ||
801 | /* | ||
802 | * Trim history (remove all packets after the NUM_LATE_LOSS + 1 | ||
803 | * data packets) | ||
804 | */ | ||
805 | num_later = TFRC_RECV_NUM_LATE_LOSS + 1; | ||
806 | |||
807 | if (!list_empty(&hcrx->ccid3hcrx_li_hist)) { | ||
808 | list_for_each_entry_safe(entry, next, &hcrx->ccid3hcrx_hist, | ||
809 | dccphrx_node) { | ||
810 | if (num_later == 0) { | ||
811 | list_del_init(&entry->dccphrx_node); | ||
812 | dccp_rx_hist_entry_delete(ccid3_rx_hist, entry); | ||
813 | } else if (dccp_rx_hist_entry_data_packet(entry)) | ||
814 | --num_later; | ||
815 | } | ||
816 | } else { | ||
817 | int step = 0; | ||
818 | u8 win_count = 0; /* Not needed, but lets shut up gcc */ | ||
819 | int tmp; | ||
820 | /* | ||
821 | * We have no loss interval history so we need at least one | ||
822 | * rtt:s of data packets to approximate rtt. | ||
823 | */ | ||
824 | list_for_each_entry_safe(entry, next, &hcrx->ccid3hcrx_hist, | ||
825 | dccphrx_node) { | ||
826 | if (num_later == 0) { | ||
827 | switch (step) { | ||
828 | case 0: | ||
829 | step = 1; | ||
830 | /* OK, find next data packet */ | ||
831 | num_later = 1; | ||
832 | break; | ||
833 | case 1: | ||
834 | step = 2; | ||
835 | /* OK, find next data packet */ | ||
836 | num_later = 1; | ||
837 | win_count = entry->dccphrx_ccval; | ||
838 | break; | ||
839 | case 2: | ||
840 | tmp = win_count - entry->dccphrx_ccval; | ||
841 | if (tmp < 0) | ||
842 | tmp += TFRC_WIN_COUNT_LIMIT; | ||
843 | if (tmp > TFRC_WIN_COUNT_PER_RTT + 1) { | ||
844 | /* | ||
845 | * We have found a packet older | ||
846 | * than one rtt remove the rest | ||
847 | */ | ||
848 | step = 3; | ||
849 | } else /* OK, find next data packet */ | ||
850 | num_later = 1; | ||
851 | break; | ||
852 | case 3: | ||
853 | list_del_init(&entry->dccphrx_node); | ||
854 | dccp_rx_hist_entry_delete(ccid3_rx_hist, | ||
855 | entry); | ||
856 | break; | ||
857 | } | ||
858 | } else if (dccp_rx_hist_entry_data_packet(entry)) | ||
859 | --num_later; | ||
860 | } | ||
861 | } | ||
862 | |||
863 | return 0; | ||
864 | } | ||
865 | |||
866 | static void ccid3_hc_rx_send_feedback(struct sock *sk) | 747 | static void ccid3_hc_rx_send_feedback(struct sock *sk) |
867 | { | 748 | { |
868 | struct dccp_sock *dp = dccp_sk(sk); | 749 | struct dccp_sock *dp = dccp_sk(sk); |
@@ -1185,7 +1066,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1185 | 1066 | ||
1186 | win_count = packet->dccphrx_ccval; | 1067 | win_count = packet->dccphrx_ccval; |
1187 | 1068 | ||
1188 | ins = ccid3_hc_rx_add_hist(sk, packet); | 1069 | ins = dccp_rx_hist_add_packet(ccid3_rx_hist, &hcrx->ccid3hcrx_hist, |
1070 | &hcrx->ccid3hcrx_li_hist, packet); | ||
1189 | 1071 | ||
1190 | if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK) | 1072 | if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK) |
1191 | return; | 1073 | return; |