26 #include <linux/pci.h>
28 #include <linux/slab.h>
29 #include <linux/utsname.h>
31 #include <scsi/scsi.h>
52 #define HBA_PORTSPEED_1GBIT 0x0001
53 #define HBA_PORTSPEED_2GBIT 0x0002
54 #define HBA_PORTSPEED_4GBIT 0x0008
55 #define HBA_PORTSPEED_10GBIT 0x0004
56 #define HBA_PORTSPEED_8GBIT 0x0010
57 #define HBA_PORTSPEED_16GBIT 0x0020
58 #define HBA_PORTSPEED_UNKNOWN 0x0800
71 "0146 Ignoring unsolicited CT No HBQ "
76 "0145 Ignoring unsolicted CT HBQ Size:%d "
85 lpfc_ct_ignore_hbq_buffer(phba, piocbq, mp, size);
123 INIT_LIST_HEAD(&head);
131 size = icmd->
un.
cont64[0].tus.f.bdeSize;
132 lpfc_ct_unsol_buffer(phba, piocbq, bdeBuf, size);
138 lpfc_ct_unsol_buffer(phba, piocbq, bdeBuf,
145 INIT_LIST_HEAD(&head);
150 lpfc_ct_unsol_buffer(phba, iocbq,
NULL, 0);
157 lpfc_ct_unsol_buffer(phba, iocbq, mp, size);
195 size = icmd->
un.
cont64[0].tus.f.bdeSize;
196 lpfc_ct_unsol_buffer(phba, piocbq, bdeBuf, size);
231 lpfc_free_ct_rsp(phba, mlist);
235 INIT_LIST_HEAD(&mp->
list);
246 lpfc_free_ct_rsp(phba, mlist);
321 icmd = &geniocb->
iocb;
367 "0119 Issue GEN REQ IOCB to NPORT x%x "
373 geniocb->
vport = vport;
397 CommandResponse.bits.CmdRsp;
402 outmp = lpfc_alloc_ct_rsp(phba, cmdcode, bpl, rsp_size, &cnt);
411 status = lpfc_gen_req(vport, bmp, inmp, outmp, cmpl, ndlp, 0,
414 lpfc_free_ct_rsp(phba, outmp);
428 spin_unlock_irqrestore(&phba->
hbalock, flags);
432 spin_unlock_irqrestore(&phba->
hbalock, flags);
491 "did:x%x flg:x%x x%x",
500 "Data: x%x x%x x%x\n",
508 "did:x%x flg:x%x cnt:%d",
516 "NameServer Rsp Data: "
528 "did:x%x flg:x%x cnt:%d",
556 "did:x%x flg:x%x cnt:%d",
564 "NameServer Rsp Data: "
605 irsp = &rspiocb->
iocb;
608 "GID_FT cmpl: status:x%x/x%x rtry:%d",
620 "0216 Link event during NS query\n");
626 if (lpfc_error_lost_link(irsp)) {
628 "0226 NS query failed due to link event\n");
651 "0257 GID_FT Query error: 0x%x 0x%x\n",
659 "0208 NameServer Rsp Data: x%x\n",
661 lpfc_ns_rsp(vport, outp,
670 "0269 No NameServer Entries "
671 "Data: x%x x%x x%x x%x\n",
678 "GID_FT no entry cmd:x%x rsn:x%x exp:x%x",
685 "0240 NameServer Rsp Error "
686 "Data: x%x x%x x%x x%x\n",
693 "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x",
703 "0241 NameServer Rsp Error "
704 "Data: x%x x%x x%x x%x\n",
711 "GID_FT rsp err2 cmd:x%x rsn:x%x exp:x%x",
748 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
761 "GFF_ID cmpl: status:x%x/x%x did:x%x",
776 "NameServer Rsp Data: (init) "
777 "x%x x%x\n", did, fbits,
811 cmdiocb->
retry, did);
820 "0267 NameServer GFF Rsp "
821 "x%x Error (%d %d) Data: x%x x%x\n",
830 "0242 Process x%x GFF "
831 "NameServer Rsp Data: x%x x%x x%x\n",
837 "NameServer Rsp Data: x%x x%x\n", did,
889 irsp = &rspiocb->
iocb;
892 CommandResponse.bits.CmdRsp);
899 "0209 CT Request completes, latt %d, "
900 "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n",
906 "CT cmd cmpl: status:x%x/x%x cmd:x%x",
911 "0268 NS cmd %x Error (%d %d)\n",
921 retry = cmdiocb->
retry;
927 "0250 Retrying NS cmd %x\n", cmdcode);
956 lpfc_cmpl_ct(phba, cmdiocb, rspiocb);
977 lpfc_cmpl_ct(phba, cmdiocb, rspiocb);
998 lpfc_cmpl_ct(phba, cmdiocb, rspiocb);
1019 lpfc_cmpl_ct(phba, cmdiocb, rspiocb);
1031 lpfc_cmpl_ct(phba, cmdiocb, rspiocb);
1052 lpfc_cmpl_ct(phba, cmdiocb, rspiocb);
1064 "Emulex PPN-%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
1065 wwn[0], wwn[1], wwn[2], wwn[3],
1066 wwn[4], wwn[5], wwn[6], wwn[7]);
1072 n +=
snprintf(symbol + n, size - n,
" VPort-%d", vport->
vpi);
1076 n +=
snprintf(symbol + n, size - n,
" VName-%s",
1090 n =
snprintf(symbol, size,
"Emulex %s FV%s DV%s",
1091 vport->
phba->ModelName, fwrev, lpfc_release_version);
1132 INIT_LIST_HEAD(&mp->
list);
1136 goto ns_cmd_free_mp;
1143 goto ns_cmd_free_mpvirt;
1146 INIT_LIST_HEAD(&bmp->
list);
1150 goto ns_cmd_free_bmp;
1155 "0236 NameServer Req Data: x%x x%x x%x\n",
1162 bpl->
tus.
f.bdeFlags = 0;
1180 bpl->
tus.
f.bdeSize = 0;
1198 cmpl = lpfc_cmpl_ct_cmd_gid_ft;
1206 cmpl = lpfc_cmpl_ct_cmd_gff_id;
1214 CtReq->
un.
rft.fcpReg = 1;
1215 cmpl = lpfc_cmpl_ct_cmd_rft_id;
1225 cmpl = lpfc_cmpl_ct_cmd_rnn_id;
1233 size =
sizeof(CtReq->
un.
rspn.symbname);
1236 CtReq->
un.
rspn.symbname, size);
1237 cmpl = lpfc_cmpl_ct_cmd_rspn_id;
1245 size =
sizeof(CtReq->
un.
rsnn.symbname);
1248 CtReq->
un.
rsnn.symbname, size);
1249 cmpl = lpfc_cmpl_ct_cmd_rsnn_nn;
1256 cmpl = lpfc_cmpl_ct_cmd_da_id;
1265 cmpl = lpfc_cmpl_ct_cmd_rff_id;
1271 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) {
1274 "Issue CT cmd: cmd:x%x did:x%x",
1294 "0266 Issue NameServer Req x%x err %d Data: x%x x%x\n",
1317 "FDMI cmpl: status:x%x/x%x latt:%d",
1322 "0229 FDMI cmd %04x failed, latt = %d "
1323 "ulpStatus: x%x, rid x%x\n",
1337 "0220 FDMI rsp failed Data: x%x\n",
1388 goto fdmi_cmd_free_mp;
1393 goto fdmi_cmd_free_mpvirt;
1397 goto fdmi_cmd_free_bmp;
1399 INIT_LIST_HEAD(&mp->
list);
1400 INIT_LIST_HEAD(&bmp->
list);
1404 "0218 FDMI Request Data: x%x x%x x%x\n",
1435 size = 2 *
sizeof (
struct lpfc_name) + FOURBYTES;
1450 size += FOURBYTES +
sizeof (
struct lpfc_name);
1457 len += (len & 3) ? (4 - (len & 3)) : 4;
1460 size += FOURBYTES + len;
1467 len += (len & 3) ? (4 - (len & 3)) : 4;
1470 size += FOURBYTES + len;
1477 len += (len & 3) ? (4 - (len & 3)) : 4;
1480 size += FOURBYTES + len;
1487 len += (len & 3) ? (4 - (len & 3)) : 4;
1490 size += FOURBYTES + len;
1497 incr = vp->
rev.biuRev;
1498 for (i = 0; i < 8; i++) {
1511 size += FOURBYTES + 8;
1518 len += (len & 3) ? (4 - (len & 3)) : 4;
1521 size += FOURBYTES + len;
1528 len += (len & 3) ? (4 - (len & 3)) : 4;
1531 size += FOURBYTES + len;
1539 len += (len & 3) ? (4 - (len & 3)) : 4;
1542 size += FOURBYTES + len;
1548 init_utsname()->sysname,
1552 len += (len & 3) ? (4 - (len & 3)) : 4;
1555 size += FOURBYTES + len;
1563 size += FOURBYTES + 4;
1667 len += (len & 3) ? (4 - (len & 3)) : 4;
1678 init_utsname()->nodename);
1680 len += (len & 3) ? (4 - (len & 3)) : 4;
1717 bpl->
tus.
f.bdeFlags = 0;
1721 cmpl = lpfc_cmpl_ct_cmd_fdmi;
1726 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl,
FC_MAX_NS_RSP, 0))
1737 fdmi_cmd_free_mpvirt:
1744 "0244 Issue FDMI request failed Data: x%x\n",
1762 unsigned long iflag;
1785 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1804 unsigned long iflag;
1824 if (init_utsname()->nodename[0] !=
'\0')
1844 else if (vp->
rev.rBit) {
1846 rev = vp->
rev.sli2FwRev;
1848 rev = vp->
rev.sli1FwRev;
1850 b1 = (rev & 0x0000f000) >> 12;
1851 b2 = (rev & 0x00000f00) >> 8;
1852 b3 = (rev & 0x000000c0) >> 6;
1853 b4 = (rev & 0x00000030) >> 4;
1872 b4 = (rev & 0x0000000f);
1875 fwname = vp->
rev.sli2FwName;
1877 fwname = vp->
rev.sli1FwName;
1879 for (i = 0; i < 16; i++)
1880 if (fwname[i] == 0x20)
1885 for (i = 0; i < 3; i++)
1890 sprintf(fwrevision,
"%d.%d%d (%s)",
1891 b1, b2, b3, (
char *)str);
1893 sprintf(fwrevision,
"%d.%d%d", b1,
1897 sprintf(fwrevision,
"%d.%d%d%c%d (%s)",
1901 sprintf(fwrevision,
"%d.%d%d%c%d",
1905 rev = vp->
rev.smFwRev;
1907 b1 = (rev & 0xff000000) >> 24;
1908 b2 = (rev & 0x00f00000) >> 20;
1909 b3 = (rev & 0x000f0000) >> 16;
1910 c = (rev & 0x0000ff00) >> 8;
1911 b4 = (rev & 0x000000ff);
1913 sprintf(fwrevision,
"%d.%d%d%c%d", b1, b2, b3, c, b4);