| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1 | /******************************************************************* |
| 2 | * This file is part of the Emulex Linux Device Driver for * |
James.Smart@Emulex.Com | c44ce17 | 2005-06-25 10:34:39 -0400 | [diff] [blame] | 3 | * Fibre Channel Host Bus Adapters. * |
Jamie Wellnitz | 4141586 | 2006-02-28 19:25:27 -0500 | [diff] [blame] | 4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * |
James.Smart@Emulex.Com | c44ce17 | 2005-06-25 10:34:39 -0400 | [diff] [blame] | 5 | * EMULEX and SLI are trademarks of Emulex. * |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 6 | * www.emulex.com * |
James.Smart@Emulex.Com | c44ce17 | 2005-06-25 10:34:39 -0400 | [diff] [blame] | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 8 | * * |
| 9 | * This program is free software; you can redistribute it and/or * |
James.Smart@Emulex.Com | c44ce17 | 2005-06-25 10:34:39 -0400 | [diff] [blame] | 10 | * modify it under the terms of version 2 of the GNU General * |
| 11 | * Public License as published by the Free Software Foundation. * |
| 12 | * This program is distributed in the hope that it will be useful. * |
| 13 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * |
| 14 | * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * |
| 16 | * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * |
| 17 | * TO BE LEGALLY INVALID. See the GNU General Public License for * |
| 18 | * more details, a copy of which can be found in the file COPYING * |
| 19 | * included with this package. * |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 20 | *******************************************************************/ |
| 21 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 22 | #include <linux/ctype.h> |
| 23 | #include <linux/pci.h> |
| 24 | #include <linux/interrupt.h> |
| 25 | |
James.Smart@Emulex.Com | 9188652 | 2005-08-10 15:03:09 -0400 | [diff] [blame] | 26 | #include <scsi/scsi.h> |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 27 | #include <scsi/scsi_device.h> |
| 28 | #include <scsi/scsi_host.h> |
| 29 | #include <scsi/scsi_tcq.h> |
| 30 | #include <scsi/scsi_transport_fc.h> |
| 31 | |
| 32 | #include "lpfc_hw.h" |
| 33 | #include "lpfc_sli.h" |
| 34 | #include "lpfc_disc.h" |
| 35 | #include "lpfc_scsi.h" |
| 36 | #include "lpfc.h" |
| 37 | #include "lpfc_logmsg.h" |
| 38 | #include "lpfc_version.h" |
| 39 | #include "lpfc_compat.h" |
| 40 | #include "lpfc_crtn.h" |
| 41 | |
| 42 | |
| 43 | static void |
| 44 | lpfc_jedec_to_ascii(int incr, char hdw[]) |
| 45 | { |
| 46 | int i, j; |
| 47 | for (i = 0; i < 8; i++) { |
| 48 | j = (incr & 0xf); |
| 49 | if (j <= 9) |
| 50 | hdw[7 - i] = 0x30 + j; |
| 51 | else |
| 52 | hdw[7 - i] = 0x61 + j - 10; |
| 53 | incr = (incr >> 4); |
| 54 | } |
| 55 | hdw[8] = 0; |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | static ssize_t |
| 60 | lpfc_drvr_version_show(struct class_device *cdev, char *buf) |
| 61 | { |
| 62 | return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); |
| 63 | } |
| 64 | |
| 65 | static ssize_t |
| 66 | management_version_show(struct class_device *cdev, char *buf) |
| 67 | { |
| 68 | return snprintf(buf, PAGE_SIZE, DFC_API_VERSION "\n"); |
| 69 | } |
| 70 | |
| 71 | static ssize_t |
| 72 | lpfc_info_show(struct class_device *cdev, char *buf) |
| 73 | { |
| 74 | struct Scsi_Host *host = class_to_shost(cdev); |
| 75 | return snprintf(buf, PAGE_SIZE, "%s\n",lpfc_info(host)); |
| 76 | } |
| 77 | |
| 78 | static ssize_t |
| 79 | lpfc_serialnum_show(struct class_device *cdev, char *buf) |
| 80 | { |
| 81 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 82 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 83 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->SerialNumber); |
| 84 | } |
| 85 | |
| 86 | static ssize_t |
| 87 | lpfc_modeldesc_show(struct class_device *cdev, char *buf) |
| 88 | { |
| 89 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 90 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 91 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelDesc); |
| 92 | } |
| 93 | |
| 94 | static ssize_t |
| 95 | lpfc_modelname_show(struct class_device *cdev, char *buf) |
| 96 | { |
| 97 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 98 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 99 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelName); |
| 100 | } |
| 101 | |
| 102 | static ssize_t |
| 103 | lpfc_programtype_show(struct class_device *cdev, char *buf) |
| 104 | { |
| 105 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 106 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 107 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ProgramType); |
| 108 | } |
| 109 | |
| 110 | static ssize_t |
| 111 | lpfc_portnum_show(struct class_device *cdev, char *buf) |
| 112 | { |
| 113 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 114 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 115 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->Port); |
| 116 | } |
| 117 | |
| 118 | static ssize_t |
| 119 | lpfc_fwrev_show(struct class_device *cdev, char *buf) |
| 120 | { |
| 121 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 122 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 123 | char fwrev[32]; |
| 124 | lpfc_decode_firmware_rev(phba, fwrev, 1); |
| 125 | return snprintf(buf, PAGE_SIZE, "%s\n",fwrev); |
| 126 | } |
| 127 | |
| 128 | static ssize_t |
| 129 | lpfc_hdw_show(struct class_device *cdev, char *buf) |
| 130 | { |
| 131 | char hdw[9]; |
| 132 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 133 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 134 | lpfc_vpd_t *vp = &phba->vpd; |
| 135 | lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); |
| 136 | return snprintf(buf, PAGE_SIZE, "%s\n", hdw); |
| 137 | } |
| 138 | static ssize_t |
| 139 | lpfc_option_rom_version_show(struct class_device *cdev, char *buf) |
| 140 | { |
| 141 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 142 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 143 | return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion); |
| 144 | } |
| 145 | static ssize_t |
| 146 | lpfc_state_show(struct class_device *cdev, char *buf) |
| 147 | { |
| 148 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 149 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 150 | int len = 0; |
| 151 | switch (phba->hba_state) { |
Jamie Wellnitz | 4141586 | 2006-02-28 19:25:27 -0500 | [diff] [blame] | 152 | case LPFC_STATE_UNKNOWN: |
| 153 | case LPFC_WARM_START: |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 154 | case LPFC_INIT_START: |
| 155 | case LPFC_INIT_MBX_CMDS: |
| 156 | case LPFC_LINK_DOWN: |
| 157 | len += snprintf(buf + len, PAGE_SIZE-len, "Link Down\n"); |
| 158 | break; |
| 159 | case LPFC_LINK_UP: |
| 160 | case LPFC_LOCAL_CFG_LINK: |
| 161 | len += snprintf(buf + len, PAGE_SIZE-len, "Link Up\n"); |
| 162 | break; |
| 163 | case LPFC_FLOGI: |
| 164 | case LPFC_FABRIC_CFG_LINK: |
| 165 | case LPFC_NS_REG: |
| 166 | case LPFC_NS_QRY: |
| 167 | case LPFC_BUILD_DISC_LIST: |
| 168 | case LPFC_DISC_AUTH: |
| 169 | case LPFC_CLEAR_LA: |
| 170 | len += snprintf(buf + len, PAGE_SIZE-len, |
| 171 | "Link Up - Discovery\n"); |
| 172 | break; |
| 173 | case LPFC_HBA_READY: |
| 174 | len += snprintf(buf + len, PAGE_SIZE-len, |
| 175 | "Link Up - Ready:\n"); |
| 176 | if (phba->fc_topology == TOPOLOGY_LOOP) { |
| 177 | if (phba->fc_flag & FC_PUBLIC_LOOP) |
| 178 | len += snprintf(buf + len, PAGE_SIZE-len, |
| 179 | " Public Loop\n"); |
| 180 | else |
| 181 | len += snprintf(buf + len, PAGE_SIZE-len, |
| 182 | " Private Loop\n"); |
| 183 | } else { |
| 184 | if (phba->fc_flag & FC_FABRIC) |
| 185 | len += snprintf(buf + len, PAGE_SIZE-len, |
| 186 | " Fabric\n"); |
| 187 | else |
| 188 | len += snprintf(buf + len, PAGE_SIZE-len, |
| 189 | " Point-2-Point\n"); |
| 190 | } |
| 191 | } |
| 192 | return len; |
| 193 | } |
| 194 | |
| 195 | static ssize_t |
| 196 | lpfc_num_discovered_ports_show(struct class_device *cdev, char *buf) |
| 197 | { |
| 198 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 199 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 200 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->fc_map_cnt + |
| 201 | phba->fc_unmap_cnt); |
| 202 | } |
| 203 | |
| 204 | |
Andrew Vasquez | 91ca7b0 | 2005-10-27 16:03:37 -0700 | [diff] [blame] | 205 | static int |
| 206 | lpfc_issue_lip(struct Scsi_Host *host) |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 207 | { |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 208 | struct lpfc_hba *phba = (struct lpfc_hba *) host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 209 | LPFC_MBOXQ_t *pmboxq; |
| 210 | int mbxstatus = MBXERR_ERROR; |
| 211 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 212 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
| 213 | (phba->hba_state != LPFC_HBA_READY)) |
| 214 | return -EPERM; |
| 215 | |
| 216 | pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); |
| 217 | |
| 218 | if (!pmboxq) |
| 219 | return -ENOMEM; |
| 220 | |
| 221 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
James Smart | 4db621e | 2006-07-06 15:49:49 -0400 | [diff] [blame^] | 222 | pmboxq->mb.mbxCommand = MBX_DOWN_LINK; |
| 223 | pmboxq->mb.mbxOwner = OWN_HOST; |
| 224 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 225 | mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); |
| 226 | |
James Smart | 4db621e | 2006-07-06 15:49:49 -0400 | [diff] [blame^] | 227 | if ((mbxstatus == MBX_SUCCESS) && (pmboxq->mb.mbxStatus == 0)) { |
| 228 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
| 229 | lpfc_init_link(phba, pmboxq, phba->cfg_topology, |
| 230 | phba->cfg_link_speed); |
| 231 | mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, |
| 232 | phba->fc_ratov * 2); |
| 233 | } |
| 234 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 235 | if (mbxstatus == MBX_TIMEOUT) |
| 236 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
| 237 | else |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 238 | mempool_free(pmboxq, phba->mbox_mem_pool); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 239 | |
| 240 | if (mbxstatus == MBXERR_ERROR) |
| 241 | return -EIO; |
| 242 | |
Andrew Vasquez | 91ca7b0 | 2005-10-27 16:03:37 -0700 | [diff] [blame] | 243 | return 0; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | static ssize_t |
| 247 | lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) |
| 248 | { |
| 249 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 250 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 251 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); |
| 252 | } |
| 253 | |
| 254 | static ssize_t |
| 255 | lpfc_board_online_show(struct class_device *cdev, char *buf) |
| 256 | { |
| 257 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 258 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 259 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 260 | if (phba->fc_flag & FC_OFFLINE_MODE) |
| 261 | return snprintf(buf, PAGE_SIZE, "0\n"); |
| 262 | else |
| 263 | return snprintf(buf, PAGE_SIZE, "1\n"); |
| 264 | } |
| 265 | |
| 266 | static ssize_t |
| 267 | lpfc_board_online_store(struct class_device *cdev, const char *buf, |
| 268 | size_t count) |
| 269 | { |
| 270 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 271 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 272 | struct completion online_compl; |
| 273 | int val=0, status=0; |
| 274 | |
| 275 | if (sscanf(buf, "%d", &val) != 1) |
James.Smart@Emulex.Com | 755c0d0 | 2005-10-28 20:29:06 -0400 | [diff] [blame] | 276 | return -EINVAL; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 277 | |
| 278 | init_completion(&online_compl); |
| 279 | |
| 280 | if (val) |
| 281 | lpfc_workq_post_event(phba, &status, &online_compl, |
| 282 | LPFC_EVT_ONLINE); |
| 283 | else |
| 284 | lpfc_workq_post_event(phba, &status, &online_compl, |
| 285 | LPFC_EVT_OFFLINE); |
| 286 | wait_for_completion(&online_compl); |
| 287 | if (!status) |
| 288 | return strlen(buf); |
| 289 | else |
James.Smart@Emulex.Com | 755c0d0 | 2005-10-28 20:29:06 -0400 | [diff] [blame] | 290 | return -EIO; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 291 | } |
| 292 | |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 293 | static ssize_t |
Jamie Wellnitz | 4141586 | 2006-02-28 19:25:27 -0500 | [diff] [blame] | 294 | lpfc_board_mode_show(struct class_device *cdev, char *buf) |
| 295 | { |
| 296 | struct Scsi_Host *host = class_to_shost(cdev); |
| 297 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| 298 | char * state; |
| 299 | |
| 300 | if (phba->hba_state == LPFC_HBA_ERROR) |
| 301 | state = "error"; |
| 302 | else if (phba->hba_state == LPFC_WARM_START) |
| 303 | state = "warm start"; |
| 304 | else if (phba->hba_state == LPFC_INIT_START) |
| 305 | state = "offline"; |
| 306 | else |
| 307 | state = "online"; |
| 308 | |
| 309 | return snprintf(buf, PAGE_SIZE, "%s\n", state); |
| 310 | } |
| 311 | |
| 312 | static ssize_t |
| 313 | lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) |
| 314 | { |
| 315 | struct Scsi_Host *host = class_to_shost(cdev); |
| 316 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| 317 | struct completion online_compl; |
| 318 | int status=0; |
| 319 | |
| 320 | init_completion(&online_compl); |
| 321 | |
| 322 | if(strncmp(buf, "online", sizeof("online") - 1) == 0) |
| 323 | lpfc_workq_post_event(phba, &status, &online_compl, |
| 324 | LPFC_EVT_ONLINE); |
| 325 | else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) |
| 326 | lpfc_workq_post_event(phba, &status, &online_compl, |
| 327 | LPFC_EVT_OFFLINE); |
| 328 | else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) |
| 329 | lpfc_workq_post_event(phba, &status, &online_compl, |
| 330 | LPFC_EVT_WARM_START); |
| 331 | else if (strncmp(buf, "error", sizeof("error") - 1) == 0) |
| 332 | lpfc_workq_post_event(phba, &status, &online_compl, |
| 333 | LPFC_EVT_KILL); |
| 334 | else |
| 335 | return -EINVAL; |
| 336 | |
| 337 | wait_for_completion(&online_compl); |
| 338 | |
| 339 | if (!status) |
| 340 | return strlen(buf); |
| 341 | else |
| 342 | return -EIO; |
| 343 | } |
| 344 | |
| 345 | static ssize_t |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 346 | lpfc_poll_show(struct class_device *cdev, char *buf) |
| 347 | { |
| 348 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 349 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 350 | |
| 351 | return snprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); |
| 352 | } |
| 353 | |
| 354 | static ssize_t |
| 355 | lpfc_poll_store(struct class_device *cdev, const char *buf, |
| 356 | size_t count) |
| 357 | { |
| 358 | struct Scsi_Host *host = class_to_shost(cdev); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 359 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 360 | uint32_t creg_val; |
| 361 | uint32_t old_val; |
| 362 | int val=0; |
| 363 | |
| 364 | if (!isdigit(buf[0])) |
| 365 | return -EINVAL; |
| 366 | |
| 367 | if (sscanf(buf, "%i", &val) != 1) |
| 368 | return -EINVAL; |
| 369 | |
| 370 | if ((val & 0x3) != val) |
| 371 | return -EINVAL; |
| 372 | |
| 373 | spin_lock_irq(phba->host->host_lock); |
| 374 | |
| 375 | old_val = phba->cfg_poll; |
| 376 | |
| 377 | if (val & ENABLE_FCP_RING_POLLING) { |
| 378 | if ((val & DISABLE_FCP_RING_INT) && |
| 379 | !(old_val & DISABLE_FCP_RING_INT)) { |
| 380 | creg_val = readl(phba->HCregaddr); |
| 381 | creg_val &= ~(HC_R0INT_ENA << LPFC_FCP_RING); |
| 382 | writel(creg_val, phba->HCregaddr); |
| 383 | readl(phba->HCregaddr); /* flush */ |
| 384 | |
| 385 | lpfc_poll_start_timer(phba); |
| 386 | } |
| 387 | } else if (val != 0x0) { |
| 388 | spin_unlock_irq(phba->host->host_lock); |
| 389 | return -EINVAL; |
| 390 | } |
| 391 | |
| 392 | if (!(val & DISABLE_FCP_RING_INT) && |
| 393 | (old_val & DISABLE_FCP_RING_INT)) |
| 394 | { |
| 395 | spin_unlock_irq(phba->host->host_lock); |
| 396 | del_timer(&phba->fcp_poll_timer); |
| 397 | spin_lock_irq(phba->host->host_lock); |
| 398 | creg_val = readl(phba->HCregaddr); |
| 399 | creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING); |
| 400 | writel(creg_val, phba->HCregaddr); |
| 401 | readl(phba->HCregaddr); /* flush */ |
| 402 | } |
| 403 | |
| 404 | phba->cfg_poll = val; |
| 405 | |
| 406 | spin_unlock_irq(phba->host->host_lock); |
| 407 | |
| 408 | return strlen(buf); |
| 409 | } |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 410 | |
| 411 | #define lpfc_param_show(attr) \ |
| 412 | static ssize_t \ |
| 413 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ |
| 414 | { \ |
| 415 | struct Scsi_Host *host = class_to_shost(cdev);\ |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 416 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;\ |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 417 | int val = 0;\ |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 418 | val = phba->cfg_##attr;\ |
| 419 | return snprintf(buf, PAGE_SIZE, "%d\n",\ |
| 420 | phba->cfg_##attr);\ |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 421 | } |
| 422 | |
James.Smart@Emulex.Com | 93a20f7 | 2005-10-28 20:29:32 -0400 | [diff] [blame] | 423 | #define lpfc_param_hex_show(attr) \ |
| 424 | static ssize_t \ |
| 425 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ |
| 426 | { \ |
| 427 | struct Scsi_Host *host = class_to_shost(cdev);\ |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 428 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;\ |
James.Smart@Emulex.Com | 93a20f7 | 2005-10-28 20:29:32 -0400 | [diff] [blame] | 429 | int val = 0;\ |
| 430 | val = phba->cfg_##attr;\ |
| 431 | return snprintf(buf, PAGE_SIZE, "%#x\n",\ |
| 432 | phba->cfg_##attr);\ |
| 433 | } |
| 434 | |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 435 | #define lpfc_param_init(attr, default, minval, maxval) \ |
| 436 | static int \ |
| 437 | lpfc_##attr##_init(struct lpfc_hba *phba, int val) \ |
| 438 | { \ |
| 439 | if (val >= minval && val <= maxval) {\ |
| 440 | phba->cfg_##attr = val;\ |
| 441 | return 0;\ |
| 442 | }\ |
| 443 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ |
| 444 | "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ |
| 445 | "allowed range is ["#minval", "#maxval"]\n", \ |
| 446 | phba->brd_no, val); \ |
| 447 | phba->cfg_##attr = default;\ |
| 448 | return -EINVAL;\ |
| 449 | } |
| 450 | |
| 451 | #define lpfc_param_set(attr, default, minval, maxval) \ |
| 452 | static int \ |
| 453 | lpfc_##attr##_set(struct lpfc_hba *phba, int val) \ |
| 454 | { \ |
| 455 | if (val >= minval && val <= maxval) {\ |
| 456 | phba->cfg_##attr = val;\ |
| 457 | return 0;\ |
| 458 | }\ |
| 459 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ |
| 460 | "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ |
| 461 | "allowed range is ["#minval", "#maxval"]\n", \ |
| 462 | phba->brd_no, val); \ |
| 463 | return -EINVAL;\ |
| 464 | } |
| 465 | |
| 466 | #define lpfc_param_store(attr) \ |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 467 | static ssize_t \ |
| 468 | lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ |
| 469 | { \ |
| 470 | struct Scsi_Host *host = class_to_shost(cdev);\ |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 471 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;\ |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 472 | int val=0;\ |
James.Smart@Emulex.Com | 93a20f7 | 2005-10-28 20:29:32 -0400 | [diff] [blame] | 473 | if (!isdigit(buf[0]))\ |
| 474 | return -EINVAL;\ |
| 475 | if (sscanf(buf, "%i", &val) != 1)\ |
| 476 | return -EINVAL;\ |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 477 | if (lpfc_##attr##_set(phba, val) == 0) \ |
James.Smart@Emulex.Com | 755c0d0 | 2005-10-28 20:29:06 -0400 | [diff] [blame] | 478 | return strlen(buf);\ |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 479 | else \ |
| 480 | return -EINVAL;\ |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 481 | } |
| 482 | |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 483 | #define LPFC_ATTR(name, defval, minval, maxval, desc) \ |
| 484 | static int lpfc_##name = defval;\ |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 485 | module_param(lpfc_##name, int, 0);\ |
| 486 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 487 | lpfc_param_init(name, defval, minval, maxval) |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 488 | |
| 489 | #define LPFC_ATTR_R(name, defval, minval, maxval, desc) \ |
| 490 | static int lpfc_##name = defval;\ |
| 491 | module_param(lpfc_##name, int, 0);\ |
| 492 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
| 493 | lpfc_param_show(name)\ |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 494 | lpfc_param_init(name, defval, minval, maxval)\ |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 495 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) |
| 496 | |
| 497 | #define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \ |
| 498 | static int lpfc_##name = defval;\ |
| 499 | module_param(lpfc_##name, int, 0);\ |
| 500 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
| 501 | lpfc_param_show(name)\ |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 502 | lpfc_param_init(name, defval, minval, maxval)\ |
| 503 | lpfc_param_set(name, defval, minval, maxval)\ |
| 504 | lpfc_param_store(name)\ |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 505 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
| 506 | lpfc_##name##_show, lpfc_##name##_store) |
| 507 | |
James.Smart@Emulex.Com | 93a20f7 | 2005-10-28 20:29:32 -0400 | [diff] [blame] | 508 | #define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \ |
| 509 | static int lpfc_##name = defval;\ |
| 510 | module_param(lpfc_##name, int, 0);\ |
| 511 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
| 512 | lpfc_param_hex_show(name)\ |
| 513 | lpfc_param_init(name, defval, minval, maxval)\ |
| 514 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) |
| 515 | |
| 516 | #define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ |
| 517 | static int lpfc_##name = defval;\ |
| 518 | module_param(lpfc_##name, int, 0);\ |
| 519 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
| 520 | lpfc_param_hex_show(name)\ |
| 521 | lpfc_param_init(name, defval, minval, maxval)\ |
| 522 | lpfc_param_set(name, defval, minval, maxval)\ |
| 523 | lpfc_param_store(name)\ |
| 524 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
| 525 | lpfc_##name##_show, lpfc_##name##_store) |
| 526 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 527 | static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); |
| 528 | static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); |
| 529 | static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); |
| 530 | static CLASS_DEVICE_ATTR(modelname, S_IRUGO, lpfc_modelname_show, NULL); |
| 531 | static CLASS_DEVICE_ATTR(programtype, S_IRUGO, lpfc_programtype_show, NULL); |
| 532 | static CLASS_DEVICE_ATTR(portnum, S_IRUGO, lpfc_portnum_show, NULL); |
| 533 | static CLASS_DEVICE_ATTR(fwrev, S_IRUGO, lpfc_fwrev_show, NULL); |
| 534 | static CLASS_DEVICE_ATTR(hdw, S_IRUGO, lpfc_hdw_show, NULL); |
| 535 | static CLASS_DEVICE_ATTR(state, S_IRUGO, lpfc_state_show, NULL); |
| 536 | static CLASS_DEVICE_ATTR(option_rom_version, S_IRUGO, |
| 537 | lpfc_option_rom_version_show, NULL); |
| 538 | static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO, |
| 539 | lpfc_num_discovered_ports_show, NULL); |
| 540 | static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); |
| 541 | static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, |
| 542 | NULL); |
| 543 | static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, |
| 544 | NULL); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 545 | static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, |
| 546 | lpfc_board_online_show, lpfc_board_online_store); |
Jamie Wellnitz | 4141586 | 2006-02-28 19:25:27 -0500 | [diff] [blame] | 547 | static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, |
| 548 | lpfc_board_mode_show, lpfc_board_mode_store); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 549 | |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 550 | static int lpfc_poll = 0; |
| 551 | module_param(lpfc_poll, int, 0); |
| 552 | MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode control:" |
| 553 | " 0 - none," |
| 554 | " 1 - poll with interrupts enabled" |
| 555 | " 3 - poll and disable FCP ring interrupts"); |
| 556 | |
| 557 | static CLASS_DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, |
| 558 | lpfc_poll_show, lpfc_poll_store); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 559 | |
| 560 | /* |
| 561 | # lpfc_log_verbose: Only turn this flag on if you are willing to risk being |
| 562 | # deluged with LOTS of information. |
| 563 | # You can set a bit mask to record specific types of verbose messages: |
| 564 | # |
| 565 | # LOG_ELS 0x1 ELS events |
| 566 | # LOG_DISCOVERY 0x2 Link discovery events |
| 567 | # LOG_MBOX 0x4 Mailbox events |
| 568 | # LOG_INIT 0x8 Initialization events |
| 569 | # LOG_LINK_EVENT 0x10 Link events |
| 570 | # LOG_IP 0x20 IP traffic history |
| 571 | # LOG_FCP 0x40 FCP traffic history |
| 572 | # LOG_NODE 0x80 Node table events |
| 573 | # LOG_MISC 0x400 Miscellaneous events |
| 574 | # LOG_SLI 0x800 SLI events |
| 575 | # LOG_CHK_COND 0x1000 FCP Check condition flag |
| 576 | # LOG_LIBDFC 0x2000 LIBDFC events |
| 577 | # LOG_ALL_MSG 0xffff LOG all messages |
| 578 | */ |
James.Smart@Emulex.Com | 93a20f7 | 2005-10-28 20:29:32 -0400 | [diff] [blame] | 579 | LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask"); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 580 | |
| 581 | /* |
| 582 | # lun_queue_depth: This parameter is used to limit the number of outstanding |
| 583 | # commands per FCP LUN. Value range is [1,128]. Default value is 30. |
| 584 | */ |
| 585 | LPFC_ATTR_R(lun_queue_depth, 30, 1, 128, |
| 586 | "Max number of FCP commands we can queue to a specific LUN"); |
| 587 | |
| 588 | /* |
Jamie Wellnitz | b28485a | 2006-02-28 19:25:21 -0500 | [diff] [blame] | 589 | # hba_queue_depth: This parameter is used to limit the number of outstanding |
| 590 | # commands per lpfc HBA. Value range is [32,8192]. If this parameter |
| 591 | # value is greater than the maximum number of exchanges supported by the HBA, |
| 592 | # then maximum number of exchanges supported by the HBA is used to determine |
| 593 | # the hba_queue_depth. |
| 594 | */ |
| 595 | LPFC_ATTR_R(hba_queue_depth, 8192, 32, 8192, |
| 596 | "Max number of FCP commands we can queue to a lpfc HBA"); |
| 597 | |
| 598 | /* |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 599 | # Some disk devices have a "select ID" or "select Target" capability. |
| 600 | # From a protocol standpoint "select ID" usually means select the |
| 601 | # Fibre channel "ALPA". In the FC-AL Profile there is an "informative |
| 602 | # annex" which contains a table that maps a "select ID" (a number |
| 603 | # between 0 and 7F) to an ALPA. By default, for compatibility with |
| 604 | # older drivers, the lpfc driver scans this table from low ALPA to high |
| 605 | # ALPA. |
| 606 | # |
| 607 | # Turning on the scan-down variable (on = 1, off = 0) will |
| 608 | # cause the lpfc driver to use an inverted table, effectively |
| 609 | # scanning ALPAs from high to low. Value range is [0,1]. Default value is 1. |
| 610 | # |
| 611 | # (Note: This "select ID" functionality is a LOOP ONLY characteristic |
| 612 | # and will not work across a fabric. Also this parameter will take |
| 613 | # effect only in the case when ALPA map is not available.) |
| 614 | */ |
| 615 | LPFC_ATTR_R(scan_down, 1, 0, 1, |
| 616 | "Start scanning for devices from highest ALPA to lowest"); |
| 617 | |
| 618 | /* |
| 619 | # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear |
James.Smart@Emulex.Com | 09703d3 | 2005-10-28 20:29:21 -0400 | [diff] [blame] | 620 | # until the timer expires. Value range is [0,255]. Default value is 30. |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 621 | # NOTE: this MUST be less then the SCSI Layer command timeout - 1. |
| 622 | */ |
| 623 | LPFC_ATTR_RW(nodev_tmo, 30, 0, 255, |
| 624 | "Seconds driver will hold I/O waiting for a device to come back"); |
| 625 | |
| 626 | /* |
| 627 | # lpfc_topology: link topology for init link |
| 628 | # 0x0 = attempt loop mode then point-to-point |
Jamie Wellnitz | 367c271 | 2006-02-28 19:25:32 -0500 | [diff] [blame] | 629 | # 0x01 = internal loopback mode |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 630 | # 0x02 = attempt point-to-point mode only |
| 631 | # 0x04 = attempt loop mode only |
| 632 | # 0x06 = attempt point-to-point mode then loop |
| 633 | # Set point-to-point mode if you want to run as an N_Port. |
| 634 | # Set loop mode if you want to run as an NL_Port. Value range is [0,0x6]. |
| 635 | # Default value is 0. |
| 636 | */ |
Jamie Wellnitz | 367c271 | 2006-02-28 19:25:32 -0500 | [diff] [blame] | 637 | LPFC_ATTR_RW(topology, 0, 0, 6, "Select Fibre Channel topology"); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 638 | |
| 639 | /* |
| 640 | # lpfc_link_speed: Link speed selection for initializing the Fibre Channel |
| 641 | # connection. |
| 642 | # 0 = auto select (default) |
| 643 | # 1 = 1 Gigabaud |
| 644 | # 2 = 2 Gigabaud |
| 645 | # 4 = 4 Gigabaud |
| 646 | # Value range is [0,4]. Default value is 0. |
| 647 | */ |
| 648 | LPFC_ATTR_R(link_speed, 0, 0, 4, "Select link speed"); |
| 649 | |
| 650 | /* |
| 651 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. |
| 652 | # Value range is [2,3]. Default value is 3. |
| 653 | */ |
| 654 | LPFC_ATTR_R(fcp_class, 3, 2, 3, |
| 655 | "Select Fibre Channel class of service for FCP sequences"); |
| 656 | |
| 657 | /* |
| 658 | # lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range |
| 659 | # is [0,1]. Default value is 0. |
| 660 | */ |
| 661 | LPFC_ATTR_RW(use_adisc, 0, 0, 1, |
| 662 | "Use ADISC on rediscovery to authenticate FCP devices"); |
| 663 | |
| 664 | /* |
| 665 | # lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value |
| 666 | # range is [0,1]. Default value is 0. |
| 667 | */ |
| 668 | LPFC_ATTR_R(ack0, 0, 0, 1, "Enable ACK0 support"); |
| 669 | |
| 670 | /* |
| 671 | # lpfc_cr_delay & lpfc_cr_count: Default values for I/O colaesing |
| 672 | # cr_delay (msec) or cr_count outstanding commands. cr_delay can take |
| 673 | # value [0,63]. cr_count can take value [0,255]. Default value of cr_delay |
| 674 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if |
| 675 | # cr_delay is set to 0. |
| 676 | */ |
Jamie Wellnitz | 8189fd1 | 2006-02-28 19:25:35 -0500 | [diff] [blame] | 677 | LPFC_ATTR_RW(cr_delay, 0, 0, 63, "A count of milliseconds after which an " |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 678 | "interrupt response is generated"); |
| 679 | |
Jamie Wellnitz | 8189fd1 | 2006-02-28 19:25:35 -0500 | [diff] [blame] | 680 | LPFC_ATTR_RW(cr_count, 1, 1, 255, "A count of I/O completions after which an " |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 681 | "interrupt response is generated"); |
| 682 | |
| 683 | /* |
Jamie Wellnitz | cf5bf97 | 2006-02-28 22:33:08 -0500 | [diff] [blame] | 684 | # lpfc_multi_ring_support: Determines how many rings to spread available |
| 685 | # cmd/rsp IOCB entries across. |
| 686 | # Value range is [1,2]. Default value is 1. |
| 687 | */ |
| 688 | LPFC_ATTR_R(multi_ring_support, 1, 1, 2, "Determines number of primary " |
| 689 | "SLI rings to spread IOCB entries across"); |
| 690 | |
| 691 | /* |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 692 | # lpfc_fdmi_on: controls FDMI support. |
| 693 | # 0 = no FDMI support |
| 694 | # 1 = support FDMI without attribute of hostname |
| 695 | # 2 = support FDMI with attribute of hostname |
| 696 | # Value range [0,2]. Default value is 0. |
| 697 | */ |
| 698 | LPFC_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); |
| 699 | |
| 700 | /* |
| 701 | # Specifies the maximum number of ELS cmds we can have outstanding (for |
| 702 | # discovery). Value range is [1,64]. Default value = 32. |
| 703 | */ |
Jamie Wellnitz | 8189fd1 | 2006-02-28 19:25:35 -0500 | [diff] [blame] | 704 | LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 705 | "during discovery"); |
| 706 | |
| 707 | /* |
| 708 | # lpfc_max_luns: maximum number of LUNs per target driver will support |
| 709 | # Value range is [1,32768]. Default value is 256. |
| 710 | # NOTE: The SCSI layer will scan each target for this many luns |
| 711 | */ |
| 712 | LPFC_ATTR_R(max_luns, 256, 1, 32768, |
| 713 | "Maximum number of LUNs per target driver will support"); |
| 714 | |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 715 | /* |
| 716 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. |
| 717 | # Value range is [1,255], default value is 10. |
| 718 | */ |
| 719 | LPFC_ATTR_RW(poll_tmo, 10, 1, 255, |
| 720 | "Milliseconds driver will wait between polling FCP ring"); |
| 721 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 722 | struct class_device_attribute *lpfc_host_attrs[] = { |
| 723 | &class_device_attr_info, |
| 724 | &class_device_attr_serialnum, |
| 725 | &class_device_attr_modeldesc, |
| 726 | &class_device_attr_modelname, |
| 727 | &class_device_attr_programtype, |
| 728 | &class_device_attr_portnum, |
| 729 | &class_device_attr_fwrev, |
| 730 | &class_device_attr_hdw, |
| 731 | &class_device_attr_option_rom_version, |
| 732 | &class_device_attr_state, |
| 733 | &class_device_attr_num_discovered_ports, |
| 734 | &class_device_attr_lpfc_drvr_version, |
| 735 | &class_device_attr_lpfc_log_verbose, |
| 736 | &class_device_attr_lpfc_lun_queue_depth, |
Jamie Wellnitz | b28485a | 2006-02-28 19:25:21 -0500 | [diff] [blame] | 737 | &class_device_attr_lpfc_hba_queue_depth, |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 738 | &class_device_attr_lpfc_nodev_tmo, |
| 739 | &class_device_attr_lpfc_fcp_class, |
| 740 | &class_device_attr_lpfc_use_adisc, |
| 741 | &class_device_attr_lpfc_ack0, |
| 742 | &class_device_attr_lpfc_topology, |
| 743 | &class_device_attr_lpfc_scan_down, |
| 744 | &class_device_attr_lpfc_link_speed, |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 745 | &class_device_attr_lpfc_cr_delay, |
| 746 | &class_device_attr_lpfc_cr_count, |
Jamie Wellnitz | cf5bf97 | 2006-02-28 22:33:08 -0500 | [diff] [blame] | 747 | &class_device_attr_lpfc_multi_ring_support, |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 748 | &class_device_attr_lpfc_fdmi_on, |
| 749 | &class_device_attr_lpfc_max_luns, |
| 750 | &class_device_attr_nport_evt_cnt, |
| 751 | &class_device_attr_management_version, |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 752 | &class_device_attr_board_online, |
Jamie Wellnitz | 4141586 | 2006-02-28 19:25:27 -0500 | [diff] [blame] | 753 | &class_device_attr_board_mode, |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 754 | &class_device_attr_lpfc_poll, |
| 755 | &class_device_attr_lpfc_poll_tmo, |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 756 | NULL, |
| 757 | }; |
| 758 | |
| 759 | static ssize_t |
| 760 | sysfs_ctlreg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) |
| 761 | { |
| 762 | size_t buf_off; |
| 763 | struct Scsi_Host *host = class_to_shost(container_of(kobj, |
| 764 | struct class_device, kobj)); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 765 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 766 | |
| 767 | if ((off + count) > FF_REG_AREA_SIZE) |
| 768 | return -ERANGE; |
| 769 | |
| 770 | if (count == 0) return 0; |
| 771 | |
| 772 | if (off % 4 || count % 4 || (unsigned long)buf % 4) |
| 773 | return -EINVAL; |
| 774 | |
| 775 | spin_lock_irq(phba->host->host_lock); |
| 776 | |
| 777 | if (!(phba->fc_flag & FC_OFFLINE_MODE)) { |
| 778 | spin_unlock_irq(phba->host->host_lock); |
| 779 | return -EPERM; |
| 780 | } |
| 781 | |
| 782 | for (buf_off = 0; buf_off < count; buf_off += sizeof(uint32_t)) |
| 783 | writel(*((uint32_t *)(buf + buf_off)), |
| 784 | phba->ctrl_regs_memmap_p + off + buf_off); |
| 785 | |
| 786 | spin_unlock_irq(phba->host->host_lock); |
| 787 | |
| 788 | return count; |
| 789 | } |
| 790 | |
| 791 | static ssize_t |
| 792 | sysfs_ctlreg_read(struct kobject *kobj, char *buf, loff_t off, size_t count) |
| 793 | { |
| 794 | size_t buf_off; |
| 795 | uint32_t * tmp_ptr; |
| 796 | struct Scsi_Host *host = class_to_shost(container_of(kobj, |
| 797 | struct class_device, kobj)); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 798 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 799 | |
| 800 | if (off > FF_REG_AREA_SIZE) |
| 801 | return -ERANGE; |
| 802 | |
| 803 | if ((off + count) > FF_REG_AREA_SIZE) |
| 804 | count = FF_REG_AREA_SIZE - off; |
| 805 | |
| 806 | if (count == 0) return 0; |
| 807 | |
| 808 | if (off % 4 || count % 4 || (unsigned long)buf % 4) |
| 809 | return -EINVAL; |
| 810 | |
| 811 | spin_lock_irq(phba->host->host_lock); |
| 812 | |
| 813 | for (buf_off = 0; buf_off < count; buf_off += sizeof(uint32_t)) { |
| 814 | tmp_ptr = (uint32_t *)(buf + buf_off); |
| 815 | *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); |
| 816 | } |
| 817 | |
| 818 | spin_unlock_irq(phba->host->host_lock); |
| 819 | |
| 820 | return count; |
| 821 | } |
| 822 | |
| 823 | static struct bin_attribute sysfs_ctlreg_attr = { |
| 824 | .attr = { |
| 825 | .name = "ctlreg", |
| 826 | .mode = S_IRUSR | S_IWUSR, |
| 827 | .owner = THIS_MODULE, |
| 828 | }, |
| 829 | .size = 256, |
| 830 | .read = sysfs_ctlreg_read, |
| 831 | .write = sysfs_ctlreg_write, |
| 832 | }; |
| 833 | |
| 834 | |
| 835 | static void |
| 836 | sysfs_mbox_idle (struct lpfc_hba * phba) |
| 837 | { |
| 838 | phba->sysfs_mbox.state = SMBOX_IDLE; |
| 839 | phba->sysfs_mbox.offset = 0; |
| 840 | |
| 841 | if (phba->sysfs_mbox.mbox) { |
| 842 | mempool_free(phba->sysfs_mbox.mbox, |
| 843 | phba->mbox_mem_pool); |
| 844 | phba->sysfs_mbox.mbox = NULL; |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | static ssize_t |
| 849 | sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count) |
| 850 | { |
| 851 | struct Scsi_Host * host = |
| 852 | class_to_shost(container_of(kobj, struct class_device, kobj)); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 853 | struct lpfc_hba * phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 854 | struct lpfcMboxq * mbox = NULL; |
| 855 | |
| 856 | if ((count + off) > MAILBOX_CMD_SIZE) |
| 857 | return -ERANGE; |
| 858 | |
| 859 | if (off % 4 || count % 4 || (unsigned long)buf % 4) |
| 860 | return -EINVAL; |
| 861 | |
| 862 | if (count == 0) |
| 863 | return 0; |
| 864 | |
| 865 | if (off == 0) { |
| 866 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
| 867 | if (!mbox) |
| 868 | return -ENOMEM; |
James Smart | fc6c12b | 2006-03-07 15:04:19 -0500 | [diff] [blame] | 869 | memset(mbox, 0, sizeof (LPFC_MBOXQ_t)); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | spin_lock_irq(host->host_lock); |
| 873 | |
| 874 | if (off == 0) { |
| 875 | if (phba->sysfs_mbox.mbox) |
| 876 | mempool_free(mbox, phba->mbox_mem_pool); |
| 877 | else |
| 878 | phba->sysfs_mbox.mbox = mbox; |
| 879 | phba->sysfs_mbox.state = SMBOX_WRITING; |
| 880 | } else { |
| 881 | if (phba->sysfs_mbox.state != SMBOX_WRITING || |
| 882 | phba->sysfs_mbox.offset != off || |
| 883 | phba->sysfs_mbox.mbox == NULL ) { |
| 884 | sysfs_mbox_idle(phba); |
| 885 | spin_unlock_irq(host->host_lock); |
| 886 | return -EINVAL; |
| 887 | } |
| 888 | } |
| 889 | |
| 890 | memcpy((uint8_t *) & phba->sysfs_mbox.mbox->mb + off, |
| 891 | buf, count); |
| 892 | |
| 893 | phba->sysfs_mbox.offset = off + count; |
| 894 | |
| 895 | spin_unlock_irq(host->host_lock); |
| 896 | |
| 897 | return count; |
| 898 | } |
| 899 | |
| 900 | static ssize_t |
| 901 | sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) |
| 902 | { |
| 903 | struct Scsi_Host *host = |
| 904 | class_to_shost(container_of(kobj, struct class_device, |
| 905 | kobj)); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 906 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 907 | int rc; |
| 908 | |
| 909 | if (off > sizeof(MAILBOX_t)) |
| 910 | return -ERANGE; |
| 911 | |
| 912 | if ((count + off) > sizeof(MAILBOX_t)) |
| 913 | count = sizeof(MAILBOX_t) - off; |
| 914 | |
| 915 | if (off % 4 || count % 4 || (unsigned long)buf % 4) |
| 916 | return -EINVAL; |
| 917 | |
| 918 | if (off && count == 0) |
| 919 | return 0; |
| 920 | |
| 921 | spin_lock_irq(phba->host->host_lock); |
| 922 | |
| 923 | if (off == 0 && |
| 924 | phba->sysfs_mbox.state == SMBOX_WRITING && |
| 925 | phba->sysfs_mbox.offset >= 2 * sizeof(uint32_t)) { |
| 926 | |
| 927 | switch (phba->sysfs_mbox.mbox->mb.mbxCommand) { |
| 928 | /* Offline only */ |
| 929 | case MBX_WRITE_NV: |
| 930 | case MBX_INIT_LINK: |
| 931 | case MBX_DOWN_LINK: |
| 932 | case MBX_CONFIG_LINK: |
| 933 | case MBX_CONFIG_RING: |
| 934 | case MBX_RESET_RING: |
| 935 | case MBX_UNREG_LOGIN: |
| 936 | case MBX_CLEAR_LA: |
| 937 | case MBX_DUMP_CONTEXT: |
| 938 | case MBX_RUN_DIAGS: |
| 939 | case MBX_RESTART: |
| 940 | case MBX_FLASH_WR_ULA: |
| 941 | case MBX_SET_MASK: |
| 942 | case MBX_SET_SLIM: |
| 943 | case MBX_SET_DEBUG: |
| 944 | if (!(phba->fc_flag & FC_OFFLINE_MODE)) { |
| 945 | printk(KERN_WARNING "mbox_read:Command 0x%x " |
| 946 | "is illegal in on-line state\n", |
| 947 | phba->sysfs_mbox.mbox->mb.mbxCommand); |
| 948 | sysfs_mbox_idle(phba); |
| 949 | spin_unlock_irq(phba->host->host_lock); |
| 950 | return -EPERM; |
| 951 | } |
| 952 | case MBX_LOAD_SM: |
| 953 | case MBX_READ_NV: |
| 954 | case MBX_READ_CONFIG: |
| 955 | case MBX_READ_RCONFIG: |
| 956 | case MBX_READ_STATUS: |
| 957 | case MBX_READ_XRI: |
| 958 | case MBX_READ_REV: |
| 959 | case MBX_READ_LNK_STAT: |
| 960 | case MBX_DUMP_MEMORY: |
| 961 | case MBX_DOWN_LOAD: |
| 962 | case MBX_UPDATE_CFG: |
Jamie Wellnitz | 4141586 | 2006-02-28 19:25:27 -0500 | [diff] [blame] | 963 | case MBX_KILL_BOARD: |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 964 | case MBX_LOAD_AREA: |
| 965 | case MBX_LOAD_EXP_ROM: |
Jamie Wellnitz | 4141586 | 2006-02-28 19:25:27 -0500 | [diff] [blame] | 966 | case MBX_BEACON: |
| 967 | case MBX_DEL_LD_ENTRY: |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 968 | break; |
| 969 | case MBX_READ_SPARM64: |
| 970 | case MBX_READ_LA: |
| 971 | case MBX_READ_LA64: |
| 972 | case MBX_REG_LOGIN: |
| 973 | case MBX_REG_LOGIN64: |
| 974 | case MBX_CONFIG_PORT: |
| 975 | case MBX_RUN_BIU_DIAG: |
| 976 | printk(KERN_WARNING "mbox_read: Illegal Command 0x%x\n", |
| 977 | phba->sysfs_mbox.mbox->mb.mbxCommand); |
| 978 | sysfs_mbox_idle(phba); |
| 979 | spin_unlock_irq(phba->host->host_lock); |
| 980 | return -EPERM; |
| 981 | default: |
| 982 | printk(KERN_WARNING "mbox_read: Unknown Command 0x%x\n", |
| 983 | phba->sysfs_mbox.mbox->mb.mbxCommand); |
| 984 | sysfs_mbox_idle(phba); |
| 985 | spin_unlock_irq(phba->host->host_lock); |
| 986 | return -EPERM; |
| 987 | } |
| 988 | |
| 989 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
| 990 | (!(phba->sli.sli_flag & LPFC_SLI2_ACTIVE))){ |
| 991 | |
| 992 | spin_unlock_irq(phba->host->host_lock); |
| 993 | rc = lpfc_sli_issue_mbox (phba, |
| 994 | phba->sysfs_mbox.mbox, |
| 995 | MBX_POLL); |
| 996 | spin_lock_irq(phba->host->host_lock); |
| 997 | |
| 998 | } else { |
| 999 | spin_unlock_irq(phba->host->host_lock); |
| 1000 | rc = lpfc_sli_issue_mbox_wait (phba, |
| 1001 | phba->sysfs_mbox.mbox, |
| 1002 | phba->fc_ratov * 2); |
| 1003 | spin_lock_irq(phba->host->host_lock); |
| 1004 | } |
| 1005 | |
| 1006 | if (rc != MBX_SUCCESS) { |
| 1007 | sysfs_mbox_idle(phba); |
| 1008 | spin_unlock_irq(host->host_lock); |
| 1009 | return -ENODEV; |
| 1010 | } |
| 1011 | phba->sysfs_mbox.state = SMBOX_READING; |
| 1012 | } |
| 1013 | else if (phba->sysfs_mbox.offset != off || |
| 1014 | phba->sysfs_mbox.state != SMBOX_READING) { |
| 1015 | printk(KERN_WARNING "mbox_read: Bad State\n"); |
| 1016 | sysfs_mbox_idle(phba); |
| 1017 | spin_unlock_irq(host->host_lock); |
| 1018 | return -EINVAL; |
| 1019 | } |
| 1020 | |
| 1021 | memcpy(buf, (uint8_t *) & phba->sysfs_mbox.mbox->mb + off, count); |
| 1022 | |
| 1023 | phba->sysfs_mbox.offset = off + count; |
| 1024 | |
| 1025 | if (phba->sysfs_mbox.offset == sizeof(MAILBOX_t)) |
| 1026 | sysfs_mbox_idle(phba); |
| 1027 | |
| 1028 | spin_unlock_irq(phba->host->host_lock); |
| 1029 | |
| 1030 | return count; |
| 1031 | } |
| 1032 | |
| 1033 | static struct bin_attribute sysfs_mbox_attr = { |
| 1034 | .attr = { |
| 1035 | .name = "mbox", |
| 1036 | .mode = S_IRUSR | S_IWUSR, |
| 1037 | .owner = THIS_MODULE, |
| 1038 | }, |
| 1039 | .size = sizeof(MAILBOX_t), |
| 1040 | .read = sysfs_mbox_read, |
| 1041 | .write = sysfs_mbox_write, |
| 1042 | }; |
| 1043 | |
| 1044 | int |
| 1045 | lpfc_alloc_sysfs_attr(struct lpfc_hba *phba) |
| 1046 | { |
| 1047 | struct Scsi_Host *host = phba->host; |
| 1048 | int error; |
| 1049 | |
| 1050 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, |
| 1051 | &sysfs_ctlreg_attr); |
| 1052 | if (error) |
| 1053 | goto out; |
| 1054 | |
| 1055 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, |
| 1056 | &sysfs_mbox_attr); |
| 1057 | if (error) |
| 1058 | goto out_remove_ctlreg_attr; |
| 1059 | |
| 1060 | return 0; |
| 1061 | out_remove_ctlreg_attr: |
| 1062 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &sysfs_ctlreg_attr); |
| 1063 | out: |
| 1064 | return error; |
| 1065 | } |
| 1066 | |
| 1067 | void |
| 1068 | lpfc_free_sysfs_attr(struct lpfc_hba *phba) |
| 1069 | { |
| 1070 | struct Scsi_Host *host = phba->host; |
| 1071 | |
| 1072 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &sysfs_mbox_attr); |
| 1073 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &sysfs_ctlreg_attr); |
| 1074 | } |
| 1075 | |
| 1076 | |
| 1077 | /* |
| 1078 | * Dynamic FC Host Attributes Support |
| 1079 | */ |
| 1080 | |
| 1081 | static void |
| 1082 | lpfc_get_host_port_id(struct Scsi_Host *shost) |
| 1083 | { |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1084 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1085 | /* note: fc_myDID already in cpu endianness */ |
| 1086 | fc_host_port_id(shost) = phba->fc_myDID; |
| 1087 | } |
| 1088 | |
| 1089 | static void |
| 1090 | lpfc_get_host_port_type(struct Scsi_Host *shost) |
| 1091 | { |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1092 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1093 | |
| 1094 | spin_lock_irq(shost->host_lock); |
| 1095 | |
| 1096 | if (phba->hba_state == LPFC_HBA_READY) { |
| 1097 | if (phba->fc_topology == TOPOLOGY_LOOP) { |
| 1098 | if (phba->fc_flag & FC_PUBLIC_LOOP) |
| 1099 | fc_host_port_type(shost) = FC_PORTTYPE_NLPORT; |
| 1100 | else |
| 1101 | fc_host_port_type(shost) = FC_PORTTYPE_LPORT; |
| 1102 | } else { |
| 1103 | if (phba->fc_flag & FC_FABRIC) |
| 1104 | fc_host_port_type(shost) = FC_PORTTYPE_NPORT; |
| 1105 | else |
| 1106 | fc_host_port_type(shost) = FC_PORTTYPE_PTP; |
| 1107 | } |
| 1108 | } else |
| 1109 | fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN; |
| 1110 | |
| 1111 | spin_unlock_irq(shost->host_lock); |
| 1112 | } |
| 1113 | |
| 1114 | static void |
| 1115 | lpfc_get_host_port_state(struct Scsi_Host *shost) |
| 1116 | { |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1117 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1118 | |
| 1119 | spin_lock_irq(shost->host_lock); |
| 1120 | |
| 1121 | if (phba->fc_flag & FC_OFFLINE_MODE) |
| 1122 | fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; |
| 1123 | else { |
| 1124 | switch (phba->hba_state) { |
Jamie Wellnitz | 4141586 | 2006-02-28 19:25:27 -0500 | [diff] [blame] | 1125 | case LPFC_STATE_UNKNOWN: |
| 1126 | case LPFC_WARM_START: |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1127 | case LPFC_INIT_START: |
| 1128 | case LPFC_INIT_MBX_CMDS: |
| 1129 | case LPFC_LINK_DOWN: |
| 1130 | fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN; |
| 1131 | break; |
| 1132 | case LPFC_LINK_UP: |
| 1133 | case LPFC_LOCAL_CFG_LINK: |
| 1134 | case LPFC_FLOGI: |
| 1135 | case LPFC_FABRIC_CFG_LINK: |
| 1136 | case LPFC_NS_REG: |
| 1137 | case LPFC_NS_QRY: |
| 1138 | case LPFC_BUILD_DISC_LIST: |
| 1139 | case LPFC_DISC_AUTH: |
| 1140 | case LPFC_CLEAR_LA: |
| 1141 | case LPFC_HBA_READY: |
| 1142 | /* Links up, beyond this port_type reports state */ |
| 1143 | fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; |
| 1144 | break; |
| 1145 | case LPFC_HBA_ERROR: |
| 1146 | fc_host_port_state(shost) = FC_PORTSTATE_ERROR; |
| 1147 | break; |
| 1148 | default: |
| 1149 | fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN; |
| 1150 | break; |
| 1151 | } |
| 1152 | } |
| 1153 | |
| 1154 | spin_unlock_irq(shost->host_lock); |
| 1155 | } |
| 1156 | |
| 1157 | static void |
| 1158 | lpfc_get_host_speed(struct Scsi_Host *shost) |
| 1159 | { |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1160 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1161 | |
| 1162 | spin_lock_irq(shost->host_lock); |
| 1163 | |
| 1164 | if (phba->hba_state == LPFC_HBA_READY) { |
| 1165 | switch(phba->fc_linkspeed) { |
| 1166 | case LA_1GHZ_LINK: |
| 1167 | fc_host_speed(shost) = FC_PORTSPEED_1GBIT; |
| 1168 | break; |
| 1169 | case LA_2GHZ_LINK: |
| 1170 | fc_host_speed(shost) = FC_PORTSPEED_2GBIT; |
| 1171 | break; |
| 1172 | case LA_4GHZ_LINK: |
| 1173 | fc_host_speed(shost) = FC_PORTSPEED_4GBIT; |
| 1174 | break; |
| 1175 | default: |
| 1176 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; |
| 1177 | break; |
| 1178 | } |
| 1179 | } |
| 1180 | |
| 1181 | spin_unlock_irq(shost->host_lock); |
| 1182 | } |
| 1183 | |
| 1184 | static void |
| 1185 | lpfc_get_host_fabric_name (struct Scsi_Host *shost) |
| 1186 | { |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1187 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
Andrew Vasquez | f631b4b | 2005-08-31 15:23:12 -0700 | [diff] [blame] | 1188 | u64 node_name; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1189 | |
| 1190 | spin_lock_irq(shost->host_lock); |
| 1191 | |
| 1192 | if ((phba->fc_flag & FC_FABRIC) || |
| 1193 | ((phba->fc_topology == TOPOLOGY_LOOP) && |
| 1194 | (phba->fc_flag & FC_PUBLIC_LOOP))) |
Andrew Morton | 68ce1eb | 2005-09-21 09:46:54 -0700 | [diff] [blame] | 1195 | node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1196 | else |
| 1197 | /* fabric is local port if there is no F/FL_Port */ |
Andrew Morton | 68ce1eb | 2005-09-21 09:46:54 -0700 | [diff] [blame] | 1198 | node_name = wwn_to_u64(phba->fc_nodename.u.wwn); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1199 | |
| 1200 | spin_unlock_irq(shost->host_lock); |
| 1201 | |
Andrew Vasquez | f631b4b | 2005-08-31 15:23:12 -0700 | [diff] [blame] | 1202 | fc_host_fabric_name(shost) = node_name; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1203 | } |
| 1204 | |
| 1205 | |
| 1206 | static struct fc_host_statistics * |
| 1207 | lpfc_get_stats(struct Scsi_Host *shost) |
| 1208 | { |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1209 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1210 | struct lpfc_sli *psli = &phba->sli; |
James.Smart@Emulex.Com | f888ba3 | 2005-08-10 15:03:01 -0400 | [diff] [blame] | 1211 | struct fc_host_statistics *hs = &phba->link_stats; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1212 | LPFC_MBOXQ_t *pmboxq; |
| 1213 | MAILBOX_t *pmb; |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 1214 | int rc = 0; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1215 | |
| 1216 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
| 1217 | if (!pmboxq) |
| 1218 | return NULL; |
| 1219 | memset(pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
| 1220 | |
| 1221 | pmb = &pmboxq->mb; |
| 1222 | pmb->mbxCommand = MBX_READ_STATUS; |
| 1223 | pmb->mbxOwner = OWN_HOST; |
| 1224 | pmboxq->context1 = NULL; |
| 1225 | |
| 1226 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 1227 | (!(psli->sli_flag & LPFC_SLI2_ACTIVE))) |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1228 | rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 1229 | else |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1230 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); |
| 1231 | |
| 1232 | if (rc != MBX_SUCCESS) { |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 1233 | if (rc == MBX_TIMEOUT) |
| 1234 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
| 1235 | else |
| 1236 | mempool_free(pmboxq, phba->mbox_mem_pool); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1237 | return NULL; |
| 1238 | } |
| 1239 | |
James.Smart@Emulex.Com | f888ba3 | 2005-08-10 15:03:01 -0400 | [diff] [blame] | 1240 | memset(hs, 0, sizeof (struct fc_host_statistics)); |
| 1241 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1242 | hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; |
| 1243 | hs->tx_words = (pmb->un.varRdStatus.xmitByteCnt * 256); |
| 1244 | hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; |
| 1245 | hs->rx_words = (pmb->un.varRdStatus.rcvByteCnt * 256); |
| 1246 | |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 1247 | memset(pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1248 | pmb->mbxCommand = MBX_READ_LNK_STAT; |
| 1249 | pmb->mbxOwner = OWN_HOST; |
| 1250 | pmboxq->context1 = NULL; |
| 1251 | |
| 1252 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 1253 | (!(psli->sli_flag & LPFC_SLI2_ACTIVE))) |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1254 | rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 1255 | else |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1256 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); |
| 1257 | |
| 1258 | if (rc != MBX_SUCCESS) { |
James.Smart@Emulex.Com | 433c357 | 2005-10-28 20:28:56 -0400 | [diff] [blame] | 1259 | if (rc == MBX_TIMEOUT) |
| 1260 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
| 1261 | else |
| 1262 | mempool_free( pmboxq, phba->mbox_mem_pool); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1263 | return NULL; |
| 1264 | } |
| 1265 | |
| 1266 | hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; |
| 1267 | hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; |
| 1268 | hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; |
| 1269 | hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; |
| 1270 | hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; |
| 1271 | hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; |
| 1272 | hs->error_frames = pmb->un.varRdLnk.crcCnt; |
| 1273 | |
| 1274 | if (phba->fc_topology == TOPOLOGY_LOOP) { |
| 1275 | hs->lip_count = (phba->fc_eventTag >> 1); |
| 1276 | hs->nos_count = -1; |
| 1277 | } else { |
| 1278 | hs->lip_count = -1; |
| 1279 | hs->nos_count = (phba->fc_eventTag >> 1); |
| 1280 | } |
| 1281 | |
| 1282 | hs->dumped_frames = -1; |
| 1283 | |
| 1284 | /* FIX ME */ |
| 1285 | /*hs->SecondsSinceLastReset = (jiffies - lpfc_loadtime) / HZ;*/ |
| 1286 | |
| 1287 | return hs; |
| 1288 | } |
| 1289 | |
| 1290 | |
| 1291 | /* |
| 1292 | * The LPFC driver treats linkdown handling as target loss events so there |
| 1293 | * are no sysfs handlers for link_down_tmo. |
| 1294 | */ |
| 1295 | static void |
| 1296 | lpfc_get_starget_port_id(struct scsi_target *starget) |
| 1297 | { |
| 1298 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1299 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1300 | uint32_t did = -1; |
| 1301 | struct lpfc_nodelist *ndlp = NULL; |
| 1302 | |
| 1303 | spin_lock_irq(shost->host_lock); |
| 1304 | /* Search the mapped list for this target ID */ |
| 1305 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { |
| 1306 | if (starget->id == ndlp->nlp_sid) { |
| 1307 | did = ndlp->nlp_DID; |
| 1308 | break; |
| 1309 | } |
| 1310 | } |
| 1311 | spin_unlock_irq(shost->host_lock); |
| 1312 | |
| 1313 | fc_starget_port_id(starget) = did; |
| 1314 | } |
| 1315 | |
| 1316 | static void |
| 1317 | lpfc_get_starget_node_name(struct scsi_target *starget) |
| 1318 | { |
| 1319 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1320 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
Andrew Vasquez | f631b4b | 2005-08-31 15:23:12 -0700 | [diff] [blame] | 1321 | u64 node_name = 0; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1322 | struct lpfc_nodelist *ndlp = NULL; |
| 1323 | |
| 1324 | spin_lock_irq(shost->host_lock); |
| 1325 | /* Search the mapped list for this target ID */ |
| 1326 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { |
| 1327 | if (starget->id == ndlp->nlp_sid) { |
Andrew Morton | 68ce1eb | 2005-09-21 09:46:54 -0700 | [diff] [blame] | 1328 | node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1329 | break; |
| 1330 | } |
| 1331 | } |
| 1332 | spin_unlock_irq(shost->host_lock); |
| 1333 | |
Andrew Vasquez | f631b4b | 2005-08-31 15:23:12 -0700 | [diff] [blame] | 1334 | fc_starget_node_name(starget) = node_name; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1335 | } |
| 1336 | |
| 1337 | static void |
| 1338 | lpfc_get_starget_port_name(struct scsi_target *starget) |
| 1339 | { |
| 1340 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
Jamie Wellnitz | 7f0b5b1 | 2006-02-28 19:25:24 -0500 | [diff] [blame] | 1341 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
Andrew Vasquez | f631b4b | 2005-08-31 15:23:12 -0700 | [diff] [blame] | 1342 | u64 port_name = 0; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1343 | struct lpfc_nodelist *ndlp = NULL; |
| 1344 | |
| 1345 | spin_lock_irq(shost->host_lock); |
| 1346 | /* Search the mapped list for this target ID */ |
| 1347 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { |
| 1348 | if (starget->id == ndlp->nlp_sid) { |
Andrew Morton | 68ce1eb | 2005-09-21 09:46:54 -0700 | [diff] [blame] | 1349 | port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1350 | break; |
| 1351 | } |
| 1352 | } |
| 1353 | spin_unlock_irq(shost->host_lock); |
| 1354 | |
Andrew Vasquez | f631b4b | 2005-08-31 15:23:12 -0700 | [diff] [blame] | 1355 | fc_starget_port_name(starget) = port_name; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1356 | } |
| 1357 | |
| 1358 | static void |
| 1359 | lpfc_get_rport_loss_tmo(struct fc_rport *rport) |
| 1360 | { |
| 1361 | /* |
| 1362 | * Return the driver's global value for device loss timeout plus |
| 1363 | * five seconds to allow the driver's nodev timer to run. |
| 1364 | */ |
| 1365 | rport->dev_loss_tmo = lpfc_nodev_tmo + 5; |
| 1366 | } |
| 1367 | |
| 1368 | static void |
| 1369 | lpfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) |
| 1370 | { |
| 1371 | /* |
| 1372 | * The driver doesn't have a per-target timeout setting. Set |
| 1373 | * this value globally. lpfc_nodev_tmo should be greater then 0. |
| 1374 | */ |
| 1375 | if (timeout) |
| 1376 | lpfc_nodev_tmo = timeout; |
| 1377 | else |
| 1378 | lpfc_nodev_tmo = 1; |
| 1379 | rport->dev_loss_tmo = lpfc_nodev_tmo + 5; |
| 1380 | } |
| 1381 | |
| 1382 | |
| 1383 | #define lpfc_rport_show_function(field, format_string, sz, cast) \ |
| 1384 | static ssize_t \ |
| 1385 | lpfc_show_rport_##field (struct class_device *cdev, char *buf) \ |
| 1386 | { \ |
| 1387 | struct fc_rport *rport = transport_class_to_rport(cdev); \ |
| 1388 | struct lpfc_rport_data *rdata = rport->hostdata; \ |
| 1389 | return snprintf(buf, sz, format_string, \ |
| 1390 | (rdata->target) ? cast rdata->target->field : 0); \ |
| 1391 | } |
| 1392 | |
| 1393 | #define lpfc_rport_rd_attr(field, format_string, sz) \ |
| 1394 | lpfc_rport_show_function(field, format_string, sz, ) \ |
| 1395 | static FC_RPORT_ATTR(field, S_IRUGO, lpfc_show_rport_##field, NULL) |
| 1396 | |
| 1397 | |
| 1398 | struct fc_function_template lpfc_transport_functions = { |
| 1399 | /* fixed attributes the driver supports */ |
| 1400 | .show_host_node_name = 1, |
| 1401 | .show_host_port_name = 1, |
| 1402 | .show_host_supported_classes = 1, |
| 1403 | .show_host_supported_fc4s = 1, |
| 1404 | .show_host_symbolic_name = 1, |
| 1405 | .show_host_supported_speeds = 1, |
| 1406 | .show_host_maxframe_size = 1, |
| 1407 | |
| 1408 | /* dynamic attributes the driver supports */ |
| 1409 | .get_host_port_id = lpfc_get_host_port_id, |
| 1410 | .show_host_port_id = 1, |
| 1411 | |
| 1412 | .get_host_port_type = lpfc_get_host_port_type, |
| 1413 | .show_host_port_type = 1, |
| 1414 | |
| 1415 | .get_host_port_state = lpfc_get_host_port_state, |
| 1416 | .show_host_port_state = 1, |
| 1417 | |
| 1418 | /* active_fc4s is shown but doesn't change (thus no get function) */ |
| 1419 | .show_host_active_fc4s = 1, |
| 1420 | |
| 1421 | .get_host_speed = lpfc_get_host_speed, |
| 1422 | .show_host_speed = 1, |
| 1423 | |
| 1424 | .get_host_fabric_name = lpfc_get_host_fabric_name, |
| 1425 | .show_host_fabric_name = 1, |
| 1426 | |
| 1427 | /* |
| 1428 | * The LPFC driver treats linkdown handling as target loss events |
| 1429 | * so there are no sysfs handlers for link_down_tmo. |
| 1430 | */ |
| 1431 | |
| 1432 | .get_fc_host_stats = lpfc_get_stats, |
| 1433 | |
| 1434 | /* the LPFC driver doesn't support resetting stats yet */ |
| 1435 | |
| 1436 | .dd_fcrport_size = sizeof(struct lpfc_rport_data), |
| 1437 | .show_rport_maxframe_size = 1, |
| 1438 | .show_rport_supported_classes = 1, |
| 1439 | |
| 1440 | .get_rport_dev_loss_tmo = lpfc_get_rport_loss_tmo, |
| 1441 | .set_rport_dev_loss_tmo = lpfc_set_rport_loss_tmo, |
| 1442 | .show_rport_dev_loss_tmo = 1, |
| 1443 | |
| 1444 | .get_starget_port_id = lpfc_get_starget_port_id, |
| 1445 | .show_starget_port_id = 1, |
| 1446 | |
| 1447 | .get_starget_node_name = lpfc_get_starget_node_name, |
| 1448 | .show_starget_node_name = 1, |
| 1449 | |
| 1450 | .get_starget_port_name = lpfc_get_starget_port_name, |
| 1451 | .show_starget_port_name = 1, |
Andrew Vasquez | 91ca7b0 | 2005-10-27 16:03:37 -0700 | [diff] [blame] | 1452 | |
| 1453 | .issue_fc_host_lip = lpfc_issue_lip, |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1454 | }; |
| 1455 | |
| 1456 | void |
| 1457 | lpfc_get_cfgparam(struct lpfc_hba *phba) |
| 1458 | { |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 1459 | lpfc_log_verbose_init(phba, lpfc_log_verbose); |
| 1460 | lpfc_cr_delay_init(phba, lpfc_cr_delay); |
| 1461 | lpfc_cr_count_init(phba, lpfc_cr_count); |
Jamie Wellnitz | cf5bf97 | 2006-02-28 22:33:08 -0500 | [diff] [blame] | 1462 | lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); |
James.Smart@Emulex.Com | 7bcbb75 | 2005-10-28 20:29:13 -0400 | [diff] [blame] | 1463 | lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth); |
| 1464 | lpfc_fcp_class_init(phba, lpfc_fcp_class); |
| 1465 | lpfc_use_adisc_init(phba, lpfc_use_adisc); |
| 1466 | lpfc_ack0_init(phba, lpfc_ack0); |
| 1467 | lpfc_topology_init(phba, lpfc_topology); |
| 1468 | lpfc_scan_down_init(phba, lpfc_scan_down); |
| 1469 | lpfc_nodev_tmo_init(phba, lpfc_nodev_tmo); |
| 1470 | lpfc_link_speed_init(phba, lpfc_link_speed); |
| 1471 | lpfc_fdmi_on_init(phba, lpfc_fdmi_on); |
| 1472 | lpfc_discovery_threads_init(phba, lpfc_discovery_threads); |
| 1473 | lpfc_max_luns_init(phba, lpfc_max_luns); |
James.Smart@Emulex.Com | 875fbdf | 2005-11-29 16:32:13 -0500 | [diff] [blame] | 1474 | lpfc_poll_tmo_init(phba, lpfc_poll_tmo); |
| 1475 | |
| 1476 | phba->cfg_poll = lpfc_poll; |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1477 | |
| 1478 | /* |
| 1479 | * The total number of segments is the configuration value plus 2 |
| 1480 | * since the IOCB need a command and response bde. |
| 1481 | */ |
| 1482 | phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2; |
| 1483 | |
| 1484 | /* |
| 1485 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size |
| 1486 | * used to create the sg_dma_buf_pool must be dynamically calculated |
| 1487 | */ |
| 1488 | phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + |
| 1489 | sizeof(struct fcp_rsp) + |
| 1490 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); |
| 1491 | |
| 1492 | switch (phba->pcidev->device) { |
| 1493 | case PCI_DEVICE_ID_LP101: |
| 1494 | case PCI_DEVICE_ID_BSMB: |
| 1495 | case PCI_DEVICE_ID_ZSMB: |
| 1496 | phba->cfg_hba_queue_depth = LPFC_LP101_HBA_Q_DEPTH; |
| 1497 | break; |
| 1498 | case PCI_DEVICE_ID_RFLY: |
| 1499 | case PCI_DEVICE_ID_PFLY: |
| 1500 | case PCI_DEVICE_ID_BMID: |
| 1501 | case PCI_DEVICE_ID_ZMID: |
| 1502 | case PCI_DEVICE_ID_TFLY: |
| 1503 | phba->cfg_hba_queue_depth = LPFC_LC_HBA_Q_DEPTH; |
| 1504 | break; |
| 1505 | default: |
| 1506 | phba->cfg_hba_queue_depth = LPFC_DFT_HBA_Q_DEPTH; |
| 1507 | } |
Jamie Wellnitz | b28485a | 2006-02-28 19:25:21 -0500 | [diff] [blame] | 1508 | |
| 1509 | if (phba->cfg_hba_queue_depth > lpfc_hba_queue_depth) |
| 1510 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); |
| 1511 | |
| dea3101 | 2005-04-17 16:05:31 -0500 | [diff] [blame] | 1512 | return; |
| 1513 | } |