Print this page
NEX-3177 enums and string arrays required to be in sync.
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
re #8564, rb4224 "mutex_enter: bad mutex" panic when under heavy load

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/port/pppt/pppt.h
          +++ new/usr/src/uts/common/io/comstar/port/pppt/pppt.h
↓ open down ↓ 10 lines elided ↑ open up ↑
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
       24 + * Copyright 2013, 2015 Nexenta Systems, Inc. All rights reserved.
  24   25   */
  25   26  #ifndef _PPPT_H
  26   27  #define _PPPT_H
  27   28  
  28   29  #include <sys/pppt_ic_if.h>
  29   30  
  30   31  #ifdef  __cplusplus
  31   32  extern "C" {
  32   33  #endif
  33   34  
↓ open down ↓ 8 lines elided ↑ open up ↑
  42   43  
  43   44  typedef enum {
  44   45          PPPT_STATUS_SUCCESS = 0,
  45   46          PPPT_STATUS_FAIL,
  46   47          PPPT_STATUS_ABORTED,
  47   48          PPPT_STATUS_DONE
  48   49  } pppt_status_t;
  49   50  
  50   51  #define PPPT_MODNAME "pppt"
  51   52  
       53 +#define TGT_STATE_LIST() \
       54 +        item(TS_UNDEFINED) \
       55 +        item(TS_CREATED) \
       56 +        item(TS_ONLINING) \
       57 +        item(TS_ONLINE) \
       58 +        item(TS_STMF_ONLINE) \
       59 +        item(TS_DELETING_NEED_OFFLINE) \
       60 +        item(TS_OFFLINING) \
       61 +        item(TS_OFFLINE) \
       62 +        item(TS_STMF_OFFLINE) \
       63 +        item(TS_DELETING_STMF_DEREG) \
       64 +        item(TS_DELETING_STMF_DEREG_FAIL) \
       65 +        item(TS_DELETING) \
       66 +        item(TS_MAX_STATE)
       67 +
  52   68  /* Target states and events, update pppt_ts_name table whenever modified */
  53   69  typedef enum {
  54      -        TS_UNDEFINED = 0,
  55      -        TS_CREATED,
  56      -        TS_ONLINING,
  57      -        TS_ONLINE,
  58      -        TS_STMF_ONLINE,
  59      -        TS_DELETING_NEED_OFFLINE,
  60      -        TS_OFFLINING,
  61      -        TS_OFFLINE,
  62      -        TS_STMF_OFFLINE,
  63      -        TS_DELETING_STMF_DEREG,
  64      -        TS_DELETING_STMF_DEREG_FAIL,
  65      -        TS_DELETING,
  66      -        TS_MAX_STATE
       70 +#define item(a) a,
       71 +        TGT_STATE_LIST()
       72 +#undef  item
  67   73  } pppt_tgt_state_t;
  68   74  
  69   75  #ifdef PPPT_TGT_SM_STRINGS
  70      -static const char *pppt_ts_name[TS_MAX_STATE+1] = {
  71      -        "TS_UNDEFINED",
  72      -        "TS_CREATED",
  73      -        "TS_ONLINING",
  74      -        "TS_ONLINE",
  75      -        "TS_STMF_ONLINE",
  76      -        "TS_DELETING_NEED_OFFLINE",
  77      -        "TS_OFFLINING",
  78      -        "TS_OFFLINE",
  79      -        "TS_STMF_OFFLINE",
  80      -        "TS_DELETING_STMF_DEREG",
  81      -        "TS_DELETING_STMF_DEREG_FAIL",
  82      -        "TS_DELETING",
  83      -        "TS_MAX_STATE"
       76 +static const char *pppt_ts_name[TS_MAX_STATE + 1] = {
       77 +#define item(a) #a,
       78 +        TGT_STATE_LIST()
       79 +#undef  item
  84   80  };
  85   81  #endif
  86   82  
       83 +#define TGT_EVENT_LIST() \
       84 +        item(TE_UNDEFINED) \
       85 +        item(TE_STMF_ONLINE_REQ) \
       86 +        item(TE_ONLINE_SUCCESS) \
       87 +        item(TE_ONLINE_FAIL) \
       88 +        item(TE_STMF_ONLINE_COMPLETE_ACK) \
       89 +        item(TE_STMF_OFFLINE_REQ) \
       90 +        item(TE_OFFLINE_COMPLETE) \
       91 +        item(TE_STMF_OFFLINE_COMPLETE_ACK) \
       92 +        item(TE_DELETE) \
       93 +        item(TE_STMF_DEREG_SUCCESS) \
       94 +        item(TE_STMF_DEREG_FAIL) \
       95 +        item(TE_STMF_DEREG_RETRY) \
       96 +        item(TE_WAIT_REF_COMPLETE) /* XXX */ \
       97 +        item(TE_MAX_EVENT)
       98 +
  87   99  typedef enum {
  88      -        TE_UNDEFINED = 0,
  89      -        TE_STMF_ONLINE_REQ,
  90      -        TE_ONLINE_SUCCESS,
  91      -        TE_ONLINE_FAIL,
  92      -        TE_STMF_ONLINE_COMPLETE_ACK,
  93      -        TE_STMF_OFFLINE_REQ,
  94      -        TE_OFFLINE_COMPLETE,
  95      -        TE_STMF_OFFLINE_COMPLETE_ACK,
  96      -        TE_DELETE,
  97      -        TE_STMF_DEREG_SUCCESS,
  98      -        TE_STMF_DEREG_FAIL,
  99      -        TE_STMF_DEREG_RETRY,
 100      -        TE_WAIT_REF_COMPLETE, /* XXX */
 101      -        TE_MAX_EVENT
      100 +#define item(a) a,
      101 +        TGT_EVENT_LIST()
      102 +#undef  item
 102  103  } pppt_tgt_event_t;
 103  104  
 104  105  #ifdef PPPT_TGT_SM_STRINGS
 105      -static const char *pppt_te_name[TE_MAX_EVENT+1] = {
 106      -        "TE_UNDEFINED",
 107      -        "TE_STMF_ONLINE_REQ",
 108      -        "TE_ONLINE_SUCCESS",
 109      -        "TE_ONLINE_FAIL",
 110      -        "TE_STMF_ONLINE_COMPLETE_ACK",
 111      -        "TE_STMF_OFFLINE_REQ",
 112      -        "TE_OFFLINE_COMPLETE",
 113      -        "TE_STMF_OFFLINE_COMPLETE_ACK",
 114      -        "TE_DELETE",
 115      -        "TE_STMF_DEREG_SUCCESS",
 116      -        "TE_STMF_DEREG_FAIL",
 117      -        "TE_STMF_DEREG_RETRY",
 118      -        "TE_WAIT_REF_COMPLETE",
 119      -        "TE_MAX_EVENT"
      106 +static const char *pppt_te_name[TE_MAX_EVENT + 1] = {
      107 +#define item(a) #a,
      108 +        TGT_EVENT_LIST()
      109 +#undef  item
 120  110  };
 121  111  #endif
 122  112  
 123  113  typedef struct pppt_tgt_s {
 124  114          kmutex_t                target_mutex;
 125  115          kcondvar_t              target_cv;
 126  116          avl_node_t              target_global_ln;
 127  117          scsi_devid_desc_t       *target_devid;
 128  118          stmf_local_port_t       *target_stmf_lport;
 129  119          avl_tree_t              target_sess_list;
↓ open down ↓ 176 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX