Print this page
11546 Track TCP round-trip time in nanoseconds
Portions contributed by: Cody Peter Mello <cody.mello@joyent.com>
Portions contributed by: Brandon Baker <bbaker@delphix.com>
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/tcp/tcp_opt_data.c
          +++ new/usr/src/uts/common/inet/tcp/tcp_opt_data.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   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
       24 + * Copyright 2016 Joyent, Inc.
       25 + * Copyright (c) 2016 by Delphix. All rights reserved.
  24   26   */
  25   27  
  26   28  #include <sys/types.h>
  27   29  #include <sys/stream.h>
  28   30  #define _SUN_TPI_VERSION 2
  29   31  #include <sys/tihdr.h>
  30   32  #include <sys/socket.h>
  31   33  #include <sys/xti_xtiopt.h>
  32   34  #include <sys/xti_inet.h>
  33   35  #include <sys/policy.h>
↓ open down ↓ 828 lines elided ↑ open up ↑
 862  864                                   * can send data even if it is less than mss
 863  865                                   */
 864  866                                  if (tcp->tcp_cork && onoff == 0 &&
 865  867                                      tcp->tcp_unsent > 0) {
 866  868                                          tcp->tcp_cork = B_FALSE;
 867  869                                          tcp_wput_data(tcp, NULL, B_FALSE);
 868  870                                  }
 869  871                                  tcp->tcp_cork = onoff;
 870  872                          }
 871  873                          break;
 872      -                case TCP_RTO_INITIAL: {
 873      -                        clock_t rto;
 874      -
      874 +                case TCP_RTO_INITIAL:
 875  875                          if (checkonly || val == 0)
 876  876                                  break;
 877  877  
 878  878                          /*
 879  879                           * Sanity checks
 880  880                           *
 881  881                           * The initial RTO should be bounded by the minimum
 882  882                           * and maximum RTO.  And it should also be smaller
 883  883                           * than the connect attempt abort timeout.  Otherwise,
 884  884                           * the connection won't be aborted in a period
↓ open down ↓ 9 lines elided ↑ open up ↑
 894  894                          tcp->tcp_rto_initial = val;
 895  895  
 896  896                          /*
 897  897                           * If TCP has not sent anything, need to re-calculate
 898  898                           * tcp_rto.  Otherwise, this option change does not
 899  899                           * really affect anything.
 900  900                           */
 901  901                          if (tcp->tcp_state >= TCPS_SYN_SENT)
 902  902                                  break;
 903  903  
 904      -                        tcp->tcp_rtt_sa = tcp->tcp_rto_initial << 2;
 905      -                        tcp->tcp_rtt_sd = tcp->tcp_rto_initial >> 1;
 906      -                        rto = (tcp->tcp_rtt_sa >> 3) + tcp->tcp_rtt_sd +
 907      -                            tcps->tcps_rexmit_interval_extra +
 908      -                            (tcp->tcp_rtt_sa >> 5) +
 909      -                            tcps->tcps_conn_grace_period;
 910      -                        TCP_SET_RTO(tcp, rto);
      904 +                        tcp->tcp_rtt_sa = MSEC2NSEC(tcp->tcp_rto_initial) << 2;
      905 +                        tcp->tcp_rtt_sd = MSEC2NSEC(tcp->tcp_rto_initial) >> 1;
      906 +                        tcp->tcp_rto = tcp_calculate_rto(tcp, tcps,
      907 +                            tcps->tcps_conn_grace_period);
 911  908                          break;
 912      -                }
 913  909                  case TCP_RTO_MIN:
 914  910                          if (checkonly || val == 0)
 915  911                                  break;
 916  912  
 917  913                          if (val < tcps->tcps_rexmit_interval_min_low ||
 918  914                              val > tcps->tcps_rexmit_interval_min_high ||
 919  915                              val > tcp->tcp_rto_max) {
 920  916                                  *outlenp = 0;
 921  917                                  return (EINVAL);
 922  918                          }
↓ open down ↓ 189 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX