Print this page
917 Make TCP's iss_incr a tunable

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/tcp/tcp_time_wait.c
          +++ new/usr/src/uts/common/inet/tcp/tcp_time_wait.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright (c) 2011, Joyent Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  /*
  27   28   * This file contains functions related to TCP time wait processing.  Also
  28   29   * refer to the time wait handling comments in tcp_impl.h.
  29   30   */
  30   31  
  31   32  #include <sys/types.h>
  32   33  #include <sys/strsun.h>
  33   34  #include <sys/squeue_impl.h>
↓ open down ↓ 469 lines elided ↑ open up ↑
 503  504                          goto process_ack;
 504  505                  }
 505  506  
 506  507                  /* Fix seg_seq, and chew the gap off the front. */
 507  508                  seg_seq = tcp->tcp_rnxt;
 508  509          }
 509  510  
 510  511          if ((flags & TH_SYN) && gap > 0 && rgap < 0) {
 511  512                  /*
 512  513                   * Make sure that when we accept the connection, pick
 513      -                 * an ISS greater than (tcp_snxt + ISS_INCR/2) for the
      514 +                 * an ISS greater than (tcp_snxt + tcp_iss_incr/2) for the
 514  515                   * old connection.
 515  516                   *
 516  517                   * The next ISS generated is equal to tcp_iss_incr_extra
 517      -                 * + ISS_INCR/2 + other components depending on the
      518 +                 * + tcp_iss_incr/2 + other components depending on the
 518  519                   * value of tcp_strong_iss.  We pre-calculate the new
 519  520                   * ISS here and compare with tcp_snxt to determine if
 520  521                   * we need to make adjustment to tcp_iss_incr_extra.
 521  522                   *
 522  523                   * The above calculation is ugly and is a
 523  524                   * waste of CPU cycles...
 524  525                   */
 525  526                  uint32_t new_iss = tcps->tcps_iss_incr_extra;
 526  527                  int32_t adj;
 527  528                  ip_stack_t *ipst = tcps->tcps_netstack->netstack_ip;
↓ open down ↓ 22 lines elided ↑ open up ↑
 550  551                          answer[0] ^= answer[1] ^ answer[2] ^ answer[3];
 551  552                          new_iss += (gethrtime() >> ISS_NSEC_SHT) + answer[0];
 552  553                          break;
 553  554                  }
 554  555                  case 1:
 555  556                          /* Add time component and min random (i.e. 1). */
 556  557                          new_iss += (gethrtime() >> ISS_NSEC_SHT) + 1;
 557  558                          break;
 558  559                  default:
 559  560                          /* Add only time component. */
 560      -                        new_iss += (uint32_t)gethrestime_sec() * ISS_INCR;
      561 +                        new_iss += (uint32_t)gethrestime_sec() *
      562 +                            tcps->tcps_iss_incr;
 561  563                          break;
 562  564                  }
 563  565                  if ((adj = (int32_t)(tcp->tcp_snxt - new_iss)) > 0) {
 564  566                          /*
 565      -                         * New ISS not guaranteed to be ISS_INCR/2
      567 +                         * New ISS not guaranteed to be tcp_iss_incr/2
 566  568                           * ahead of the current tcp_snxt, so add the
 567  569                           * difference to tcp_iss_incr_extra.
 568  570                           */
 569  571                          tcps->tcps_iss_incr_extra += adj;
 570  572                  }
 571  573                  /*
 572  574                   * If tcp_clean_death() can not perform the task now,
 573  575                   * drop the SYN packet and let the other side re-xmit.
 574  576                   * Otherwise pass the SYN packet back in, since the
 575  577                   * old tcp state has been cleaned up or freed.
↓ open down ↓ 87 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX