Print this page
NEX-3168 sasinfo does not know about 12gb sas
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>


  82         HBA_PORTSTATE_ONLINE,           "online",
  83         HBA_PORTSTATE_OFFLINE,          "offline",
  84         HBA_PORTSTATE_BYPASSED,         "bypassed",
  85         HBA_PORTSTATE_DIAGNOSTICS,      "diagnostics",
  86         HBA_PORTSTATE_LINKDOWN,         "link Down",
  87         HBA_PORTSTATE_ERROR,            "port Error",
  88         HBA_PORTSTATE_LOOPBACK,         "loopback",
  89         HBA_PORTSTATE_DEGRADED,         "degraded",
  90         -1,                             NULL,
  91 };
  92 
  93 static SAS_STATE phystate_string[] = {
  94         HBA_SASSTATE_UNKNOWN,           "unknown",
  95         HBA_SASSTATE_DISABLED,          "disabled",
  96         HBA_SASSTATE_FAILED,            "failed",
  97         HBA_SASSTATE_SATASPINUP,        "sata-spinup",
  98         HBA_SASSTATE_SATAPORTSEL,       "sata-portselector",
  99         HBA_SASSPEED_1_5GBIT,           "1.5Gbit",
 100         HBA_SASSPEED_3GBIT,             "3Gbit",
 101         HBA_SASSPEED_6GBIT,             "6Gbit",

 102         -1,                             NULL,
 103 };
 104 
 105 static SAS_STATE dtype_string[] = {
 106         DTYPE_DIRECT,                   "Disk Device",
 107         DTYPE_SEQUENTIAL,               "Tape Device",
 108         DTYPE_PRINTER,                  "Printer Device",
 109         DTYPE_PROCESSOR,                "Processor Device",
 110         DTYPE_WORM,                     "WORM Device",
 111         DTYPE_RODIRECT,                 "CD/DVD Device",
 112         DTYPE_SCANNER,                  "Scanner Device",
 113         DTYPE_OPTICAL,                  "Optical Memory Device",
 114         DTYPE_CHANGER,                  "Medium Changer Device",
 115         DTYPE_COMM,                     "Communications Device",
 116         DTYPE_ARRAY_CTRL,               "Storage Array Controller Device",
 117         DTYPE_ESI,                      "Enclosure Services Device",
 118         DTYPE_RBC,                      "Simplified Direct-access Device",
 119         DTYPE_OCRW,                     "Optical Card Reader/Writer Device",
 120         DTYPE_BCC,                      "Bridge Controller Commands",
 121         DTYPE_OSD,                      "Object-based Storage Device",


 148 getStateString(HBA_UINT32 key, SAS_STATE *stat_string)
 149 {
 150         static char ret[64];
 151         while (stat_string->key != -1) {
 152                 if (stat_string->key == key) {
 153                         return ((char *)stat_string->value);
 154                 }
 155                 stat_string++;
 156         }
 157         (void *) sprintf(ret, "Undefined value (%d)", key);
 158         return (ret);
 159 }
 160 
 161 static char *
 162 getPhyStateString(HBA_UINT32 key, phystat_type phyt)
 163 {
 164         int i = 0, len = 0, match = 0;
 165         HBA_UINT32 physpeed[] = {
 166                 HBA_SASSPEED_1_5GBIT,
 167                 HBA_SASSPEED_3GBIT,
 168                 HBA_SASSPEED_6GBIT

 169         };
 170 
 171         len = sizeof (physpeed) / sizeof (HBA_UINT32);
 172         for (i = 0; i < len; i++) {
 173                 if (key == physpeed[i]) {
 174                         match = 1;
 175                         break;
 176                 }
 177         }
 178 
 179         if (match == 1) {
 180                 if (phyt == PHY_STATE)
 181                         return ("enabled");
 182                 else
 183                         return (getStateString(key, phystate_string));
 184         } else {
 185                 if (phyt == PHY_STATE)
 186                         return (getStateString(key, phystate_string));
 187                 else
 188                         return ("not available");




  82         HBA_PORTSTATE_ONLINE,           "online",
  83         HBA_PORTSTATE_OFFLINE,          "offline",
  84         HBA_PORTSTATE_BYPASSED,         "bypassed",
  85         HBA_PORTSTATE_DIAGNOSTICS,      "diagnostics",
  86         HBA_PORTSTATE_LINKDOWN,         "link Down",
  87         HBA_PORTSTATE_ERROR,            "port Error",
  88         HBA_PORTSTATE_LOOPBACK,         "loopback",
  89         HBA_PORTSTATE_DEGRADED,         "degraded",
  90         -1,                             NULL,
  91 };
  92 
  93 static SAS_STATE phystate_string[] = {
  94         HBA_SASSTATE_UNKNOWN,           "unknown",
  95         HBA_SASSTATE_DISABLED,          "disabled",
  96         HBA_SASSTATE_FAILED,            "failed",
  97         HBA_SASSTATE_SATASPINUP,        "sata-spinup",
  98         HBA_SASSTATE_SATAPORTSEL,       "sata-portselector",
  99         HBA_SASSPEED_1_5GBIT,           "1.5Gbit",
 100         HBA_SASSPEED_3GBIT,             "3Gbit",
 101         HBA_SASSPEED_6GBIT,             "6Gbit",
 102         HBA_SASSPEED_12GBIT,            "12Gbit",
 103         -1,                             NULL,
 104 };
 105 
 106 static SAS_STATE dtype_string[] = {
 107         DTYPE_DIRECT,                   "Disk Device",
 108         DTYPE_SEQUENTIAL,               "Tape Device",
 109         DTYPE_PRINTER,                  "Printer Device",
 110         DTYPE_PROCESSOR,                "Processor Device",
 111         DTYPE_WORM,                     "WORM Device",
 112         DTYPE_RODIRECT,                 "CD/DVD Device",
 113         DTYPE_SCANNER,                  "Scanner Device",
 114         DTYPE_OPTICAL,                  "Optical Memory Device",
 115         DTYPE_CHANGER,                  "Medium Changer Device",
 116         DTYPE_COMM,                     "Communications Device",
 117         DTYPE_ARRAY_CTRL,               "Storage Array Controller Device",
 118         DTYPE_ESI,                      "Enclosure Services Device",
 119         DTYPE_RBC,                      "Simplified Direct-access Device",
 120         DTYPE_OCRW,                     "Optical Card Reader/Writer Device",
 121         DTYPE_BCC,                      "Bridge Controller Commands",
 122         DTYPE_OSD,                      "Object-based Storage Device",


 149 getStateString(HBA_UINT32 key, SAS_STATE *stat_string)
 150 {
 151         static char ret[64];
 152         while (stat_string->key != -1) {
 153                 if (stat_string->key == key) {
 154                         return ((char *)stat_string->value);
 155                 }
 156                 stat_string++;
 157         }
 158         (void *) sprintf(ret, "Undefined value (%d)", key);
 159         return (ret);
 160 }
 161 
 162 static char *
 163 getPhyStateString(HBA_UINT32 key, phystat_type phyt)
 164 {
 165         int i = 0, len = 0, match = 0;
 166         HBA_UINT32 physpeed[] = {
 167                 HBA_SASSPEED_1_5GBIT,
 168                 HBA_SASSPEED_3GBIT,
 169                 HBA_SASSPEED_6GBIT,
 170                 HBA_SASSPEED_12GBIT
 171         };
 172 
 173         len = sizeof (physpeed) / sizeof (HBA_UINT32);
 174         for (i = 0; i < len; i++) {
 175                 if (key == physpeed[i]) {
 176                         match = 1;
 177                         break;
 178                 }
 179         }
 180 
 181         if (match == 1) {
 182                 if (phyt == PHY_STATE)
 183                         return ("enabled");
 184                 else
 185                         return (getStateString(key, phystate_string));
 186         } else {
 187                 if (phyt == PHY_STATE)
 188                         return (getStateString(key, phystate_string));
 189                 else
 190                         return ("not available");