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_STACK_H
  17 #define _INET_DCCP_DCCP_STACK_H
  18 
  19 #include <sys/netstack.h>
  20 #include <sys/cpuvar.h>
  21 
  22 #ifdef  __cplusplus
  23 extern "C" {
  24 #endif
  25 
  26 typedef struct dccp_stat_counter_s {
  27         uint64_t        dccp_rst_unsent;
  28 } dccp_stat_counter_t;
  29 
  30 typedef struct {
  31         uint64_t                dccp_stats_cnt;
  32         dccp_stat_counter_t     dccp_sc_stats;
  33 } dccp_stats_cpu_t;
  34 
  35 #define DCCP_STAT(dccps, x)     \
  36         ((dccps)->dccps_sc[CPU->cpu_seqid]->dccp_sc_stats.x++)
  37 
  38 /*
  39  * DCCP stack instances
  40  */
  41 typedef struct dccp_stack {
  42         netstack_t              *dccps_netstack;        /* Common netstack */
  43 
  44         uint_t                  dccps_bind_fanout_size;
  45         struct dccp_df_s        *dccps_bind_fanout;
  46 
  47         /* Ports */
  48 #define DCCP_NUM_EPRIV_PORTS    64
  49         int                     dccps_num_epriv_ports;
  50         in_port_t               dccps_epriv_ports[DCCP_NUM_EPRIV_PORTS];
  51         kmutex_t                dccps_epriv_port_lock;
  52 
  53         uint_t                  dccps_next_port_to_try;
  54 
  55         in_port_t               dccps_min_anonpriv_port;
  56 
  57         /* Reset rate control */
  58         int64_t                 dccps_last_rst_intrvl;
  59         uint32_t                dccps_rst_cnt;
  60 
  61         /* Tunables table */
  62         struct mod_prop_info_s  *dccps_propinfo_tbl;
  63 
  64         ldi_ident_t             dccps_ldi_ident;
  65 
  66         /* Cpu stats counter */
  67         dccp_stats_cpu_t        **dccps_sc;
  68         int                     dccps_sc_cnt;
  69 } dccp_stack_t;
  70 
  71 #ifdef  __cplusplus
  72 }
  73 #endif
  74 
  75 #endif  /* _INET_DCCP_DCCP_STACK_H */