1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2012 David Hoeppner.  All rights reserved.
  14  */
  15 
  16 #ifndef _INET_DCCP_DCCP_STATS_H
  17 #define _INET_DCCP_DCCP_STATS_H
  18 
  19 #include <sys/netstack.h>
  20 #include <sys/cpuvar.h>
  21 
  22 #ifdef  __cplusplus
  23 extern "C" {
  24 #endif
  25 
  26 /* Kstats */
  27 typedef struct dccp_stat {
  28         kstat_named_t   dccp_sock_fallback;
  29 } dccp_stat_t;
  30 
  31 typedef struct dccp_stat_counter_s {
  32         uint64_t        dccp_no_listener;
  33         uint64_t        dccp_listendrop;
  34         uint64_t        dccp_wsrv_called;
  35         uint64_t        dccp_sock_fallback;
  36         uint64_t        dccp_rst_unsent;
  37 } dccp_stat_counter_t;
  38 
  39 typedef struct {
  40         uint64_t                dccp_stats_cnt;
  41         mib2_dccp_t             dccp_sc_mib;
  42         dccp_stat_counter_t     dccp_sc_stats;
  43 } dccp_stats_cpu_t;
  44 
  45 /*
  46  * MIB-II
  47  */
  48 #define DCCPS_BUMP_MIB(dccps, x) \
  49         BUMP_MIB(&(dccps)->dccps_sc[CPU->cpu_seqid]->dccp_sc_mib, x)
  50 
  51 #define DCCPS_UPDATE_MIB(dccps, x, y) \
  52         UPDATE_MIB(&(dccps)->dccps_sc[CPU->cpu_seqid]->dccp_sc_mib, x, y)
  53 
  54 #define DCCP_STAT(dccps, x)     \
  55         ((dccps)->dccps_sc[CPU->cpu_seqid]->dccp_sc_stats.x++)
  56 
  57 #ifdef  __cplusplus
  58 }
  59 #endif
  60 
  61 #endif  /* _INET_DCCP_DCCP_STATS_H */