aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/ackvec.c5
-rw-r--r--net/dccp/ccids/ccid2.c2
-rw-r--r--net/dccp/ccids/ccid3.c132
-rw-r--r--net/dccp/ccids/lib/loss_interval.c6
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c7
-rw-r--r--net/dccp/dccp.h17
-rw-r--r--net/dccp/feat.c11
-rw-r--r--net/dccp/input.c25
-rw-r--r--net/dccp/ipv4.c24
-rw-r--r--net/dccp/ipv6.c4
-rw-r--r--net/dccp/minisocks.c7
-rw-r--r--net/dccp/options.c10
-rw-r--r--net/dccp/output.c16
-rw-r--r--net/dccp/proto.c5
14 files changed, 115 insertions, 156 deletions
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index d34badcd012e..1b4b60d8bdec 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -461,9 +461,6 @@ int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
461 return 0; 461 return 0;
462} 462}
463 463
464static char dccp_ackvec_slab_msg[] __initdata =
465 KERN_CRIT "DCCP: Unable to create ack vectors slab caches\n";
466
467int __init dccp_ackvec_init(void) 464int __init dccp_ackvec_init(void)
468{ 465{
469 dccp_ackvec_slab = kmem_cache_create("dccp_ackvec", 466 dccp_ackvec_slab = kmem_cache_create("dccp_ackvec",
@@ -485,7 +482,7 @@ out_destroy_slab:
485 kmem_cache_destroy(dccp_ackvec_slab); 482 kmem_cache_destroy(dccp_ackvec_slab);
486 dccp_ackvec_slab = NULL; 483 dccp_ackvec_slab = NULL;
487out_err: 484out_err:
488 printk(dccp_ackvec_slab_msg); 485 DCCP_CRIT("Unable to create Ack Vector slab cache");
489 return -ENOBUFS; 486 return -ENOBUFS;
490} 487}
491 488
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
422out_invalid_option: 422out_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 }
835found: 821found:
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
19struct dccp_li_hist *dccp_li_hist_new(const char *name) 19struct 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
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 3a94625a1af3..68886986c8e4 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -18,12 +18,17 @@
18#include <net/tcp.h> 18#include <net/tcp.h>
19#include "ackvec.h" 19#include "ackvec.h"
20 20
21#define DCCP_CRIT(fmt, a...) LIMIT_NETDEBUG(KERN_CRIT fmt " at %s:%d/%s()\n", \ 21/*
22 ##a, __FILE__, __LINE__, __FUNCTION__) 22 * DCCP - specific warning and debugging macros.
23#define DCCP_BUG(fmt, a...) do { DCCP_CRIT(fmt, ##a); dump_stack(); } while (0) 23 */
24#define DCCP_BUG_ON(cond) do { if (unlikely((cond) == 0)) \ 24#define DCCP_WARN(fmt, a...) LIMIT_NETDEBUG(KERN_WARNING "%s: " fmt, \
25 DCCP_BUG("BUG: condition \"%s\" fails",\ 25 __FUNCTION__, ##a)
26 __stringify((cond))); \ 26#define DCCP_CRIT(fmt, a...) printk(KERN_CRIT fmt " at %s:%d/%s()\n", ##a, \
27 __FILE__, __LINE__, __FUNCTION__)
28#define DCCP_BUG(a...) do { DCCP_CRIT("BUG: " a); dump_stack(); } while(0)
29#define DCCP_BUG_ON(cond) do { if (unlikely((cond) != 0)) \
30 DCCP_BUG("\"%s\" holds (exception!)", \
31 __stringify(cond)); \
27 } while (0) 32 } while (0)
28 33
29#ifdef MODULE 34#ifdef MODULE
diff --git a/net/dccp/feat.c b/net/dccp/feat.c
index e808c418c992..4dc487f27a1f 100644
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -25,11 +25,11 @@ int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature,
25 dccp_feat_debug(type, feature, *val); 25 dccp_feat_debug(type, feature, *val);
26 26
27 if (!dccp_feat_is_valid_type(type)) { 27 if (!dccp_feat_is_valid_type(type)) {
28 pr_info("option type %d invalid in negotiation\n", type); 28 DCCP_WARN("option type %d invalid in negotiation\n", type);
29 return 1; 29 return 1;
30 } 30 }
31 if (!dccp_feat_is_valid_length(type, feature, len)) { 31 if (!dccp_feat_is_valid_length(type, feature, len)) {
32 pr_info("invalid length %d\n", len); 32 DCCP_WARN("invalid length %d\n", len);
33 return 1; 33 return 1;
34 } 34 }
35 /* XXX add further sanity checks */ 35 /* XXX add further sanity checks */
@@ -169,7 +169,8 @@ static int dccp_feat_reconcile(struct sock *sk, struct dccp_opt_pend *opt,
169 break; 169 break;
170 170
171 default: 171 default:
172 WARN_ON(1); /* XXX implement res */ 172 DCCP_BUG("Fell through, feat=%d", opt->dccpop_feat);
173 /* XXX implement res */
173 return -EFAULT; 174 return -EFAULT;
174 } 175 }
175 176
@@ -328,7 +329,7 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk,
328 switch (type) { 329 switch (type) {
329 case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break; 330 case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break;
330 case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break; 331 case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break;
331 default: pr_info("invalid type %d\n", type); return; 332 default: DCCP_WARN("invalid type %d\n", type); return;
332 333
333 } 334 }
334 opt->dccpop_feat = feature; 335 opt->dccpop_feat = feature;
@@ -426,7 +427,7 @@ int dccp_feat_confirm_recv(struct sock *sk, u8 type, u8 feature,
426 switch (type) { 427 switch (type) {
427 case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break; 428 case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break;
428 case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break; 429 case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break;
429 default: pr_info("invalid type %d\n", type); 430 default: DCCP_WARN("invalid type %d\n", type);
430 return 1; 431 return 1;
431 432
432 } 433 }
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 97ccdc30fd89..7371a2f3acf4 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -128,21 +128,18 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
128 DCCP_PKT_WITHOUT_ACK_SEQ)) 128 DCCP_PKT_WITHOUT_ACK_SEQ))
129 dp->dccps_gar = DCCP_SKB_CB(skb)->dccpd_ack_seq; 129 dp->dccps_gar = DCCP_SKB_CB(skb)->dccpd_ack_seq;
130 } else { 130 } else {
131 LIMIT_NETDEBUG(KERN_WARNING "DCCP: Step 6 failed for %s packet, " 131 DCCP_WARN("DCCP: Step 6 failed for %s packet, "
132 "(LSWL(%llu) <= P.seqno(%llu) <= S.SWH(%llu)) and " 132 "(LSWL(%llu) <= P.seqno(%llu) <= S.SWH(%llu)) and "
133 "(P.ackno %s or LAWL(%llu) <= P.ackno(%llu) <= S.AWH(%llu), " 133 "(P.ackno %s or LAWL(%llu) <= P.ackno(%llu) <= S.AWH(%llu), "
134 "sending SYNC...\n", 134 "sending SYNC...\n", dccp_packet_name(dh->dccph_type),
135 dccp_packet_name(dh->dccph_type), 135 (unsigned long long) lswl,
136 (unsigned long long) lswl, 136 (unsigned long long) DCCP_SKB_CB(skb)->dccpd_seq,
137 (unsigned long long) 137 (unsigned long long) dp->dccps_swh,
138 DCCP_SKB_CB(skb)->dccpd_seq, 138 (DCCP_SKB_CB(skb)->dccpd_ack_seq ==
139 (unsigned long long) dp->dccps_swh,
140 (DCCP_SKB_CB(skb)->dccpd_ack_seq ==
141 DCCP_PKT_WITHOUT_ACK_SEQ) ? "doesn't exist" : "exists", 139 DCCP_PKT_WITHOUT_ACK_SEQ) ? "doesn't exist" : "exists",
142 (unsigned long long) lawl, 140 (unsigned long long) lawl,
143 (unsigned long long) 141 (unsigned long long) DCCP_SKB_CB(skb)->dccpd_ack_seq,
144 DCCP_SKB_CB(skb)->dccpd_ack_seq, 142 (unsigned long long) dp->dccps_awh);
145 (unsigned long long) dp->dccps_awh);
146 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNC); 143 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNC);
147 return -1; 144 return -1;
148 } 145 }
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 7114befe7d50..ff81679c9f17 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -747,7 +747,7 @@ int dccp_invalid_packet(struct sk_buff *skb)
747 747
748 /* If the packet is shorter than 12 bytes, drop packet and return */ 748 /* If the packet is shorter than 12 bytes, drop packet and return */
749 if (!pskb_may_pull(skb, sizeof(struct dccp_hdr))) { 749 if (!pskb_may_pull(skb, sizeof(struct dccp_hdr))) {
750 LIMIT_NETDEBUG(KERN_WARNING "DCCP: pskb_may_pull failed\n"); 750 DCCP_WARN("pskb_may_pull failed\n");
751 return 1; 751 return 1;
752 } 752 }
753 753
@@ -755,7 +755,7 @@ int dccp_invalid_packet(struct sk_buff *skb)
755 755
756 /* If P.type is not understood, drop packet and return */ 756 /* If P.type is not understood, drop packet and return */
757 if (dh->dccph_type >= DCCP_PKT_INVALID) { 757 if (dh->dccph_type >= DCCP_PKT_INVALID) {
758 LIMIT_NETDEBUG(KERN_WARNING "DCCP: invalid packet type\n"); 758 DCCP_WARN("invalid packet type\n");
759 return 1; 759 return 1;
760 } 760 }
761 761
@@ -763,16 +763,14 @@ int dccp_invalid_packet(struct sk_buff *skb)
763 * If P.Data Offset is too small for packet type, drop packet and return 763 * If P.Data Offset is too small for packet type, drop packet and return
764 */ 764 */
765 if (dh->dccph_doff < dccp_hdr_len(skb) / sizeof(u32)) { 765 if (dh->dccph_doff < dccp_hdr_len(skb) / sizeof(u32)) {
766 LIMIT_NETDEBUG(KERN_WARNING "DCCP: P.Data Offset(%u) " 766 DCCP_WARN("P.Data Offset(%u) too small\n", dh->dccph_doff);
767 "too small\n", dh->dccph_doff);
768 return 1; 767 return 1;
769 } 768 }
770 /* 769 /*
771 * If P.Data Offset is too too large for packet, drop packet and return 770 * If P.Data Offset is too too large for packet, drop packet and return
772 */ 771 */
773 if (!pskb_may_pull(skb, dh->dccph_doff * sizeof(u32))) { 772 if (!pskb_may_pull(skb, dh->dccph_doff * sizeof(u32))) {
774 LIMIT_NETDEBUG(KERN_WARNING "DCCP: P.Data Offset(%u) " 773 DCCP_WARN("P.Data Offset(%u) too large\n", dh->dccph_doff);
775 "too large\n", dh->dccph_doff);
776 return 1; 774 return 1;
777 } 775 }
778 776
@@ -782,9 +780,8 @@ int dccp_invalid_packet(struct sk_buff *skb)
782 */ 780 */
783 if (dh->dccph_type >= DCCP_PKT_DATA && 781 if (dh->dccph_type >= DCCP_PKT_DATA &&
784 dh->dccph_type <= DCCP_PKT_DATAACK && dh->dccph_x == 0) { 782 dh->dccph_type <= DCCP_PKT_DATAACK && dh->dccph_x == 0) {
785 LIMIT_NETDEBUG(KERN_WARNING "DCCP: P.type (%s) not Data||Ack||" 783 DCCP_WARN("P.type (%s) not Data || [Data]Ack, while P.X == 0\n",
786 "DataAck, while P.X == 0\n", 784 dccp_packet_name(dh->dccph_type));
787 dccp_packet_name(dh->dccph_type));
788 return 1; 785 return 1;
789 } 786 }
790 787
@@ -794,9 +791,8 @@ int dccp_invalid_packet(struct sk_buff *skb)
794 */ 791 */
795 cscov = dccp_csum_coverage(skb); 792 cscov = dccp_csum_coverage(skb);
796 if (cscov > skb->len) { 793 if (cscov > skb->len) {
797 LIMIT_NETDEBUG(KERN_WARNING 794 DCCP_WARN("P.CsCov %u exceeds packet length %d\n",
798 "DCCP: P.CsCov %u exceeds packet length %d\n", 795 dh->dccph_cscov, skb->len);
799 dh->dccph_cscov, skb->len);
800 return 1; 796 return 1;
801 } 797 }
802 798
@@ -823,9 +819,7 @@ static int dccp_v4_rcv(struct sk_buff *skb)
823 819
824 /* Step 1: If header checksum is incorrect, drop packet and return */ 820 /* Step 1: If header checksum is incorrect, drop packet and return */
825 if (dccp_v4_csum_finish(skb, skb->nh.iph->saddr, skb->nh.iph->daddr)) { 821 if (dccp_v4_csum_finish(skb, skb->nh.iph->saddr, skb->nh.iph->daddr)) {
826 LIMIT_NETDEBUG(KERN_WARNING 822 DCCP_WARN("dropped packet with invalid checksum\n");
827 "%s: dropped packet with invalid checksum\n",
828 __FUNCTION__);
829 goto discard_it; 823 goto discard_it;
830 } 824 }
831 825
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 03bb8298250a..c7aaa2574f52 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -828,9 +828,7 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
828 /* Step 1: If header checksum is incorrect, drop packet and return. */ 828 /* Step 1: If header checksum is incorrect, drop packet and return. */
829 if (dccp_v6_csum_finish(skb, &skb->nh.ipv6h->saddr, 829 if (dccp_v6_csum_finish(skb, &skb->nh.ipv6h->saddr,
830 &skb->nh.ipv6h->daddr)) { 830 &skb->nh.ipv6h->daddr)) {
831 LIMIT_NETDEBUG(KERN_WARNING 831 DCCP_WARN("dropped packet with invalid checksum\n");
832 "%s: dropped packet with invalid checksum\n",
833 __FUNCTION__);
834 goto discard_it; 832 goto discard_it;
835 } 833 }
836 834
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 3975048d8094..7b52f2a03eef 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -84,8 +84,7 @@ void dccp_time_wait(struct sock *sk, int state, int timeo)
84 * socket up. We've got bigger problems than 84 * socket up. We've got bigger problems than
85 * non-graceful socket closings. 85 * non-graceful socket closings.
86 */ 86 */
87 LIMIT_NETDEBUG(KERN_INFO "DCCP: time wait bucket " 87 DCCP_WARN("time wait bucket table overflow\n");
88 "table overflow\n");
89 } 88 }
90 89
91 dccp_done(sk); 90 dccp_done(sk);
@@ -289,9 +288,7 @@ EXPORT_SYMBOL_GPL(dccp_child_process);
289 288
290void dccp_reqsk_send_ack(struct sk_buff *skb, struct request_sock *rsk) 289void dccp_reqsk_send_ack(struct sk_buff *skb, struct request_sock *rsk)
291{ 290{
292 pr_info(KERN_WARNING "DCCP: ACK packets are never sent in " 291 DCCP_BUG("DCCP-ACK packets are never sent in LISTEN/RESPOND state");
293 "LISTEN/RESPOND state\n");
294 dump_stack();
295} 292}
296 293
297EXPORT_SYMBOL_GPL(dccp_reqsk_send_ack); 294EXPORT_SYMBOL_GPL(dccp_reqsk_send_ack);
diff --git a/net/dccp/options.c b/net/dccp/options.c
index 7e50678e2471..ee709ae0a97f 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -238,9 +238,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
238 } 238 }
239 break; 239 break;
240 default: 240 default:
241 pr_info("DCCP(%p): option %d(len=%d) not " 241 DCCP_CRIT("DCCP(%p): option %d(len=%d) not "
242 "implemented, ignoring\n", 242 "implemented, ignoring", sk, opt, len);
243 sk, opt, len);
244 break; 243 break;
245 } 244 }
246 245
@@ -257,7 +256,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
257out_invalid_option: 256out_invalid_option:
258 DCCP_INC_STATS_BH(DCCP_MIB_INVALIDOPT); 257 DCCP_INC_STATS_BH(DCCP_MIB_INVALIDOPT);
259 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_OPTION_ERROR; 258 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_OPTION_ERROR;
260 pr_info("DCCP(%p): invalid option %d, len=%d\n", sk, opt, len); 259 DCCP_WARN("DCCP(%p): invalid option %d, len=%d", sk, opt, len);
261 return -1; 260 return -1;
262} 261}
263 262
@@ -447,8 +446,7 @@ static int dccp_insert_feat_opt(struct sk_buff *skb, u8 type, u8 feat,
447 u8 *to; 446 u8 *to;
448 447
449 if (DCCP_SKB_CB(skb)->dccpd_opt_len + len + 3 > DCCP_MAX_OPT_LEN) { 448 if (DCCP_SKB_CB(skb)->dccpd_opt_len + len + 3 > DCCP_MAX_OPT_LEN) {
450 LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small" 449 DCCP_WARN("packet too small for feature %d option!\n", feat);
451 " to insert feature %d option!\n", feat);
452 return -1; 450 return -1;
453 } 451 }
454 452
diff --git a/net/dccp/output.c b/net/dccp/output.c
index c34eada7f025..bfd9c5757897 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -257,11 +257,8 @@ void dccp_write_xmit(struct sock *sk, int block)
257 err = dccp_wait_for_ccid(sk, skb, &timeo); 257 err = dccp_wait_for_ccid(sk, skb, &timeo);
258 timeo = DCCP_XMIT_TIMEO; 258 timeo = DCCP_XMIT_TIMEO;
259 } 259 }
260 if (err) { 260 if (err)
261 printk(KERN_CRIT "%s:err at dccp_wait_for_ccid" 261 DCCP_BUG("err=%d after dccp_wait_for_ccid", err);
262 " %d\n", __FUNCTION__, err);
263 dump_stack();
264 }
265 } 262 }
266 263
267 skb_dequeue(&sk->sk_write_queue); 264 skb_dequeue(&sk->sk_write_queue);
@@ -283,12 +280,9 @@ void dccp_write_xmit(struct sock *sk, int block)
283 280
284 err = dccp_transmit_skb(sk, skb); 281 err = dccp_transmit_skb(sk, skb);
285 ccid_hc_tx_packet_sent(dp->dccps_hc_tx_ccid, sk, 0, len); 282 ccid_hc_tx_packet_sent(dp->dccps_hc_tx_ccid, sk, 0, len);
286 if (err) { 283 if (err)
287 printk(KERN_CRIT "%s:err from " 284 DCCP_BUG("err=%d after ccid_hc_tx_packet_sent",
288 "ccid_hc_tx_packet_sent %d\n", 285 err);
289 __FUNCTION__, err);
290 dump_stack();
291 }
292 } else 286 } else
293 kfree(skb); 287 kfree(skb);
294 } 288 }
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index a7f345c8d0db..3c44d502e5c1 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -1033,8 +1033,7 @@ static int __init dccp_init(void)
1033 } while (!dccp_hashinfo.ehash && --ehash_order > 0); 1033 } while (!dccp_hashinfo.ehash && --ehash_order > 0);
1034 1034
1035 if (!dccp_hashinfo.ehash) { 1035 if (!dccp_hashinfo.ehash) {
1036 printk(KERN_CRIT "Failed to allocate DCCP " 1036 DCCP_CRIT("Failed to allocate DCCP established hash table");
1037 "established hash table\n");
1038 goto out_free_bind_bucket_cachep; 1037 goto out_free_bind_bucket_cachep;
1039 } 1038 }
1040 1039
@@ -1056,7 +1055,7 @@ static int __init dccp_init(void)
1056 } while (!dccp_hashinfo.bhash && --bhash_order >= 0); 1055 } while (!dccp_hashinfo.bhash && --bhash_order >= 0);
1057 1056
1058 if (!dccp_hashinfo.bhash) { 1057 if (!dccp_hashinfo.bhash) {
1059 printk(KERN_CRIT "Failed to allocate DCCP bind hash table\n"); 1058 DCCP_CRIT("Failed to allocate DCCP bind hash table");
1060 goto out_free_dccp_ehash; 1059 goto out_free_dccp_ehash;
1061 } 1060 }
1062 1061