23 #include <linux/pci.h>
24 #include <linux/slab.h>
27 #include <scsi/scsi.h>
82 if (sp->
cls1.classValid) {
84 hsp_value = ((hsp->
cls1.rcvDataSizeMsb << 8) |
85 hsp->
cls1.rcvDataSizeLsb);
86 ssp_value = ((sp->
cls1.rcvDataSizeMsb << 8) |
87 sp->
cls1.rcvDataSizeLsb);
89 goto bad_service_param;
90 if (ssp_value > hsp_value) {
91 sp->
cls1.rcvDataSizeLsb =
92 hsp->
cls1.rcvDataSizeLsb;
93 sp->
cls1.rcvDataSizeMsb =
94 hsp->
cls1.rcvDataSizeMsb;
97 }
else if (
class ==
CLASS1)
98 goto bad_service_param;
99 if (sp->
cls2.classValid) {
101 hsp_value = ((hsp->
cls2.rcvDataSizeMsb << 8) |
102 hsp->
cls2.rcvDataSizeLsb);
103 ssp_value = ((sp->
cls2.rcvDataSizeMsb << 8) |
104 sp->
cls2.rcvDataSizeLsb);
106 goto bad_service_param;
107 if (ssp_value > hsp_value) {
108 sp->
cls2.rcvDataSizeLsb =
109 hsp->
cls2.rcvDataSizeLsb;
110 sp->
cls2.rcvDataSizeMsb =
111 hsp->
cls2.rcvDataSizeMsb;
114 }
else if (
class ==
CLASS2)
115 goto bad_service_param;
116 if (sp->
cls3.classValid) {
118 hsp_value = ((hsp->
cls3.rcvDataSizeMsb << 8) |
119 hsp->
cls3.rcvDataSizeLsb);
120 ssp_value = ((sp->
cls3.rcvDataSizeMsb << 8) |
121 sp->
cls3.rcvDataSizeLsb);
123 goto bad_service_param;
124 if (ssp_value > hsp_value) {
125 sp->
cls3.rcvDataSizeLsb =
126 hsp->
cls3.rcvDataSizeLsb;
127 sp->
cls3.rcvDataSizeMsb =
128 hsp->
cls3.rcvDataSizeMsb;
131 }
else if (
class ==
CLASS3)
132 goto bad_service_param;
139 hsp_value = (hsp->
cmn.bbRcvSizeMsb << 8) | hsp->
cmn.bbRcvSizeLsb;
140 ssp_value = (sp->
cmn.bbRcvSizeMsb << 8) | sp->
cmn.bbRcvSizeLsb;
141 if (ssp_value > hsp_value) {
142 sp->
cmn.bbRcvSizeLsb = hsp->
cmn.bbRcvSizeLsb;
143 sp->
cmn.bbRcvSizeMsb = (sp->
cmn.bbRcvSizeMsb & 0xF0) |
144 (hsp->
cmn.bbRcvSizeMsb & 0x0F);
153 "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent "
154 "invalid service parameters. Ignoring device.\n",
172 irsp = &rspiocb->
iocb;
215 "2819 Abort outstanding I/O on NPort x%x "
216 "Data: x%x x%x x%x\n",
228 list_move_tail(&iocb->
list, &completions);
234 list_splice_init(&pring->
txcmplq, &txcmplq_completions);
235 spin_unlock_irq(&phba->
hbalock);
243 list_splice(&txcmplq_completions, &pring->
txcmplq);
244 spin_unlock_irq(&phba->
hbalock);
248 list_del_init(&iocb->
dlist);
250 spin_unlock_irq(&phba->
hbalock);
306 if (wwn_to_u64(sp->
portName.u.wwn) == 0) {
308 "0140 PLOGI Reject: invalid nname\n");
315 if (wwn_to_u64(sp->
nodeName.u.wwn) == 0) {
317 "0141 PLOGI Reject: invalid pname\n");
332 icmd = &cmdiocb->
iocb;
336 "0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n",
346 if (sp->
cls1.classValid)
348 if (sp->
cls2.classValid)
350 if (sp->
cls3.classValid)
352 if (sp->
cls4.classValid)
355 ((sp->
cmn.bbRcvSizeMsb & 0x0F) << 8) | sp->
cmn.bbRcvSizeLsb;
487 vport = mboxq->
vport;
504 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
521 pnn = (
struct lpfc_name *) & ap->nodeName;
522 ppn = (
struct lpfc_name *) & ap->portName;
529 icmd = &cmdiocb->
iocb;
530 if (icmd->
ulpStatus == 0 && lpfc_check_adisc(vport, ndlp, pnn, ppn)) {
550 lpfc_mbx_cmpl_resume_rpi, elsiocb);
571 stat.un.b.lsRjtRsvd0 = 0;
574 stat.un.b.vendorUnique = 0;
593 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
596 int i, active_vlink_present = 0 ;
623 active_vlink_present = 1;
630 if (active_vlink_present) {
707 "rport rolechg: role:x%x did:x%x flg:x%x",
717 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
761 "2796 mailbox memory allocation failed \n");
790 "0271 Illegal State Transition: node x%x "
791 "event x%x, state x%x Data: x%x x%x\n",
808 "0272 Illegal State Transition: node x%x "
809 "event x%x, state x%x Data: x%x x%x\n",
826 if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) {
844 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
870 lpfc_device_recov_unused_node(
struct lpfc_vport *vport,
881 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
907 if (lpfc_rcv_plogi(vport, ndlp, cmdiocb) &&
959 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
985 lpfc_cmpl_plogi_plogi_issue(
struct lpfc_vport *vport,
991 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1007 irsp = &rspiocb->
iocb;
1021 (wwn_to_u64(sp->
portName.u.wwn) == 0 ||
1022 wwn_to_u64(sp->
nodeName.u.wwn) == 0)) {
1024 "0142 PLOGI RSP: Invalid WWN.\n");
1031 "0121 PLOGI chkparm OK Data: x%x x%x x%x x%x\n",
1040 if (sp->
cls1.classValid)
1042 if (sp->
cls2.classValid)
1044 if (sp->
cls3.classValid)
1046 if (sp->
cls4.classValid)
1049 ((sp->
cmn.bbRcvSizeMsb & 0x0F) << 8) | sp->
cmn.bbRcvSizeLsb;
1054 "0133 PLOGI: no memory for reg_login "
1055 "Data: x%x x%x x%x x%x\n",
1077 mbox->
vport = vport;
1096 "0134 PLOGI: cannot issue reg_login "
1097 "Data: x%x x%x x%x x%x\n",
1104 "0135 PLOGI: cannot format reg_login "
1105 "Data: x%x x%x x%x x%x\n",
1115 "0261 Cannot Register NameServer login\n");
1132 lpfc_cmpl_reglogin_plogi_issue(
struct lpfc_vport *vport,
1154 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1171 lpfc_device_recov_plogi_issue(
struct lpfc_vport *vport,
1176 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1201 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1210 if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) {
1254 lpfc_rcv_padisc_adisc_issue(
struct lpfc_vport *vport,
1262 lpfc_rcv_padisc(vport, ndlp, cmdiocb);
1280 lpfc_cmpl_adisc_adisc_issue(
struct lpfc_vport *vport,
1284 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1294 ap = (
ADISC *)lpfc_check_elscmpl_iocb(phba, cmdiocb, rspiocb);
1295 irsp = &rspiocb->
iocb;
1339 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1356 lpfc_device_recov_adisc_issue(
struct lpfc_vport *vport,
1361 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1378 lpfc_disc_set_adisc(vport, ndlp);
1383 lpfc_rcv_plogi_reglogin_issue(
struct lpfc_vport *vport,
1390 lpfc_rcv_plogi(vport, ndlp, cmdiocb);
1395 lpfc_rcv_prli_reglogin_issue(
struct lpfc_vport *vport,
1407 lpfc_rcv_logo_reglogin_issue(
struct lpfc_vport *vport,
1421 if ((mb = phba->
sli.mbox_active)) {
1430 spin_lock_irq(&phba->
hbalock);
1441 phba->
sli.mboxq_cnt--;
1445 spin_unlock_irq(&phba->
hbalock);
1452 lpfc_rcv_padisc_reglogin_issue(
struct lpfc_vport *vport,
1459 lpfc_rcv_padisc(vport, ndlp, cmdiocb);
1464 lpfc_rcv_prlo_reglogin_issue(
struct lpfc_vport *vport,
1477 lpfc_cmpl_reglogin_reglogin_issue(
struct lpfc_vport *vport,
1482 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1490 "0246 RegLogin failed Data: x%x x%x x%x x%x "
1537 lpfc_device_rm_reglogin_issue(
struct lpfc_vport *vport,
1542 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1556 lpfc_device_recov_reglogin_issue(
struct lpfc_vport *vport,
1561 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1575 lpfc_disc_set_adisc(vport, ndlp);
1587 lpfc_rcv_plogi(vport, ndlp, cmdiocb);
1620 lpfc_rcv_padisc(vport, ndlp, cmdiocb);
1643 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1651 npr = (
PRLI *)lpfc_check_elscmpl_iocb(phba, cmdiocb, rspiocb);
1653 irsp = &rspiocb->
iocb;
1720 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1754 lpfc_device_recov_prli_issue(
struct lpfc_vport *vport,
1759 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1776 lpfc_disc_set_adisc(vport, ndlp);
1812 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1854 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1861 lpfc_disc_set_adisc(vport, ndlp);
1879 lpfc_device_recov_logo_issue(
struct lpfc_vport *vport,
1897 lpfc_rcv_plogi(vport, ndlp, cmdiocb);
1907 lpfc_rcv_prli(vport, ndlp, cmdiocb);
1928 lpfc_rcv_padisc(vport, ndlp, cmdiocb);
1943 lpfc_device_recov_unmap_node(
struct lpfc_vport *vport,
1948 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1955 lpfc_disc_set_adisc(vport, ndlp);
1966 lpfc_rcv_plogi(vport, ndlp, cmdiocb);
1991 lpfc_rcv_padisc_mapped_node(
struct lpfc_vport *vport,
1997 lpfc_rcv_padisc(vport, ndlp, cmdiocb);
2018 lpfc_device_recov_mapped_node(
struct lpfc_vport *vport,
2023 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2030 lpfc_disc_set_adisc(vport, ndlp);
2038 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2044 if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) {
2064 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2106 lpfc_rcv_padisc(vport, ndlp, cmdiocb);
2132 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2166 irsp = &rspiocb->
iocb;
2184 irsp = &rspiocb->
iocb;
2196 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2218 irsp = &rspiocb->
iocb;
2227 lpfc_cmpl_reglogin_npr_node(
struct lpfc_vport *vport,
2252 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2268 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2343 lpfc_rcv_plogi_unused_node,
2344 lpfc_rcv_els_unused_node,
2345 lpfc_rcv_logo_unused_node,
2346 lpfc_rcv_els_unused_node,
2347 lpfc_rcv_els_unused_node,
2348 lpfc_rcv_els_unused_node,
2351 lpfc_cmpl_logo_unused_node,
2354 lpfc_device_rm_unused_node,
2355 lpfc_device_recov_unused_node,
2357 lpfc_rcv_plogi_plogi_issue,
2358 lpfc_rcv_prli_plogi_issue,
2359 lpfc_rcv_logo_plogi_issue,
2360 lpfc_rcv_els_plogi_issue,
2361 lpfc_rcv_els_plogi_issue,
2362 lpfc_rcv_els_plogi_issue,
2363 lpfc_cmpl_plogi_plogi_issue,
2365 lpfc_cmpl_logo_plogi_issue,
2367 lpfc_cmpl_reglogin_plogi_issue,
2368 lpfc_device_rm_plogi_issue,
2369 lpfc_device_recov_plogi_issue,
2371 lpfc_rcv_plogi_adisc_issue,
2372 lpfc_rcv_prli_adisc_issue,
2373 lpfc_rcv_logo_adisc_issue,
2374 lpfc_rcv_padisc_adisc_issue,
2375 lpfc_rcv_padisc_adisc_issue,
2376 lpfc_rcv_prlo_adisc_issue,
2380 lpfc_cmpl_adisc_adisc_issue,
2382 lpfc_device_rm_adisc_issue,
2383 lpfc_device_recov_adisc_issue,
2385 lpfc_rcv_plogi_reglogin_issue,
2386 lpfc_rcv_prli_reglogin_issue,
2387 lpfc_rcv_logo_reglogin_issue,
2388 lpfc_rcv_padisc_reglogin_issue,
2389 lpfc_rcv_padisc_reglogin_issue,
2390 lpfc_rcv_prlo_reglogin_issue,
2391 lpfc_cmpl_plogi_illegal,
2395 lpfc_cmpl_reglogin_reglogin_issue,
2396 lpfc_device_rm_reglogin_issue,
2397 lpfc_device_recov_reglogin_issue,
2399 lpfc_rcv_plogi_prli_issue,
2400 lpfc_rcv_prli_prli_issue,
2401 lpfc_rcv_logo_prli_issue,
2402 lpfc_rcv_padisc_prli_issue,
2403 lpfc_rcv_padisc_prli_issue,
2404 lpfc_rcv_prlo_prli_issue,
2405 lpfc_cmpl_plogi_illegal,
2406 lpfc_cmpl_prli_prli_issue,
2410 lpfc_device_rm_prli_issue,
2411 lpfc_device_recov_prli_issue,
2413 lpfc_rcv_plogi_logo_issue,
2414 lpfc_rcv_prli_logo_issue,
2415 lpfc_rcv_logo_logo_issue,
2416 lpfc_rcv_padisc_logo_issue,
2417 lpfc_rcv_padisc_logo_issue,
2418 lpfc_rcv_prlo_logo_issue,
2419 lpfc_cmpl_plogi_illegal,
2421 lpfc_cmpl_logo_logo_issue,
2424 lpfc_device_rm_logo_issue,
2425 lpfc_device_recov_logo_issue,
2427 lpfc_rcv_plogi_unmap_node,
2428 lpfc_rcv_prli_unmap_node,
2429 lpfc_rcv_logo_unmap_node,
2430 lpfc_rcv_padisc_unmap_node,
2431 lpfc_rcv_padisc_unmap_node,
2432 lpfc_rcv_prlo_unmap_node,
2439 lpfc_device_recov_unmap_node,
2441 lpfc_rcv_plogi_mapped_node,
2442 lpfc_rcv_prli_mapped_node,
2443 lpfc_rcv_logo_mapped_node,
2444 lpfc_rcv_padisc_mapped_node,
2445 lpfc_rcv_padisc_mapped_node,
2446 lpfc_rcv_prlo_mapped_node,
2453 lpfc_device_recov_mapped_node,
2455 lpfc_rcv_plogi_npr_node,
2456 lpfc_rcv_prli_npr_node,
2457 lpfc_rcv_logo_npr_node,
2458 lpfc_rcv_padisc_npr_node,
2459 lpfc_rcv_padisc_npr_node,
2460 lpfc_rcv_prlo_npr_node,
2461 lpfc_cmpl_plogi_npr_node,
2462 lpfc_cmpl_prli_npr_node,
2463 lpfc_cmpl_logo_npr_node,
2464 lpfc_cmpl_adisc_npr_node,
2465 lpfc_cmpl_reglogin_npr_node,
2466 lpfc_device_rm_npr_node,
2467 lpfc_device_recov_npr_node,
2486 "0211 DSM in event x%x on NPort x%x in "
2487 "state %d Data: x%x\n",
2491 "DSM in: evt:%d ste:%d did:x%x",
2492 evt, cur_state, ndlp->
nlp_DID);
2495 rc = (
func) (vport, ndlp, arg, evt);
2500 "0212 DSM out state %d on NPort x%x Data: x%x\n",
2504 "DSM out: ste:%d did:x%x flg:x%x",
2510 "0213 DSM out state %d on NPort free\n", rc);
2513 "DSM out: ste:%d did:x%x flg:x%x",