diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 19:30:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 19:30:12 -0500 |
commit | f61ea1b0c825a20a1826bb43a226387091934586 (patch) | |
tree | fdedf0a2368f707e3fd5205db05bfcbac79606ec /drivers/scsi/lpfc | |
parent | d347da0deffa1d8f88f0d270eab040e4707c9916 (diff) | |
parent | 7b32b8e018d8f8cc94c808a5fa84a3f889441b91 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 14 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 92 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 3 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_disc.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 4 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 18 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw.h | 40 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 183 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nportdisc.c | 69 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 295 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 217 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_version.h | 2 |
12 files changed, 727 insertions, 212 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 3062b39fbdb9..38ffa8d6e629 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -29,9 +29,10 @@ struct lpfc_sli2_slim; | |||
29 | #define LPFC_LC_HBA_Q_DEPTH 1024 /* max cmds per low cost hba */ | 29 | #define LPFC_LC_HBA_Q_DEPTH 1024 /* max cmds per low cost hba */ |
30 | #define LPFC_LP101_HBA_Q_DEPTH 128 /* max cmds per low cost hba */ | 30 | #define LPFC_LP101_HBA_Q_DEPTH 128 /* max cmds per low cost hba */ |
31 | 31 | ||
32 | #define LPFC_CMD_PER_LUN 30 /* max outstanding cmds per lun */ | 32 | #define LPFC_CMD_PER_LUN 3 /* max outstanding cmds per lun */ |
33 | #define LPFC_SG_SEG_CNT 64 /* sg element count per scsi cmnd */ | 33 | #define LPFC_SG_SEG_CNT 64 /* sg element count per scsi cmnd */ |
34 | #define LPFC_IOCB_LIST_CNT 2250 /* list of IOCBs for fast-path usage. */ | 34 | #define LPFC_IOCB_LIST_CNT 2250 /* list of IOCBs for fast-path usage. */ |
35 | #define LPFC_Q_RAMP_UP_INTERVAL 120 /* lun q_depth ramp up interval */ | ||
35 | 36 | ||
36 | /* Define macros for 64 bit support */ | 37 | /* Define macros for 64 bit support */ |
37 | #define putPaddrLow(addr) ((uint32_t) (0xffffffff & (u64)(addr))) | 38 | #define putPaddrLow(addr) ((uint32_t) (0xffffffff & (u64)(addr))) |
@@ -45,6 +46,11 @@ struct lpfc_sli2_slim; | |||
45 | 46 | ||
46 | #define MAX_HBAEVT 32 | 47 | #define MAX_HBAEVT 32 |
47 | 48 | ||
49 | enum lpfc_polling_flags { | ||
50 | ENABLE_FCP_RING_POLLING = 0x1, | ||
51 | DISABLE_FCP_RING_INT = 0x2 | ||
52 | }; | ||
53 | |||
48 | /* Provide DMA memory definitions the driver uses per port instance. */ | 54 | /* Provide DMA memory definitions the driver uses per port instance. */ |
49 | struct lpfc_dmabuf { | 55 | struct lpfc_dmabuf { |
50 | struct list_head list; | 56 | struct list_head list; |
@@ -167,6 +173,7 @@ struct lpfc_hba { | |||
167 | dma_addr_t slim2p_mapping; | 173 | dma_addr_t slim2p_mapping; |
168 | uint16_t pci_cfg_value; | 174 | uint16_t pci_cfg_value; |
169 | 175 | ||
176 | struct semaphore hba_can_block; | ||
170 | uint32_t hba_state; | 177 | uint32_t hba_state; |
171 | 178 | ||
172 | #define LPFC_INIT_START 1 /* Initial state after board reset */ | 179 | #define LPFC_INIT_START 1 /* Initial state after board reset */ |
@@ -286,6 +293,8 @@ struct lpfc_hba { | |||
286 | uint32_t cfg_fcp_bind_method; | 293 | uint32_t cfg_fcp_bind_method; |
287 | uint32_t cfg_discovery_threads; | 294 | uint32_t cfg_discovery_threads; |
288 | uint32_t cfg_max_luns; | 295 | uint32_t cfg_max_luns; |
296 | uint32_t cfg_poll; | ||
297 | uint32_t cfg_poll_tmo; | ||
289 | uint32_t cfg_sg_seg_cnt; | 298 | uint32_t cfg_sg_seg_cnt; |
290 | uint32_t cfg_sg_dma_buf_size; | 299 | uint32_t cfg_sg_dma_buf_size; |
291 | 300 | ||
@@ -337,7 +346,9 @@ struct lpfc_hba { | |||
337 | #define VPD_PORT 0x8 /* valid vpd port data */ | 346 | #define VPD_PORT 0x8 /* valid vpd port data */ |
338 | #define VPD_MASK 0xf /* mask for any vpd data */ | 347 | #define VPD_MASK 0xf /* mask for any vpd data */ |
339 | 348 | ||
349 | struct timer_list fcp_poll_timer; | ||
340 | struct timer_list els_tmofunc; | 350 | struct timer_list els_tmofunc; |
351 | |||
341 | /* | 352 | /* |
342 | * stat counters | 353 | * stat counters |
343 | */ | 354 | */ |
@@ -348,6 +359,7 @@ struct lpfc_hba { | |||
348 | struct lpfc_sysfs_mbox sysfs_mbox; | 359 | struct lpfc_sysfs_mbox sysfs_mbox; |
349 | 360 | ||
350 | /* fastpath list. */ | 361 | /* fastpath list. */ |
362 | spinlock_t scsi_buf_list_lock; | ||
351 | struct list_head lpfc_scsi_buf_list; | 363 | struct list_head lpfc_scsi_buf_list; |
352 | uint32_t total_scsi_bufs; | 364 | uint32_t total_scsi_bufs; |
353 | struct list_head lpfc_iocb_list; | 365 | struct list_head lpfc_iocb_list; |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 89e8222bc7cc..5625a8c2a8fd 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -278,6 +278,71 @@ lpfc_board_online_store(struct class_device *cdev, const char *buf, | |||
278 | return -EIO; | 278 | return -EIO; |
279 | } | 279 | } |
280 | 280 | ||
281 | static ssize_t | ||
282 | lpfc_poll_show(struct class_device *cdev, char *buf) | ||
283 | { | ||
284 | struct Scsi_Host *host = class_to_shost(cdev); | ||
285 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | ||
286 | |||
287 | return snprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); | ||
288 | } | ||
289 | |||
290 | static ssize_t | ||
291 | lpfc_poll_store(struct class_device *cdev, const char *buf, | ||
292 | size_t count) | ||
293 | { | ||
294 | struct Scsi_Host *host = class_to_shost(cdev); | ||
295 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | ||
296 | uint32_t creg_val; | ||
297 | uint32_t old_val; | ||
298 | int val=0; | ||
299 | |||
300 | if (!isdigit(buf[0])) | ||
301 | return -EINVAL; | ||
302 | |||
303 | if (sscanf(buf, "%i", &val) != 1) | ||
304 | return -EINVAL; | ||
305 | |||
306 | if ((val & 0x3) != val) | ||
307 | return -EINVAL; | ||
308 | |||
309 | spin_lock_irq(phba->host->host_lock); | ||
310 | |||
311 | old_val = phba->cfg_poll; | ||
312 | |||
313 | if (val & ENABLE_FCP_RING_POLLING) { | ||
314 | if ((val & DISABLE_FCP_RING_INT) && | ||
315 | !(old_val & DISABLE_FCP_RING_INT)) { | ||
316 | creg_val = readl(phba->HCregaddr); | ||
317 | creg_val &= ~(HC_R0INT_ENA << LPFC_FCP_RING); | ||
318 | writel(creg_val, phba->HCregaddr); | ||
319 | readl(phba->HCregaddr); /* flush */ | ||
320 | |||
321 | lpfc_poll_start_timer(phba); | ||
322 | } | ||
323 | } else if (val != 0x0) { | ||
324 | spin_unlock_irq(phba->host->host_lock); | ||
325 | return -EINVAL; | ||
326 | } | ||
327 | |||
328 | if (!(val & DISABLE_FCP_RING_INT) && | ||
329 | (old_val & DISABLE_FCP_RING_INT)) | ||
330 | { | ||
331 | spin_unlock_irq(phba->host->host_lock); | ||
332 | del_timer(&phba->fcp_poll_timer); | ||
333 | spin_lock_irq(phba->host->host_lock); | ||
334 | creg_val = readl(phba->HCregaddr); | ||
335 | creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING); | ||
336 | writel(creg_val, phba->HCregaddr); | ||
337 | readl(phba->HCregaddr); /* flush */ | ||
338 | } | ||
339 | |||
340 | phba->cfg_poll = val; | ||
341 | |||
342 | spin_unlock_irq(phba->host->host_lock); | ||
343 | |||
344 | return strlen(buf); | ||
345 | } | ||
281 | 346 | ||
282 | #define lpfc_param_show(attr) \ | 347 | #define lpfc_param_show(attr) \ |
283 | static ssize_t \ | 348 | static ssize_t \ |
@@ -416,6 +481,15 @@ static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, | |||
416 | static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, | 481 | static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, |
417 | lpfc_board_online_show, lpfc_board_online_store); | 482 | lpfc_board_online_show, lpfc_board_online_store); |
418 | 483 | ||
484 | static int lpfc_poll = 0; | ||
485 | module_param(lpfc_poll, int, 0); | ||
486 | MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode control:" | ||
487 | " 0 - none," | ||
488 | " 1 - poll with interrupts enabled" | ||
489 | " 3 - poll and disable FCP ring interrupts"); | ||
490 | |||
491 | static CLASS_DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, | ||
492 | lpfc_poll_show, lpfc_poll_store); | ||
419 | 493 | ||
420 | /* | 494 | /* |
421 | # lpfc_log_verbose: Only turn this flag on if you are willing to risk being | 495 | # lpfc_log_verbose: Only turn this flag on if you are willing to risk being |
@@ -523,10 +597,10 @@ LPFC_ATTR_R(ack0, 0, 0, 1, "Enable ACK0 support"); | |||
523 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if | 597 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if |
524 | # cr_delay is set to 0. | 598 | # cr_delay is set to 0. |
525 | */ | 599 | */ |
526 | LPFC_ATTR(cr_delay, 0, 0, 63, "A count of milliseconds after which an" | 600 | LPFC_ATTR_RW(cr_delay, 0, 0, 63, "A count of milliseconds after which an" |
527 | "interrupt response is generated"); | 601 | "interrupt response is generated"); |
528 | 602 | ||
529 | LPFC_ATTR(cr_count, 1, 1, 255, "A count of I/O completions after which an" | 603 | LPFC_ATTR_RW(cr_count, 1, 1, 255, "A count of I/O completions after which an" |
530 | "interrupt response is generated"); | 604 | "interrupt response is generated"); |
531 | 605 | ||
532 | /* | 606 | /* |
@@ -553,6 +627,13 @@ LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands" | |||
553 | LPFC_ATTR_R(max_luns, 256, 1, 32768, | 627 | LPFC_ATTR_R(max_luns, 256, 1, 32768, |
554 | "Maximum number of LUNs per target driver will support"); | 628 | "Maximum number of LUNs per target driver will support"); |
555 | 629 | ||
630 | /* | ||
631 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. | ||
632 | # Value range is [1,255], default value is 10. | ||
633 | */ | ||
634 | LPFC_ATTR_RW(poll_tmo, 10, 1, 255, | ||
635 | "Milliseconds driver will wait between polling FCP ring"); | ||
636 | |||
556 | struct class_device_attribute *lpfc_host_attrs[] = { | 637 | struct class_device_attribute *lpfc_host_attrs[] = { |
557 | &class_device_attr_info, | 638 | &class_device_attr_info, |
558 | &class_device_attr_serialnum, | 639 | &class_device_attr_serialnum, |
@@ -575,11 +656,15 @@ struct class_device_attribute *lpfc_host_attrs[] = { | |||
575 | &class_device_attr_lpfc_topology, | 656 | &class_device_attr_lpfc_topology, |
576 | &class_device_attr_lpfc_scan_down, | 657 | &class_device_attr_lpfc_scan_down, |
577 | &class_device_attr_lpfc_link_speed, | 658 | &class_device_attr_lpfc_link_speed, |
659 | &class_device_attr_lpfc_cr_delay, | ||
660 | &class_device_attr_lpfc_cr_count, | ||
578 | &class_device_attr_lpfc_fdmi_on, | 661 | &class_device_attr_lpfc_fdmi_on, |
579 | &class_device_attr_lpfc_max_luns, | 662 | &class_device_attr_lpfc_max_luns, |
580 | &class_device_attr_nport_evt_cnt, | 663 | &class_device_attr_nport_evt_cnt, |
581 | &class_device_attr_management_version, | 664 | &class_device_attr_management_version, |
582 | &class_device_attr_board_online, | 665 | &class_device_attr_board_online, |
666 | &class_device_attr_lpfc_poll, | ||
667 | &class_device_attr_lpfc_poll_tmo, | ||
583 | NULL, | 668 | NULL, |
584 | }; | 669 | }; |
585 | 670 | ||
@@ -1292,6 +1377,9 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
1292 | lpfc_fdmi_on_init(phba, lpfc_fdmi_on); | 1377 | lpfc_fdmi_on_init(phba, lpfc_fdmi_on); |
1293 | lpfc_discovery_threads_init(phba, lpfc_discovery_threads); | 1378 | lpfc_discovery_threads_init(phba, lpfc_discovery_threads); |
1294 | lpfc_max_luns_init(phba, lpfc_max_luns); | 1379 | lpfc_max_luns_init(phba, lpfc_max_luns); |
1380 | lpfc_poll_tmo_init(phba, lpfc_poll_tmo); | ||
1381 | |||
1382 | phba->cfg_poll = lpfc_poll; | ||
1295 | 1383 | ||
1296 | /* | 1384 | /* |
1297 | * The total number of segments is the configuration value plus 2 | 1385 | * The total number of segments is the configuration value plus 2 |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index d527d05a607f..f1e708946e66 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -143,6 +143,9 @@ LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *); | |||
143 | int lpfc_mem_alloc(struct lpfc_hba *); | 143 | int lpfc_mem_alloc(struct lpfc_hba *); |
144 | void lpfc_mem_free(struct lpfc_hba *); | 144 | void lpfc_mem_free(struct lpfc_hba *); |
145 | 145 | ||
146 | void lpfc_poll_timeout(unsigned long ptr); | ||
147 | void lpfc_poll_start_timer(struct lpfc_hba * phba); | ||
148 | void lpfc_sli_poll_fcp_ring(struct lpfc_hba * hba); | ||
146 | struct lpfc_iocbq * lpfc_sli_get_iocbq(struct lpfc_hba *); | 149 | struct lpfc_iocbq * lpfc_sli_get_iocbq(struct lpfc_hba *); |
147 | void lpfc_sli_release_iocbq(struct lpfc_hba * phba, struct lpfc_iocbq * iocb); | 150 | void lpfc_sli_release_iocbq(struct lpfc_hba * phba, struct lpfc_iocbq * iocb); |
148 | uint16_t lpfc_sli_next_iotag(struct lpfc_hba * phba, struct lpfc_iocbq * iocb); | 151 | uint16_t lpfc_sli_next_iotag(struct lpfc_hba * phba, struct lpfc_iocbq * iocb); |
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index 084e7628ce17..ed6c81660e03 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h | |||
@@ -73,6 +73,8 @@ struct lpfc_nodelist { | |||
73 | struct lpfc_hba *nlp_phba; | 73 | struct lpfc_hba *nlp_phba; |
74 | struct lpfc_work_evt nodev_timeout_evt; | 74 | struct lpfc_work_evt nodev_timeout_evt; |
75 | struct lpfc_work_evt els_retry_evt; | 75 | struct lpfc_work_evt els_retry_evt; |
76 | unsigned long last_ramp_up_time; /* jiffy of last ramp up */ | ||
77 | unsigned long last_q_full_time; /* jiffy of last queue full */ | ||
76 | }; | 78 | }; |
77 | 79 | ||
78 | /* Defines for nlp_flag (uint32) */ | 80 | /* Defines for nlp_flag (uint32) */ |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index bcc29ec126dc..20f1a0713db2 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -720,6 +720,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
720 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ | 720 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ |
721 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | 721 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && |
722 | ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || | 722 | ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || |
723 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || | ||
723 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { | 724 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { |
724 | disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); | 725 | disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); |
725 | } | 726 | } |
@@ -869,6 +870,7 @@ lpfc_cmpl_els_prli(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
869 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ | 870 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ |
870 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | 871 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && |
871 | ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || | 872 | ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || |
873 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || | ||
872 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { | 874 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { |
873 | goto out; | 875 | goto out; |
874 | } | 876 | } |
@@ -1054,6 +1056,7 @@ lpfc_cmpl_els_adisc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1054 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ | 1056 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ |
1055 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | 1057 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && |
1056 | ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || | 1058 | ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || |
1059 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || | ||
1057 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { | 1060 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { |
1058 | disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); | 1061 | disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); |
1059 | } | 1062 | } |
@@ -1205,6 +1208,7 @@ lpfc_cmpl_els_logo(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1205 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ | 1208 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ |
1206 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | 1209 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && |
1207 | ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || | 1210 | ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || |
1211 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || | ||
1208 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { | 1212 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { |
1209 | goto out; | 1213 | goto out; |
1210 | } | 1214 | } |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 259eeb161b82..a1f751e79405 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -1017,12 +1017,7 @@ lpfc_register_remote_port(struct lpfc_hba * phba, | |||
1017 | rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); | 1017 | rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); |
1018 | rport_ids.port_id = ndlp->nlp_DID; | 1018 | rport_ids.port_id = ndlp->nlp_DID; |
1019 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; | 1019 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; |
1020 | if (ndlp->nlp_type & NLP_FCP_TARGET) | ||
1021 | rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; | ||
1022 | if (ndlp->nlp_type & NLP_FCP_INITIATOR) | ||
1023 | rport_ids.roles |= FC_RPORT_ROLE_FCP_INITIATOR; | ||
1024 | 1020 | ||
1025 | scsi_block_requests(phba->host); | ||
1026 | ndlp->rport = rport = fc_remote_port_add(phba->host, 0, &rport_ids); | 1021 | ndlp->rport = rport = fc_remote_port_add(phba->host, 0, &rport_ids); |
1027 | if (!rport) { | 1022 | if (!rport) { |
1028 | dev_printk(KERN_WARNING, &phba->pcidev->dev, | 1023 | dev_printk(KERN_WARNING, &phba->pcidev->dev, |
@@ -1039,7 +1034,16 @@ lpfc_register_remote_port(struct lpfc_hba * phba, | |||
1039 | } | 1034 | } |
1040 | rdata = rport->dd_data; | 1035 | rdata = rport->dd_data; |
1041 | rdata->pnode = ndlp; | 1036 | rdata->pnode = ndlp; |
1042 | scsi_unblock_requests(phba->host); | 1037 | |
1038 | if (ndlp->nlp_type & NLP_FCP_TARGET) | ||
1039 | rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; | ||
1040 | if (ndlp->nlp_type & NLP_FCP_INITIATOR) | ||
1041 | rport_ids.roles |= FC_RPORT_ROLE_FCP_INITIATOR; | ||
1042 | |||
1043 | |||
1044 | if (rport_ids.roles != FC_RPORT_ROLE_UNKNOWN) | ||
1045 | fc_remote_port_rolechg(rport, rport_ids.roles); | ||
1046 | |||
1043 | 1047 | ||
1044 | return; | 1048 | return; |
1045 | } | 1049 | } |
@@ -1053,9 +1057,7 @@ lpfc_unregister_remote_port(struct lpfc_hba * phba, | |||
1053 | 1057 | ||
1054 | ndlp->rport = NULL; | 1058 | ndlp->rport = NULL; |
1055 | rdata->pnode = NULL; | 1059 | rdata->pnode = NULL; |
1056 | scsi_block_requests(phba->host); | ||
1057 | fc_remote_port_delete(rport); | 1060 | fc_remote_port_delete(rport); |
1058 | scsi_unblock_requests(phba->host); | ||
1059 | 1061 | ||
1060 | return; | 1062 | return; |
1061 | } | 1063 | } |
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index 86c41981188b..1ea565e0561f 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -266,9 +266,11 @@ struct lpfc_name { | |||
266 | struct { | 266 | struct { |
267 | #ifdef __BIG_ENDIAN_BITFIELD | 267 | #ifdef __BIG_ENDIAN_BITFIELD |
268 | uint8_t nameType:4; /* FC Word 0, bit 28:31 */ | 268 | uint8_t nameType:4; /* FC Word 0, bit 28:31 */ |
269 | uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */ | 269 | uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit |
270 | 8:11 of IEEE ext */ | ||
270 | #else /* __LITTLE_ENDIAN_BITFIELD */ | 271 | #else /* __LITTLE_ENDIAN_BITFIELD */ |
271 | uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */ | 272 | uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit |
273 | 8:11 of IEEE ext */ | ||
272 | uint8_t nameType:4; /* FC Word 0, bit 28:31 */ | 274 | uint8_t nameType:4; /* FC Word 0, bit 28:31 */ |
273 | #endif | 275 | #endif |
274 | 276 | ||
@@ -278,7 +280,8 @@ struct lpfc_name { | |||
278 | #define NAME_IP_TYPE 0x4 /* IP address */ | 280 | #define NAME_IP_TYPE 0x4 /* IP address */ |
279 | #define NAME_CCITT_TYPE 0xC | 281 | #define NAME_CCITT_TYPE 0xC |
280 | #define NAME_CCITT_GR_TYPE 0xE | 282 | #define NAME_CCITT_GR_TYPE 0xE |
281 | uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */ | 283 | uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE |
284 | extended Lsb */ | ||
282 | uint8_t IEEE[6]; /* FC IEEE address */ | 285 | uint8_t IEEE[6]; /* FC IEEE address */ |
283 | } s; | 286 | } s; |
284 | uint8_t wwn[8]; | 287 | uint8_t wwn[8]; |
@@ -1024,23 +1027,38 @@ typedef struct { | |||
1024 | /* Start FireFly Register definitions */ | 1027 | /* Start FireFly Register definitions */ |
1025 | #define PCI_VENDOR_ID_EMULEX 0x10df | 1028 | #define PCI_VENDOR_ID_EMULEX 0x10df |
1026 | #define PCI_DEVICE_ID_FIREFLY 0x1ae5 | 1029 | #define PCI_DEVICE_ID_FIREFLY 0x1ae5 |
1027 | #define PCI_DEVICE_ID_SUPERFLY 0xf700 | ||
1028 | #define PCI_DEVICE_ID_DRAGONFLY 0xf800 | ||
1029 | #define PCI_DEVICE_ID_RFLY 0xf095 | 1030 | #define PCI_DEVICE_ID_RFLY 0xf095 |
1030 | #define PCI_DEVICE_ID_PFLY 0xf098 | 1031 | #define PCI_DEVICE_ID_PFLY 0xf098 |
1032 | #define PCI_DEVICE_ID_LP101 0xf0a1 | ||
1031 | #define PCI_DEVICE_ID_TFLY 0xf0a5 | 1033 | #define PCI_DEVICE_ID_TFLY 0xf0a5 |
1034 | #define PCI_DEVICE_ID_BSMB 0xf0d1 | ||
1035 | #define PCI_DEVICE_ID_BMID 0xf0d5 | ||
1036 | #define PCI_DEVICE_ID_ZSMB 0xf0e1 | ||
1037 | #define PCI_DEVICE_ID_ZMID 0xf0e5 | ||
1038 | #define PCI_DEVICE_ID_NEPTUNE 0xf0f5 | ||
1039 | #define PCI_DEVICE_ID_NEPTUNE_SCSP 0xf0f6 | ||
1040 | #define PCI_DEVICE_ID_NEPTUNE_DCSP 0xf0f7 | ||
1041 | #define PCI_DEVICE_ID_SUPERFLY 0xf700 | ||
1042 | #define PCI_DEVICE_ID_DRAGONFLY 0xf800 | ||
1032 | #define PCI_DEVICE_ID_CENTAUR 0xf900 | 1043 | #define PCI_DEVICE_ID_CENTAUR 0xf900 |
1033 | #define PCI_DEVICE_ID_PEGASUS 0xf980 | 1044 | #define PCI_DEVICE_ID_PEGASUS 0xf980 |
1034 | #define PCI_DEVICE_ID_THOR 0xfa00 | 1045 | #define PCI_DEVICE_ID_THOR 0xfa00 |
1035 | #define PCI_DEVICE_ID_VIPER 0xfb00 | 1046 | #define PCI_DEVICE_ID_VIPER 0xfb00 |
1047 | #define PCI_DEVICE_ID_LP10000S 0xfc00 | ||
1048 | #define PCI_DEVICE_ID_LP11000S 0xfc10 | ||
1049 | #define PCI_DEVICE_ID_LPE11000S 0xfc20 | ||
1036 | #define PCI_DEVICE_ID_HELIOS 0xfd00 | 1050 | #define PCI_DEVICE_ID_HELIOS 0xfd00 |
1037 | #define PCI_DEVICE_ID_BMID 0xf0d5 | 1051 | #define PCI_DEVICE_ID_HELIOS_SCSP 0xfd11 |
1038 | #define PCI_DEVICE_ID_BSMB 0xf0d1 | 1052 | #define PCI_DEVICE_ID_HELIOS_DCSP 0xfd12 |
1039 | #define PCI_DEVICE_ID_ZEPHYR 0xfe00 | 1053 | #define PCI_DEVICE_ID_ZEPHYR 0xfe00 |
1040 | #define PCI_DEVICE_ID_ZMID 0xf0e5 | 1054 | #define PCI_DEVICE_ID_ZEPHYR_SCSP 0xfe11 |
1041 | #define PCI_DEVICE_ID_ZSMB 0xf0e1 | 1055 | #define PCI_DEVICE_ID_ZEPHYR_DCSP 0xfe12 |
1042 | #define PCI_DEVICE_ID_LP101 0xf0a1 | 1056 | |
1043 | #define PCI_DEVICE_ID_LP10000S 0xfc00 | 1057 | #define PCI_SUBSYSTEM_ID_LP11000S 0xfc11 |
1058 | #define PCI_SUBSYSTEM_ID_LP11002S 0xfc12 | ||
1059 | #define PCI_SUBSYSTEM_ID_LPE11000S 0xfc21 | ||
1060 | #define PCI_SUBSYSTEM_ID_LPE11002S 0xfc22 | ||
1061 | #define PCI_SUBSYSTEM_ID_LPE11010S 0xfc2A | ||
1044 | 1062 | ||
1045 | #define JEDEC_ID_ADDRESS 0x0080001c | 1063 | #define JEDEC_ID_ADDRESS 0x0080001c |
1046 | #define FIREFLY_JEDEC_ID 0x1ACC | 1064 | #define FIREFLY_JEDEC_ID 0x1ACC |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 07498118359d..b7a603a45328 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -126,34 +126,26 @@ lpfc_config_port_prep(struct lpfc_hba * phba) | |||
126 | return -ERESTART; | 126 | return -ERESTART; |
127 | } | 127 | } |
128 | 128 | ||
129 | /* The HBA's current state is provided by the ProgType and rr fields. | 129 | /* |
130 | * Read and check the value of these fields before continuing to config | 130 | * The value of rr must be 1 since the driver set the cv field to 1. |
131 | * this port. | 131 | * This setting requires the FW to set all revision fields. |
132 | */ | 132 | */ |
133 | if (mb->un.varRdRev.rr == 0 || mb->un.varRdRev.un.b.ProgType != 2) { | 133 | if (mb->un.varRdRev.rr == 0) { |
134 | /* Old firmware */ | ||
135 | vp->rev.rBit = 0; | 134 | vp->rev.rBit = 0; |
136 | lpfc_printf_log(phba, | 135 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
137 | KERN_ERR, | 136 | "%d:0440 Adapter failed to init, READ_REV has " |
138 | LOG_INIT, | 137 | "missing revision information.\n", |
139 | "%d:0440 Adapter failed to init, mbxCmd x%x " | 138 | phba->brd_no); |
140 | "READ_REV detected outdated firmware" | ||
141 | "Data: x%x\n", | ||
142 | phba->brd_no, | ||
143 | mb->mbxCommand, 0); | ||
144 | mempool_free(pmb, phba->mbox_mem_pool); | 139 | mempool_free(pmb, phba->mbox_mem_pool); |
145 | return -ERESTART; | 140 | return -ERESTART; |
146 | } else { | ||
147 | vp->rev.rBit = 1; | ||
148 | vp->rev.sli1FwRev = mb->un.varRdRev.sli1FwRev; | ||
149 | memcpy(vp->rev.sli1FwName, | ||
150 | (char*)mb->un.varRdRev.sli1FwName, 16); | ||
151 | vp->rev.sli2FwRev = mb->un.varRdRev.sli2FwRev; | ||
152 | memcpy(vp->rev.sli2FwName, | ||
153 | (char *)mb->un.varRdRev.sli2FwName, 16); | ||
154 | } | 141 | } |
155 | 142 | ||
156 | /* Save information as VPD data */ | 143 | /* Save information as VPD data */ |
144 | vp->rev.rBit = 1; | ||
145 | vp->rev.sli1FwRev = mb->un.varRdRev.sli1FwRev; | ||
146 | memcpy(vp->rev.sli1FwName, (char*) mb->un.varRdRev.sli1FwName, 16); | ||
147 | vp->rev.sli2FwRev = mb->un.varRdRev.sli2FwRev; | ||
148 | memcpy(vp->rev.sli2FwName, (char *) mb->un.varRdRev.sli2FwName, 16); | ||
157 | vp->rev.biuRev = mb->un.varRdRev.biuRev; | 149 | vp->rev.biuRev = mb->un.varRdRev.biuRev; |
158 | vp->rev.smRev = mb->un.varRdRev.smRev; | 150 | vp->rev.smRev = mb->un.varRdRev.smRev; |
159 | vp->rev.smFwRev = mb->un.varRdRev.un.smFwRev; | 151 | vp->rev.smFwRev = mb->un.varRdRev.un.smFwRev; |
@@ -378,6 +370,10 @@ lpfc_config_port_post(struct lpfc_hba * phba) | |||
378 | if (psli->num_rings > 3) | 370 | if (psli->num_rings > 3) |
379 | status |= HC_R3INT_ENA; | 371 | status |= HC_R3INT_ENA; |
380 | 372 | ||
373 | if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && | ||
374 | (phba->cfg_poll & DISABLE_FCP_RING_INT)) | ||
375 | status &= ~(HC_R0INT_ENA << LPFC_FCP_RING); | ||
376 | |||
381 | writel(status, phba->HCregaddr); | 377 | writel(status, phba->HCregaddr); |
382 | readl(phba->HCregaddr); /* flush */ | 378 | readl(phba->HCregaddr); /* flush */ |
383 | spin_unlock_irq(phba->host->host_lock); | 379 | spin_unlock_irq(phba->host->host_lock); |
@@ -571,6 +567,8 @@ lpfc_handle_latt(struct lpfc_hba * phba) | |||
571 | 567 | ||
572 | rc = -EIO; | 568 | rc = -EIO; |
573 | 569 | ||
570 | /* Cleanup any outstanding ELS commands */ | ||
571 | lpfc_els_flush_cmd(phba); | ||
574 | 572 | ||
575 | psli->slistat.link_event++; | 573 | psli->slistat.link_event++; |
576 | lpfc_read_la(phba, pmb, mp); | 574 | lpfc_read_la(phba, pmb, mp); |
@@ -765,96 +763,139 @@ static void | |||
765 | lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp) | 763 | lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp) |
766 | { | 764 | { |
767 | lpfc_vpd_t *vp; | 765 | lpfc_vpd_t *vp; |
768 | uint32_t id; | 766 | uint16_t dev_id = phba->pcidev->device; |
769 | uint8_t hdrtype; | 767 | uint16_t dev_subid = phba->pcidev->subsystem_device; |
770 | char str[16]; | 768 | uint8_t hdrtype = phba->pcidev->hdr_type; |
769 | char *model_str = ""; | ||
771 | 770 | ||
772 | vp = &phba->vpd; | 771 | vp = &phba->vpd; |
773 | pci_read_config_dword(phba->pcidev, PCI_VENDOR_ID, &id); | ||
774 | pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype); | ||
775 | 772 | ||
776 | switch ((id >> 16) & 0xffff) { | 773 | switch (dev_id) { |
777 | case PCI_DEVICE_ID_FIREFLY: | 774 | case PCI_DEVICE_ID_FIREFLY: |
778 | strcpy(str, "LP6000 1"); | 775 | model_str = "LP6000 1Gb PCI"; |
779 | break; | 776 | break; |
780 | case PCI_DEVICE_ID_SUPERFLY: | 777 | case PCI_DEVICE_ID_SUPERFLY: |
781 | if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3) | 778 | if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3) |
782 | strcpy(str, "LP7000 1"); | 779 | model_str = "LP7000 1Gb PCI"; |
783 | else | 780 | else |
784 | strcpy(str, "LP7000E 1"); | 781 | model_str = "LP7000E 1Gb PCI"; |
785 | break; | 782 | break; |
786 | case PCI_DEVICE_ID_DRAGONFLY: | 783 | case PCI_DEVICE_ID_DRAGONFLY: |
787 | strcpy(str, "LP8000 1"); | 784 | model_str = "LP8000 1Gb PCI"; |
788 | break; | 785 | break; |
789 | case PCI_DEVICE_ID_CENTAUR: | 786 | case PCI_DEVICE_ID_CENTAUR: |
790 | if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID) | 787 | if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID) |
791 | strcpy(str, "LP9002 2"); | 788 | model_str = "LP9002 2Gb PCI"; |
792 | else | 789 | else |
793 | strcpy(str, "LP9000 1"); | 790 | model_str = "LP9000 1Gb PCI"; |
794 | break; | 791 | break; |
795 | case PCI_DEVICE_ID_RFLY: | 792 | case PCI_DEVICE_ID_RFLY: |
796 | strcpy(str, "LP952 2"); | 793 | model_str = "LP952 2Gb PCI"; |
797 | break; | 794 | break; |
798 | case PCI_DEVICE_ID_PEGASUS: | 795 | case PCI_DEVICE_ID_PEGASUS: |
799 | strcpy(str, "LP9802 2"); | 796 | model_str = "LP9802 2Gb PCI-X"; |
800 | break; | 797 | break; |
801 | case PCI_DEVICE_ID_THOR: | 798 | case PCI_DEVICE_ID_THOR: |
802 | if (hdrtype == 0x80) | 799 | if (hdrtype == 0x80) |
803 | strcpy(str, "LP10000DC 2"); | 800 | model_str = "LP10000DC 2Gb 2-port PCI-X"; |
804 | else | 801 | else |
805 | strcpy(str, "LP10000 2"); | 802 | model_str = "LP10000 2Gb PCI-X"; |
806 | break; | 803 | break; |
807 | case PCI_DEVICE_ID_VIPER: | 804 | case PCI_DEVICE_ID_VIPER: |
808 | strcpy(str, "LPX1000 10"); | 805 | model_str = "LPX1000 10Gb PCI-X"; |
809 | break; | 806 | break; |
810 | case PCI_DEVICE_ID_PFLY: | 807 | case PCI_DEVICE_ID_PFLY: |
811 | strcpy(str, "LP982 2"); | 808 | model_str = "LP982 2Gb PCI-X"; |
812 | break; | 809 | break; |
813 | case PCI_DEVICE_ID_TFLY: | 810 | case PCI_DEVICE_ID_TFLY: |
814 | if (hdrtype == 0x80) | 811 | if (hdrtype == 0x80) |
815 | strcpy(str, "LP1050DC 2"); | 812 | model_str = "LP1050DC 2Gb 2-port PCI-X"; |
816 | else | 813 | else |
817 | strcpy(str, "LP1050 2"); | 814 | model_str = "LP1050 2Gb PCI-X"; |
818 | break; | 815 | break; |
819 | case PCI_DEVICE_ID_HELIOS: | 816 | case PCI_DEVICE_ID_HELIOS: |
820 | if (hdrtype == 0x80) | 817 | if (hdrtype == 0x80) |
821 | strcpy(str, "LP11002 4"); | 818 | model_str = "LP11002 4Gb 2-port PCI-X2"; |
819 | else | ||
820 | model_str = "LP11000 4Gb PCI-X2"; | ||
821 | break; | ||
822 | case PCI_DEVICE_ID_HELIOS_SCSP: | ||
823 | model_str = "LP11000-SP 4Gb PCI-X2"; | ||
824 | break; | ||
825 | case PCI_DEVICE_ID_HELIOS_DCSP: | ||
826 | model_str = "LP11002-SP 4Gb 2-port PCI-X2"; | ||
827 | break; | ||
828 | case PCI_DEVICE_ID_NEPTUNE: | ||
829 | if (hdrtype == 0x80) | ||
830 | model_str = "LPe1002 4Gb 2-port"; | ||
822 | else | 831 | else |
823 | strcpy(str, "LP11000 4"); | 832 | model_str = "LPe1000 4Gb PCIe"; |
833 | break; | ||
834 | case PCI_DEVICE_ID_NEPTUNE_SCSP: | ||
835 | model_str = "LPe1000-SP 4Gb PCIe"; | ||
836 | break; | ||
837 | case PCI_DEVICE_ID_NEPTUNE_DCSP: | ||
838 | model_str = "LPe1002-SP 4Gb 2-port PCIe"; | ||
824 | break; | 839 | break; |
825 | case PCI_DEVICE_ID_BMID: | 840 | case PCI_DEVICE_ID_BMID: |
826 | strcpy(str, "LP1150 4"); | 841 | model_str = "LP1150 4Gb PCI-X2"; |
827 | break; | 842 | break; |
828 | case PCI_DEVICE_ID_BSMB: | 843 | case PCI_DEVICE_ID_BSMB: |
829 | strcpy(str, "LP111 4"); | 844 | model_str = "LP111 4Gb PCI-X2"; |
830 | break; | 845 | break; |
831 | case PCI_DEVICE_ID_ZEPHYR: | 846 | case PCI_DEVICE_ID_ZEPHYR: |
832 | if (hdrtype == 0x80) | 847 | if (hdrtype == 0x80) |
833 | strcpy(str, "LPe11002 4"); | 848 | model_str = "LPe11002 4Gb 2-port PCIe"; |
834 | else | 849 | else |
835 | strcpy(str, "LPe11000 4"); | 850 | model_str = "LPe11000 4Gb PCIe"; |
851 | break; | ||
852 | case PCI_DEVICE_ID_ZEPHYR_SCSP: | ||
853 | model_str = "LPe11000-SP 4Gb PCIe"; | ||
854 | break; | ||
855 | case PCI_DEVICE_ID_ZEPHYR_DCSP: | ||
856 | model_str = "LPe11002-SP 4Gb 2-port PCIe"; | ||
836 | break; | 857 | break; |
837 | case PCI_DEVICE_ID_ZMID: | 858 | case PCI_DEVICE_ID_ZMID: |
838 | strcpy(str, "LPe1150 4"); | 859 | model_str = "LPe1150 4Gb PCIe"; |
839 | break; | 860 | break; |
840 | case PCI_DEVICE_ID_ZSMB: | 861 | case PCI_DEVICE_ID_ZSMB: |
841 | strcpy(str, "LPe111 4"); | 862 | model_str = "LPe111 4Gb PCIe"; |
842 | break; | 863 | break; |
843 | case PCI_DEVICE_ID_LP101: | 864 | case PCI_DEVICE_ID_LP101: |
844 | strcpy(str, "LP101 2"); | 865 | model_str = "LP101 2Gb PCI-X"; |
845 | break; | 866 | break; |
846 | case PCI_DEVICE_ID_LP10000S: | 867 | case PCI_DEVICE_ID_LP10000S: |
847 | strcpy(str, "LP10000-S 2"); | 868 | model_str = "LP10000-S 2Gb PCI"; |
869 | break; | ||
870 | case PCI_DEVICE_ID_LP11000S: | ||
871 | case PCI_DEVICE_ID_LPE11000S: | ||
872 | switch (dev_subid) { | ||
873 | case PCI_SUBSYSTEM_ID_LP11000S: | ||
874 | model_str = "LP11002-S 4Gb PCI-X2"; | ||
875 | break; | ||
876 | case PCI_SUBSYSTEM_ID_LP11002S: | ||
877 | model_str = "LP11000-S 4Gb 2-port PCI-X2"; | ||
878 | break; | ||
879 | case PCI_SUBSYSTEM_ID_LPE11000S: | ||
880 | model_str = "LPe11002-S 4Gb PCIe"; | ||
881 | break; | ||
882 | case PCI_SUBSYSTEM_ID_LPE11002S: | ||
883 | model_str = "LPe11002-S 4Gb 2-port PCIe"; | ||
884 | break; | ||
885 | case PCI_SUBSYSTEM_ID_LPE11010S: | ||
886 | model_str = "LPe11010-S 4Gb 10-port PCIe"; | ||
887 | break; | ||
888 | default: | ||
889 | break; | ||
890 | } | ||
848 | break; | 891 | break; |
849 | default: | 892 | default: |
850 | memset(str, 0, 16); | ||
851 | break; | 893 | break; |
852 | } | 894 | } |
853 | if (mdp) | 895 | if (mdp) |
854 | sscanf(str, "%s", mdp); | 896 | sscanf(model_str, "%s", mdp); |
855 | if (descp) | 897 | if (descp) |
856 | sprintf(descp, "Emulex LightPulse %s Gigabit PCI Fibre " | 898 | sprintf(descp, "Emulex %s Fibre Channel Adapter", model_str); |
857 | "Channel Adapter", str); | ||
858 | } | 899 | } |
859 | 900 | ||
860 | /**************************************************/ | 901 | /**************************************************/ |
@@ -1196,6 +1237,7 @@ lpfc_stop_timer(struct lpfc_hba * phba) | |||
1196 | } | 1237 | } |
1197 | } | 1238 | } |
1198 | 1239 | ||
1240 | del_timer_sync(&phba->fcp_poll_timer); | ||
1199 | del_timer_sync(&phba->fc_estabtmo); | 1241 | del_timer_sync(&phba->fc_estabtmo); |
1200 | del_timer_sync(&phba->fc_disctmo); | 1242 | del_timer_sync(&phba->fc_disctmo); |
1201 | del_timer_sync(&phba->fc_fdmitmo); | 1243 | del_timer_sync(&phba->fc_fdmitmo); |
@@ -1351,7 +1393,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1351 | goto out_put_host; | 1393 | goto out_put_host; |
1352 | 1394 | ||
1353 | host->unique_id = phba->brd_no; | 1395 | host->unique_id = phba->brd_no; |
1354 | 1396 | init_MUTEX(&phba->hba_can_block); | |
1355 | INIT_LIST_HEAD(&phba->ctrspbuflist); | 1397 | INIT_LIST_HEAD(&phba->ctrspbuflist); |
1356 | INIT_LIST_HEAD(&phba->rnidrspbuflist); | 1398 | INIT_LIST_HEAD(&phba->rnidrspbuflist); |
1357 | INIT_LIST_HEAD(&phba->freebufList); | 1399 | INIT_LIST_HEAD(&phba->freebufList); |
@@ -1375,6 +1417,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1375 | psli->mbox_tmo.function = lpfc_mbox_timeout; | 1417 | psli->mbox_tmo.function = lpfc_mbox_timeout; |
1376 | psli->mbox_tmo.data = (unsigned long)phba; | 1418 | psli->mbox_tmo.data = (unsigned long)phba; |
1377 | 1419 | ||
1420 | init_timer(&phba->fcp_poll_timer); | ||
1421 | phba->fcp_poll_timer.function = lpfc_poll_timeout; | ||
1422 | phba->fcp_poll_timer.data = (unsigned long)phba; | ||
1423 | |||
1378 | /* | 1424 | /* |
1379 | * Get all the module params for configuring this host and then | 1425 | * Get all the module params for configuring this host and then |
1380 | * establish the host parameters. | 1426 | * establish the host parameters. |
@@ -1489,6 +1535,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1489 | host->max_cmd_len = 16; | 1535 | host->max_cmd_len = 16; |
1490 | 1536 | ||
1491 | /* Initialize the list of scsi buffers used by driver for scsi IO. */ | 1537 | /* Initialize the list of scsi buffers used by driver for scsi IO. */ |
1538 | spin_lock_init(&phba->scsi_buf_list_lock); | ||
1492 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list); | 1539 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list); |
1493 | 1540 | ||
1494 | host->transportt = lpfc_transport_template; | 1541 | host->transportt = lpfc_transport_template; |
@@ -1520,6 +1567,12 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1520 | if (error) | 1567 | if (error) |
1521 | goto out_free_irq; | 1568 | goto out_free_irq; |
1522 | 1569 | ||
1570 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { | ||
1571 | spin_lock_irq(phba->host->host_lock); | ||
1572 | lpfc_poll_start_timer(phba); | ||
1573 | spin_unlock_irq(phba->host->host_lock); | ||
1574 | } | ||
1575 | |||
1523 | /* | 1576 | /* |
1524 | * set fixed host attributes | 1577 | * set fixed host attributes |
1525 | * Must done after lpfc_sli_hba_setup() | 1578 | * Must done after lpfc_sli_hba_setup() |
@@ -1679,14 +1732,28 @@ static struct pci_device_id lpfc_id_table[] = { | |||
1679 | PCI_ANY_ID, PCI_ANY_ID, }, | 1732 | PCI_ANY_ID, PCI_ANY_ID, }, |
1680 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PFLY, | 1733 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PFLY, |
1681 | PCI_ANY_ID, PCI_ANY_ID, }, | 1734 | PCI_ANY_ID, PCI_ANY_ID, }, |
1735 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE, | ||
1736 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1737 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE_SCSP, | ||
1738 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1739 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE_DCSP, | ||
1740 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1682 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS, | 1741 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS, |
1683 | PCI_ANY_ID, PCI_ANY_ID, }, | 1742 | PCI_ANY_ID, PCI_ANY_ID, }, |
1743 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_SCSP, | ||
1744 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1745 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_DCSP, | ||
1746 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1684 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BMID, | 1747 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BMID, |
1685 | PCI_ANY_ID, PCI_ANY_ID, }, | 1748 | PCI_ANY_ID, PCI_ANY_ID, }, |
1686 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BSMB, | 1749 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BSMB, |
1687 | PCI_ANY_ID, PCI_ANY_ID, }, | 1750 | PCI_ANY_ID, PCI_ANY_ID, }, |
1688 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR, | 1751 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR, |
1689 | PCI_ANY_ID, PCI_ANY_ID, }, | 1752 | PCI_ANY_ID, PCI_ANY_ID, }, |
1753 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_SCSP, | ||
1754 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1755 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_DCSP, | ||
1756 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1690 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZMID, | 1757 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZMID, |
1691 | PCI_ANY_ID, PCI_ANY_ID, }, | 1758 | PCI_ANY_ID, PCI_ANY_ID, }, |
1692 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZSMB, | 1759 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZSMB, |
@@ -1697,6 +1764,10 @@ static struct pci_device_id lpfc_id_table[] = { | |||
1697 | PCI_ANY_ID, PCI_ANY_ID, }, | 1764 | PCI_ANY_ID, PCI_ANY_ID, }, |
1698 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP10000S, | 1765 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP10000S, |
1699 | PCI_ANY_ID, PCI_ANY_ID, }, | 1766 | PCI_ANY_ID, PCI_ANY_ID, }, |
1767 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP11000S, | ||
1768 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1769 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LPE11000S, | ||
1770 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1700 | { 0 } | 1771 | { 0 } |
1701 | }; | 1772 | }; |
1702 | 1773 | ||
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 507a6af56f42..fbead786031f 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -55,55 +55,76 @@ lpfc_check_adisc(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, | |||
55 | return (1); | 55 | return (1); |
56 | } | 56 | } |
57 | 57 | ||
58 | |||
59 | int | 58 | int |
60 | lpfc_check_sparm(struct lpfc_hba * phba, | 59 | lpfc_check_sparm(struct lpfc_hba * phba, |
61 | struct lpfc_nodelist * ndlp, struct serv_parm * sp, | 60 | struct lpfc_nodelist * ndlp, struct serv_parm * sp, |
62 | uint32_t class) | 61 | uint32_t class) |
63 | { | 62 | { |
64 | volatile struct serv_parm *hsp = &phba->fc_sparam; | 63 | volatile struct serv_parm *hsp = &phba->fc_sparam; |
65 | /* First check for supported version */ | 64 | uint16_t hsp_value, ssp_value = 0; |
66 | 65 | ||
67 | /* Next check for class validity */ | 66 | /* |
67 | * The receive data field size and buffer-to-buffer receive data field | ||
68 | * size entries are 16 bits but are represented as two 8-bit fields in | ||
69 | * the driver data structure to account for rsvd bits and other control | ||
70 | * bits. Reconstruct and compare the fields as a 16-bit values before | ||
71 | * correcting the byte values. | ||
72 | */ | ||
68 | if (sp->cls1.classValid) { | 73 | if (sp->cls1.classValid) { |
69 | 74 | hsp_value = (hsp->cls1.rcvDataSizeMsb << 8) | | |
70 | if (sp->cls1.rcvDataSizeMsb > hsp->cls1.rcvDataSizeMsb) | 75 | hsp->cls1.rcvDataSizeLsb; |
71 | sp->cls1.rcvDataSizeMsb = hsp->cls1.rcvDataSizeMsb; | 76 | ssp_value = (sp->cls1.rcvDataSizeMsb << 8) | |
72 | if (sp->cls1.rcvDataSizeLsb > hsp->cls1.rcvDataSizeLsb) | 77 | sp->cls1.rcvDataSizeLsb; |
78 | if (ssp_value > hsp_value) { | ||
73 | sp->cls1.rcvDataSizeLsb = hsp->cls1.rcvDataSizeLsb; | 79 | sp->cls1.rcvDataSizeLsb = hsp->cls1.rcvDataSizeLsb; |
80 | sp->cls1.rcvDataSizeMsb = hsp->cls1.rcvDataSizeMsb; | ||
81 | } | ||
74 | } else if (class == CLASS1) { | 82 | } else if (class == CLASS1) { |
75 | return (0); | 83 | return 0; |
76 | } | 84 | } |
77 | 85 | ||
78 | if (sp->cls2.classValid) { | 86 | if (sp->cls2.classValid) { |
79 | 87 | hsp_value = (hsp->cls2.rcvDataSizeMsb << 8) | | |
80 | if (sp->cls2.rcvDataSizeMsb > hsp->cls2.rcvDataSizeMsb) | 88 | hsp->cls2.rcvDataSizeLsb; |
81 | sp->cls2.rcvDataSizeMsb = hsp->cls2.rcvDataSizeMsb; | 89 | ssp_value = (sp->cls2.rcvDataSizeMsb << 8) | |
82 | if (sp->cls2.rcvDataSizeLsb > hsp->cls2.rcvDataSizeLsb) | 90 | sp->cls2.rcvDataSizeLsb; |
91 | if (ssp_value > hsp_value) { | ||
83 | sp->cls2.rcvDataSizeLsb = hsp->cls2.rcvDataSizeLsb; | 92 | sp->cls2.rcvDataSizeLsb = hsp->cls2.rcvDataSizeLsb; |
93 | sp->cls2.rcvDataSizeMsb = hsp->cls2.rcvDataSizeMsb; | ||
94 | } | ||
84 | } else if (class == CLASS2) { | 95 | } else if (class == CLASS2) { |
85 | return (0); | 96 | return 0; |
86 | } | 97 | } |
87 | 98 | ||
88 | if (sp->cls3.classValid) { | 99 | if (sp->cls3.classValid) { |
89 | 100 | hsp_value = (hsp->cls3.rcvDataSizeMsb << 8) | | |
90 | if (sp->cls3.rcvDataSizeMsb > hsp->cls3.rcvDataSizeMsb) | 101 | hsp->cls3.rcvDataSizeLsb; |
91 | sp->cls3.rcvDataSizeMsb = hsp->cls3.rcvDataSizeMsb; | 102 | ssp_value = (sp->cls3.rcvDataSizeMsb << 8) | |
92 | if (sp->cls3.rcvDataSizeLsb > hsp->cls3.rcvDataSizeLsb) | 103 | sp->cls3.rcvDataSizeLsb; |
104 | if (ssp_value > hsp_value) { | ||
93 | sp->cls3.rcvDataSizeLsb = hsp->cls3.rcvDataSizeLsb; | 105 | sp->cls3.rcvDataSizeLsb = hsp->cls3.rcvDataSizeLsb; |
106 | sp->cls3.rcvDataSizeMsb = hsp->cls3.rcvDataSizeMsb; | ||
107 | } | ||
94 | } else if (class == CLASS3) { | 108 | } else if (class == CLASS3) { |
95 | return (0); | 109 | return 0; |
96 | } | 110 | } |
97 | 111 | ||
98 | if (sp->cmn.bbRcvSizeMsb > hsp->cmn.bbRcvSizeMsb) | 112 | /* |
99 | sp->cmn.bbRcvSizeMsb = hsp->cmn.bbRcvSizeMsb; | 113 | * Preserve the upper four bits of the MSB from the PLOGI response. |
100 | if (sp->cmn.bbRcvSizeLsb > hsp->cmn.bbRcvSizeLsb) | 114 | * These bits contain the Buffer-to-Buffer State Change Number |
115 | * from the target and need to be passed to the FW. | ||
116 | */ | ||
117 | hsp_value = (hsp->cmn.bbRcvSizeMsb << 8) | hsp->cmn.bbRcvSizeLsb; | ||
118 | ssp_value = (sp->cmn.bbRcvSizeMsb << 8) | sp->cmn.bbRcvSizeLsb; | ||
119 | if (ssp_value > hsp_value) { | ||
101 | sp->cmn.bbRcvSizeLsb = hsp->cmn.bbRcvSizeLsb; | 120 | sp->cmn.bbRcvSizeLsb = hsp->cmn.bbRcvSizeLsb; |
121 | sp->cmn.bbRcvSizeMsb = (sp->cmn.bbRcvSizeMsb & 0xF0) | | ||
122 | (hsp->cmn.bbRcvSizeMsb & 0x0F); | ||
123 | } | ||
102 | 124 | ||
103 | /* If check is good, copy wwpn wwnn into ndlp */ | ||
104 | memcpy(&ndlp->nlp_nodename, &sp->nodeName, sizeof (struct lpfc_name)); | 125 | memcpy(&ndlp->nlp_nodename, &sp->nodeName, sizeof (struct lpfc_name)); |
105 | memcpy(&ndlp->nlp_portname, &sp->portName, sizeof (struct lpfc_name)); | 126 | memcpy(&ndlp->nlp_portname, &sp->portName, sizeof (struct lpfc_name)); |
106 | return (1); | 127 | return 1; |
107 | } | 128 | } |
108 | 129 | ||
109 | static void * | 130 | static void * |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c63275e66e2e..9ee8218404c0 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -41,6 +41,20 @@ | |||
41 | #define LPFC_ABORT_WAIT 2 | 41 | #define LPFC_ABORT_WAIT 2 |
42 | 42 | ||
43 | 43 | ||
44 | static inline void | ||
45 | lpfc_block_requests(struct lpfc_hba * phba) | ||
46 | { | ||
47 | down(&phba->hba_can_block); | ||
48 | scsi_block_requests(phba->host); | ||
49 | } | ||
50 | |||
51 | static inline void | ||
52 | lpfc_unblock_requests(struct lpfc_hba * phba) | ||
53 | { | ||
54 | scsi_unblock_requests(phba->host); | ||
55 | up(&phba->hba_can_block); | ||
56 | } | ||
57 | |||
44 | /* | 58 | /* |
45 | * This routine allocates a scsi buffer, which contains all the necessary | 59 | * This routine allocates a scsi buffer, which contains all the necessary |
46 | * information needed to initiate a SCSI I/O. The non-DMAable buffer region | 60 | * information needed to initiate a SCSI I/O. The non-DMAable buffer region |
@@ -137,18 +151,22 @@ lpfc_new_scsi_buf(struct lpfc_hba * phba) | |||
137 | } | 151 | } |
138 | 152 | ||
139 | struct lpfc_scsi_buf* | 153 | struct lpfc_scsi_buf* |
140 | lpfc_sli_get_scsi_buf(struct lpfc_hba * phba) | 154 | lpfc_get_scsi_buf(struct lpfc_hba * phba) |
141 | { | 155 | { |
142 | struct lpfc_scsi_buf * lpfc_cmd = NULL; | 156 | struct lpfc_scsi_buf * lpfc_cmd = NULL; |
143 | struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list; | 157 | struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list; |
158 | unsigned long iflag = 0; | ||
144 | 159 | ||
160 | spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag); | ||
145 | list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list); | 161 | list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list); |
162 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); | ||
146 | return lpfc_cmd; | 163 | return lpfc_cmd; |
147 | } | 164 | } |
148 | 165 | ||
149 | static void | 166 | static void |
150 | lpfc_release_scsi_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) | 167 | lpfc_release_scsi_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) |
151 | { | 168 | { |
169 | unsigned long iflag = 0; | ||
152 | /* | 170 | /* |
153 | * There are only two special cases to consider. (1) the scsi command | 171 | * There are only two special cases to consider. (1) the scsi command |
154 | * requested scatter-gather usage or (2) the scsi command allocated | 172 | * requested scatter-gather usage or (2) the scsi command allocated |
@@ -166,8 +184,10 @@ lpfc_release_scsi_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) | |||
166 | } | 184 | } |
167 | } | 185 | } |
168 | 186 | ||
187 | spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag); | ||
169 | psb->pCmd = NULL; | 188 | psb->pCmd = NULL; |
170 | list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list); | 189 | list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list); |
190 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); | ||
171 | } | 191 | } |
172 | 192 | ||
173 | static int | 193 | static int |
@@ -389,7 +409,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
389 | struct lpfc_rport_data *rdata = lpfc_cmd->rdata; | 409 | struct lpfc_rport_data *rdata = lpfc_cmd->rdata; |
390 | struct lpfc_nodelist *pnode = rdata->pnode; | 410 | struct lpfc_nodelist *pnode = rdata->pnode; |
391 | struct scsi_cmnd *cmd = lpfc_cmd->pCmd; | 411 | struct scsi_cmnd *cmd = lpfc_cmd->pCmd; |
392 | unsigned long iflag; | 412 | int result; |
413 | struct scsi_device *sdev, *tmp_sdev; | ||
414 | int depth = 0; | ||
393 | 415 | ||
394 | lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4]; | 416 | lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4]; |
395 | lpfc_cmd->status = pIocbOut->iocb.ulpStatus; | 417 | lpfc_cmd->status = pIocbOut->iocb.ulpStatus; |
@@ -441,11 +463,64 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
441 | *lp, *(lp + 3), cmd->retries, cmd->resid); | 463 | *lp, *(lp + 3), cmd->retries, cmd->resid); |
442 | } | 464 | } |
443 | 465 | ||
466 | result = cmd->result; | ||
467 | sdev = cmd->device; | ||
444 | cmd->scsi_done(cmd); | 468 | cmd->scsi_done(cmd); |
445 | 469 | ||
446 | spin_lock_irqsave(phba->host->host_lock, iflag); | 470 | if (!result && |
471 | ((jiffies - pnode->last_ramp_up_time) > | ||
472 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | ||
473 | ((jiffies - pnode->last_q_full_time) > | ||
474 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | ||
475 | (phba->cfg_lun_queue_depth > sdev->queue_depth)) { | ||
476 | shost_for_each_device(tmp_sdev, sdev->host) { | ||
477 | if (phba->cfg_lun_queue_depth > tmp_sdev->queue_depth) { | ||
478 | if (tmp_sdev->id != sdev->id) | ||
479 | continue; | ||
480 | if (tmp_sdev->ordered_tags) | ||
481 | scsi_adjust_queue_depth(tmp_sdev, | ||
482 | MSG_ORDERED_TAG, | ||
483 | tmp_sdev->queue_depth+1); | ||
484 | else | ||
485 | scsi_adjust_queue_depth(tmp_sdev, | ||
486 | MSG_SIMPLE_TAG, | ||
487 | tmp_sdev->queue_depth+1); | ||
488 | |||
489 | pnode->last_ramp_up_time = jiffies; | ||
490 | } | ||
491 | } | ||
492 | } | ||
493 | |||
494 | /* | ||
495 | * Check for queue full. If the lun is reporting queue full, then | ||
496 | * back off the lun queue depth to prevent target overloads. | ||
497 | */ | ||
498 | if (result == SAM_STAT_TASK_SET_FULL) { | ||
499 | pnode->last_q_full_time = jiffies; | ||
500 | |||
501 | shost_for_each_device(tmp_sdev, sdev->host) { | ||
502 | if (tmp_sdev->id != sdev->id) | ||
503 | continue; | ||
504 | depth = scsi_track_queue_full(tmp_sdev, | ||
505 | tmp_sdev->queue_depth - 1); | ||
506 | } | ||
507 | /* | ||
508 | * The queue depth cannot be lowered any more. | ||
509 | * Modify the returned error code to store | ||
510 | * the final depth value set by | ||
511 | * scsi_track_queue_full. | ||
512 | */ | ||
513 | if (depth == -1) | ||
514 | depth = sdev->host->cmd_per_lun; | ||
515 | |||
516 | if (depth) { | ||
517 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | ||
518 | "%d:0711 detected queue full - lun queue depth " | ||
519 | " adjusted to %d.\n", phba->brd_no, depth); | ||
520 | } | ||
521 | } | ||
522 | |||
447 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 523 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
448 | spin_unlock_irqrestore(phba->host->host_lock, iflag); | ||
449 | } | 524 | } |
450 | 525 | ||
451 | static void | 526 | static void |
@@ -693,6 +768,37 @@ lpfc_info(struct Scsi_Host *host) | |||
693 | return lpfcinfobuf; | 768 | return lpfcinfobuf; |
694 | } | 769 | } |
695 | 770 | ||
771 | static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) | ||
772 | { | ||
773 | unsigned long poll_tmo_expires = | ||
774 | (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); | ||
775 | |||
776 | if (phba->sli.ring[LPFC_FCP_RING].txcmplq_cnt) | ||
777 | mod_timer(&phba->fcp_poll_timer, | ||
778 | poll_tmo_expires); | ||
779 | } | ||
780 | |||
781 | void lpfc_poll_start_timer(struct lpfc_hba * phba) | ||
782 | { | ||
783 | lpfc_poll_rearm_timer(phba); | ||
784 | } | ||
785 | |||
786 | void lpfc_poll_timeout(unsigned long ptr) | ||
787 | { | ||
788 | struct lpfc_hba *phba = (struct lpfc_hba *)ptr; | ||
789 | unsigned long iflag; | ||
790 | |||
791 | spin_lock_irqsave(phba->host->host_lock, iflag); | ||
792 | |||
793 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | ||
794 | lpfc_sli_poll_fcp_ring (phba); | ||
795 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) | ||
796 | lpfc_poll_rearm_timer(phba); | ||
797 | } | ||
798 | |||
799 | spin_unlock_irqrestore(phba->host->host_lock, iflag); | ||
800 | } | ||
801 | |||
696 | static int | 802 | static int |
697 | lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | 803 | lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) |
698 | { | 804 | { |
@@ -719,10 +825,11 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
719 | cmnd->result = ScsiResult(DID_BUS_BUSY, 0); | 825 | cmnd->result = ScsiResult(DID_BUS_BUSY, 0); |
720 | goto out_fail_command; | 826 | goto out_fail_command; |
721 | } | 827 | } |
722 | lpfc_cmd = lpfc_sli_get_scsi_buf (phba); | 828 | lpfc_cmd = lpfc_get_scsi_buf (phba); |
723 | if (lpfc_cmd == NULL) { | 829 | if (lpfc_cmd == NULL) { |
724 | printk(KERN_WARNING "%s: No buffer available - list empty, " | 830 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, |
725 | "total count %d\n", __FUNCTION__, phba->total_scsi_bufs); | 831 | "%d:0707 driver's buffer pool is empty, " |
832 | "IO busied\n", phba->brd_no); | ||
726 | goto out_host_busy; | 833 | goto out_host_busy; |
727 | } | 834 | } |
728 | 835 | ||
@@ -746,11 +853,17 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
746 | &lpfc_cmd->cur_iocbq, SLI_IOCB_RET_IOCB); | 853 | &lpfc_cmd->cur_iocbq, SLI_IOCB_RET_IOCB); |
747 | if (err) | 854 | if (err) |
748 | goto out_host_busy_free_buf; | 855 | goto out_host_busy_free_buf; |
856 | |||
857 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | ||
858 | lpfc_sli_poll_fcp_ring(phba); | ||
859 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) | ||
860 | lpfc_poll_rearm_timer(phba); | ||
861 | } | ||
862 | |||
749 | return 0; | 863 | return 0; |
750 | 864 | ||
751 | out_host_busy_free_buf: | 865 | out_host_busy_free_buf: |
752 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 866 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
753 | cmnd->host_scribble = NULL; | ||
754 | out_host_busy: | 867 | out_host_busy: |
755 | return SCSI_MLQUEUE_HOST_BUSY; | 868 | return SCSI_MLQUEUE_HOST_BUSY; |
756 | 869 | ||
@@ -759,11 +872,12 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
759 | return 0; | 872 | return 0; |
760 | } | 873 | } |
761 | 874 | ||
875 | |||
762 | static int | 876 | static int |
763 | __lpfc_abort_handler(struct scsi_cmnd *cmnd) | 877 | lpfc_abort_handler(struct scsi_cmnd *cmnd) |
764 | { | 878 | { |
765 | struct lpfc_hba *phba = | 879 | struct Scsi_Host *shost = cmnd->device->host; |
766 | (struct lpfc_hba *)cmnd->device->host->hostdata[0]; | 880 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; |
767 | struct lpfc_sli_ring *pring = &phba->sli.ring[phba->sli.fcp_ring]; | 881 | struct lpfc_sli_ring *pring = &phba->sli.ring[phba->sli.fcp_ring]; |
768 | struct lpfc_iocbq *iocb; | 882 | struct lpfc_iocbq *iocb; |
769 | struct lpfc_iocbq *abtsiocb; | 883 | struct lpfc_iocbq *abtsiocb; |
@@ -772,6 +886,8 @@ __lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
772 | unsigned int loop_count = 0; | 886 | unsigned int loop_count = 0; |
773 | int ret = SUCCESS; | 887 | int ret = SUCCESS; |
774 | 888 | ||
889 | lpfc_block_requests(phba); | ||
890 | spin_lock_irq(shost->host_lock); | ||
775 | 891 | ||
776 | lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble; | 892 | lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble; |
777 | BUG_ON(!lpfc_cmd); | 893 | BUG_ON(!lpfc_cmd); |
@@ -821,9 +937,15 @@ __lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
821 | goto out; | 937 | goto out; |
822 | } | 938 | } |
823 | 939 | ||
940 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) | ||
941 | lpfc_sli_poll_fcp_ring (phba); | ||
942 | |||
824 | /* Wait for abort to complete */ | 943 | /* Wait for abort to complete */ |
825 | while (lpfc_cmd->pCmd == cmnd) | 944 | while (lpfc_cmd->pCmd == cmnd) |
826 | { | 945 | { |
946 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) | ||
947 | lpfc_sli_poll_fcp_ring (phba); | ||
948 | |||
827 | spin_unlock_irq(phba->host->host_lock); | 949 | spin_unlock_irq(phba->host->host_lock); |
828 | schedule_timeout_uninterruptible(LPFC_ABORT_WAIT*HZ); | 950 | schedule_timeout_uninterruptible(LPFC_ABORT_WAIT*HZ); |
829 | spin_lock_irq(phba->host->host_lock); | 951 | spin_lock_irq(phba->host->host_lock); |
@@ -844,26 +966,19 @@ __lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
844 | 966 | ||
845 | out: | 967 | out: |
846 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | 968 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, |
847 | "%d:0749 SCSI layer issued abort device: ret %#x, " | 969 | "%d:0749 SCSI Layer I/O Abort Request " |
848 | "ID %d, LUN %d, snum %#lx\n", | 970 | "Status x%x ID %d LUN %d snum %#lx\n", |
849 | phba->brd_no, ret, cmnd->device->id, | 971 | phba->brd_no, ret, cmnd->device->id, |
850 | cmnd->device->lun, cmnd->serial_number); | 972 | cmnd->device->lun, cmnd->serial_number); |
851 | 973 | ||
852 | return ret; | 974 | spin_unlock_irq(shost->host_lock); |
853 | } | 975 | lpfc_unblock_requests(phba); |
854 | 976 | ||
855 | static int | 977 | return ret; |
856 | lpfc_abort_handler(struct scsi_cmnd *cmnd) | ||
857 | { | ||
858 | int rc; | ||
859 | spin_lock_irq(cmnd->device->host->host_lock); | ||
860 | rc = __lpfc_abort_handler(cmnd); | ||
861 | spin_unlock_irq(cmnd->device->host->host_lock); | ||
862 | return rc; | ||
863 | } | 978 | } |
864 | 979 | ||
865 | static int | 980 | static int |
866 | __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | 981 | lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) |
867 | { | 982 | { |
868 | struct Scsi_Host *shost = cmnd->device->host; | 983 | struct Scsi_Host *shost = cmnd->device->host; |
869 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; | 984 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; |
@@ -871,9 +986,12 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
871 | struct lpfc_iocbq *iocbq, *iocbqrsp; | 986 | struct lpfc_iocbq *iocbq, *iocbqrsp; |
872 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; | 987 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; |
873 | struct lpfc_nodelist *pnode = rdata->pnode; | 988 | struct lpfc_nodelist *pnode = rdata->pnode; |
989 | uint32_t cmd_result = 0, cmd_status = 0; | ||
874 | int ret = FAILED; | 990 | int ret = FAILED; |
875 | int cnt, loopcnt; | 991 | int cnt, loopcnt; |
876 | 992 | ||
993 | lpfc_block_requests(phba); | ||
994 | spin_lock_irq(shost->host_lock); | ||
877 | /* | 995 | /* |
878 | * If target is not in a MAPPED state, delay the reset until | 996 | * If target is not in a MAPPED state, delay the reset until |
879 | * target is rediscovered or nodev timeout expires. | 997 | * target is rediscovered or nodev timeout expires. |
@@ -891,7 +1009,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
891 | break; | 1009 | break; |
892 | } | 1010 | } |
893 | 1011 | ||
894 | lpfc_cmd = lpfc_sli_get_scsi_buf (phba); | 1012 | lpfc_cmd = lpfc_get_scsi_buf (phba); |
895 | if (lpfc_cmd == NULL) | 1013 | if (lpfc_cmd == NULL) |
896 | goto out; | 1014 | goto out; |
897 | 1015 | ||
@@ -916,26 +1034,28 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
916 | if (ret == IOCB_SUCCESS) | 1034 | if (ret == IOCB_SUCCESS) |
917 | ret = SUCCESS; | 1035 | ret = SUCCESS; |
918 | 1036 | ||
919 | lpfc_cmd->result = iocbqrsp->iocb.un.ulpWord[4]; | 1037 | |
920 | lpfc_cmd->status = iocbqrsp->iocb.ulpStatus; | 1038 | cmd_result = iocbqrsp->iocb.un.ulpWord[4]; |
921 | if (lpfc_cmd->status == IOSTAT_LOCAL_REJECT) | 1039 | cmd_status = iocbqrsp->iocb.ulpStatus; |
922 | if (lpfc_cmd->result & IOERR_DRVR_MASK) | 1040 | |
923 | lpfc_cmd->status = IOSTAT_DRIVER_REJECT; | 1041 | lpfc_sli_release_iocbq(phba, iocbqrsp); |
1042 | lpfc_release_scsi_buf(phba, lpfc_cmd); | ||
924 | 1043 | ||
925 | /* | 1044 | /* |
926 | * All outstanding txcmplq I/Os should have been aborted by the target. | 1045 | * All outstanding txcmplq I/Os should have been aborted by the device. |
927 | * Unfortunately, some targets do not abide by this forcing the driver | 1046 | * Unfortunately, some targets do not abide by this forcing the driver |
928 | * to double check. | 1047 | * to double check. |
929 | */ | 1048 | */ |
930 | lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 1049 | cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], |
931 | cmnd->device->id, cmnd->device->lun, 0, | 1050 | cmnd->device->id, cmnd->device->lun, |
932 | LPFC_CTX_LUN); | 1051 | LPFC_CTX_LUN); |
933 | 1052 | if (cnt) | |
1053 | lpfc_sli_abort_iocb(phba, | ||
1054 | &phba->sli.ring[phba->sli.fcp_ring], | ||
1055 | cmnd->device->id, cmnd->device->lun, | ||
1056 | 0, LPFC_CTX_LUN); | ||
934 | loopcnt = 0; | 1057 | loopcnt = 0; |
935 | while((cnt = lpfc_sli_sum_iocb(phba, | 1058 | while(cnt) { |
936 | &phba->sli.ring[phba->sli.fcp_ring], | ||
937 | cmnd->device->id, cmnd->device->lun, | ||
938 | LPFC_CTX_LUN))) { | ||
939 | spin_unlock_irq(phba->host->host_lock); | 1059 | spin_unlock_irq(phba->host->host_lock); |
940 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); | 1060 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); |
941 | spin_lock_irq(phba->host->host_lock); | 1061 | spin_lock_irq(phba->host->host_lock); |
@@ -943,6 +1063,11 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
943 | if (++loopcnt | 1063 | if (++loopcnt |
944 | > (2 * phba->cfg_nodev_tmo)/LPFC_RESET_WAIT) | 1064 | > (2 * phba->cfg_nodev_tmo)/LPFC_RESET_WAIT) |
945 | break; | 1065 | break; |
1066 | |||
1067 | cnt = lpfc_sli_sum_iocb(phba, | ||
1068 | &phba->sli.ring[phba->sli.fcp_ring], | ||
1069 | cmnd->device->id, cmnd->device->lun, | ||
1070 | LPFC_CTX_LUN); | ||
946 | } | 1071 | } |
947 | 1072 | ||
948 | if (cnt) { | 1073 | if (cnt) { |
@@ -952,35 +1077,21 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
952 | ret = FAILED; | 1077 | ret = FAILED; |
953 | } | 1078 | } |
954 | 1079 | ||
955 | lpfc_sli_release_iocbq(phba, iocbqrsp); | ||
956 | |||
957 | out_free_scsi_buf: | 1080 | out_free_scsi_buf: |
958 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1081 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
959 | "%d:0713 SCSI layer issued LUN reset (%d, %d) " | 1082 | "%d:0713 SCSI layer issued LUN reset (%d, %d) " |
960 | "Data: x%x x%x x%x\n", | 1083 | "Data: x%x x%x x%x\n", |
961 | phba->brd_no, lpfc_cmd->pCmd->device->id, | 1084 | phba->brd_no, cmnd->device->id,cmnd->device->lun, |
962 | lpfc_cmd->pCmd->device->lun, ret, lpfc_cmd->status, | 1085 | ret, cmd_status, cmd_result); |
963 | lpfc_cmd->result); | 1086 | |
964 | lpfc_release_scsi_buf(phba, lpfc_cmd); | ||
965 | out: | 1087 | out: |
1088 | spin_unlock_irq(shost->host_lock); | ||
1089 | lpfc_unblock_requests(phba); | ||
966 | return ret; | 1090 | return ret; |
967 | } | 1091 | } |
968 | 1092 | ||
969 | static int | 1093 | static int |
970 | lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | 1094 | lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) |
971 | { | ||
972 | int rc; | ||
973 | spin_lock_irq(cmnd->device->host->host_lock); | ||
974 | rc = __lpfc_reset_lun_handler(cmnd); | ||
975 | spin_unlock_irq(cmnd->device->host->host_lock); | ||
976 | return rc; | ||
977 | } | ||
978 | |||
979 | /* | ||
980 | * Note: midlayer calls this function with the host_lock held | ||
981 | */ | ||
982 | static int | ||
983 | __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | ||
984 | { | 1095 | { |
985 | struct Scsi_Host *shost = cmnd->device->host; | 1096 | struct Scsi_Host *shost = cmnd->device->host; |
986 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; | 1097 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; |
@@ -991,7 +1102,10 @@ __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
991 | unsigned int midlayer_id = 0; | 1102 | unsigned int midlayer_id = 0; |
992 | struct lpfc_scsi_buf * lpfc_cmd; | 1103 | struct lpfc_scsi_buf * lpfc_cmd; |
993 | 1104 | ||
994 | lpfc_cmd = lpfc_sli_get_scsi_buf (phba); | 1105 | lpfc_block_requests(phba); |
1106 | spin_lock_irq(shost->host_lock); | ||
1107 | |||
1108 | lpfc_cmd = lpfc_get_scsi_buf(phba); | ||
995 | if (lpfc_cmd == NULL) | 1109 | if (lpfc_cmd == NULL) |
996 | goto out; | 1110 | goto out; |
997 | 1111 | ||
@@ -1022,18 +1136,31 @@ __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1022 | lpfc_cmd->pCmd->device->hostdata = ndlp->rport->dd_data; | 1136 | lpfc_cmd->pCmd->device->hostdata = ndlp->rport->dd_data; |
1023 | ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba); | 1137 | ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba); |
1024 | if (ret != SUCCESS) { | 1138 | if (ret != SUCCESS) { |
1025 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 1139 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1026 | "%d:0713 Bus Reset on target %d failed\n", | 1140 | "%d:0713 Bus Reset on target %d failed\n", |
1027 | phba->brd_no, i); | 1141 | phba->brd_no, i); |
1028 | err_count++; | 1142 | err_count++; |
1029 | } | 1143 | } |
1030 | } | 1144 | } |
1031 | 1145 | ||
1146 | if (err_count == 0) | ||
1147 | ret = SUCCESS; | ||
1148 | |||
1149 | lpfc_release_scsi_buf(phba, lpfc_cmd); | ||
1150 | |||
1151 | /* | ||
1152 | * All outstanding txcmplq I/Os should have been aborted by | ||
1153 | * the targets. Unfortunately, some targets do not abide by | ||
1154 | * this forcing the driver to double check. | ||
1155 | */ | ||
1032 | cmnd->device->id = midlayer_id; | 1156 | cmnd->device->id = midlayer_id; |
1157 | cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | ||
1158 | 0, 0, LPFC_CTX_HOST); | ||
1159 | if (cnt) | ||
1160 | lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | ||
1161 | 0, 0, 0, LPFC_CTX_HOST); | ||
1033 | loopcnt = 0; | 1162 | loopcnt = 0; |
1034 | while((cnt = lpfc_sli_sum_iocb(phba, | 1163 | while(cnt) { |
1035 | &phba->sli.ring[phba->sli.fcp_ring], | ||
1036 | 0, 0, LPFC_CTX_HOST))) { | ||
1037 | spin_unlock_irq(phba->host->host_lock); | 1164 | spin_unlock_irq(phba->host->host_lock); |
1038 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); | 1165 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); |
1039 | spin_lock_irq(phba->host->host_lock); | 1166 | spin_lock_irq(phba->host->host_lock); |
@@ -1041,45 +1168,31 @@ __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1041 | if (++loopcnt | 1168 | if (++loopcnt |
1042 | > (2 * phba->cfg_nodev_tmo)/LPFC_RESET_WAIT) | 1169 | > (2 * phba->cfg_nodev_tmo)/LPFC_RESET_WAIT) |
1043 | break; | 1170 | break; |
1171 | |||
1172 | cnt = lpfc_sli_sum_iocb(phba, | ||
1173 | &phba->sli.ring[phba->sli.fcp_ring], | ||
1174 | 0, 0, LPFC_CTX_HOST); | ||
1044 | } | 1175 | } |
1045 | 1176 | ||
1046 | if (cnt) { | 1177 | if (cnt) { |
1047 | /* flush all outstanding commands on the host */ | 1178 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1048 | i = lpfc_sli_abort_iocb(phba, | ||
1049 | &phba->sli.ring[phba->sli.fcp_ring], 0, 0, 0, | ||
1050 | LPFC_CTX_HOST); | ||
1051 | |||
1052 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | ||
1053 | "%d:0715 Bus Reset I/O flush failure: cnt x%x left x%x\n", | 1179 | "%d:0715 Bus Reset I/O flush failure: cnt x%x left x%x\n", |
1054 | phba->brd_no, cnt, i); | 1180 | phba->brd_no, cnt, i); |
1055 | } | ||
1056 | |||
1057 | if (cnt == 0) | ||
1058 | ret = SUCCESS; | ||
1059 | else | ||
1060 | ret = FAILED; | 1181 | ret = FAILED; |
1182 | } | ||
1061 | 1183 | ||
1062 | lpfc_release_scsi_buf(phba, lpfc_cmd); | ||
1063 | lpfc_printf_log(phba, | 1184 | lpfc_printf_log(phba, |
1064 | KERN_ERR, | 1185 | KERN_ERR, |
1065 | LOG_FCP, | 1186 | LOG_FCP, |
1066 | "%d:0714 SCSI layer issued Bus Reset Data: x%x\n", | 1187 | "%d:0714 SCSI layer issued Bus Reset Data: x%x\n", |
1067 | phba->brd_no, ret); | 1188 | phba->brd_no, ret); |
1068 | out: | 1189 | out: |
1190 | spin_unlock_irq(shost->host_lock); | ||
1191 | lpfc_unblock_requests(phba); | ||
1069 | return ret; | 1192 | return ret; |
1070 | } | 1193 | } |
1071 | 1194 | ||
1072 | static int | 1195 | static int |
1073 | lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | ||
1074 | { | ||
1075 | int rc; | ||
1076 | spin_lock_irq(cmnd->device->host->host_lock); | ||
1077 | rc = __lpfc_reset_bus_handler(cmnd); | ||
1078 | spin_unlock_irq(cmnd->device->host->host_lock); | ||
1079 | return rc; | ||
1080 | } | ||
1081 | |||
1082 | static int | ||
1083 | lpfc_slave_alloc(struct scsi_device *sdev) | 1196 | lpfc_slave_alloc(struct scsi_device *sdev) |
1084 | { | 1197 | { |
1085 | struct lpfc_hba *phba = (struct lpfc_hba *)sdev->host->hostdata[0]; | 1198 | struct lpfc_hba *phba = (struct lpfc_hba *)sdev->host->hostdata[0]; |
@@ -1127,10 +1240,10 @@ lpfc_slave_alloc(struct scsi_device *sdev) | |||
1127 | break; | 1240 | break; |
1128 | } | 1241 | } |
1129 | 1242 | ||
1130 | spin_lock_irqsave(phba->host->host_lock, flags); | 1243 | spin_lock_irqsave(&phba->scsi_buf_list_lock, flags); |
1131 | phba->total_scsi_bufs++; | 1244 | phba->total_scsi_bufs++; |
1132 | list_add_tail(&scsi_buf->list, &phba->lpfc_scsi_buf_list); | 1245 | list_add_tail(&scsi_buf->list, &phba->lpfc_scsi_buf_list); |
1133 | spin_unlock_irqrestore(phba->host->host_lock, flags); | 1246 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, flags); |
1134 | } | 1247 | } |
1135 | return 0; | 1248 | return 0; |
1136 | } | 1249 | } |
@@ -1154,6 +1267,12 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
1154 | */ | 1267 | */ |
1155 | rport->dev_loss_tmo = phba->cfg_nodev_tmo + 5; | 1268 | rport->dev_loss_tmo = phba->cfg_nodev_tmo + 5; |
1156 | 1269 | ||
1270 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | ||
1271 | lpfc_sli_poll_fcp_ring(phba); | ||
1272 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) | ||
1273 | lpfc_poll_rearm_timer(phba); | ||
1274 | } | ||
1275 | |||
1157 | return 0; | 1276 | return 0; |
1158 | } | 1277 | } |
1159 | 1278 | ||
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index e2c08c5d83fb..7b785ade8b07 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -886,6 +886,182 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba * phba, struct lpfc_sli_ring * pring, | |||
886 | return rc; | 886 | return rc; |
887 | } | 887 | } |
888 | 888 | ||
889 | static void lpfc_sli_rsp_pointers_error(struct lpfc_hba * phba, | ||
890 | struct lpfc_sli_ring * pring) | ||
891 | { | ||
892 | struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno]; | ||
893 | /* | ||
894 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger then | ||
895 | * rsp ring <portRspMax> | ||
896 | */ | ||
897 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
898 | "%d:0312 Ring %d handler: portRspPut %d " | ||
899 | "is bigger then rsp ring %d\n", | ||
900 | phba->brd_no, pring->ringno, | ||
901 | le32_to_cpu(pgp->rspPutInx), | ||
902 | pring->numRiocb); | ||
903 | |||
904 | phba->hba_state = LPFC_HBA_ERROR; | ||
905 | |||
906 | /* | ||
907 | * All error attention handlers are posted to | ||
908 | * worker thread | ||
909 | */ | ||
910 | phba->work_ha |= HA_ERATT; | ||
911 | phba->work_hs = HS_FFER3; | ||
912 | if (phba->work_wait) | ||
913 | wake_up(phba->work_wait); | ||
914 | |||
915 | return; | ||
916 | } | ||
917 | |||
918 | void lpfc_sli_poll_fcp_ring(struct lpfc_hba * phba) | ||
919 | { | ||
920 | struct lpfc_sli * psli = &phba->sli; | ||
921 | struct lpfc_sli_ring * pring = &psli->ring[LPFC_FCP_RING]; | ||
922 | IOCB_t *irsp = NULL; | ||
923 | IOCB_t *entry = NULL; | ||
924 | struct lpfc_iocbq *cmdiocbq = NULL; | ||
925 | struct lpfc_iocbq rspiocbq; | ||
926 | struct lpfc_pgp *pgp; | ||
927 | uint32_t status; | ||
928 | uint32_t portRspPut, portRspMax; | ||
929 | int type; | ||
930 | uint32_t rsp_cmpl = 0; | ||
931 | void __iomem *to_slim; | ||
932 | uint32_t ha_copy; | ||
933 | |||
934 | pring->stats.iocb_event++; | ||
935 | |||
936 | /* The driver assumes SLI-2 mode */ | ||
937 | pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno]; | ||
938 | |||
939 | /* | ||
940 | * The next available response entry should never exceed the maximum | ||
941 | * entries. If it does, treat it as an adapter hardware error. | ||
942 | */ | ||
943 | portRspMax = pring->numRiocb; | ||
944 | portRspPut = le32_to_cpu(pgp->rspPutInx); | ||
945 | if (unlikely(portRspPut >= portRspMax)) { | ||
946 | lpfc_sli_rsp_pointers_error(phba, pring); | ||
947 | return; | ||
948 | } | ||
949 | |||
950 | rmb(); | ||
951 | while (pring->rspidx != portRspPut) { | ||
952 | |||
953 | entry = IOCB_ENTRY(pring->rspringaddr, pring->rspidx); | ||
954 | |||
955 | if (++pring->rspidx >= portRspMax) | ||
956 | pring->rspidx = 0; | ||
957 | |||
958 | lpfc_sli_pcimem_bcopy((uint32_t *) entry, | ||
959 | (uint32_t *) &rspiocbq.iocb, | ||
960 | sizeof (IOCB_t)); | ||
961 | irsp = &rspiocbq.iocb; | ||
962 | type = lpfc_sli_iocb_cmd_type(irsp->ulpCommand & CMD_IOCB_MASK); | ||
963 | pring->stats.iocb_rsp++; | ||
964 | rsp_cmpl++; | ||
965 | |||
966 | if (unlikely(irsp->ulpStatus)) { | ||
967 | /* Rsp ring <ringno> error: IOCB */ | ||
968 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
969 | "%d:0326 Rsp Ring %d error: IOCB Data: " | ||
970 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", | ||
971 | phba->brd_no, pring->ringno, | ||
972 | irsp->un.ulpWord[0], | ||
973 | irsp->un.ulpWord[1], | ||
974 | irsp->un.ulpWord[2], | ||
975 | irsp->un.ulpWord[3], | ||
976 | irsp->un.ulpWord[4], | ||
977 | irsp->un.ulpWord[5], | ||
978 | *(((uint32_t *) irsp) + 6), | ||
979 | *(((uint32_t *) irsp) + 7)); | ||
980 | } | ||
981 | |||
982 | switch (type) { | ||
983 | case LPFC_ABORT_IOCB: | ||
984 | case LPFC_SOL_IOCB: | ||
985 | /* | ||
986 | * Idle exchange closed via ABTS from port. No iocb | ||
987 | * resources need to be recovered. | ||
988 | */ | ||
989 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { | ||
990 | printk(KERN_INFO "%s: IOCB cmd 0x%x processed." | ||
991 | " Skipping completion\n", __FUNCTION__, | ||
992 | irsp->ulpCommand); | ||
993 | break; | ||
994 | } | ||
995 | |||
996 | cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, | ||
997 | &rspiocbq); | ||
998 | if ((cmdiocbq) && (cmdiocbq->iocb_cmpl)) { | ||
999 | (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, | ||
1000 | &rspiocbq); | ||
1001 | } | ||
1002 | break; | ||
1003 | default: | ||
1004 | if (irsp->ulpCommand == CMD_ADAPTER_MSG) { | ||
1005 | char adaptermsg[LPFC_MAX_ADPTMSG]; | ||
1006 | memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); | ||
1007 | memcpy(&adaptermsg[0], (uint8_t *) irsp, | ||
1008 | MAX_MSG_DATA); | ||
1009 | dev_warn(&((phba->pcidev)->dev), "lpfc%d: %s", | ||
1010 | phba->brd_no, adaptermsg); | ||
1011 | } else { | ||
1012 | /* Unknown IOCB command */ | ||
1013 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
1014 | "%d:0321 Unknown IOCB command " | ||
1015 | "Data: x%x, x%x x%x x%x x%x\n", | ||
1016 | phba->brd_no, type, | ||
1017 | irsp->ulpCommand, | ||
1018 | irsp->ulpStatus, | ||
1019 | irsp->ulpIoTag, | ||
1020 | irsp->ulpContext); | ||
1021 | } | ||
1022 | break; | ||
1023 | } | ||
1024 | |||
1025 | /* | ||
1026 | * The response IOCB has been processed. Update the ring | ||
1027 | * pointer in SLIM. If the port response put pointer has not | ||
1028 | * been updated, sync the pgp->rspPutInx and fetch the new port | ||
1029 | * response put pointer. | ||
1030 | */ | ||
1031 | to_slim = phba->MBslimaddr + | ||
1032 | (SLIMOFF + (pring->ringno * 2) + 1) * 4; | ||
1033 | writeb(pring->rspidx, to_slim); | ||
1034 | |||
1035 | if (pring->rspidx == portRspPut) | ||
1036 | portRspPut = le32_to_cpu(pgp->rspPutInx); | ||
1037 | } | ||
1038 | |||
1039 | ha_copy = readl(phba->HAregaddr); | ||
1040 | ha_copy >>= (LPFC_FCP_RING * 4); | ||
1041 | |||
1042 | if ((rsp_cmpl > 0) && (ha_copy & HA_R0RE_REQ)) { | ||
1043 | pring->stats.iocb_rsp_full++; | ||
1044 | status = ((CA_R0ATT | CA_R0RE_RSP) << (LPFC_FCP_RING * 4)); | ||
1045 | writel(status, phba->CAregaddr); | ||
1046 | readl(phba->CAregaddr); | ||
1047 | } | ||
1048 | if ((ha_copy & HA_R0CE_RSP) && | ||
1049 | (pring->flag & LPFC_CALL_RING_AVAILABLE)) { | ||
1050 | pring->flag &= ~LPFC_CALL_RING_AVAILABLE; | ||
1051 | pring->stats.iocb_cmd_empty++; | ||
1052 | |||
1053 | /* Force update of the local copy of cmdGetInx */ | ||
1054 | pring->local_getidx = le32_to_cpu(pgp->cmdGetInx); | ||
1055 | lpfc_sli_resume_iocb(phba, pring); | ||
1056 | |||
1057 | if ((pring->lpfc_sli_cmd_available)) | ||
1058 | (pring->lpfc_sli_cmd_available) (phba, pring); | ||
1059 | |||
1060 | } | ||
1061 | |||
1062 | return; | ||
1063 | } | ||
1064 | |||
889 | /* | 1065 | /* |
890 | * This routine presumes LPFC_FCP_RING handling and doesn't bother | 1066 | * This routine presumes LPFC_FCP_RING handling and doesn't bother |
891 | * to check it explicitly. | 1067 | * to check it explicitly. |
@@ -917,24 +1093,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba, | |||
917 | portRspMax = pring->numRiocb; | 1093 | portRspMax = pring->numRiocb; |
918 | portRspPut = le32_to_cpu(pgp->rspPutInx); | 1094 | portRspPut = le32_to_cpu(pgp->rspPutInx); |
919 | if (unlikely(portRspPut >= portRspMax)) { | 1095 | if (unlikely(portRspPut >= portRspMax)) { |
920 | /* | 1096 | lpfc_sli_rsp_pointers_error(phba, pring); |
921 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger then | ||
922 | * rsp ring <portRspMax> | ||
923 | */ | ||
924 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
925 | "%d:0312 Ring %d handler: portRspPut %d " | ||
926 | "is bigger then rsp ring %d\n", | ||
927 | phba->brd_no, pring->ringno, portRspPut, | ||
928 | portRspMax); | ||
929 | |||
930 | phba->hba_state = LPFC_HBA_ERROR; | ||
931 | |||
932 | /* All error attention handlers are posted to worker thread */ | ||
933 | phba->work_ha |= HA_ERATT; | ||
934 | phba->work_hs = HS_FFER3; | ||
935 | if (phba->work_wait) | ||
936 | wake_up(phba->work_wait); | ||
937 | |||
938 | spin_unlock_irqrestore(phba->host->host_lock, iflag); | 1097 | spin_unlock_irqrestore(phba->host->host_lock, iflag); |
939 | return 1; | 1098 | return 1; |
940 | } | 1099 | } |
@@ -947,6 +1106,10 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba, | |||
947 | * network byte order and pci byte orders are different. | 1106 | * network byte order and pci byte orders are different. |
948 | */ | 1107 | */ |
949 | entry = IOCB_ENTRY(pring->rspringaddr, pring->rspidx); | 1108 | entry = IOCB_ENTRY(pring->rspringaddr, pring->rspidx); |
1109 | |||
1110 | if (++pring->rspidx >= portRspMax) | ||
1111 | pring->rspidx = 0; | ||
1112 | |||
950 | lpfc_sli_pcimem_bcopy((uint32_t *) entry, | 1113 | lpfc_sli_pcimem_bcopy((uint32_t *) entry, |
951 | (uint32_t *) &rspiocbq.iocb, | 1114 | (uint32_t *) &rspiocbq.iocb, |
952 | sizeof (IOCB_t)); | 1115 | sizeof (IOCB_t)); |
@@ -1020,9 +1183,6 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba, | |||
1020 | * been updated, sync the pgp->rspPutInx and fetch the new port | 1183 | * been updated, sync the pgp->rspPutInx and fetch the new port |
1021 | * response put pointer. | 1184 | * response put pointer. |
1022 | */ | 1185 | */ |
1023 | if (++pring->rspidx >= portRspMax) | ||
1024 | pring->rspidx = 0; | ||
1025 | |||
1026 | to_slim = phba->MBslimaddr + | 1186 | to_slim = phba->MBslimaddr + |
1027 | (SLIMOFF + (pring->ringno * 2) + 1) * 4; | 1187 | (SLIMOFF + (pring->ringno * 2) + 1) * 4; |
1028 | writel(pring->rspidx, to_slim); | 1188 | writel(pring->rspidx, to_slim); |
@@ -2615,6 +2775,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba * phba, | |||
2615 | DECLARE_WAIT_QUEUE_HEAD(done_q); | 2775 | DECLARE_WAIT_QUEUE_HEAD(done_q); |
2616 | long timeleft, timeout_req = 0; | 2776 | long timeleft, timeout_req = 0; |
2617 | int retval = IOCB_SUCCESS; | 2777 | int retval = IOCB_SUCCESS; |
2778 | uint32_t creg_val; | ||
2618 | 2779 | ||
2619 | /* | 2780 | /* |
2620 | * If the caller has provided a response iocbq buffer, then context2 | 2781 | * If the caller has provided a response iocbq buffer, then context2 |
@@ -2630,6 +2791,13 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba * phba, | |||
2630 | piocb->context_un.wait_queue = &done_q; | 2791 | piocb->context_un.wait_queue = &done_q; |
2631 | piocb->iocb_flag &= ~LPFC_IO_WAKE; | 2792 | piocb->iocb_flag &= ~LPFC_IO_WAKE; |
2632 | 2793 | ||
2794 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { | ||
2795 | creg_val = readl(phba->HCregaddr); | ||
2796 | creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING); | ||
2797 | writel(creg_val, phba->HCregaddr); | ||
2798 | readl(phba->HCregaddr); /* flush */ | ||
2799 | } | ||
2800 | |||
2633 | retval = lpfc_sli_issue_iocb(phba, pring, piocb, 0); | 2801 | retval = lpfc_sli_issue_iocb(phba, pring, piocb, 0); |
2634 | if (retval == IOCB_SUCCESS) { | 2802 | if (retval == IOCB_SUCCESS) { |
2635 | timeout_req = timeout * HZ; | 2803 | timeout_req = timeout * HZ; |
@@ -2663,6 +2831,13 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba * phba, | |||
2663 | retval = IOCB_ERROR; | 2831 | retval = IOCB_ERROR; |
2664 | } | 2832 | } |
2665 | 2833 | ||
2834 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { | ||
2835 | creg_val = readl(phba->HCregaddr); | ||
2836 | creg_val &= ~(HC_R0INT_ENA << LPFC_FCP_RING); | ||
2837 | writel(creg_val, phba->HCregaddr); | ||
2838 | readl(phba->HCregaddr); /* flush */ | ||
2839 | } | ||
2840 | |||
2666 | if (prspiocbq) | 2841 | if (prspiocbq) |
2667 | piocb->context2 = NULL; | 2842 | piocb->context2 = NULL; |
2668 | 2843 | ||
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 4f0466fbd5f2..fa681a934ffe 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
@@ -18,7 +18,7 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | #define LPFC_DRIVER_VERSION "8.1.0" | 21 | #define LPFC_DRIVER_VERSION "8.1.1" |
22 | 22 | ||
23 | #define LPFC_DRIVER_NAME "lpfc" | 23 | #define LPFC_DRIVER_NAME "lpfc" |
24 | 24 | ||