aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_hbadisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_hbadisc.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c79
1 files changed, 20 insertions, 59 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index dee875ee6165..20b2a4905daa 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -232,9 +232,9 @@ static void
232lpfc_work_done(struct lpfc_hba *phba) 232lpfc_work_done(struct lpfc_hba *phba)
233{ 233{
234 struct lpfc_sli_ring *pring; 234 struct lpfc_sli_ring *pring;
235 int i;
236 uint32_t ha_copy, control, work_port_events; 235 uint32_t ha_copy, control, work_port_events;
237 struct lpfc_vport *vport; 236 struct lpfc_vport *vport;
237 int i;
238 238
239 spin_lock_irq(&phba->hbalock); 239 spin_lock_irq(&phba->hbalock);
240 ha_copy = phba->work_ha; 240 ha_copy = phba->work_ha;
@@ -303,9 +303,9 @@ check_work_wait_done(struct lpfc_hba *phba)
303 struct lpfc_vport *vport = phba->pport; 303 struct lpfc_vport *vport = phba->pport;
304 int rc = 0; 304 int rc = 0;
305 305
306
307 if (!vport) 306 if (!vport)
308 return 0; 307 return 0;
308
309 spin_lock_irq(&phba->hbalock); 309 spin_lock_irq(&phba->hbalock);
310 310
311 if (phba->work_ha || 311 if (phba->work_ha ||
@@ -354,6 +354,7 @@ lpfc_workq_post_event(struct lpfc_hba *phba, void *arg1, void *arg2,
354 uint32_t evt) 354 uint32_t evt)
355{ 355{
356 struct lpfc_work_evt *evtp; 356 struct lpfc_work_evt *evtp;
357 unsigned long flags;
357 358
358 /* 359 /*
359 * All Mailbox completions and LPFC_ELS_RING rcv ring IOCB events will 360 * All Mailbox completions and LPFC_ELS_RING rcv ring IOCB events will
@@ -367,11 +368,11 @@ lpfc_workq_post_event(struct lpfc_hba *phba, void *arg1, void *arg2,
367 evtp->evt_arg2 = arg2; 368 evtp->evt_arg2 = arg2;
368 evtp->evt = evt; 369 evtp->evt = evt;
369 370
370 spin_lock_irq(&phba->hbalock); 371 spin_lock_irqsave(&phba->hbalock, flags);
371 list_add_tail(&evtp->evt_listp, &phba->work_list); 372 list_add_tail(&evtp->evt_listp, &phba->work_list);
372 if (phba->work_wait) 373 if (phba->work_wait)
373 wake_up(phba->work_wait); 374 wake_up(phba->work_wait);
374 spin_unlock_irq(&phba->hbalock); 375 spin_unlock_irqrestore(&phba->hbalock, flags);
375 376
376 return 1; 377 return 1;
377} 378}
@@ -401,6 +402,7 @@ lpfc_linkdown(struct lpfc_hba *phba)
401 mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 402 mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
402 if (mb) { 403 if (mb) {
403 lpfc_unreg_did(phba, 0xffffffff, mb); 404 lpfc_unreg_did(phba, 0xffffffff, mb);
405 mb->vport = vport;
404 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 406 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
405 if (lpfc_sli_issue_mbox(phba, mb, (MBX_NOWAIT | MBX_STOP_IOCB)) 407 if (lpfc_sli_issue_mbox(phba, mb, (MBX_NOWAIT | MBX_STOP_IOCB))
406 == MBX_NOT_FINISHED) { 408 == MBX_NOT_FINISHED) {
@@ -433,6 +435,7 @@ lpfc_linkdown(struct lpfc_hba *phba)
433 if (mb) { 435 if (mb) {
434 lpfc_config_link(phba, mb); 436 lpfc_config_link(phba, mb);
435 mb->mbox_cmpl=lpfc_sli_def_mbox_cmpl; 437 mb->mbox_cmpl=lpfc_sli_def_mbox_cmpl;
438 mb->vport = vport;
436 if (lpfc_sli_issue_mbox(phba, mb, 439 if (lpfc_sli_issue_mbox(phba, mb,
437 (MBX_NOWAIT | MBX_STOP_IOCB)) 440 (MBX_NOWAIT | MBX_STOP_IOCB))
438 == MBX_NOT_FINISHED) { 441 == MBX_NOT_FINISHED) {
@@ -550,15 +553,11 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
550 spin_unlock_irq(shost->host_lock); 553 spin_unlock_irq(shost->host_lock);
551 } 554 }
552 555
553 printk(KERN_ERR "%s (%d): vport ready\n",
554 __FUNCTION__, __LINE__);
555 vport->port_state = LPFC_VPORT_READY; 556 vport->port_state = LPFC_VPORT_READY;
556 557
557out: 558out:
558 /* Device Discovery completes */ 559 /* Device Discovery completes */
559 lpfc_printf_log(phba, 560 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
560 KERN_INFO,
561 LOG_DISCOVERY,
562 "%d:0225 Device Discovery completes\n", 561 "%d:0225 Device Discovery completes\n",
563 phba->brd_no); 562 phba->brd_no);
564 563
@@ -632,8 +631,6 @@ out:
632 phba->brd_no, vport->port_state); 631 phba->brd_no, vport->port_state);
633 632
634 lpfc_clear_la(phba, pmb); 633 lpfc_clear_la(phba, pmb);
635 printk(KERN_ERR "%s (%d): do clear_la\n",
636 __FUNCTION__, __LINE__);
637 pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la; 634 pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la;
638 pmb->vport = vport; 635 pmb->vport = vport;
639 rc = lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)); 636 rc = lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB));
@@ -643,8 +640,6 @@ out:
643 psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 640 psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
644 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 641 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
645 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 642 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
646 printk(KERN_ERR "%s (%d): vport ready\n",
647 __FUNCTION__, __LINE__);
648 vport->port_state = LPFC_VPORT_READY; 643 vport->port_state = LPFC_VPORT_READY;
649 } 644 }
650 return; 645 return;
@@ -702,8 +697,6 @@ out:
702 struct lpfc_sli_ring *next_ring = &psli->ring[psli->next_ring]; 697 struct lpfc_sli_ring *next_ring = &psli->ring[psli->next_ring];
703 698
704 lpfc_clear_la(phba, pmb); 699 lpfc_clear_la(phba, pmb);
705 printk(KERN_ERR "%s (%d): do clear_la\n",
706 __FUNCTION__, __LINE__);
707 pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la; 700 pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la;
708 pmb->vport = vport; 701 pmb->vport = vport;
709 if (lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)) 702 if (lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB))
@@ -713,8 +706,6 @@ out:
713 extra_ring->flag &= ~LPFC_STOP_IOCB_EVENT; 706 extra_ring->flag &= ~LPFC_STOP_IOCB_EVENT;
714 fcp_ring->flag &= ~LPFC_STOP_IOCB_EVENT; 707 fcp_ring->flag &= ~LPFC_STOP_IOCB_EVENT;
715 next_ring->flag &= ~LPFC_STOP_IOCB_EVENT; 708 next_ring->flag &= ~LPFC_STOP_IOCB_EVENT;
716 printk(KERN_ERR "%s (%d): vport ready\n",
717 __FUNCTION__, __LINE__);
718 vport->port_state = LPFC_VPORT_READY; 709 vport->port_state = LPFC_VPORT_READY;
719 } 710 }
720 } else { 711 } else {
@@ -875,12 +866,9 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
875 866
876 /* Check for error */ 867 /* Check for error */
877 if (mb->mbxStatus) { 868 if (mb->mbxStatus) {
878 lpfc_printf_log(phba, 869 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
879 KERN_INFO,
880 LOG_LINK_EVENT,
881 "%d:1307 READ_LA mbox error x%x state x%x\n", 870 "%d:1307 READ_LA mbox error x%x state x%x\n",
882 phba->brd_no, 871 phba->brd_no, mb->mbxStatus, vport->port_state);
883 mb->mbxStatus, vport->port_state);
884 lpfc_mbx_issue_link_down(phba); 872 lpfc_mbx_issue_link_down(phba);
885 phba->link_state = LPFC_HBA_ERROR; 873 phba->link_state = LPFC_HBA_ERROR;
886 goto lpfc_mbx_cmpl_read_la_free_mbuf; 874 goto lpfc_mbx_cmpl_read_la_free_mbuf;
@@ -955,7 +943,6 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
955 struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) pmb->context1; 943 struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) pmb->context1;
956 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2; 944 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2;
957 945
958
959 pmb->context1 = NULL; 946 pmb->context1 = NULL;
960 947
961 /* Good status, call state machine */ 948 /* Good status, call state machine */
@@ -1553,6 +1540,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1553 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 1540 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
1554 if (mbox) { 1541 if (mbox) {
1555 lpfc_unreg_login(phba, ndlp->nlp_rpi, mbox); 1542 lpfc_unreg_login(phba, ndlp->nlp_rpi, mbox);
1543 mbox->vport = vport;
1556 mbox->mbox_cmpl=lpfc_sli_def_mbox_cmpl; 1544 mbox->mbox_cmpl=lpfc_sli_def_mbox_cmpl;
1557 rc = lpfc_sli_issue_mbox 1545 rc = lpfc_sli_issue_mbox
1558 (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); 1546 (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB));
@@ -1925,8 +1913,6 @@ lpfc_disc_start(struct lpfc_vport *vport)
1925 if (vport->port_state < LPFC_VPORT_READY && !clear_la_pending) { 1913 if (vport->port_state < LPFC_VPORT_READY && !clear_la_pending) {
1926 if (vport->port_type == LPFC_PHYSICAL_PORT) { 1914 if (vport->port_type == LPFC_PHYSICAL_PORT) {
1927 /* If we get here, there is nothing to ADISC */ 1915 /* If we get here, there is nothing to ADISC */
1928 printk(KERN_ERR "%s (%d): do clear_la\n",
1929 __FUNCTION__, __LINE__);
1930 lpfc_issue_clear_la(phba, vport); 1916 lpfc_issue_clear_la(phba, vport);
1931 } else if (!(vport->fc_flag & FC_ABORT_DISCOVERY)) { 1917 } else if (!(vport->fc_flag & FC_ABORT_DISCOVERY)) {
1932 1918
@@ -1940,8 +1926,6 @@ lpfc_disc_start(struct lpfc_vport *vport)
1940 vport->fc_flag &= ~FC_NDISC_ACTIVE; 1926 vport->fc_flag &= ~FC_NDISC_ACTIVE;
1941 spin_unlock_irq(shost->host_lock); 1927 spin_unlock_irq(shost->host_lock);
1942 } 1928 }
1943 printk(KERN_ERR "%s (%d): vport ready\n",
1944 __FUNCTION__, __LINE__);
1945 vport->port_state = LPFC_VPORT_READY; 1929 vport->port_state = LPFC_VPORT_READY;
1946 } 1930 }
1947 } else { 1931 } else {
@@ -2095,13 +2079,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2095 if (!(vport->fc_flag & FC_DISC_TMO)) 2079 if (!(vport->fc_flag & FC_DISC_TMO))
2096 return; 2080 return;
2097 2081
2098
2099 spin_lock_irq(shost->host_lock); 2082 spin_lock_irq(shost->host_lock);
2100 vport->fc_flag &= ~FC_DISC_TMO; 2083 vport->fc_flag &= ~FC_DISC_TMO;
2101 spin_unlock_irq(shost->host_lock); 2084 spin_unlock_irq(shost->host_lock);
2102 2085
2103 printk(KERN_ERR "%s (%d): link_state = %d, port_state = %d\n",
2104 __FUNCTION__, __LINE__, phba->link_state, vport->port_state);
2105 switch (vport->port_state) { 2086 switch (vport->port_state) {
2106 2087
2107 case LPFC_LOCAL_CFG_LINK: 2088 case LPFC_LOCAL_CFG_LINK:
@@ -2109,9 +2090,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2109 * FAN 2090 * FAN
2110 */ 2091 */
2111 /* FAN timeout */ 2092 /* FAN timeout */
2112 lpfc_printf_log(phba, 2093 lpfc_printf_log(phba, KERN_WARNING, LOG_DISCOVERY,
2113 KERN_WARNING,
2114 LOG_DISCOVERY,
2115 "%d:0221 FAN timeout\n", 2094 "%d:0221 FAN timeout\n",
2116 phba->brd_no); 2095 phba->brd_no);
2117 2096
@@ -2138,9 +2117,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2138 case LPFC_FLOGI: 2117 case LPFC_FLOGI:
2139 /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */ 2118 /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */
2140 /* Initial FLOGI timeout */ 2119 /* Initial FLOGI timeout */
2141 lpfc_printf_log(phba, 2120 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2142 KERN_ERR,
2143 LOG_DISCOVERY,
2144 "%d:0222 Initial FLOGI timeout\n", 2121 "%d:0222 Initial FLOGI timeout\n",
2145 phba->brd_no); 2122 phba->brd_no);
2146 2123
@@ -2203,8 +2180,6 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2203 2180
2204 phba->link_state = LPFC_CLEAR_LA; 2181 phba->link_state = LPFC_CLEAR_LA;
2205 lpfc_clear_la(phba, clearlambox); 2182 lpfc_clear_la(phba, clearlambox);
2206 printk(KERN_ERR "%s (%d): do clear_la\n",
2207 __FUNCTION__, __LINE__);
2208 clearlambox->mbox_cmpl = lpfc_mbx_cmpl_clear_la; 2183 clearlambox->mbox_cmpl = lpfc_mbx_cmpl_clear_la;
2209 clearlambox->vport = vport; 2184 clearlambox->vport = vport;
2210 rc = lpfc_sli_issue_mbox(phba, clearlambox, 2185 rc = lpfc_sli_issue_mbox(phba, clearlambox,
@@ -2230,6 +2205,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2230 lpfc_init_link(phba, initlinkmbox, phba->cfg_topology, 2205 lpfc_init_link(phba, initlinkmbox, phba->cfg_topology,
2231 phba->cfg_link_speed); 2206 phba->cfg_link_speed);
2232 initlinkmbox->mb.un.varInitLnk.lipsr_AL_PA = 0; 2207 initlinkmbox->mb.un.varInitLnk.lipsr_AL_PA = 0;
2208 initlinkmbox->vport = vport;
2233 rc = lpfc_sli_issue_mbox(phba, initlinkmbox, 2209 rc = lpfc_sli_issue_mbox(phba, initlinkmbox,
2234 (MBX_NOWAIT | MBX_STOP_IOCB)); 2210 (MBX_NOWAIT | MBX_STOP_IOCB));
2235 lpfc_set_loopback_flag(phba); 2211 lpfc_set_loopback_flag(phba);
@@ -2240,9 +2216,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2240 2216
2241 case LPFC_DISC_AUTH: 2217 case LPFC_DISC_AUTH:
2242 /* Node Authentication timeout */ 2218 /* Node Authentication timeout */
2243 lpfc_printf_log(phba, 2219 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2244 KERN_ERR,
2245 LOG_DISCOVERY,
2246 "%d:0227 Node Authentication timeout\n", 2220 "%d:0227 Node Authentication timeout\n",
2247 phba->brd_no); 2221 phba->brd_no);
2248 lpfc_disc_flush_list(vport); 2222 lpfc_disc_flush_list(vport);
@@ -2259,8 +2233,6 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2259 } 2233 }
2260 phba->link_state = LPFC_CLEAR_LA; 2234 phba->link_state = LPFC_CLEAR_LA;
2261 lpfc_clear_la(phba, clearlambox); 2235 lpfc_clear_la(phba, clearlambox);
2262 printk(KERN_ERR "%s (%d): do clear_la\n",
2263 __FUNCTION__, __LINE__);
2264 clearlambox->mbox_cmpl = lpfc_mbx_cmpl_clear_la; 2236 clearlambox->mbox_cmpl = lpfc_mbx_cmpl_clear_la;
2265 clearlambox->vport = vport; 2237 clearlambox->vport = vport;
2266 rc = lpfc_sli_issue_mbox(phba, clearlambox, 2238 rc = lpfc_sli_issue_mbox(phba, clearlambox,
@@ -2273,9 +2245,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2273 2245
2274 case LPFC_VPORT_READY: 2246 case LPFC_VPORT_READY:
2275 if (vport->fc_flag & FC_RSCN_MODE) { 2247 if (vport->fc_flag & FC_RSCN_MODE) {
2276 lpfc_printf_log(phba, 2248 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2277 KERN_ERR,
2278 LOG_DISCOVERY,
2279 "%d:0231 RSCN timeout Data: x%x x%x\n", 2249 "%d:0231 RSCN timeout Data: x%x x%x\n",
2280 phba->brd_no, 2250 phba->brd_no,
2281 vport->fc_ns_retry, LPFC_MAX_NS_RETRY); 2251 vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
@@ -2291,13 +2261,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2291 case LPFC_STATE_UNKNOWN: 2261 case LPFC_STATE_UNKNOWN:
2292 case LPFC_NS_REG: 2262 case LPFC_NS_REG:
2293 case LPFC_BUILD_DISC_LIST: 2263 case LPFC_BUILD_DISC_LIST:
2294 lpfc_printf_log(phba, 2264 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2295 KERN_ERR,
2296 LOG_DISCOVERY,
2297 "%d:0229 Unexpected discovery timeout, vport " 2265 "%d:0229 Unexpected discovery timeout, vport "
2298 "State x%x\n", 2266 "State x%x\n",
2299 vport->port_state, 2267 vport->port_state, phba->brd_no);
2300 phba->brd_no);
2301 2268
2302 break; 2269 break;
2303 } 2270 }
@@ -2305,9 +2272,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2305 switch (phba->link_state) { 2272 switch (phba->link_state) {
2306 case LPFC_CLEAR_LA: 2273 case LPFC_CLEAR_LA:
2307 /* CLEAR LA timeout */ 2274 /* CLEAR LA timeout */
2308 lpfc_printf_log(phba, 2275 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2309 KERN_ERR,
2310 LOG_DISCOVERY,
2311 "%d:0228 CLEAR LA timeout\n", 2276 "%d:0228 CLEAR LA timeout\n",
2312 phba->brd_no); 2277 phba->brd_no);
2313 clrlaerr = 1; 2278 clrlaerr = 1;
@@ -2320,9 +2285,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2320 case LPFC_LINK_DOWN: 2285 case LPFC_LINK_DOWN:
2321 case LPFC_LINK_UP: 2286 case LPFC_LINK_UP:
2322 case LPFC_HBA_ERROR: 2287 case LPFC_HBA_ERROR:
2323 lpfc_printf_log(phba, 2288 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2324 KERN_ERR,
2325 LOG_DISCOVERY,
2326 "%d:0230 Unexpected timeout, hba link " 2289 "%d:0230 Unexpected timeout, hba link "
2327 "state x%x\n", 2290 "state x%x\n",
2328 phba->brd_no, phba->link_state); 2291 phba->brd_no, phba->link_state);
@@ -2335,8 +2298,6 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2335 psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2298 psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
2336 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2299 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
2337 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2300 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
2338 printk(KERN_ERR "%s (%d): vport ready\n",
2339 __FUNCTION__, __LINE__);
2340 vport->port_state = LPFC_VPORT_READY; 2301 vport->port_state = LPFC_VPORT_READY;
2341 } 2302 }
2342 2303