diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-11-20 15:39:23 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:24:38 -0500 |
commit | 59348b19efebfd6a8d0791ff81d207b16594c94b (patch) | |
tree | a9212a7bf62bd594cf02d23b9e33eb45a46d414d /net/dccp/ccids | |
parent | b1308dc015eb09cf094ca169296738a13ae049ad (diff) |
[DCCP]: Simplified conditions due to use of enum:8 states
This reaps the benefit of the earlier patch, which changed the type of
CCID 3 states to use enums, in that many conditions are now simplified
and the number of possible (unexpected) values is greatly reduced.
In a few instances, this also allowed to simplify pre-conditions; where
care has been taken to retain logical equivalence.
[DCCP]: Introduce a consistent BUG/WARN message scheme
This refines the existing set of DCCP messages so that
* BUG(), BUG_ON(), WARN_ON() have meaningful DCCP-specific counterparts
* DCCP_CRIT (for severe warnings) is not rate-limited
* DCCP_WARN() is introduced as rate-limited wrapper
Using these allows a faster and cleaner transition to their original
counterparts once the code has matured into a full DCCP implementation.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r-- | net/dccp/ccids/ccid2.c | 2 | ||||
-rw-r--r-- | net/dccp/ccids/ccid3.c | 132 | ||||
-rw-r--r-- | net/dccp/ccids/lib/loss_interval.c | 6 | ||||
-rw-r--r-- | net/dccp/ccids/lib/tfrc_equation.c | 7 |
4 files changed, 63 insertions, 84 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 0fb0d66544a2..207f7f9b36ca 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -420,7 +420,7 @@ static int ccid2_ackvector(struct sock *sk, struct sk_buff *skb, int offset, | |||
420 | return -1; | 420 | return -1; |
421 | 421 | ||
422 | out_invalid_option: | 422 | out_invalid_option: |
423 | BUG_ON(1); /* should never happen... options were previously parsed ! */ | 423 | DCCP_BUG("Invalid option - this should not happen (previous parsing)!"); |
424 | return -1; | 424 | return -1; |
425 | } | 425 | } |
426 | 426 | ||
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 7db801ec1ab9..4eada515b773 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -176,8 +176,6 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
176 | ccid3_tx_state_name(hctx->ccid3hctx_state)); | 176 | ccid3_tx_state_name(hctx->ccid3hctx_state)); |
177 | 177 | ||
178 | switch (hctx->ccid3hctx_state) { | 178 | switch (hctx->ccid3hctx_state) { |
179 | case TFRC_SSTATE_TERM: | ||
180 | goto out; | ||
181 | case TFRC_SSTATE_NO_FBACK: | 179 | case TFRC_SSTATE_NO_FBACK: |
182 | /* Halve send rate */ | 180 | /* Halve send rate */ |
183 | hctx->ccid3hctx_x /= 2; | 181 | hctx->ccid3hctx_x /= 2; |
@@ -240,9 +238,10 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
240 | 2 * usecs_div(hctx->ccid3hctx_s, | 238 | 2 * usecs_div(hctx->ccid3hctx_s, |
241 | hctx->ccid3hctx_x)); | 239 | hctx->ccid3hctx_x)); |
242 | break; | 240 | break; |
243 | default: | 241 | case TFRC_SSTATE_NO_SENT: |
244 | DCCP_BUG("%s, sk=%p, Illegal state (%d)!", dccp_role(sk), sk, | 242 | DCCP_BUG("Illegal %s state NO_SENT, sk=%p", dccp_role(sk), sk); |
245 | hctx->ccid3hctx_state); | 243 | /* fall through */ |
244 | case TFRC_SSTATE_TERM: | ||
246 | goto out; | 245 | goto out; |
247 | } | 246 | } |
248 | 247 | ||
@@ -264,7 +263,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, | |||
264 | long delay; | 263 | long delay; |
265 | int rc = -ENOTCONN; | 264 | int rc = -ENOTCONN; |
266 | 265 | ||
267 | BUG_ON(hctx == NULL || hctx->ccid3hctx_state == TFRC_SSTATE_TERM); | 266 | BUG_ON(hctx == NULL); |
268 | 267 | ||
269 | /* Check if pure ACK or Terminating*/ | 268 | /* Check if pure ACK or Terminating*/ |
270 | /* | 269 | /* |
@@ -282,9 +281,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, | |||
282 | 281 | ||
283 | rc = -ENOBUFS; | 282 | rc = -ENOBUFS; |
284 | if (unlikely(new_packet == NULL)) { | 283 | if (unlikely(new_packet == NULL)) { |
285 | LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, not enough " | 284 | DCCP_WARN("%s, sk=%p, not enough mem to add to history," |
286 | "mem to add to history, send refused\n", | 285 | "send refused\n", dccp_role(sk), sk); |
287 | __FUNCTION__, dccp_role(sk), sk); | ||
288 | goto out; | 286 | goto out; |
289 | } | 287 | } |
290 | 288 | ||
@@ -317,9 +315,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, | |||
317 | /* divide by -1000 is to convert to ms and get sign right */ | 315 | /* divide by -1000 is to convert to ms and get sign right */ |
318 | rc = delay > 0 ? delay : 0; | 316 | rc = delay > 0 ? delay : 0; |
319 | break; | 317 | break; |
320 | default: | 318 | case TFRC_SSTATE_TERM: |
321 | DCCP_BUG("%s, sk=%p, Illegal state (%d)!", dccp_role(sk), sk, | 319 | DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk); |
322 | hctx->ccid3hctx_state); | ||
323 | rc = -EINVAL; | 320 | rc = -EINVAL; |
324 | break; | 321 | break; |
325 | } | 322 | } |
@@ -343,7 +340,7 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len) | |||
343 | struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | 340 | struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); |
344 | struct timeval now; | 341 | struct timeval now; |
345 | 342 | ||
346 | BUG_ON(hctx == NULL || hctx->ccid3hctx_state == TFRC_SSTATE_TERM); | 343 | BUG_ON(hctx == NULL); |
347 | 344 | ||
348 | dccp_timestamp(sk, &now); | 345 | dccp_timestamp(sk, &now); |
349 | 346 | ||
@@ -354,13 +351,11 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len) | |||
354 | 351 | ||
355 | packet = dccp_tx_hist_head(&hctx->ccid3hctx_hist); | 352 | packet = dccp_tx_hist_head(&hctx->ccid3hctx_hist); |
356 | if (unlikely(packet == NULL)) { | 353 | if (unlikely(packet == NULL)) { |
357 | LIMIT_NETDEBUG(KERN_WARNING "%s: packet doesn't " | 354 | DCCP_WARN("packet doesn't exist in history!\n"); |
358 | "exists in history!\n", __FUNCTION__); | ||
359 | return; | 355 | return; |
360 | } | 356 | } |
361 | if (unlikely(packet->dccphtx_sent)) { | 357 | if (unlikely(packet->dccphtx_sent)) { |
362 | LIMIT_NETDEBUG(KERN_WARNING "%s: no unsent packet in " | 358 | DCCP_WARN("no unsent packet in history!\n"); |
363 | "history!\n", __FUNCTION__); | ||
364 | return; | 359 | return; |
365 | } | 360 | } |
366 | packet->dccphtx_tstamp = now; | 361 | packet->dccphtx_tstamp = now; |
@@ -395,9 +390,8 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len) | |||
395 | case TFRC_SSTATE_NO_SENT: | 390 | case TFRC_SSTATE_NO_SENT: |
396 | /* if first wasn't pure ack */ | 391 | /* if first wasn't pure ack */ |
397 | if (len != 0) | 392 | if (len != 0) |
398 | printk(KERN_CRIT "%s: %s, First packet sent is noted " | 393 | DCCP_CRIT("%s, First packet sent is noted " |
399 | "as a data packet\n", | 394 | "as a data packet", dccp_role(sk)); |
400 | __FUNCTION__, dccp_role(sk)); | ||
401 | return; | 395 | return; |
402 | case TFRC_SSTATE_NO_FBACK: | 396 | case TFRC_SSTATE_NO_FBACK: |
403 | case TFRC_SSTATE_FBACK: | 397 | case TFRC_SSTATE_FBACK: |
@@ -410,9 +404,8 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len) | |||
410 | hctx->ccid3hctx_t_ipi); | 404 | hctx->ccid3hctx_t_ipi); |
411 | } | 405 | } |
412 | break; | 406 | break; |
413 | default: | 407 | case TFRC_SSTATE_TERM: |
414 | DCCP_BUG("%s, sk=%p, Illegal state (%d)!", dccp_role(sk), sk, | 408 | DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk); |
415 | hctx->ccid3hctx_state); | ||
416 | break; | 409 | break; |
417 | } | 410 | } |
418 | } | 411 | } |
@@ -430,7 +423,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
430 | u32 x_recv; | 423 | u32 x_recv; |
431 | u32 r_sample; | 424 | u32 r_sample; |
432 | 425 | ||
433 | BUG_ON(hctx == NULL || hctx->ccid3hctx_state == TFRC_SSTATE_TERM); | 426 | BUG_ON(hctx == NULL); |
434 | 427 | ||
435 | /* we are only interested in ACKs */ | 428 | /* we are only interested in ACKs */ |
436 | if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK || | 429 | if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK || |
@@ -455,11 +448,10 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
455 | packet = dccp_tx_hist_find_entry(&hctx->ccid3hctx_hist, | 448 | packet = dccp_tx_hist_find_entry(&hctx->ccid3hctx_hist, |
456 | DCCP_SKB_CB(skb)->dccpd_ack_seq); | 449 | DCCP_SKB_CB(skb)->dccpd_ack_seq); |
457 | if (unlikely(packet == NULL)) { | 450 | if (unlikely(packet == NULL)) { |
458 | LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, seqno " | 451 | DCCP_WARN("%s, sk=%p, seqno %llu(%s) does't exist " |
459 | "%llu(%s) does't exist in history!\n", | 452 | "in history!\n", dccp_role(sk), sk, |
460 | __FUNCTION__, dccp_role(sk), sk, | ||
461 | (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, | 453 | (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, |
462 | dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type)); | 454 | dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type)); |
463 | return; | 455 | return; |
464 | } | 456 | } |
465 | 457 | ||
@@ -467,9 +459,8 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
467 | dccp_timestamp(sk, &now); | 459 | dccp_timestamp(sk, &now); |
468 | r_sample = timeval_delta(&now, &packet->dccphtx_tstamp); | 460 | r_sample = timeval_delta(&now, &packet->dccphtx_tstamp); |
469 | if (unlikely(r_sample <= t_elapsed)) | 461 | if (unlikely(r_sample <= t_elapsed)) |
470 | LIMIT_NETDEBUG(KERN_WARNING "%s: r_sample=%uus, " | 462 | DCCP_WARN("r_sample=%uus,t_elapsed=%uus\n", |
471 | "t_elapsed=%uus\n", | 463 | r_sample, t_elapsed); |
472 | __FUNCTION__, r_sample, t_elapsed); | ||
473 | else | 464 | else |
474 | r_sample -= t_elapsed; | 465 | r_sample -= t_elapsed; |
475 | 466 | ||
@@ -554,9 +545,8 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
554 | /* set idle flag */ | 545 | /* set idle flag */ |
555 | hctx->ccid3hctx_idle = 1; | 546 | hctx->ccid3hctx_idle = 1; |
556 | break; | 547 | break; |
557 | default: | 548 | case TFRC_SSTATE_TERM: |
558 | DCCP_BUG("%s, sk=%p, Illegal state (%d)!", dccp_role(sk), sk, | 549 | DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk); |
559 | hctx->ccid3hctx_state); | ||
560 | break; | 550 | break; |
561 | } | 551 | } |
562 | } | 552 | } |
@@ -596,9 +586,9 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option, | |||
596 | switch (option) { | 586 | switch (option) { |
597 | case TFRC_OPT_LOSS_EVENT_RATE: | 587 | case TFRC_OPT_LOSS_EVENT_RATE: |
598 | if (unlikely(len != 4)) { | 588 | if (unlikely(len != 4)) { |
599 | LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, invalid " | 589 | DCCP_WARN("%s, sk=%p, invalid len %d " |
600 | "len for TFRC_OPT_LOSS_EVENT_RATE\n", | 590 | "for TFRC_OPT_LOSS_EVENT_RATE\n", |
601 | __FUNCTION__, dccp_role(sk), sk); | 591 | dccp_role(sk), sk, len); |
602 | rc = -EINVAL; | 592 | rc = -EINVAL; |
603 | } else { | 593 | } else { |
604 | opt_recv->ccid3or_loss_event_rate = ntohl(*(__be32 *)value); | 594 | opt_recv->ccid3or_loss_event_rate = ntohl(*(__be32 *)value); |
@@ -617,9 +607,9 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option, | |||
617 | break; | 607 | break; |
618 | case TFRC_OPT_RECEIVE_RATE: | 608 | case TFRC_OPT_RECEIVE_RATE: |
619 | if (unlikely(len != 4)) { | 609 | if (unlikely(len != 4)) { |
620 | LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, invalid " | 610 | DCCP_WARN("%s, sk=%p, invalid len %d " |
621 | "len for TFRC_OPT_RECEIVE_RATE\n", | 611 | "for TFRC_OPT_RECEIVE_RATE\n", |
622 | __FUNCTION__, dccp_role(sk), sk); | 612 | dccp_role(sk), sk, len); |
623 | rc = -EINVAL; | 613 | rc = -EINVAL; |
624 | } else { | 614 | } else { |
625 | opt_recv->ccid3or_receive_rate = ntohl(*(__be32 *)value); | 615 | opt_recv->ccid3or_receive_rate = ntohl(*(__be32 *)value); |
@@ -722,17 +712,15 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk) | |||
722 | delta); | 712 | delta); |
723 | } | 713 | } |
724 | break; | 714 | break; |
725 | default: | 715 | case TFRC_RSTATE_TERM: |
726 | DCCP_BUG("%s, sk=%p, Illegal state (%d)!", dccp_role(sk), sk, | 716 | DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk); |
727 | hcrx->ccid3hcrx_state); | ||
728 | return; | 717 | return; |
729 | } | 718 | } |
730 | 719 | ||
731 | packet = dccp_rx_hist_find_data_packet(&hcrx->ccid3hcrx_hist); | 720 | packet = dccp_rx_hist_find_data_packet(&hcrx->ccid3hcrx_hist); |
732 | if (unlikely(packet == NULL)) { | 721 | if (unlikely(packet == NULL)) { |
733 | LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, no data packet " | 722 | DCCP_WARN("%s, sk=%p, no data packet in history!\n", |
734 | "in history!\n", | 723 | dccp_role(sk), sk); |
735 | __FUNCTION__, dccp_role(sk), sk); | ||
736 | return; | 724 | return; |
737 | } | 725 | } |
738 | 726 | ||
@@ -820,29 +808,29 @@ static u32 ccid3_hc_rx_calc_first_li(struct sock *sk) | |||
820 | } | 808 | } |
821 | 809 | ||
822 | if (unlikely(step == 0)) { | 810 | if (unlikely(step == 0)) { |
823 | LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, packet history " | 811 | DCCP_WARN("%s, sk=%p, packet history has no data packets!\n", |
824 | "contains no data packets!\n", | 812 | dccp_role(sk), sk); |
825 | __FUNCTION__, dccp_role(sk), sk); | ||
826 | return ~0; | 813 | return ~0; |
827 | } | 814 | } |
828 | 815 | ||
829 | if (unlikely(interval == 0)) { | 816 | if (unlikely(interval == 0)) { |
830 | LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, Could not find a " | 817 | DCCP_WARN("%s, sk=%p, Could not find a win_count interval > 0." |
831 | "win_count interval > 0. Defaulting to 1\n", | 818 | "Defaulting to 1\n", dccp_role(sk), sk); |
832 | __FUNCTION__, dccp_role(sk), sk); | ||
833 | interval = 1; | 819 | interval = 1; |
834 | } | 820 | } |
835 | found: | 821 | found: |
836 | if (!tail) { | 822 | if (!tail) { |
837 | LIMIT_NETDEBUG(KERN_WARNING "%s: tail is null\n", | 823 | DCCP_CRIT("tail is null\n"); |
838 | __FUNCTION__); | ||
839 | return ~0; | 824 | return ~0; |
840 | } | 825 | } |
841 | rtt = timeval_delta(&tstamp, &tail->dccphrx_tstamp) * 4 / interval; | 826 | rtt = timeval_delta(&tstamp, &tail->dccphrx_tstamp) * 4 / interval; |
842 | ccid3_pr_debug("%s, sk=%p, approximated RTT to %uus\n", | 827 | ccid3_pr_debug("%s, sk=%p, approximated RTT to %uus\n", |
843 | dccp_role(sk), sk, rtt); | 828 | dccp_role(sk), sk, rtt); |
844 | if (rtt == 0) | 829 | |
845 | rtt = 1; | 830 | if (rtt == 0) { |
831 | DCCP_WARN("RTT==0, setting to 1\n"); | ||
832 | rtt = 1; | ||
833 | } | ||
846 | 834 | ||
847 | dccp_timestamp(sk, &tstamp); | 835 | dccp_timestamp(sk, &tstamp); |
848 | delta = timeval_delta(&tstamp, &hcrx->ccid3hcrx_tstamp_last_feedback); | 836 | delta = timeval_delta(&tstamp, &hcrx->ccid3hcrx_tstamp_last_feedback); |
@@ -856,9 +844,7 @@ found: | |||
856 | tmp2 = (u32)tmp1; | 844 | tmp2 = (u32)tmp1; |
857 | 845 | ||
858 | if (!tmp2) { | 846 | if (!tmp2) { |
859 | LIMIT_NETDEBUG(KERN_WARNING "tmp2 = 0 " | 847 | DCCP_CRIT("tmp2 = 0, x_recv = %u, rtt =%u\n", x_recv, rtt); |
860 | "%s: x_recv = %u, rtt =%u\n", | ||
861 | __FUNCTION__, x_recv, rtt); | ||
862 | return ~0; | 848 | return ~0; |
863 | } | 849 | } |
864 | 850 | ||
@@ -904,8 +890,7 @@ static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss) | |||
904 | entry = dccp_li_hist_entry_new(ccid3_li_hist, SLAB_ATOMIC); | 890 | entry = dccp_li_hist_entry_new(ccid3_li_hist, SLAB_ATOMIC); |
905 | 891 | ||
906 | if (entry == NULL) { | 892 | if (entry == NULL) { |
907 | printk(KERN_CRIT "%s: out of memory\n",__FUNCTION__); | 893 | DCCP_BUG("out of memory - can not allocate entry"); |
908 | dump_stack(); | ||
909 | return; | 894 | return; |
910 | } | 895 | } |
911 | 896 | ||
@@ -984,9 +969,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
984 | u32 p_prev, rtt_prev, r_sample, t_elapsed; | 969 | u32 p_prev, rtt_prev, r_sample, t_elapsed; |
985 | int loss; | 970 | int loss; |
986 | 971 | ||
987 | BUG_ON(hcrx == NULL || | 972 | BUG_ON(hcrx == NULL); |
988 | !(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA || | ||
989 | hcrx->ccid3hcrx_state == TFRC_RSTATE_DATA)); | ||
990 | 973 | ||
991 | opt_recv = &dccp_sk(sk)->dccps_options_received; | 974 | opt_recv = &dccp_sk(sk)->dccps_options_received; |
992 | 975 | ||
@@ -1004,9 +987,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1004 | t_elapsed = opt_recv->dccpor_elapsed_time * 10; | 987 | t_elapsed = opt_recv->dccpor_elapsed_time * 10; |
1005 | 988 | ||
1006 | if (unlikely(r_sample <= t_elapsed)) | 989 | if (unlikely(r_sample <= t_elapsed)) |
1007 | LIMIT_NETDEBUG(KERN_WARNING "%s: r_sample=%uus, " | 990 | DCCP_WARN("r_sample=%uus, t_elapsed=%uus\n", |
1008 | "t_elapsed=%uus\n", | 991 | r_sample, t_elapsed); |
1009 | __FUNCTION__, r_sample, t_elapsed); | ||
1010 | else | 992 | else |
1011 | r_sample -= t_elapsed; | 993 | r_sample -= t_elapsed; |
1012 | 994 | ||
@@ -1030,9 +1012,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1030 | packet = dccp_rx_hist_entry_new(ccid3_rx_hist, sk, opt_recv->dccpor_ndp, | 1012 | packet = dccp_rx_hist_entry_new(ccid3_rx_hist, sk, opt_recv->dccpor_ndp, |
1031 | skb, SLAB_ATOMIC); | 1013 | skb, SLAB_ATOMIC); |
1032 | if (unlikely(packet == NULL)) { | 1014 | if (unlikely(packet == NULL)) { |
1033 | LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, Not enough mem to " | 1015 | DCCP_WARN("%s, sk=%p, Not enough mem to add rx packet " |
1034 | "add rx packet to history, consider it lost!\n", | 1016 | "to history, consider it lost!\n", dccp_role(sk), sk); |
1035 | __FUNCTION__, dccp_role(sk), sk); | ||
1036 | return; | 1017 | return; |
1037 | } | 1018 | } |
1038 | 1019 | ||
@@ -1065,9 +1046,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1065 | ccid3_hc_rx_send_feedback(sk); | 1046 | ccid3_hc_rx_send_feedback(sk); |
1066 | } | 1047 | } |
1067 | return; | 1048 | return; |
1068 | default: | 1049 | case TFRC_RSTATE_TERM: |
1069 | DCCP_BUG("%s, sk=%p, Illegal state (%d)!", dccp_role(sk), sk, | 1050 | DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk); |
1070 | hcrx->ccid3hcrx_state); | ||
1071 | return; | 1051 | return; |
1072 | } | 1052 | } |
1073 | 1053 | ||
@@ -1084,10 +1064,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1084 | /* Scaling up by 1000000 as fixed decimal */ | 1064 | /* Scaling up by 1000000 as fixed decimal */ |
1085 | if (i_mean != 0) | 1065 | if (i_mean != 0) |
1086 | hcrx->ccid3hcrx_p = 1000000 / i_mean; | 1066 | hcrx->ccid3hcrx_p = 1000000 / i_mean; |
1087 | } else { | 1067 | } else |
1088 | printk(KERN_CRIT "%s: empty loss hist\n",__FUNCTION__); | 1068 | DCCP_BUG("empty loss history"); |
1089 | dump_stack(); | ||
1090 | } | ||
1091 | 1069 | ||
1092 | if (hcrx->ccid3hcrx_p > p_prev) { | 1070 | if (hcrx->ccid3hcrx_p > p_prev) { |
1093 | ccid3_hc_rx_send_feedback(sk); | 1071 | ccid3_hc_rx_send_feedback(sk); |
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c index 906c81ab9d4f..48b9b93f8acb 100644 --- a/net/dccp/ccids/lib/loss_interval.c +++ b/net/dccp/ccids/lib/loss_interval.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <net/sock.h> | 15 | #include <net/sock.h> |
16 | 16 | #include "../../dccp.h" | |
17 | #include "loss_interval.h" | 17 | #include "loss_interval.h" |
18 | 18 | ||
19 | struct dccp_li_hist *dccp_li_hist_new(const char *name) | 19 | struct dccp_li_hist *dccp_li_hist_new(const char *name) |
@@ -109,7 +109,7 @@ u32 dccp_li_hist_calc_i_mean(struct list_head *list) | |||
109 | i_tot = max(i_tot0, i_tot1); | 109 | i_tot = max(i_tot0, i_tot1); |
110 | 110 | ||
111 | if (!w_tot) { | 111 | if (!w_tot) { |
112 | LIMIT_NETDEBUG(KERN_WARNING "%s: w_tot = 0\n", __FUNCTION__); | 112 | DCCP_WARN("w_tot = 0\n"); |
113 | return 1; | 113 | return 1; |
114 | } | 114 | } |
115 | 115 | ||
@@ -128,7 +128,7 @@ int dccp_li_hist_interval_new(struct dccp_li_hist *hist, | |||
128 | entry = dccp_li_hist_entry_new(hist, SLAB_ATOMIC); | 128 | entry = dccp_li_hist_entry_new(hist, SLAB_ATOMIC); |
129 | if (entry == NULL) { | 129 | if (entry == NULL) { |
130 | dccp_li_hist_purge(hist, list); | 130 | dccp_li_hist_purge(hist, list); |
131 | dump_stack(); | 131 | DCCP_BUG("loss interval list entry is NULL"); |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | entry->dccplih_interval = ~0; | 134 | entry->dccplih_interval = ~0; |
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c index 44076e0c6591..2601012383fb 100644 --- a/net/dccp/ccids/lib/tfrc_equation.c +++ b/net/dccp/ccids/lib/tfrc_equation.c | |||
@@ -13,9 +13,8 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | |||
17 | #include <asm/div64.h> | 16 | #include <asm/div64.h> |
18 | 17 | #include "../../dccp.h" | |
19 | #include "tfrc.h" | 18 | #include "tfrc.h" |
20 | 19 | ||
21 | #define TFRC_CALC_X_ARRSIZE 500 | 20 | #define TFRC_CALC_X_ARRSIZE 500 |
@@ -588,8 +587,10 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p) | |||
588 | /* p should be 0 unless there is a bug in my code */ | 587 | /* p should be 0 unless there is a bug in my code */ |
589 | index = 0; | 588 | index = 0; |
590 | 589 | ||
591 | if (R == 0) | 590 | if (R == 0) { |
591 | DCCP_WARN("RTT==0, setting to 1\n"); | ||
592 | R = 1; /* RTT can't be zero or else divide by zero */ | 592 | R = 1; /* RTT can't be zero or else divide by zero */ |
593 | } | ||
593 | 594 | ||
594 | BUG_ON(index >= TFRC_CALC_X_ARRSIZE); | 595 | BUG_ON(index >= TFRC_CALC_X_ARRSIZE); |
595 | 596 | ||