Print this page
DLPX-43064 include high-resolution round-trip times in connstat (EP-652)
DLPX-42721 Create inline function for TCP RTO calculation

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 ↓ 14 lines elided ↑ open up ↑
  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   24   * Copyright 2016 Joyent, Inc.
       25 + * Copyright (c) 2016 by Delphix. All rights reserved.
  25   26   */
  26   27  
  27   28  #include <sys/types.h>
  28   29  #include <sys/stream.h>
  29   30  #define _SUN_TPI_VERSION 2
  30   31  #include <sys/tihdr.h>
  31   32  #include <sys/socket.h>
  32   33  #include <sys/xti_xtiopt.h>
  33   34  #include <sys/xti_inet.h>
  34   35  #include <sys/policy.h>
↓ open down ↓ 932 lines elided ↑ open up ↑
 967  968                                   * can send data even if it is less than mss
 968  969                                   */
 969  970                                  if (tcp->tcp_cork && onoff == 0 &&
 970  971                                      tcp->tcp_unsent > 0) {
 971  972                                          tcp->tcp_cork = B_FALSE;
 972  973                                          tcp_wput_data(tcp, NULL, B_FALSE);
 973  974                                  }
 974  975                                  tcp->tcp_cork = onoff;
 975  976                          }
 976  977                          break;
 977      -                case TCP_RTO_INITIAL: {
 978      -                        clock_t rto;
 979      -
      978 +                case TCP_RTO_INITIAL:
 980  979                          if (checkonly || val == 0)
 981  980                                  break;
 982  981  
 983  982                          /*
 984  983                           * Sanity checks
 985  984                           *
 986  985                           * The initial RTO should be bounded by the minimum
 987  986                           * and maximum RTO.  And it should also be smaller
 988  987                           * than the connect attempt abort timeout.  Otherwise,
 989  988                           * the connection won't be aborted in a period
↓ open down ↓ 9 lines elided ↑ open up ↑
 999  998                          tcp->tcp_rto_initial = val;
1000  999  
1001 1000                          /*
1002 1001                           * If TCP has not sent anything, need to re-calculate
1003 1002                           * tcp_rto.  Otherwise, this option change does not
1004 1003                           * really affect anything.
1005 1004                           */
1006 1005                          if (tcp->tcp_state >= TCPS_SYN_SENT)
1007 1006                                  break;
1008 1007  
1009      -                        tcp->tcp_rtt_sa = tcp->tcp_rto_initial << 2;
1010      -                        tcp->tcp_rtt_sd = tcp->tcp_rto_initial >> 1;
1011      -                        rto = (tcp->tcp_rtt_sa >> 3) + tcp->tcp_rtt_sd +
1012      -                            tcps->tcps_rexmit_interval_extra +
1013      -                            (tcp->tcp_rtt_sa >> 5) +
1014      -                            tcps->tcps_conn_grace_period;
1015      -                        TCP_SET_RTO(tcp, rto);
     1008 +                        tcp->tcp_rtt_sa = MSEC2NSEC(tcp->tcp_rto_initial) << 2;
     1009 +                        tcp->tcp_rtt_sd = MSEC2NSEC(tcp->tcp_rto_initial) >> 1;
     1010 +                        tcp->tcp_rto = tcp_calculate_rto(tcp, tcps);
1016 1011                          break;
1017      -                }
1018 1012                  case TCP_RTO_MIN:
1019 1013                          if (checkonly || val == 0)
1020 1014                                  break;
1021 1015  
1022 1016                          if (val < tcps->tcps_rexmit_interval_min_low ||
1023 1017                              val > tcps->tcps_rexmit_interval_min_high ||
1024 1018                              val > tcp->tcp_rto_max) {
1025 1019                                  *outlenp = 0;
1026 1020                                  return (EINVAL);
1027 1021                          }
↓ open down ↓ 185 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX