diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-05-28 17:04:14 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:15:18 -0400 |
commit | d83258a3da1d3c7ae7b75549c8bf7ed689562c62 (patch) | |
tree | e19e448fd411c9006e96d6add09ed56d8c5a9e4e /net | |
parent | 6bc7efe8efa627077f8f65d01dbb762fc9356a2f (diff) |
Remove accesses to ccid3_hc_rx_sock in ccid3_hc_rx_{update,calc_first}_li
This is a preparatory patch for moving these loss interval functions from
net/dccp/ccids/ccid3.c to net/dccp/ccids/lib/loss_interval.c.
Based on a patch by Ian McDonald.
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 9686a8de2e91..fb500d3851c3 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -823,9 +823,12 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) | |||
823 | * | 823 | * |
824 | * returns estimated loss interval in usecs */ | 824 | * returns estimated loss interval in usecs */ |
825 | 825 | ||
826 | static u32 ccid3_hc_rx_calc_first_li(struct sock *sk) | 826 | static u32 ccid3_hc_rx_calc_first_li(struct sock *sk, |
827 | struct list_head *hist_list, | ||
828 | struct timeval *last_feedback, | ||
829 | u16 s, u32 bytes_recv, | ||
830 | u32 previous_x_recv) | ||
827 | { | 831 | { |
828 | struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); | ||
829 | struct dccp_rx_hist_entry *entry, *next, *tail = NULL; | 832 | struct dccp_rx_hist_entry *entry, *next, *tail = NULL; |
830 | u32 x_recv, p; | 833 | u32 x_recv, p; |
831 | suseconds_t rtt, delta; | 834 | suseconds_t rtt, delta; |
@@ -835,8 +838,7 @@ static u32 ccid3_hc_rx_calc_first_li(struct sock *sk) | |||
835 | int step = 0; | 838 | int step = 0; |
836 | u64 fval; | 839 | u64 fval; |
837 | 840 | ||
838 | list_for_each_entry_safe(entry, next, &hcrx->ccid3hcrx_hist, | 841 | list_for_each_entry_safe(entry, next, hist_list, dccphrx_node) { |
839 | dccphrx_node) { | ||
840 | if (dccp_rx_hist_entry_data_packet(entry)) { | 842 | if (dccp_rx_hist_entry_data_packet(entry)) { |
841 | tail = entry; | 843 | tail = entry; |
842 | 844 | ||
@@ -895,19 +897,20 @@ found: | |||
895 | } | 897 | } |
896 | 898 | ||
897 | dccp_timestamp(sk, &tstamp); | 899 | dccp_timestamp(sk, &tstamp); |
898 | delta = timeval_delta(&tstamp, &hcrx->ccid3hcrx_tstamp_last_feedback); | 900 | delta = timeval_delta(&tstamp, last_feedback); |
899 | DCCP_BUG_ON(delta <= 0); | 901 | DCCP_BUG_ON(delta <= 0); |
900 | 902 | ||
901 | x_recv = scaled_div32(hcrx->ccid3hcrx_bytes_recv, delta); | 903 | x_recv = scaled_div32(bytes_recv, delta); |
902 | if (x_recv == 0) { /* would also trigger divide-by-zero */ | 904 | if (x_recv == 0) { /* would also trigger divide-by-zero */ |
903 | DCCP_WARN("X_recv==0\n"); | 905 | DCCP_WARN("X_recv==0\n"); |
904 | if ((x_recv = hcrx->ccid3hcrx_x_recv) == 0) { | 906 | if (previous_x_recv == 0) { |
905 | DCCP_BUG("stored value of X_recv is zero"); | 907 | DCCP_BUG("stored value of X_recv is zero"); |
906 | return ~0; | 908 | return ~0; |
907 | } | 909 | } |
910 | x_recv = previous_x_recv; | ||
908 | } | 911 | } |
909 | 912 | ||
910 | fval = scaled_div(hcrx->ccid3hcrx_s, rtt); | 913 | fval = scaled_div(s, rtt); |
911 | fval = scaled_div32(fval, x_recv); | 914 | fval = scaled_div32(fval, x_recv); |
912 | p = tfrc_calc_x_reverse_lookup(fval); | 915 | p = tfrc_calc_x_reverse_lookup(fval); |
913 | 916 | ||
@@ -920,26 +923,36 @@ found: | |||
920 | return 1000000 / p; | 923 | return 1000000 / p; |
921 | } | 924 | } |
922 | 925 | ||
923 | static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss) | 926 | static void ccid3_hc_rx_update_li(struct sock *sk, |
927 | struct list_head *li_hist_list, | ||
928 | struct list_head *hist_list, | ||
929 | struct timeval *last_feedback, | ||
930 | u16 s, u32 bytes_recv, | ||
931 | u32 previous_x_recv, | ||
932 | u64 seq_loss, u8 win_loss) | ||
924 | { | 933 | { |
925 | struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); | ||
926 | struct dccp_li_hist_entry *head; | 934 | struct dccp_li_hist_entry *head; |
927 | u64 seq_temp; | 935 | u64 seq_temp; |
928 | 936 | ||
929 | if (list_empty(&hcrx->ccid3hcrx_li_hist)) { | 937 | if (list_empty(li_hist_list)) { |
930 | if (!dccp_li_hist_interval_new(ccid3_li_hist, | 938 | if (!dccp_li_hist_interval_new(ccid3_li_hist, |
931 | &hcrx->ccid3hcrx_li_hist, seq_loss, win_loss)) | 939 | li_hist_list, seq_loss, |
940 | win_loss)) | ||
932 | return; | 941 | return; |
933 | 942 | ||
934 | head = list_entry(hcrx->ccid3hcrx_li_hist.next, | 943 | head = list_entry(li_hist_list->next, struct dccp_li_hist_entry, |
935 | struct dccp_li_hist_entry, dccplih_node); | 944 | dccplih_node); |
936 | head->dccplih_interval = ccid3_hc_rx_calc_first_li(sk); | 945 | head->dccplih_interval = |
946 | ccid3_hc_rx_calc_first_li(sk, hist_list, | ||
947 | last_feedback, s, | ||
948 | bytes_recv, | ||
949 | previous_x_recv); | ||
937 | } else { | 950 | } else { |
938 | struct dccp_li_hist_entry *entry; | 951 | struct dccp_li_hist_entry *entry; |
939 | struct list_head *tail; | 952 | struct list_head *tail; |
940 | 953 | ||
941 | head = list_entry(hcrx->ccid3hcrx_li_hist.next, | 954 | head = list_entry(li_hist_list->next, struct dccp_li_hist_entry, |
942 | struct dccp_li_hist_entry, dccplih_node); | 955 | dccplih_node); |
943 | /* FIXME win count check removed as was wrong */ | 956 | /* FIXME win count check removed as was wrong */ |
944 | /* should make this check with receive history */ | 957 | /* should make this check with receive history */ |
945 | /* and compare there as per section 10.2 of RFC4342 */ | 958 | /* and compare there as per section 10.2 of RFC4342 */ |
@@ -954,9 +967,9 @@ static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss) | |||
954 | return; | 967 | return; |
955 | } | 968 | } |
956 | 969 | ||
957 | list_add(&entry->dccplih_node, &hcrx->ccid3hcrx_li_hist); | 970 | list_add(&entry->dccplih_node, li_hist_list); |
958 | 971 | ||
959 | tail = hcrx->ccid3hcrx_li_hist.prev; | 972 | tail = li_hist_list->prev; |
960 | list_del(tail); | 973 | list_del(tail); |
961 | kmem_cache_free(ccid3_li_hist->dccplih_slab, tail); | 974 | kmem_cache_free(ccid3_li_hist->dccplih_slab, tail); |
962 | 975 | ||
@@ -992,8 +1005,15 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk, | |||
992 | while (dccp_delta_seqno(hcrx->ccid3hcrx_seqno_nonloss, seqno) | 1005 | while (dccp_delta_seqno(hcrx->ccid3hcrx_seqno_nonloss, seqno) |
993 | > TFRC_RECV_NUM_LATE_LOSS) { | 1006 | > TFRC_RECV_NUM_LATE_LOSS) { |
994 | loss = 1; | 1007 | loss = 1; |
995 | ccid3_hc_rx_update_li(sk, hcrx->ccid3hcrx_seqno_nonloss, | 1008 | ccid3_hc_rx_update_li(sk, |
996 | hcrx->ccid3hcrx_ccval_nonloss); | 1009 | &hcrx->ccid3hcrx_li_hist, |
1010 | &hcrx->ccid3hcrx_hist, | ||
1011 | &hcrx->ccid3hcrx_tstamp_last_feedback, | ||
1012 | hcrx->ccid3hcrx_s, | ||
1013 | hcrx->ccid3hcrx_bytes_recv, | ||
1014 | hcrx->ccid3hcrx_x_recv, | ||
1015 | hcrx->ccid3hcrx_seqno_nonloss, | ||
1016 | hcrx->ccid3hcrx_ccval_nonloss); | ||
997 | tmp_seqno = hcrx->ccid3hcrx_seqno_nonloss; | 1017 | tmp_seqno = hcrx->ccid3hcrx_seqno_nonloss; |
998 | dccp_inc_seqno(&tmp_seqno); | 1018 | dccp_inc_seqno(&tmp_seqno); |
999 | hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno; | 1019 | hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno; |