diff options
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 14 | ||||
-rw-r--r-- | net/dccp/ccids/lib/loss_interval.c | 10 | ||||
-rw-r--r-- | net/dccp/ccids/lib/packet_history.c | 103 | ||||
-rw-r--r-- | net/dccp/ccids/lib/packet_history.h | 30 |
4 files changed, 67 insertions, 90 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index a1929f33d703..f6756e0c9e69 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -794,7 +794,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
794 | { | 794 | { |
795 | struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); | 795 | struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); |
796 | enum ccid3_fback_type do_feedback = CCID3_FBACK_NONE; | 796 | enum ccid3_fback_type do_feedback = CCID3_FBACK_NONE; |
797 | const u32 ndp = dccp_sk(sk)->dccps_options_received.dccpor_ndp; | 797 | const u64 ndp = dccp_sk(sk)->dccps_options_received.dccpor_ndp; |
798 | const bool is_data_packet = dccp_data_packet(skb); | 798 | const bool is_data_packet = dccp_data_packet(skb); |
799 | 799 | ||
800 | if (unlikely(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)) { | 800 | if (unlikely(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)) { |
@@ -825,18 +825,16 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
825 | } | 825 | } |
826 | 826 | ||
827 | /* | 827 | /* |
828 | * Handle pending losses and otherwise check for new loss | 828 | * Perform loss detection and handle pending losses |
829 | */ | 829 | */ |
830 | if (tfrc_rx_hist_loss_pending(&hcrx->ccid3hcrx_hist) && | 830 | if (tfrc_rx_handle_loss(&hcrx->ccid3hcrx_hist, &hcrx->ccid3hcrx_li_hist, |
831 | tfrc_rx_handle_loss(&hcrx->ccid3hcrx_hist, | 831 | skb, ndp, ccid3_first_li, sk)) { |
832 | &hcrx->ccid3hcrx_li_hist, | ||
833 | skb, ndp, ccid3_first_li, sk) ) { | ||
834 | do_feedback = CCID3_FBACK_PARAM_CHANGE; | 832 | do_feedback = CCID3_FBACK_PARAM_CHANGE; |
835 | goto done_receiving; | 833 | goto done_receiving; |
836 | } | 834 | } |
837 | 835 | ||
838 | if (tfrc_rx_hist_new_loss_indicated(&hcrx->ccid3hcrx_hist, skb, ndp)) | 836 | if (tfrc_rx_hist_loss_pending(&hcrx->ccid3hcrx_hist)) |
839 | goto update_records; | 837 | return; /* done receiving */ |
840 | 838 | ||
841 | /* | 839 | /* |
842 | * Handle data packets: RTT sampling and monitoring p | 840 | * Handle data packets: RTT sampling and monitoring p |
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c index 849e181e698f..bcd6ac415bb9 100644 --- a/net/dccp/ccids/lib/loss_interval.c +++ b/net/dccp/ccids/lib/loss_interval.c | |||
@@ -90,14 +90,14 @@ u8 tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *skb) | |||
90 | { | 90 | { |
91 | struct tfrc_loss_interval *cur = tfrc_lh_peek(lh); | 91 | struct tfrc_loss_interval *cur = tfrc_lh_peek(lh); |
92 | u32 old_i_mean = lh->i_mean; | 92 | u32 old_i_mean = lh->i_mean; |
93 | s64 length; | 93 | s64 len; |
94 | 94 | ||
95 | if (cur == NULL) /* not initialised */ | 95 | if (cur == NULL) /* not initialised */ |
96 | return 0; | 96 | return 0; |
97 | 97 | ||
98 | length = dccp_delta_seqno(cur->li_seqno, DCCP_SKB_CB(skb)->dccpd_seq); | 98 | len = dccp_delta_seqno(cur->li_seqno, DCCP_SKB_CB(skb)->dccpd_seq) + 1; |
99 | 99 | ||
100 | if (length - cur->li_length <= 0) /* duplicate or reordered */ | 100 | if (len - (s64)cur->li_length <= 0) /* duplicate or reordered */ |
101 | return 0; | 101 | return 0; |
102 | 102 | ||
103 | if (SUB16(dccp_hdr(skb)->dccph_ccval, cur->li_ccval) > 4) | 103 | if (SUB16(dccp_hdr(skb)->dccph_ccval, cur->li_ccval) > 4) |
@@ -114,7 +114,7 @@ u8 tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *skb) | |||
114 | if (tfrc_lh_length(lh) == 1) /* due to RFC 3448, 6.3.1 */ | 114 | if (tfrc_lh_length(lh) == 1) /* due to RFC 3448, 6.3.1 */ |
115 | return 0; | 115 | return 0; |
116 | 116 | ||
117 | cur->li_length = length; | 117 | cur->li_length = len; |
118 | tfrc_lh_calc_i_mean(lh); | 118 | tfrc_lh_calc_i_mean(lh); |
119 | 119 | ||
120 | return (lh->i_mean < old_i_mean); | 120 | return (lh->i_mean < old_i_mean); |
@@ -159,7 +159,7 @@ int tfrc_lh_interval_add(struct tfrc_loss_hist *lh, struct tfrc_rx_hist *rh, | |||
159 | else { | 159 | else { |
160 | cur->li_length = dccp_delta_seqno(cur->li_seqno, new->li_seqno); | 160 | cur->li_length = dccp_delta_seqno(cur->li_seqno, new->li_seqno); |
161 | new->li_length = dccp_delta_seqno(new->li_seqno, | 161 | new->li_length = dccp_delta_seqno(new->li_seqno, |
162 | tfrc_rx_hist_last_rcv(rh)->tfrchrx_seqno); | 162 | tfrc_rx_hist_last_rcv(rh)->tfrchrx_seqno) + 1; |
163 | if (lh->counter > (2*LIH_SIZE)) | 163 | if (lh->counter > (2*LIH_SIZE)) |
164 | lh->counter -= LIH_SIZE; | 164 | lh->counter -= LIH_SIZE; |
165 | 165 | ||
diff --git a/net/dccp/ccids/lib/packet_history.c b/net/dccp/ccids/lib/packet_history.c index 20af1a693427..6cc108afdc3b 100644 --- a/net/dccp/ccids/lib/packet_history.c +++ b/net/dccp/ccids/lib/packet_history.c | |||
@@ -153,7 +153,7 @@ void tfrc_rx_packet_history_exit(void) | |||
153 | 153 | ||
154 | static inline void tfrc_rx_hist_entry_from_skb(struct tfrc_rx_hist_entry *entry, | 154 | static inline void tfrc_rx_hist_entry_from_skb(struct tfrc_rx_hist_entry *entry, |
155 | const struct sk_buff *skb, | 155 | const struct sk_buff *skb, |
156 | const u32 ndp) | 156 | const u64 ndp) |
157 | { | 157 | { |
158 | const struct dccp_hdr *dh = dccp_hdr(skb); | 158 | const struct dccp_hdr *dh = dccp_hdr(skb); |
159 | 159 | ||
@@ -166,7 +166,7 @@ static inline void tfrc_rx_hist_entry_from_skb(struct tfrc_rx_hist_entry *entry, | |||
166 | 166 | ||
167 | void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, | 167 | void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, |
168 | const struct sk_buff *skb, | 168 | const struct sk_buff *skb, |
169 | const u32 ndp) | 169 | const u64 ndp) |
170 | { | 170 | { |
171 | struct tfrc_rx_hist_entry *entry = tfrc_rx_hist_last_rcv(h); | 171 | struct tfrc_rx_hist_entry *entry = tfrc_rx_hist_last_rcv(h); |
172 | 172 | ||
@@ -206,31 +206,39 @@ static void tfrc_rx_hist_swap(struct tfrc_rx_hist *h, const u8 a, const u8 b) | |||
206 | * | 206 | * |
207 | * In the descriptions, `Si' refers to the sequence number of entry number i, | 207 | * In the descriptions, `Si' refers to the sequence number of entry number i, |
208 | * whose NDP count is `Ni' (lower case is used for variables). | 208 | * whose NDP count is `Ni' (lower case is used for variables). |
209 | * Note: All __after_loss functions expect that a test against duplicates has | 209 | * Note: All __xxx_loss functions expect that a test against duplicates has been |
210 | * been performed already: the seqno of the skb must not be less than the | 210 | * performed already: the seqno of the skb must not be less than the seqno |
211 | * seqno of loss_prev; and it must not equal that of any valid hist_entry. | 211 | * of loss_prev; and it must not equal that of any valid history entry. |
212 | */ | 212 | */ |
213 | static void __do_track_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u64 n1) | ||
214 | { | ||
215 | u64 s0 = tfrc_rx_hist_loss_prev(h)->tfrchrx_seqno, | ||
216 | s1 = DCCP_SKB_CB(skb)->dccpd_seq; | ||
217 | |||
218 | if (!dccp_loss_free(s0, s1, n1)) { /* gap between S0 and S1 */ | ||
219 | h->loss_count = 1; | ||
220 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 1), skb, n1); | ||
221 | } | ||
222 | } | ||
223 | |||
213 | static void __one_after_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u32 n2) | 224 | static void __one_after_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u32 n2) |
214 | { | 225 | { |
215 | u64 s0 = tfrc_rx_hist_loss_prev(h)->tfrchrx_seqno, | 226 | u64 s0 = tfrc_rx_hist_loss_prev(h)->tfrchrx_seqno, |
216 | s1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_seqno, | 227 | s1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_seqno, |
217 | s2 = DCCP_SKB_CB(skb)->dccpd_seq; | 228 | s2 = DCCP_SKB_CB(skb)->dccpd_seq; |
218 | int n1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_ndp, | ||
219 | d12 = dccp_delta_seqno(s1, s2), d2; | ||
220 | 229 | ||
221 | if (d12 > 0) { /* S1 < S2 */ | 230 | if (likely(dccp_delta_seqno(s1, s2) > 0)) { /* S1 < S2 */ |
222 | h->loss_count = 2; | 231 | h->loss_count = 2; |
223 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 2), skb, n2); | 232 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 2), skb, n2); |
224 | return; | 233 | return; |
225 | } | 234 | } |
226 | 235 | ||
227 | /* S0 < S2 < S1 */ | 236 | /* S0 < S2 < S1 */ |
228 | d2 = dccp_delta_seqno(s0, s2); | ||
229 | 237 | ||
230 | if (d2 == 1 || n2 >= d2) { /* S2 is direct successor of S0 */ | 238 | if (dccp_loss_free(s0, s2, n2)) { |
231 | int d21 = -d12; | 239 | u64 n1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_ndp; |
232 | 240 | ||
233 | if (d21 == 1 || n1 >= d21) { | 241 | if (dccp_loss_free(s2, s1, n1)) { |
234 | /* hole is filled: S0, S2, and S1 are consecutive */ | 242 | /* hole is filled: S0, S2, and S1 are consecutive */ |
235 | h->loss_count = 0; | 243 | h->loss_count = 0; |
236 | h->loss_start = tfrc_rx_hist_index(h, 1); | 244 | h->loss_start = tfrc_rx_hist_index(h, 1); |
@@ -238,9 +246,9 @@ static void __one_after_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u32 n2 | |||
238 | /* gap between S2 and S1: just update loss_prev */ | 246 | /* gap between S2 and S1: just update loss_prev */ |
239 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_loss_prev(h), skb, n2); | 247 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_loss_prev(h), skb, n2); |
240 | 248 | ||
241 | } else { /* hole between S0 and S2 */ | 249 | } else { /* gap between S0 and S2 */ |
242 | /* | 250 | /* |
243 | * Reorder history to insert S2 between S0 and s1 | 251 | * Reorder history to insert S2 between S0 and S1 |
244 | */ | 252 | */ |
245 | tfrc_rx_hist_swap(h, 0, 3); | 253 | tfrc_rx_hist_swap(h, 0, 3); |
246 | h->loss_start = tfrc_rx_hist_index(h, 3); | 254 | h->loss_start = tfrc_rx_hist_index(h, 3); |
@@ -256,22 +264,18 @@ static int __two_after_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u32 n3) | |||
256 | s1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_seqno, | 264 | s1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_seqno, |
257 | s2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_seqno, | 265 | s2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_seqno, |
258 | s3 = DCCP_SKB_CB(skb)->dccpd_seq; | 266 | s3 = DCCP_SKB_CB(skb)->dccpd_seq; |
259 | int n1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_ndp, | ||
260 | d23 = dccp_delta_seqno(s2, s3), d13, d3, d31; | ||
261 | 267 | ||
262 | if (d23 > 0) { /* S2 < S3 */ | 268 | if (likely(dccp_delta_seqno(s2, s3) > 0)) { /* S2 < S3 */ |
263 | h->loss_count = 3; | 269 | h->loss_count = 3; |
264 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 3), skb, n3); | 270 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 3), skb, n3); |
265 | return 1; | 271 | return 1; |
266 | } | 272 | } |
267 | 273 | ||
268 | /* S3 < S2 */ | 274 | /* S3 < S2 */ |
269 | d13 = dccp_delta_seqno(s1, s3); | ||
270 | 275 | ||
271 | if (d13 > 0) { | 276 | if (dccp_delta_seqno(s1, s3) > 0) { /* S1 < S3 < S2 */ |
272 | /* | 277 | /* |
273 | * The sequence number order is S1, S3, S2 | 278 | * Reorder history to insert S3 between S1 and S2 |
274 | * Reorder history to insert entry between S1 and S2 | ||
275 | */ | 279 | */ |
276 | tfrc_rx_hist_swap(h, 2, 3); | 280 | tfrc_rx_hist_swap(h, 2, 3); |
277 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 2), skb, n3); | 281 | tfrc_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 2), skb, n3); |
@@ -280,17 +284,15 @@ static int __two_after_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u32 n3) | |||
280 | } | 284 | } |
281 | 285 | ||
282 | /* S0 < S3 < S1 */ | 286 | /* S0 < S3 < S1 */ |
283 | d31 = -d13; | ||
284 | d3 = dccp_delta_seqno(s0, s3); | ||
285 | 287 | ||
286 | if (d3 == 1 || n3 >= d3) { /* S3 is a successor of S0 */ | 288 | if (dccp_loss_free(s0, s3, n3)) { |
289 | u64 n1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_ndp; | ||
287 | 290 | ||
288 | if (d31 == 1 || n1 >= d31) { | 291 | if (dccp_loss_free(s3, s1, n1)) { |
289 | /* hole between S0 and S1 filled by S3 */ | 292 | /* hole between S0 and S1 filled by S3 */ |
290 | int d2 = dccp_delta_seqno(s1, s2), | 293 | u64 n2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_ndp; |
291 | n2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_ndp; | ||
292 | 294 | ||
293 | if (d2 == 1 || n2 >= d2) { | 295 | if (dccp_loss_free(s1, s2, n2)) { |
294 | /* entire hole filled by S0, S3, S1, S2 */ | 296 | /* entire hole filled by S0, S3, S1, S2 */ |
295 | h->loss_start = tfrc_rx_hist_index(h, 2); | 297 | h->loss_start = tfrc_rx_hist_index(h, 2); |
296 | h->loss_count = 0; | 298 | h->loss_count = 0; |
@@ -307,8 +309,8 @@ static int __two_after_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u32 n3) | |||
307 | } | 309 | } |
308 | 310 | ||
309 | /* | 311 | /* |
310 | * The remaining case: S3 is not a successor of S0. | 312 | * The remaining case: S0 < S3 < S1 < S2; gap between S0 and S3 |
311 | * Sequence order is S0, S3, S1, S2; reorder to insert between S0 and S1 | 313 | * Reorder history to insert S3 between S0 and S1. |
312 | */ | 314 | */ |
313 | tfrc_rx_hist_swap(h, 0, 3); | 315 | tfrc_rx_hist_swap(h, 0, 3); |
314 | h->loss_start = tfrc_rx_hist_index(h, 3); | 316 | h->loss_start = tfrc_rx_hist_index(h, 3); |
@@ -318,33 +320,25 @@ static int __two_after_loss(struct tfrc_rx_hist *h, struct sk_buff *skb, u32 n3) | |||
318 | return 1; | 320 | return 1; |
319 | } | 321 | } |
320 | 322 | ||
321 | /* return the signed modulo-2^48 sequence number distance from entry e1 to e2 */ | ||
322 | static s64 tfrc_rx_hist_delta_seqno(struct tfrc_rx_hist *h, u8 e1, u8 e2) | ||
323 | { | ||
324 | DCCP_BUG_ON(e1 > h->loss_count || e2 > h->loss_count); | ||
325 | |||
326 | return dccp_delta_seqno(tfrc_rx_hist_entry(h, e1)->tfrchrx_seqno, | ||
327 | tfrc_rx_hist_entry(h, e2)->tfrchrx_seqno); | ||
328 | } | ||
329 | |||
330 | /* recycle RX history records to continue loss detection if necessary */ | 323 | /* recycle RX history records to continue loss detection if necessary */ |
331 | static void __three_after_loss(struct tfrc_rx_hist *h) | 324 | static void __three_after_loss(struct tfrc_rx_hist *h) |
332 | { | 325 | { |
333 | /* | 326 | /* |
334 | * The distance between S0 and S1 is always greater than 1 and the NDP | 327 | * At this stage we know already that there is a gap between S0 and S1 |
335 | * count of S1 is smaller than this distance. Otherwise there would | 328 | * (since S0 was the highest sequence number received before detecting |
336 | * have been no loss. Hence it is only necessary to see whether there | 329 | * the loss). To recycle the loss record, it is thus only necessary to |
337 | * are further missing data packets between S1/S2 and S2/S3. | 330 | * check for other possible gaps between S1/S2 and between S2/S3. |
338 | */ | 331 | */ |
339 | int d2 = tfrc_rx_hist_delta_seqno(h, 1, 2), | 332 | u64 s1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_seqno, |
340 | d3 = tfrc_rx_hist_delta_seqno(h, 2, 3), | 333 | s2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_seqno, |
341 | n2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_ndp, | 334 | s3 = tfrc_rx_hist_entry(h, 3)->tfrchrx_seqno; |
335 | u64 n2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_ndp, | ||
342 | n3 = tfrc_rx_hist_entry(h, 3)->tfrchrx_ndp; | 336 | n3 = tfrc_rx_hist_entry(h, 3)->tfrchrx_ndp; |
343 | 337 | ||
344 | if (d2 == 1 || n2 >= d2) { /* S2 is successor to S1 */ | 338 | if (dccp_loss_free(s1, s2, n2)) { |
345 | 339 | ||
346 | if (d3 == 1 || n3 >= d3) { | 340 | if (dccp_loss_free(s2, s3, n3)) { |
347 | /* S3 is successor of S2: entire hole is filled */ | 341 | /* no gap between S2 and S3: entire hole is filled */ |
348 | h->loss_start = tfrc_rx_hist_index(h, 3); | 342 | h->loss_start = tfrc_rx_hist_index(h, 3); |
349 | h->loss_count = 0; | 343 | h->loss_count = 0; |
350 | } else { | 344 | } else { |
@@ -353,7 +347,7 @@ static void __three_after_loss(struct tfrc_rx_hist *h) | |||
353 | h->loss_count = 1; | 347 | h->loss_count = 1; |
354 | } | 348 | } |
355 | 349 | ||
356 | } else { /* gap between S1 and S2 */ | 350 | } else { /* gap between S1 and S2 */ |
357 | h->loss_start = tfrc_rx_hist_index(h, 1); | 351 | h->loss_start = tfrc_rx_hist_index(h, 1); |
358 | h->loss_count = 2; | 352 | h->loss_count = 2; |
359 | } | 353 | } |
@@ -370,15 +364,20 @@ static void __three_after_loss(struct tfrc_rx_hist *h) | |||
370 | * Chooses action according to pending loss, updates LI database when a new | 364 | * Chooses action according to pending loss, updates LI database when a new |
371 | * loss was detected, and does required post-processing. Returns 1 when caller | 365 | * loss was detected, and does required post-processing. Returns 1 when caller |
372 | * should send feedback, 0 otherwise. | 366 | * should send feedback, 0 otherwise. |
367 | * Since it also takes care of reordering during loss detection and updates the | ||
368 | * records accordingly, the caller should not perform any more RX history | ||
369 | * operations when loss_count is greater than 0 after calling this function. | ||
373 | */ | 370 | */ |
374 | int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, | 371 | int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, |
375 | struct tfrc_loss_hist *lh, | 372 | struct tfrc_loss_hist *lh, |
376 | struct sk_buff *skb, u32 ndp, | 373 | struct sk_buff *skb, const u64 ndp, |
377 | u32 (*calc_first_li)(struct sock *), struct sock *sk) | 374 | u32 (*calc_first_li)(struct sock *), struct sock *sk) |
378 | { | 375 | { |
379 | int is_new_loss = 0; | 376 | int is_new_loss = 0; |
380 | 377 | ||
381 | if (h->loss_count == 1) { | 378 | if (h->loss_count == 0) { |
379 | __do_track_loss(h, skb, ndp); | ||
380 | } else if (h->loss_count == 1) { | ||
382 | __one_after_loss(h, skb, ndp); | 381 | __one_after_loss(h, skb, ndp); |
383 | } else if (h->loss_count != 2) { | 382 | } else if (h->loss_count != 2) { |
384 | DCCP_BUG("invalid loss_count %d", h->loss_count); | 383 | DCCP_BUG("invalid loss_count %d", h->loss_count); |
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h index c7eeda49cb20..461cc91cce88 100644 --- a/net/dccp/ccids/lib/packet_history.h +++ b/net/dccp/ccids/lib/packet_history.h | |||
@@ -64,7 +64,7 @@ struct tfrc_rx_hist_entry { | |||
64 | u64 tfrchrx_seqno:48, | 64 | u64 tfrchrx_seqno:48, |
65 | tfrchrx_ccval:4, | 65 | tfrchrx_ccval:4, |
66 | tfrchrx_type:4; | 66 | tfrchrx_type:4; |
67 | u32 tfrchrx_ndp; /* In fact it is from 8 to 24 bits */ | 67 | u64 tfrchrx_ndp:48; |
68 | ktime_t tfrchrx_tstamp; | 68 | ktime_t tfrchrx_tstamp; |
69 | }; | 69 | }; |
70 | 70 | ||
@@ -118,41 +118,21 @@ static inline struct tfrc_rx_hist_entry * | |||
118 | return h->ring[h->loss_start]; | 118 | return h->ring[h->loss_start]; |
119 | } | 119 | } |
120 | 120 | ||
121 | /* initialise loss detection and disable RTT sampling */ | ||
122 | static inline void tfrc_rx_hist_loss_indicated(struct tfrc_rx_hist *h) | ||
123 | { | ||
124 | h->loss_count = 1; | ||
125 | } | ||
126 | |||
127 | /* indicate whether previously a packet was detected missing */ | 121 | /* indicate whether previously a packet was detected missing */ |
128 | static inline int tfrc_rx_hist_loss_pending(const struct tfrc_rx_hist *h) | 122 | static inline bool tfrc_rx_hist_loss_pending(const struct tfrc_rx_hist *h) |
129 | { | ||
130 | return h->loss_count; | ||
131 | } | ||
132 | |||
133 | /* any data packets missing between last reception and skb ? */ | ||
134 | static inline int tfrc_rx_hist_new_loss_indicated(struct tfrc_rx_hist *h, | ||
135 | const struct sk_buff *skb, | ||
136 | u32 ndp) | ||
137 | { | 123 | { |
138 | int delta = dccp_delta_seqno(tfrc_rx_hist_last_rcv(h)->tfrchrx_seqno, | 124 | return h->loss_count > 0; |
139 | DCCP_SKB_CB(skb)->dccpd_seq); | ||
140 | |||
141 | if (delta > 1 && ndp < delta) | ||
142 | tfrc_rx_hist_loss_indicated(h); | ||
143 | |||
144 | return tfrc_rx_hist_loss_pending(h); | ||
145 | } | 125 | } |
146 | 126 | ||
147 | extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, | 127 | extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, |
148 | const struct sk_buff *skb, const u32 ndp); | 128 | const struct sk_buff *skb, const u64 ndp); |
149 | 129 | ||
150 | extern int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb); | 130 | extern int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb); |
151 | 131 | ||
152 | struct tfrc_loss_hist; | 132 | struct tfrc_loss_hist; |
153 | extern int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, | 133 | extern int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, |
154 | struct tfrc_loss_hist *lh, | 134 | struct tfrc_loss_hist *lh, |
155 | struct sk_buff *skb, u32 ndp, | 135 | struct sk_buff *skb, const u64 ndp, |
156 | u32 (*first_li)(struct sock *sk), | 136 | u32 (*first_li)(struct sock *sk), |
157 | struct sock *sk); | 137 | struct sock *sk); |
158 | extern u32 tfrc_rx_hist_sample_rtt(struct tfrc_rx_hist *h, | 138 | extern u32 tfrc_rx_hist_sample_rtt(struct tfrc_rx_hist *h, |