aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c40
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c103
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c24
4 files changed, 74 insertions, 95 deletions
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index 98b94c0eb597..eab087bf826e 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2005 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2006 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 74ad15d0a2ba..6e1a5162851c 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2005 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2006 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -717,8 +717,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
717 (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || 717 (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) ||
718 (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { 718 (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) {
719 rc = NLP_STE_FREED_NODE; 719 rc = NLP_STE_FREED_NODE;
720 } 720 } else {
721 else {
722 rc = lpfc_disc_state_machine(phba, ndlp, cmdiocb, 721 rc = lpfc_disc_state_machine(phba, ndlp, cmdiocb,
723 NLP_EVT_CMPL_PLOGI); 722 NLP_EVT_CMPL_PLOGI);
724 } 723 }
@@ -784,7 +783,7 @@ lpfc_issue_els_plogi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
784 783
785 cmdsize = (sizeof (uint32_t) + sizeof (struct serv_parm)); 784 cmdsize = (sizeof (uint32_t) + sizeof (struct serv_parm));
786 elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, 785 elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp,
787 ELS_CMD_PLOGI); 786 ELS_CMD_PLOGI);
788 if (!elsiocb) 787 if (!elsiocb)
789 return 1; 788 return 1;
790 789
@@ -861,8 +860,7 @@ lpfc_cmpl_els_prli(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
861 (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || 860 (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) ||
862 (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { 861 (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) {
863 goto out; 862 goto out;
864 } 863 } else {
865 else {
866 lpfc_disc_state_machine(phba, ndlp, cmdiocb, 864 lpfc_disc_state_machine(phba, ndlp, cmdiocb,
867 NLP_EVT_CMPL_PRLI); 865 NLP_EVT_CMPL_PRLI);
868 } 866 }
@@ -1195,8 +1193,7 @@ lpfc_cmpl_els_logo(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1195 (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || 1193 (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) ||
1196 (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) { 1194 (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) {
1197 goto out; 1195 goto out;
1198 } 1196 } else {
1199 else {
1200 lpfc_disc_state_machine(phba, ndlp, cmdiocb, 1197 lpfc_disc_state_machine(phba, ndlp, cmdiocb,
1201 NLP_EVT_CMPL_LOGO); 1198 NLP_EVT_CMPL_LOGO);
1202 } 1199 }
@@ -2201,7 +2198,7 @@ lpfc_els_disc_adisc(struct lpfc_hba * phba)
2201 phba->fc_flag &= ~FC_NLP_MORE; 2198 phba->fc_flag &= ~FC_NLP_MORE;
2202 spin_unlock_irq(phba->host->host_lock); 2199 spin_unlock_irq(phba->host->host_lock);
2203 } 2200 }
2204 return(sentadisc); 2201 return sentadisc;
2205} 2202}
2206 2203
2207int 2204int
@@ -2238,7 +2235,7 @@ lpfc_els_disc_plogi(struct lpfc_hba * phba)
2238 phba->fc_flag &= ~FC_NLP_MORE; 2235 phba->fc_flag &= ~FC_NLP_MORE;
2239 spin_unlock_irq(phba->host->host_lock); 2236 spin_unlock_irq(phba->host->host_lock);
2240 } 2237 }
2241 return(sentplogi); 2238 return sentplogi;
2242} 2239}
2243 2240
2244int 2241int
@@ -2591,8 +2588,7 @@ lpfc_els_rcv_flogi(struct lpfc_hba * phba,
2591 mempool_free( mbox, phba->mbox_mem_pool); 2588 mempool_free( mbox, phba->mbox_mem_pool);
2592 } 2589 }
2593 return 1; 2590 return 1;
2594 } 2591 } else if (rc > 0) { /* greater than */
2595 else if (rc > 0) { /* greater than */
2596 spin_lock_irq(phba->host->host_lock); 2592 spin_lock_irq(phba->host->host_lock);
2597 phba->fc_flag |= FC_PT2PT_PLOGI; 2593 phba->fc_flag |= FC_PT2PT_PLOGI;
2598 spin_unlock_irq(phba->host->host_lock); 2594 spin_unlock_irq(phba->host->host_lock);
@@ -2755,8 +2751,8 @@ lpfc_els_rcv_rps(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
2755 RPS *rps; 2751 RPS *rps;
2756 struct ls_rjt stat; 2752 struct ls_rjt stat;
2757 2753
2758 if((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) && 2754 if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
2759 (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) { 2755 (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
2760 stat.un.b.lsRjtRsvd0 = 0; 2756 stat.un.b.lsRjtRsvd0 = 0;
2761 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; 2757 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
2762 stat.un.b.lsRjtRsnCodeExp = LSEXP_CANT_GIVE_DATA; 2758 stat.un.b.lsRjtRsnCodeExp = LSEXP_CANT_GIVE_DATA;
@@ -2866,8 +2862,8 @@ lpfc_els_rcv_rpl(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
2866 RPL *rpl; 2862 RPL *rpl;
2867 struct ls_rjt stat; 2863 struct ls_rjt stat;
2868 2864
2869 if((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) && 2865 if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
2870 (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) { 2866 (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
2871 stat.un.b.lsRjtRsvd0 = 0; 2867 stat.un.b.lsRjtRsvd0 = 0;
2872 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; 2868 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
2873 stat.un.b.lsRjtRsnCodeExp = LSEXP_CANT_GIVE_DATA; 2869 stat.un.b.lsRjtRsnCodeExp = LSEXP_CANT_GIVE_DATA;
@@ -2886,8 +2882,7 @@ lpfc_els_rcv_rpl(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
2886 ((maxsize == 0) || 2882 ((maxsize == 0) ||
2887 ((maxsize * sizeof(uint32_t)) >= sizeof(RPL_RSP)))) { 2883 ((maxsize * sizeof(uint32_t)) >= sizeof(RPL_RSP)))) {
2888 cmdsize = sizeof(uint32_t) + sizeof(RPL_RSP); 2884 cmdsize = sizeof(uint32_t) + sizeof(RPL_RSP);
2889 } 2885 } else {
2890 else {
2891 cmdsize = sizeof(uint32_t) + maxsize * sizeof(uint32_t); 2886 cmdsize = sizeof(uint32_t) + maxsize * sizeof(uint32_t);
2892 } 2887 }
2893 lpfc_els_rsp_rpl_acc(phba, cmdsize, cmdiocb, ndlp); 2888 lpfc_els_rsp_rpl_acc(phba, cmdsize, cmdiocb, ndlp);
@@ -3032,8 +3027,7 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
3032 * other NLP_FABRIC logins 3027 * other NLP_FABRIC logins
3033 */ 3028 */
3034 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 3029 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
3035 } 3030 } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) {
3036 else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) {
3037 /* Fail outstanding I/O now since this 3031 /* Fail outstanding I/O now since this
3038 * device is marked for PLOGI 3032 * device is marked for PLOGI
3039 */ 3033 */
@@ -3228,8 +3222,7 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba)
3228 spin_unlock_irq(phba->host->host_lock); 3222 spin_unlock_irq(phba->host->host_lock);
3229 (piocb->iocb_cmpl) (phba, piocb, piocb); 3223 (piocb->iocb_cmpl) (phba, piocb, piocb);
3230 spin_lock_irq(phba->host->host_lock); 3224 spin_lock_irq(phba->host->host_lock);
3231 } 3225 } else
3232 else
3233 lpfc_sli_release_iocbq(phba, piocb); 3226 lpfc_sli_release_iocbq(phba, piocb);
3234 } 3227 }
3235 3228
@@ -3253,8 +3246,7 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba)
3253 spin_unlock_irq(phba->host->host_lock); 3246 spin_unlock_irq(phba->host->host_lock);
3254 (piocb->iocb_cmpl) (phba, piocb, piocb); 3247 (piocb->iocb_cmpl) (phba, piocb, piocb);
3255 spin_lock_irq(phba->host->host_lock); 3248 spin_lock_irq(phba->host->host_lock);
3256 } 3249 } else
3257 else
3258 lpfc_sli_release_iocbq(phba, piocb); 3250 lpfc_sli_release_iocbq(phba, piocb);
3259 } 3251 }
3260 spin_unlock_irq(phba->host->host_lock); 3252 spin_unlock_irq(phba->host->host_lock);
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 710efec1221f..b2aec79eed80 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -108,7 +108,7 @@ lpfc_work_list_done(struct lpfc_hba * phba)
108 evt_listp); 108 evt_listp);
109 spin_unlock_irq(phba->host->host_lock); 109 spin_unlock_irq(phba->host->host_lock);
110 free_evt = 1; 110 free_evt = 1;
111 switch(evtp->evt) { 111 switch (evtp->evt) {
112 case LPFC_EVT_NODEV_TMO: 112 case LPFC_EVT_NODEV_TMO:
113 ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); 113 ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1);
114 lpfc_process_nodev_timeout(phba, ndlp); 114 lpfc_process_nodev_timeout(phba, ndlp);
@@ -173,13 +173,13 @@ lpfc_work_done(struct lpfc_hba * phba)
173 work_hba_events=phba->work_hba_events; 173 work_hba_events=phba->work_hba_events;
174 spin_unlock_irq(phba->host->host_lock); 174 spin_unlock_irq(phba->host->host_lock);
175 175
176 if(ha_copy & HA_ERATT) 176 if (ha_copy & HA_ERATT)
177 lpfc_handle_eratt(phba); 177 lpfc_handle_eratt(phba);
178 178
179 if(ha_copy & HA_MBATT) 179 if (ha_copy & HA_MBATT)
180 lpfc_sli_handle_mb_event(phba); 180 lpfc_sli_handle_mb_event(phba);
181 181
182 if(ha_copy & HA_LATT) 182 if (ha_copy & HA_LATT)
183 lpfc_handle_latt(phba); 183 lpfc_handle_latt(phba);
184 184
185 if (work_hba_events & WORKER_DISC_TMO) 185 if (work_hba_events & WORKER_DISC_TMO)
@@ -357,8 +357,7 @@ lpfc_linkdown(struct lpfc_hba * phba)
357 /* Check config parameter use-adisc or FCP-2 */ 357 /* Check config parameter use-adisc or FCP-2 */
358 if ((rc != NLP_STE_FREED_NODE) && 358 if ((rc != NLP_STE_FREED_NODE) &&
359 (phba->cfg_use_adisc == 0) && 359 (phba->cfg_use_adisc == 0) &&
360 !(ndlp->nlp_fcp_info & 360 !(ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE)) {
361 NLP_FCP_2_DEVICE)) {
362 /* We know we will have to relogin, so 361 /* We know we will have to relogin, so
363 * unreglogin the rpi right now to fail 362 * unreglogin the rpi right now to fail
364 * any outstanding I/Os quickly. 363 * any outstanding I/Os quickly.
@@ -398,7 +397,7 @@ lpfc_linkdown(struct lpfc_hba * phba)
398 lpfc_can_disctmo(phba); 397 lpfc_can_disctmo(phba);
399 398
400 /* Must process IOCBs on all rings to handle ABORTed I/Os */ 399 /* Must process IOCBs on all rings to handle ABORTed I/Os */
401 return (0); 400 return 0;
402} 401}
403 402
404static int 403static int
@@ -497,7 +496,7 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
497 lpfc_els_disc_plogi(phba); 496 lpfc_els_disc_plogi(phba);
498 } 497 }
499 498
500 if(!phba->num_disc_nodes) { 499 if (!phba->num_disc_nodes) {
501 spin_lock_irq(phba->host->host_lock); 500 spin_lock_irq(phba->host->host_lock);
502 phba->fc_flag &= ~FC_NDISC_ACTIVE; 501 phba->fc_flag &= ~FC_NDISC_ACTIVE;
503 spin_unlock_irq(phba->host->host_lock); 502 spin_unlock_irq(phba->host->host_lock);
@@ -685,7 +684,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
685 cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 684 cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
686 685
687 spin_lock_irq(phba->host->host_lock); 686 spin_lock_irq(phba->host->host_lock);
688 switch(la->UlnkSpeed) { 687 switch (la->UlnkSpeed) {
689 case LA_1GHZ_LINK: 688 case LA_1GHZ_LINK:
690 phba->fc_linkspeed = LA_1GHZ_LINK; 689 phba->fc_linkspeed = LA_1GHZ_LINK;
691 break; 690 break;
@@ -1115,12 +1114,11 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
1115 1114
1116 psli = &phba->sli; 1115 psli = &phba->sli;
1117 /* Sanity check to ensure we are not moving to / from the same list */ 1116 /* Sanity check to ensure we are not moving to / from the same list */
1118 if ((nlp->nlp_flag & NLP_LIST_MASK) == list) { 1117 if ((nlp->nlp_flag & NLP_LIST_MASK) == list)
1119 if (list != NLP_NO_LIST) 1118 if (list != NLP_NO_LIST)
1120 return(0); 1119 return 0;
1121 }
1122 1120
1123 switch(nlp->nlp_flag & NLP_LIST_MASK) { 1121 switch (nlp->nlp_flag & NLP_LIST_MASK) {
1124 case NLP_NO_LIST: /* Not on any list */ 1122 case NLP_NO_LIST: /* Not on any list */
1125 break; 1123 break;
1126 case NLP_UNUSED_LIST: 1124 case NLP_UNUSED_LIST:
@@ -1190,7 +1188,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
1190 phba->brd_no, 1188 phba->brd_no,
1191 nlp->nlp_DID, list, nlp->nlp_flag); 1189 nlp->nlp_DID, list, nlp->nlp_flag);
1192 1190
1193 switch(list) { 1191 switch (list) {
1194 case NLP_NO_LIST: /* No list, just remove it */ 1192 case NLP_NO_LIST: /* No list, just remove it */
1195 lpfc_nlp_remove(phba, nlp); 1193 lpfc_nlp_remove(phba, nlp);
1196 /* as node removed - stop further transport calls */ 1194 /* as node removed - stop further transport calls */
@@ -1287,10 +1285,10 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
1287 list_add_tail(&nlp->nlp_listp, &phba->fc_npr_list); 1285 list_add_tail(&nlp->nlp_listp, &phba->fc_npr_list);
1288 phba->fc_npr_cnt++; 1286 phba->fc_npr_cnt++;
1289 1287
1290 if (!(nlp->nlp_flag & NLP_NODEV_TMO)) { 1288 if (!(nlp->nlp_flag & NLP_NODEV_TMO))
1291 mod_timer(&nlp->nlp_tmofunc, 1289 mod_timer(&nlp->nlp_tmofunc,
1292 jiffies + HZ * phba->cfg_nodev_tmo); 1290 jiffies + HZ * phba->cfg_nodev_tmo);
1293 } 1291
1294 spin_lock_irq(phba->host->host_lock); 1292 spin_lock_irq(phba->host->host_lock);
1295 nlp->nlp_flag |= NLP_NODEV_TMO; 1293 nlp->nlp_flag |= NLP_NODEV_TMO;
1296 nlp->nlp_flag &= ~NLP_RCV_PLOGI; 1294 nlp->nlp_flag &= ~NLP_RCV_PLOGI;
@@ -1342,7 +1340,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
1342 } 1340 }
1343 } 1341 }
1344 } 1342 }
1345 return (0); 1343 return 0;
1346} 1344}
1347 1345
1348/* 1346/*
@@ -1401,7 +1399,7 @@ lpfc_can_disctmo(struct lpfc_hba * phba)
1401 phba->brd_no, phba->hba_state, phba->fc_flag, 1399 phba->brd_no, phba->hba_state, phba->fc_flag,
1402 phba->fc_plogi_cnt, phba->fc_adisc_cnt); 1400 phba->fc_plogi_cnt, phba->fc_adisc_cnt);
1403 1401
1404 return (0); 1402 return 0;
1405} 1403}
1406 1404
1407/* 1405/*
@@ -1422,11 +1420,11 @@ lpfc_check_sli_ndlp(struct lpfc_hba * phba,
1422 switch (icmd->ulpCommand) { 1420 switch (icmd->ulpCommand) {
1423 case CMD_GEN_REQUEST64_CR: 1421 case CMD_GEN_REQUEST64_CR:
1424 if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi) 1422 if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi)
1425 return (1); 1423 return 1;
1426 case CMD_ELS_REQUEST64_CR: 1424 case CMD_ELS_REQUEST64_CR:
1427 case CMD_XMIT_ELS_RSP64_CX: 1425 case CMD_XMIT_ELS_RSP64_CX:
1428 if (iocb->context1 == (uint8_t *) ndlp) 1426 if (iocb->context1 == (uint8_t *) ndlp)
1429 return (1); 1427 return 1;
1430 } 1428 }
1431 } else if (pring->ringno == psli->ip_ring) { 1429 } else if (pring->ringno == psli->ip_ring) {
1432 1430
@@ -1434,15 +1432,15 @@ lpfc_check_sli_ndlp(struct lpfc_hba * phba,
1434 /* Skip match check if waiting to relogin to FCP target */ 1432 /* Skip match check if waiting to relogin to FCP target */
1435 if ((ndlp->nlp_type & NLP_FCP_TARGET) && 1433 if ((ndlp->nlp_type & NLP_FCP_TARGET) &&
1436 (ndlp->nlp_flag & NLP_DELAY_TMO)) { 1434 (ndlp->nlp_flag & NLP_DELAY_TMO)) {
1437 return (0); 1435 return 0;
1438 } 1436 }
1439 if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi) { 1437 if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi) {
1440 return (1); 1438 return 1;
1441 } 1439 }
1442 } else if (pring->ringno == psli->next_ring) { 1440 } else if (pring->ringno == psli->next_ring) {
1443 1441
1444 } 1442 }
1445 return (0); 1443 return 0;
1446} 1444}
1447 1445
1448/* 1446/*
@@ -1503,7 +1501,7 @@ lpfc_no_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
1503 1501
1504 } 1502 }
1505 } 1503 }
1506 return (0); 1504 return 0;
1507} 1505}
1508 1506
1509/* 1507/*
@@ -1604,7 +1602,7 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
1604 1602
1605 lpfc_unreg_rpi(phba, ndlp); 1603 lpfc_unreg_rpi(phba, ndlp);
1606 1604
1607 return (0); 1605 return 0;
1608} 1606}
1609 1607
1610/* 1608/*
@@ -1640,12 +1638,11 @@ lpfc_nlp_remove(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
1640 spin_lock_irq(phba->host->host_lock); 1638 spin_lock_irq(phba->host->host_lock);
1641 ndlp->nlp_flag |= NLP_DELAY_REMOVE; 1639 ndlp->nlp_flag |= NLP_DELAY_REMOVE;
1642 spin_unlock_irq(phba->host->host_lock); 1640 spin_unlock_irq(phba->host->host_lock);
1643 } 1641 } else {
1644 else {
1645 lpfc_freenode(phba, ndlp); 1642 lpfc_freenode(phba, ndlp);
1646 mempool_free( ndlp, phba->nlp_mem_pool); 1643 mempool_free( ndlp, phba->nlp_mem_pool);
1647 } 1644 }
1648 return(0); 1645 return 0;
1649} 1646}
1650 1647
1651static int 1648static int
@@ -1656,20 +1653,20 @@ lpfc_matchdid(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, uint32_t did)
1656 D_ID matchdid; 1653 D_ID matchdid;
1657 1654
1658 if (did == Bcast_DID) 1655 if (did == Bcast_DID)
1659 return (0); 1656 return 0;
1660 1657
1661 if (ndlp->nlp_DID == 0) { 1658 if (ndlp->nlp_DID == 0) {
1662 return (0); 1659 return 0;
1663 } 1660 }
1664 1661
1665 /* First check for Direct match */ 1662 /* First check for Direct match */
1666 if (ndlp->nlp_DID == did) 1663 if (ndlp->nlp_DID == did)
1667 return (1); 1664 return 1;
1668 1665
1669 /* Next check for area/domain identically equals 0 match */ 1666 /* Next check for area/domain identically equals 0 match */
1670 mydid.un.word = phba->fc_myDID; 1667 mydid.un.word = phba->fc_myDID;
1671 if ((mydid.un.b.domain == 0) && (mydid.un.b.area == 0)) { 1668 if ((mydid.un.b.domain == 0) && (mydid.un.b.area == 0)) {
1672 return (0); 1669 return 0;
1673 } 1670 }
1674 1671
1675 matchdid.un.word = did; 1672 matchdid.un.word = did;
@@ -1680,9 +1677,9 @@ lpfc_matchdid(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, uint32_t did)
1680 if ((ndlpdid.un.b.domain == 0) && 1677 if ((ndlpdid.un.b.domain == 0) &&
1681 (ndlpdid.un.b.area == 0)) { 1678 (ndlpdid.un.b.area == 0)) {
1682 if (ndlpdid.un.b.id) 1679 if (ndlpdid.un.b.id)
1683 return (1); 1680 return 1;
1684 } 1681 }
1685 return (0); 1682 return 0;
1686 } 1683 }
1687 1684
1688 matchdid.un.word = ndlp->nlp_DID; 1685 matchdid.un.word = ndlp->nlp_DID;
@@ -1691,11 +1688,11 @@ lpfc_matchdid(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, uint32_t did)
1691 if ((matchdid.un.b.domain == 0) && 1688 if ((matchdid.un.b.domain == 0) &&
1692 (matchdid.un.b.area == 0)) { 1689 (matchdid.un.b.area == 0)) {
1693 if (matchdid.un.b.id) 1690 if (matchdid.un.b.id)
1694 return (1); 1691 return 1;
1695 } 1692 }
1696 } 1693 }
1697 } 1694 }
1698 return (0); 1695 return 0;
1699} 1696}
1700 1697
1701/* Search for a nodelist entry on a specific list */ 1698/* Search for a nodelist entry on a specific list */
@@ -1720,7 +1717,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1720 phba->brd_no, 1717 phba->brd_no,
1721 ndlp, ndlp->nlp_DID, 1718 ndlp, ndlp->nlp_DID,
1722 ndlp->nlp_flag, data1); 1719 ndlp->nlp_flag, data1);
1723 return (ndlp); 1720 return ndlp;
1724 } 1721 }
1725 } 1722 }
1726 } 1723 }
@@ -1741,7 +1738,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1741 phba->brd_no, 1738 phba->brd_no,
1742 ndlp, ndlp->nlp_DID, 1739 ndlp, ndlp->nlp_DID,
1743 ndlp->nlp_flag, data1); 1740 ndlp->nlp_flag, data1);
1744 return (ndlp); 1741 return ndlp;
1745 } 1742 }
1746 } 1743 }
1747 } 1744 }
@@ -1763,7 +1760,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1763 phba->brd_no, 1760 phba->brd_no,
1764 ndlp, ndlp->nlp_DID, 1761 ndlp, ndlp->nlp_DID,
1765 ndlp->nlp_flag, data1); 1762 ndlp->nlp_flag, data1);
1766 return (ndlp); 1763 return ndlp;
1767 } 1764 }
1768 } 1765 }
1769 } 1766 }
@@ -1785,7 +1782,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1785 phba->brd_no, 1782 phba->brd_no,
1786 ndlp, ndlp->nlp_DID, 1783 ndlp, ndlp->nlp_DID,
1787 ndlp->nlp_flag, data1); 1784 ndlp->nlp_flag, data1);
1788 return (ndlp); 1785 return ndlp;
1789 } 1786 }
1790 } 1787 }
1791 } 1788 }
@@ -1807,7 +1804,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1807 phba->brd_no, 1804 phba->brd_no,
1808 ndlp, ndlp->nlp_DID, 1805 ndlp, ndlp->nlp_DID,
1809 ndlp->nlp_flag, data1); 1806 ndlp->nlp_flag, data1);
1810 return (ndlp); 1807 return ndlp;
1811 } 1808 }
1812 } 1809 }
1813 } 1810 }
@@ -1829,7 +1826,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1829 phba->brd_no, 1826 phba->brd_no,
1830 ndlp, ndlp->nlp_DID, 1827 ndlp, ndlp->nlp_DID,
1831 ndlp->nlp_flag, data1); 1828 ndlp->nlp_flag, data1);
1832 return (ndlp); 1829 return ndlp;
1833 } 1830 }
1834 } 1831 }
1835 } 1832 }
@@ -1851,7 +1848,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1851 phba->brd_no, 1848 phba->brd_no,
1852 ndlp, ndlp->nlp_DID, 1849 ndlp, ndlp->nlp_DID,
1853 ndlp->nlp_flag, data1); 1850 ndlp->nlp_flag, data1);
1854 return (ndlp); 1851 return ndlp;
1855 } 1852 }
1856 } 1853 }
1857 } 1854 }
@@ -1873,7 +1870,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1873 phba->brd_no, 1870 phba->brd_no,
1874 ndlp, ndlp->nlp_DID, 1871 ndlp, ndlp->nlp_DID,
1875 ndlp->nlp_flag, data1); 1872 ndlp->nlp_flag, data1);
1876 return (ndlp); 1873 return ndlp;
1877 } 1874 }
1878 } 1875 }
1879 } 1876 }
@@ -1923,17 +1920,15 @@ lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did)
1923 del_timer_sync(&ndlp->nlp_delayfunc); 1920 del_timer_sync(&ndlp->nlp_delayfunc);
1924 spin_lock_irq(phba->host->host_lock); 1921 spin_lock_irq(phba->host->host_lock);
1925 if (!list_empty(&ndlp->els_retry_evt. 1922 if (!list_empty(&ndlp->els_retry_evt.
1926 evt_listp)) 1923 evt_listp))
1927 list_del_init(&ndlp->els_retry_evt. 1924 list_del_init(&ndlp->els_retry_evt.
1928 evt_listp); 1925 evt_listp);
1929 } 1926 }
1930 } 1927 } else {
1931 else {
1932 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1928 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
1933 ndlp = NULL; 1929 ndlp = NULL;
1934 } 1930 }
1935 } 1931 } else {
1936 else {
1937 flg = ndlp->nlp_flag & NLP_LIST_MASK; 1932 flg = ndlp->nlp_flag & NLP_LIST_MASK;
1938 if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST)) 1933 if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST))
1939 return NULL; 1934 return NULL;
@@ -2084,8 +2079,7 @@ lpfc_disc_start(struct lpfc_hba * phba)
2084 spin_lock_irq(phba->host->host_lock); 2079 spin_lock_irq(phba->host->host_lock);
2085 phba->fc_flag &= ~FC_RSCN_MODE; 2080 phba->fc_flag &= ~FC_RSCN_MODE;
2086 spin_unlock_irq(phba->host->host_lock); 2081 spin_unlock_irq(phba->host->host_lock);
2087 } 2082 } else
2088 else
2089 lpfc_els_handle_rscn(phba); 2083 lpfc_els_handle_rscn(phba);
2090 } 2084 }
2091 } 2085 }
@@ -2268,8 +2262,7 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba)
2268 if (ndlp->nlp_type & NLP_FABRIC) { 2262 if (ndlp->nlp_type & NLP_FABRIC) {
2269 /* Clean up the ndlp on Fabric connections */ 2263 /* Clean up the ndlp on Fabric connections */
2270 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 2264 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
2271 } 2265 } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) {
2272 else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) {
2273 /* Fail outstanding IO now since device 2266 /* Fail outstanding IO now since device
2274 * is marked for PLOGI. 2267 * is marked for PLOGI.
2275 */ 2268 */
@@ -2544,7 +2537,7 @@ lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi)
2544 for (i = 0; i < ARRAY_SIZE(lists); i++ ) 2537 for (i = 0; i < ARRAY_SIZE(lists); i++ )
2545 list_for_each_entry(ndlp, lists[i], nlp_listp) 2538 list_for_each_entry(ndlp, lists[i], nlp_listp)
2546 if (ndlp->nlp_rpi == rpi) 2539 if (ndlp->nlp_rpi == rpi)
2547 return (ndlp); 2540 return ndlp;
2548 2541
2549 return NULL; 2542 return NULL;
2550} 2543}
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 4bf232a9adc9..dba11d94d27d 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2005 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2006 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -150,8 +150,7 @@ lpfc_check_elscmpl_iocb(struct lpfc_hba * phba,
150 lp = (uint32_t *) prsp->virt; 150 lp = (uint32_t *) prsp->virt;
151 ptr = (void *)((uint8_t *)lp + sizeof(uint32_t)); 151 ptr = (void *)((uint8_t *)lp + sizeof(uint32_t));
152 } 152 }
153 } 153 } else {
154 else {
155 /* Force ulpStatus error since we are returning NULL ptr */ 154 /* Force ulpStatus error since we are returning NULL ptr */
156 if (!(irsp->ulpStatus)) { 155 if (!(irsp->ulpStatus)) {
157 irsp->ulpStatus = IOSTAT_LOCAL_REJECT; 156 irsp->ulpStatus = IOSTAT_LOCAL_REJECT;
@@ -301,12 +300,10 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,
301 /* Start discovery - this should just do 300 /* Start discovery - this should just do
302 CLEAR_LA */ 301 CLEAR_LA */
303 lpfc_disc_start(phba); 302 lpfc_disc_start(phba);
304 } 303 } else {
305 else {
306 lpfc_initial_flogi(phba); 304 lpfc_initial_flogi(phba);
307 } 305 }
308 } 306 } else {
309 else {
310 stat.un.b.lsRjtRsnCode = LSRJT_LOGICAL_BSY; 307 stat.un.b.lsRjtRsnCode = LSRJT_LOGICAL_BSY;
311 stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; 308 stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE;
312 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, 309 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb,
@@ -354,7 +351,7 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,
354 ((sp->cmn.bbRcvSizeMsb & 0x0F) << 8) | sp->cmn.bbRcvSizeLsb; 351 ((sp->cmn.bbRcvSizeMsb & 0x0F) << 8) | sp->cmn.bbRcvSizeLsb;
355 352
356 /* no need to reg_login if we are already in one of these states */ 353 /* no need to reg_login if we are already in one of these states */
357 switch(ndlp->nlp_state) { 354 switch (ndlp->nlp_state) {
358 case NLP_STE_NPR_NODE: 355 case NLP_STE_NPR_NODE:
359 if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) 356 if (!(ndlp->nlp_flag & NLP_NPR_ADISC))
360 break; 357 break;
@@ -444,8 +441,7 @@ lpfc_rcv_padisc(struct lpfc_hba * phba,
444 (lpfc_check_adisc(phba, ndlp, pnn, ppn))) { 441 (lpfc_check_adisc(phba, ndlp, pnn, ppn))) {
445 if (cmd == ELS_CMD_ADISC) { 442 if (cmd == ELS_CMD_ADISC) {
446 lpfc_els_rsp_adisc_acc(phba, cmdiocb, ndlp); 443 lpfc_els_rsp_adisc_acc(phba, cmdiocb, ndlp);
447 } 444 } else {
448 else {
449 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, 445 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp,
450 NULL, 0); 446 NULL, 0);
451 } 447 }
@@ -672,8 +668,7 @@ lpfc_rcv_plogi_plogi_issue(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
672 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; 668 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
673 stat.un.b.lsRjtRsnCodeExp = LSEXP_CMD_IN_PROGRESS; 669 stat.un.b.lsRjtRsnCodeExp = LSEXP_CMD_IN_PROGRESS;
674 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp); 670 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
675 } 671 } else {
676 else {
677 lpfc_rcv_plogi(phba, ndlp, cmdiocb); 672 lpfc_rcv_plogi(phba, ndlp, cmdiocb);
678 } /* if our portname was less */ 673 } /* if our portname was less */
679 674
@@ -708,8 +703,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_hba * phba,
708 703
709 if (evt == NLP_EVT_RCV_LOGO) { 704 if (evt == NLP_EVT_RCV_LOGO) {
710 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 705 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
711 } 706 } else {
712 else {
713 lpfc_issue_els_logo(phba, ndlp, 0); 707 lpfc_issue_els_logo(phba, ndlp, 0);
714 } 708 }
715 709
@@ -803,7 +797,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
803 * execute first, queue this command to 797 * execute first, queue this command to
804 * be processed later. 798 * be processed later.
805 */ 799 */
806 switch(ndlp->nlp_DID) { 800 switch (ndlp->nlp_DID) {
807 case NameServer_DID: 801 case NameServer_DID:
808 mbox->mbox_cmpl = 802 mbox->mbox_cmpl =
809 lpfc_mbx_cmpl_ns_reg_login; 803 lpfc_mbx_cmpl_ns_reg_login;