Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge master.kernel.org:/pub/scm/linux/kernel/git/acme/net-2.6

+70 -105
+68 -98
net/dccp/ccids/ccid3.c
··· 78 78 79 79 static int ccid3_init(struct sock *sk) 80 80 { 81 - ccid3_pr_debug("%s, sk=%p\n", dccp_role(sk), sk); 82 81 return 0; 83 82 } 84 83 85 84 static void ccid3_exit(struct sock *sk) 86 85 { 87 - ccid3_pr_debug("%s, sk=%p\n", dccp_role(sk), sk); 88 86 } 89 87 90 88 /* TFRC sender states */ ··· 285 287 long delay; 286 288 int rc = -ENOTCONN; 287 289 288 - /* Check if pure ACK or Terminating*/ 290 + BUG_ON(hctx == NULL || hctx->ccid3hctx_state == TFRC_SSTATE_TERM); 289 291 292 + /* Check if pure ACK or Terminating*/ 290 293 /* 291 294 * XXX: We only call this function for DATA and DATAACK, on, these 292 295 * packets can have zero length, but why the comment about "pure ACK"? 293 296 */ 294 - if (hctx == NULL || len == 0 || 295 - hctx->ccid3hctx_state == TFRC_SSTATE_TERM) 297 + if (unlikely(len == 0)) 296 298 goto out; 297 299 298 300 /* See if last packet allocated was not sent */ ··· 302 304 SLAB_ATOMIC); 303 305 304 306 rc = -ENOBUFS; 305 - if (new_packet == NULL) { 306 - ccid3_pr_debug("%s, sk=%p, not enough mem to add " 307 - "to history, send refused\n", 308 - dccp_role(sk), sk); 307 + if (unlikely(new_packet == NULL)) { 308 + LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, not enough " 309 + "mem to add to history, send refused\n", 310 + __FUNCTION__, dccp_role(sk), sk); 309 311 goto out; 310 312 } 311 313 ··· 316 318 317 319 switch (hctx->ccid3hctx_state) { 318 320 case TFRC_SSTATE_NO_SENT: 319 - ccid3_pr_debug("%s, sk=%p, first packet(%llu)\n", 320 - dccp_role(sk), sk, dp->dccps_gss); 321 - 322 321 hctx->ccid3hctx_no_feedback_timer.function = ccid3_hc_tx_no_feedback_timer; 323 322 hctx->ccid3hctx_no_feedback_timer.data = (unsigned long)sk; 324 323 sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, ··· 323 328 hctx->ccid3hctx_last_win_count = 0; 324 329 hctx->ccid3hctx_t_last_win_count = now; 325 330 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK); 326 - hctx->ccid3hctx_t_ipi = TFRC_INITIAL_TIMEOUT; 331 + hctx->ccid3hctx_t_ipi = TFRC_INITIAL_IPI; 327 332 328 333 /* Set nominal send time for initial packet */ 329 334 hctx->ccid3hctx_t_nom = now; ··· 336 341 case TFRC_SSTATE_FBACK: 337 342 delay = (timeval_delta(&now, &hctx->ccid3hctx_t_nom) - 338 343 hctx->ccid3hctx_delta); 339 - ccid3_pr_debug("send_packet delay=%ld\n", delay); 340 344 delay /= -1000; 341 345 /* divide by -1000 is to convert to ms and get sign right */ 342 346 rc = delay > 0 ? delay : 0; ··· 365 371 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 366 372 struct timeval now; 367 373 368 - BUG_ON(hctx == NULL); 369 - 370 - if (hctx->ccid3hctx_state == TFRC_SSTATE_TERM) { 371 - ccid3_pr_debug("%s, sk=%p, while state is TFRC_SSTATE_TERM!\n", 372 - dccp_role(sk), sk); 373 - return; 374 - } 374 + BUG_ON(hctx == NULL || hctx->ccid3hctx_state == TFRC_SSTATE_TERM); 375 375 376 376 dccp_timestamp(sk, &now); 377 377 ··· 375 387 struct dccp_tx_hist_entry *packet; 376 388 377 389 packet = dccp_tx_hist_head(&hctx->ccid3hctx_hist); 378 - if (packet == NULL) { 379 - printk(KERN_CRIT "%s: packet doesn't exists in " 380 - "history!\n", __FUNCTION__); 390 + if (unlikely(packet == NULL)) { 391 + LIMIT_NETDEBUG(KERN_WARNING "%s: packet doesn't " 392 + "exists in history!\n", __FUNCTION__); 381 393 return; 382 394 } 383 - if (packet->dccphtx_sent) { 384 - printk(KERN_CRIT "%s: no unsent packet in history!\n", 385 - __FUNCTION__); 395 + if (unlikely(packet->dccphtx_sent)) { 396 + LIMIT_NETDEBUG(KERN_WARNING "%s: no unsent packet in " 397 + "history!\n", __FUNCTION__); 386 398 return; 387 399 } 388 400 packet->dccphtx_tstamp = now; ··· 453 465 u32 x_recv; 454 466 u32 r_sample; 455 467 456 - if (hctx == NULL) 457 - return; 458 - 459 - if (hctx->ccid3hctx_state == TFRC_SSTATE_TERM) { 460 - ccid3_pr_debug("%s, sk=%p, received a packet when " 461 - "terminating!\n", dccp_role(sk), sk); 462 - return; 463 - } 468 + BUG_ON(hctx == NULL || hctx->ccid3hctx_state == TFRC_SSTATE_TERM); 464 469 465 470 /* we are only interested in ACKs */ 466 471 if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK || ··· 477 496 /* get t_recvdata from history */ 478 497 packet = dccp_tx_hist_find_entry(&hctx->ccid3hctx_hist, 479 498 DCCP_SKB_CB(skb)->dccpd_ack_seq); 480 - if (packet == NULL) { 481 - ccid3_pr_debug("%s, sk=%p, seqno %llu(%s) does't " 482 - "exist in history!\n", 483 - dccp_role(sk), sk, 484 - DCCP_SKB_CB(skb)->dccpd_ack_seq, 485 - dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type)); 499 + if (unlikely(packet == NULL)) { 500 + LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, seqno " 501 + "%llu(%s) does't exist in history!\n", 502 + __FUNCTION__, dccp_role(sk), sk, 503 + (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, 504 + dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type)); 486 505 return; 487 506 } 488 507 ··· 490 509 dccp_timestamp(sk, &now); 491 510 r_sample = timeval_delta(&now, &packet->dccphtx_tstamp); 492 511 if (unlikely(r_sample <= t_elapsed)) 493 - LIMIT_NETDEBUG(KERN_WARNING 494 - "%s: r_sample=%uus, t_elapsed=%uus\n", 512 + LIMIT_NETDEBUG(KERN_WARNING "%s: r_sample=%uus, " 513 + "t_elapsed=%uus\n", 495 514 __FUNCTION__, r_sample, t_elapsed); 496 515 else 497 516 r_sample -= t_elapsed; ··· 587 606 588 607 static void ccid3_hc_tx_insert_options(struct sock *sk, struct sk_buff *skb) 589 608 { 590 - struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 609 + const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 591 610 592 - if (hctx == NULL || !(sk->sk_state == DCCP_OPEN || 593 - sk->sk_state == DCCP_PARTOPEN)) 611 + BUG_ON(hctx == NULL); 612 + 613 + if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN)) 594 614 return; 595 615 596 616 DCCP_SKB_CB(skb)->dccpd_ccval = hctx->ccid3hctx_last_win_count; ··· 606 624 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 607 625 struct ccid3_options_received *opt_recv; 608 626 609 - if (hctx == NULL) 610 - return 0; 627 + BUG_ON(hctx == NULL); 611 628 612 629 opt_recv = &hctx->ccid3hctx_options_received; 613 630 ··· 620 639 621 640 switch (option) { 622 641 case TFRC_OPT_LOSS_EVENT_RATE: 623 - if (len != 4) { 624 - ccid3_pr_debug("%s, sk=%p, invalid len for " 625 - "TFRC_OPT_LOSS_EVENT_RATE\n", 626 - dccp_role(sk), sk); 642 + if (unlikely(len != 4)) { 643 + LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, invalid " 644 + "len for TFRC_OPT_LOSS_EVENT_RATE\n", 645 + __FUNCTION__, dccp_role(sk), sk); 627 646 rc = -EINVAL; 628 647 } else { 629 648 opt_recv->ccid3or_loss_event_rate = ntohl(*(u32 *)value); ··· 641 660 opt_recv->ccid3or_loss_intervals_len); 642 661 break; 643 662 case TFRC_OPT_RECEIVE_RATE: 644 - if (len != 4) { 645 - ccid3_pr_debug("%s, sk=%p, invalid len for " 646 - "TFRC_OPT_RECEIVE_RATE\n", 647 - dccp_role(sk), sk); 663 + if (unlikely(len != 4)) { 664 + LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, invalid " 665 + "len for TFRC_OPT_RECEIVE_RATE\n", 666 + __FUNCTION__, dccp_role(sk), sk); 648 667 rc = -EINVAL; 649 668 } else { 650 669 opt_recv->ccid3or_receive_rate = ntohl(*(u32 *)value); ··· 662 681 { 663 682 struct dccp_sock *dp = dccp_sk(sk); 664 683 struct ccid3_hc_tx_sock *hctx; 665 - 666 - ccid3_pr_debug("%s, sk=%p\n", dccp_role(sk), sk); 667 684 668 685 dp->dccps_hc_tx_ccid_private = kmalloc(sizeof(*hctx), gfp_any()); 669 686 if (dp->dccps_hc_tx_ccid_private == NULL) ··· 691 712 struct dccp_sock *dp = dccp_sk(sk); 692 713 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 693 714 694 - ccid3_pr_debug("%s, sk=%p\n", dccp_role(sk), sk); 695 715 BUG_ON(hctx == NULL); 696 716 697 717 ccid3_hc_tx_set_state(sk, TFRC_SSTATE_TERM); ··· 770 792 } 771 793 772 794 packet = dccp_rx_hist_find_data_packet(&hcrx->ccid3hcrx_hist); 773 - if (packet == NULL) { 774 - printk(KERN_CRIT "%s: %s, sk=%p, no data packet in history!\n", 775 - __FUNCTION__, dccp_role(sk), sk); 776 - dump_stack(); 795 + if (unlikely(packet == NULL)) { 796 + LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, no data packet " 797 + "in history!\n", 798 + __FUNCTION__, dccp_role(sk), sk); 777 799 return; 778 800 } 779 801 ··· 795 817 796 818 static void ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) 797 819 { 798 - struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 820 + const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 799 821 u32 x_recv, pinv; 800 822 801 - if (hcrx == NULL || !(sk->sk_state == DCCP_OPEN || 802 - sk->sk_state == DCCP_PARTOPEN)) 823 + BUG_ON(hcrx == NULL); 824 + 825 + if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN)) 803 826 return; 804 827 805 828 DCCP_SKB_CB(skb)->dccpd_ccval = hcrx->ccid3hcrx_last_counter; ··· 857 878 } 858 879 } 859 880 860 - if (step == 0) { 861 - printk(KERN_CRIT "%s: %s, sk=%p, packet history contains no " 862 - "data packets!\n", 863 - __FUNCTION__, dccp_role(sk), sk); 881 + if (unlikely(step == 0)) { 882 + LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, packet history " 883 + "contains no data packets!\n", 884 + __FUNCTION__, dccp_role(sk), sk); 864 885 return ~0; 865 886 } 866 887 867 - if (interval == 0) { 868 - ccid3_pr_debug("%s, sk=%p, Could not find a win_count " 869 - "interval > 0. Defaulting to 1\n", 870 - dccp_role(sk), sk); 888 + if (unlikely(interval == 0)) { 889 + LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, Could not find a " 890 + "win_count interval > 0. Defaulting to 1\n", 891 + __FUNCTION__, dccp_role(sk), sk); 871 892 interval = 1; 872 893 } 873 894 found: ··· 910 931 if (li_tail == NULL) 911 932 return; 912 933 li_tail->dccplih_interval = ccid3_hc_rx_calc_first_li(sk); 913 - } 914 - /* FIXME: find end of interval */ 934 + } else 935 + LIMIT_NETDEBUG(KERN_WARNING "%s: FIXME: find end of " 936 + "interval\n", __FUNCTION__); 915 937 } 916 938 917 939 static void ccid3_hc_rx_detect_loss(struct sock *sk) ··· 936 956 u32 p_prev, r_sample, t_elapsed; 937 957 int ins; 938 958 939 - if (hcrx == NULL) 940 - return; 941 - 942 - BUG_ON(!(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA || 959 + BUG_ON(hcrx == NULL || 960 + !(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA || 943 961 hcrx->ccid3hcrx_state == TFRC_RSTATE_DATA)); 944 962 945 963 opt_recv = &dccp_sk(sk)->dccps_options_received; ··· 956 978 t_elapsed = opt_recv->dccpor_elapsed_time * 10; 957 979 958 980 if (unlikely(r_sample <= t_elapsed)) 959 - LIMIT_NETDEBUG(KERN_WARNING 960 - "%s: r_sample=%uus, t_elapsed=%uus\n", 981 + LIMIT_NETDEBUG(KERN_WARNING "%s: r_sample=%uus, " 982 + "t_elapsed=%uus\n", 961 983 __FUNCTION__, r_sample, t_elapsed); 962 984 else 963 985 r_sample -= t_elapsed; ··· 975 997 break; 976 998 case DCCP_PKT_DATA: 977 999 break; 978 - default: 979 - ccid3_pr_debug("%s, sk=%p, not DATA/DATAACK/ACK packet(%s)\n", 980 - dccp_role(sk), sk, 981 - dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type)); 1000 + default: /* We're not interested in other packet types, move along */ 982 1001 return; 983 1002 } 984 1003 985 1004 packet = dccp_rx_hist_entry_new(ccid3_rx_hist, sk, opt_recv->dccpor_ndp, 986 1005 skb, SLAB_ATOMIC); 987 - if (packet == NULL) { 988 - ccid3_pr_debug("%s, sk=%p, Not enough mem to add rx packet " 989 - "to history (consider it lost)!", 990 - dccp_role(sk), sk); 1006 + if (unlikely(packet == NULL)) { 1007 + LIMIT_NETDEBUG(KERN_WARNING "%s: %s, sk=%p, Not enough mem to " 1008 + "add rx packet to history, consider it lost!\n", 1009 + __FUNCTION__, dccp_role(sk), sk); 991 1010 return; 992 1011 } 993 1012 ··· 1077 1102 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 1078 1103 struct dccp_sock *dp = dccp_sk(sk); 1079 1104 1080 - ccid3_pr_debug("%s, sk=%p\n", dccp_role(sk), sk); 1081 - 1082 - if (hcrx == NULL) 1083 - return; 1105 + BUG_ON(hcrx == NULL); 1084 1106 1085 1107 ccid3_hc_rx_set_state(sk, TFRC_RSTATE_TERM); 1086 1108 ··· 1095 1123 { 1096 1124 const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 1097 1125 1098 - if (hcrx == NULL) 1099 - return; 1126 + BUG_ON(hcrx == NULL); 1100 1127 1101 1128 info->tcpi_ca_state = hcrx->ccid3hcrx_state; 1102 1129 info->tcpi_options |= TCPI_OPT_TIMESTAMPS; ··· 1106 1135 { 1107 1136 const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 1108 1137 1109 - if (hctx == NULL) 1110 - return; 1138 + BUG_ON(hctx == NULL); 1111 1139 1112 1140 info->tcpi_rto = hctx->ccid3hctx_t_rto; 1113 1141 info->tcpi_rtt = hctx->ccid3hctx_rtt;
+2
net/dccp/ccids/ccid3.h
··· 48 48 /* Two seconds as per CCID3 spec */ 49 49 #define TFRC_INITIAL_TIMEOUT (2 * USEC_PER_SEC) 50 50 51 + #define TFRC_INITIAL_IPI (USEC_PER_SEC / 4) 52 + 51 53 /* In usecs - half the scheduling granularity as per RFC3448 4.6 */ 52 54 #define TFRC_OPSYS_HALF_TIME_GRAN (USEC_PER_SEC / (2 * HZ)) 53 55
-4
net/dccp/ipv4.c
··· 641 641 642 642 skb = dccp_make_reset(sk, sk->sk_dst_cache, code); 643 643 if (skb != NULL) { 644 - const struct dccp_sock *dp = dccp_sk(sk); 645 644 const struct inet_sock *inet = inet_sk(sk); 646 645 647 646 err = ip_build_and_send_pkt(skb, sk, 648 647 inet->saddr, inet->daddr, NULL); 649 648 if (err == NET_XMIT_CN) 650 649 err = 0; 651 - 652 - ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk); 653 - ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk); 654 650 } 655 651 656 652 return err;
-3
net/dccp/output.c
··· 522 522 dccp_transmit_skb(sk, skb_clone(skb, prio)); 523 523 } else 524 524 dccp_transmit_skb(sk, skb); 525 - 526 - ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk); 527 - ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk); 528 525 }