Print this page
11547 Want connstat(1M) command to display per-connection TCP statistics
Portions contributed by: Cody Peter Mello <cody.mello@joyent.com>
Portions contributed by: Ahmed G <ahmedg@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_stats.h
          +++ new/usr/src/uts/common/inet/tcp_stats.h
↓ 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) 2015 by Delphix. All rights reserved.
  24   25   */
  25   26  
  26   27  #ifndef _INET_TCP_STATS_H
  27   28  #define _INET_TCP_STATS_H
  28   29  
  29   30  /*
  30   31   * TCP private kernel statistics declarations.
  31   32   */
  32   33  
  33   34  #ifdef  __cplusplus
↓ open down ↓ 164 lines elided ↑ open up ↑
 198  199          kstat_named_t   tcp_freelist_cleanup;
 199  200  } tcp_g_stat_t;
 200  201  
 201  202  /* Per CPU stats: TCP MIB2, TCP kstat and connection counter. */
 202  203  typedef struct {
 203  204          int64_t                 tcp_sc_conn_cnt;
 204  205          mib2_tcp_t              tcp_sc_mib;
 205  206          tcp_stat_counter_t      tcp_sc_stats;
 206  207  } tcp_stats_cpu_t;
 207  208  
      209 +/*
      210 + * Per-connection statistics. Some of these are also kept globally in the
      211 + * per-cpu tcp_sc_mib entry (see tcp_stats_cpu_t above). We need not maintain
      212 + * per-cpu versions of these stats since a connection is typically processed
      213 + * on the same CPU.
      214 + */
      215 +typedef struct tcp_conn_stats {
      216 +        uint64_t        tcp_in_data_inorder_bytes;
      217 +        uint64_t        tcp_in_data_inorder_segs;
      218 +        uint64_t        tcp_in_data_unorder_bytes;
      219 +        uint64_t        tcp_in_data_unorder_segs;
      220 +        uint64_t        tcp_in_zwnd_probes;
      221 +
      222 +        uint64_t        tcp_out_data_bytes;
      223 +        uint64_t        tcp_out_data_segs;
      224 +        uint64_t        tcp_out_retrans_bytes;
      225 +        uint64_t        tcp_out_retrans_segs;
      226 +        uint64_t        tcp_out_zwnd_probes;
      227 +} tcp_conn_stats_t;
      228 +
 208  229  #define TCPS_BUMP_MIB(tcps, x) \
 209  230          BUMP_MIB(&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_mib, x)
 210  231  
 211  232  #define TCPS_UPDATE_MIB(tcps, x, y) \
 212  233          UPDATE_MIB(&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_mib, x, y)
 213  234  
 214  235  #if TCP_DEBUG_COUNTER
 215  236  #define TCP_DBGSTAT(tcps, x)    \
 216  237          atomic_inc_64(          \
 217  238              &((tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_stats.x))
↓ open down ↓ 34 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX