23 #include <linux/pci.h>
26 #include <linux/slab.h>
28 #include <scsi/scsi.h>
66 static void lpfc_sli4_send_seq_to_ulp(
struct lpfc_vport *,
76 lpfc_get_iocb_from_iocbq(
struct lpfc_iocbq *iocbq)
314 if (
unlikely(released == 0 && !arm))
320 bf_set(lpfc_eqcq_doorbell_arm, &doorbell, 1);
321 bf_set(lpfc_eqcq_doorbell_eqci, &doorbell, 1);
323 bf_set(lpfc_eqcq_doorbell_num_released, &doorbell, released);
325 bf_set(lpfc_eqcq_doorbell_eqid_hi, &doorbell,
399 if (
unlikely(released == 0 && !arm))
405 bf_set(lpfc_eqcq_doorbell_arm, &doorbell, 1);
406 bf_set(lpfc_eqcq_doorbell_num_released, &doorbell, released);
408 bf_set(lpfc_eqcq_doorbell_cqid_hi, &doorbell,
565 sglq = phba->
sli4_hba.lpfc_sglq_active_list[xritag];
587 sglq = phba->
sli4_hba.lpfc_sglq_active_list[xritag];
612 if ((!ndlp) && rrq->
ndlp)
646 unsigned long next_time;
647 unsigned long iflags;
660 spin_unlock_irqrestore(&phba->
hbalock, iflags);
693 unsigned long iflags;
702 spin_unlock_irqrestore(&phba->
hbalock, iflags);
706 spin_unlock_irqrestore(&phba->
hbalock, iflags);
725 unsigned long iflags;
736 if ((rrq->
vport == vport) && (!ndlp || rrq->
ndlp == ndlp))
737 list_move(&rrq->
list, &rrq_list);
738 spin_unlock_irqrestore(&phba->
hbalock, iflags);
759 unsigned long next_time;
760 unsigned long iflags;
769 spin_unlock_irqrestore(&phba->
hbalock, iflags);
821 unsigned long iflags;
849 spin_unlock_irqrestore(&phba->
hbalock, iflags);
853 "3155 Unable to allocate RRQ xri:0x%x rxid:0x%x"
854 " DID:0x%x Send:%d\n",
855 xritag, rxid, ndlp->
nlp_DID, send_rrq);
872 spin_unlock_irqrestore(&phba->
hbalock, iflags);
875 spin_unlock_irqrestore(&phba->
hbalock, iflags);
877 "2921 Can't set rrq active xri:0x%x rxid:0x%x"
878 " DID:0x%x Send:%d\n",
879 xritag, rxid, ndlp->
nlp_DID, send_rrq);
905 ndlp = lpfc_cmd->
rdata->pnode;
928 if (sglq == start_sglq) {
955 unsigned long iflags;
959 spin_unlock_irqrestore(&phba->
hbalock, iflags);
986 unsigned long iflag = 0;
992 sglq = __lpfc_clear_active_sglq(phba, iocbq->
sli4_lxritag);
999 list_add(&sglq->
list,
1000 &phba->
sli4_hba.lpfc_abts_els_sgl_list);
1001 spin_unlock_irqrestore(
1002 &phba->
sli4_hba.abts_sgl_list_lock, iflag);
1019 memset((
char *)iocbq + start_clean, 0,
sizeof(*iocbq) - start_clean);
1044 memset((
char*)iocbq + start_clean, 0,
sizeof(*iocbq) - start_clean);
1077 unsigned long iflags;
1083 __lpfc_sli_release_iocbq(phba, iocbq);
1084 spin_unlock_irqrestore(&phba->
hbalock, iflags);
1105 while (!list_empty(iocblist)) {
1113 (piocb->
iocb_cmpl) (phba, piocb, piocb);
1135 lpfc_sli_iocb_cmd_type(
uint8_t iocb_cmnd)
1142 switch (iocb_cmnd) {
1222 printk(
"%s - Unhandled SLI-3 Command x%x\n",
1223 __func__, iocb_cmnd);
1246 lpfc_sli_ring_map(
struct lpfc_hba *phba)
1263 "0446 Adapter failed to init (%d), "
1264 "mbxCmd x%x CFG_RING, mbxStatus x%x, "
1329 if (cmd_iocb !=
NULL)
1354 (++pring->
sli.
sli3.next_cmdidx >= max_cmd_idx))
1355 pring->
sli.
sli3.next_cmdidx = 0;
1358 pring->
sli.
sli3.next_cmdidx)) {
1364 "0315 Ring %d issue: portCmdGet %d "
1365 "is bigger than cmd ring %d\n",
1387 return lpfc_cmd_iocb(phba, pring);
1411 spin_lock_irq(&phba->
hbalock);
1416 spin_unlock_irq(&phba->
hbalock);
1417 iocbq->
iotag = iotag;
1422 spin_unlock_irq(&phba->
hbalock);
1423 new_arr = kzalloc(new_len *
sizeof (
struct lpfc_iocbq *),
1426 spin_lock_irq(&phba->
hbalock);
1428 if (new_len <= psli->iocbq_lookup_len) {
1432 if(++iotag < psli->iocbq_lookup_len) {
1435 spin_unlock_irq(&phba->
hbalock);
1436 iocbq->
iotag = iotag;
1439 spin_unlock_irq(&phba->
hbalock);
1450 spin_unlock_irq(&phba->
hbalock);
1451 iocbq->
iotag = iotag;
1456 spin_unlock_irq(&phba->
hbalock);
1459 "0318 Failed to allocate IOTAG.last IOTAG is %d\n",
1491 "IOCB cmd ring: wd4:x%08x wd6:x%08x wd7:x%08x",
1502 pring->
stats.iocb_cmd++;
1510 lpfc_sli_ringtxcmpl_put(phba, pring, nextiocb);
1512 __lpfc_sli_release_iocbq(phba, nextiocb);
1537 int ringno = pring->
ringno;
1550 pring->
stats.iocb_cmd_full++;
1565 int ringno = pring->
ringno;
1600 lpfc_is_link_up(phba) &&
1604 while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) &&
1606 lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb);
1609 lpfc_sli_update_ring(phba, pring);
1611 lpfc_sli_update_full_ring(phba, pring);
1630 struct hbq_s *hbqp = &phba->
hbqs[hbqno];
1645 "1802 HBQ %d: local_hbqGetIdx "
1646 "%u is > than hbqp->entry_count %u\n",
1676 unsigned long flags;
1683 for (i = 0; i < hbq_count; ++
i) {
1685 &phba->
hbqs[i].hbq_buffer_list,
list) {
1688 (phba->
hbqs[
i].hbq_free_buffer)(phba, hbq_buf);
1690 phba->
hbqs[
i].buffer_count = 0;
1697 if (hbq_buf->
tag == -1) {
1701 hbqno = hbq_buf->
tag >> 16;
1706 (phba->
hbqs[hbqno].hbq_free_buffer)(phba,
1713 spin_unlock_irqrestore(&phba->
hbalock, flags);
1754 hbqe = lpfc_sli_next_hbq_slot(phba, hbqno);
1756 struct hbq_s *hbqp = &phba->
hbqs[hbqno];
1760 hbqe->
bde.tus.f.bdeSize = hbq_buf->
size;
1761 hbqe->
bde.tus.f.bdeFlags = 0;
1850 unsigned long flags;
1853 if (!phba->
hbqs[hbqno].hbq_alloc_buffer)
1856 if ((phba->
hbqs[hbqno].buffer_count + count) >
1859 phba->
hbqs[hbqno].buffer_count;
1863 for (i = 0; i <
count; i++) {
1864 hbq_buffer = (phba->
hbqs[hbqno].hbq_alloc_buffer)(phba);
1873 while (!list_empty(&hbq_buf_list)) {
1876 hbq_buffer->
tag = (phba->
hbqs[hbqno].buffer_count |
1878 if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) {
1879 phba->
hbqs[hbqno].buffer_count++;
1882 (phba->
hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
1884 spin_unlock_irqrestore(&phba->
hbalock, flags);
1887 spin_unlock_irqrestore(&phba->
hbalock, flags);
1888 while (!list_empty(&hbq_buf_list)) {
1891 (phba->
hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
1911 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
1912 lpfc_hbq_defs[qno]->add_count);
1928 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
1931 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
1932 lpfc_hbq_defs[qno]->init_count);
1944 lpfc_sli_hbqbuf_get(
struct list_head *rb_list)
1975 spin_lock_irq(&phba->
hbalock);
1978 if (hbq_buf->
tag == tag) {
1979 spin_unlock_irq(&phba->
hbalock);
1983 spin_unlock_irq(&phba->
hbalock);
1985 "1803 Bad hbq tag. Data: x%x x%x\n",
1986 tag, phba->
hbqs[tag >> 16].buffer_count);
2005 hbqno = hbq_buffer->
tag >> 16;
2006 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
2007 (phba->
hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
2021 lpfc_sli_chk_mbx_command(
uint8_t mbxCommand)
2025 switch (mbxCommand) {
2115 unsigned long drvr_flag;
2126 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
2177 shost = lpfc_shost_from_vport(vport);
2194 "2860 SLI authentication is required "
2195 "for INIT_LINK but has not done yet\n");
2224 phba->
sli.slistat.mbox_event++;
2227 spin_lock_irq(&phba->
hbalock);
2228 list_splice_init(&phba->
sli.mboxq_cmpl, &cmplq);
2229 spin_unlock_irq(&phba->
hbalock);
2243 "MBOX cmpl vport: cmd:x%x mb:x%x x%x",
2251 "MBOX cmpl: cmd:x%x mb:x%x x%x",
2261 if (lpfc_sli_chk_mbx_command(pmbox->
mbxCommand) ==
2265 "(%d):0323 Unknown Mailbox command "
2266 "x%x (x%x/x%x) Cmpl\n",
2280 phba->
sli.slistat.mbox_stat_err++;
2285 "(%d):0305 Mbox cmd cmpl "
2286 "error - RETRYing Data: x%x "
2287 "(x%x/x%x) x%x x%x x%x\n",
2296 pmb->
vport->port_state);
2307 "(%d):0307 Mailbox cmd x%x (x%x/x%x) Cmpl x%p "
2308 "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n",
2343 lpfc_sli_get_buff(
struct lpfc_hba *phba,
2351 hbq_entry = lpfc_sli_hbqbuf_find(phba, tag);
2354 return &hbq_entry->
dbuf;
2377 if (pring->
prt[0].profile) {
2378 if (pring->
prt[0].lpfc_sli_rcv_unsol_event)
2379 (pring->
prt[0].lpfc_sli_rcv_unsol_event) (phba, pring,
2385 for (i = 0; i < pring->
num_mask; i++) {
2386 if ((pring->
prt[i].rctl == fch_r_ctl) &&
2387 (pring->
prt[
i].type == fch_type)) {
2388 if (pring->
prt[i].lpfc_sli_rcv_unsol_event)
2389 (pring->
prt[
i].lpfc_sli_rcv_unsol_event)
2390 (phba, pring, saveq);
2423 irsp = &(saveq->
iocb);
2432 "0316 Ring %d handler: unexpected "
2433 "ASYNC_STATUS iocb received evt_code "
2443 dmzbuf = lpfc_sli_get_buff(phba, pring,
2449 dmzbuf = lpfc_sli_get_buff(phba, pring,
2455 dmzbuf = lpfc_sli_get_buff(phba, pring,
2465 saveq->
context2 = lpfc_sli_get_buff(phba, pring,
2471 "0341 Ring %d Cannot find buffer for "
2472 "an unsolicited iocb. tag 0x%x\n",
2477 saveq->
context3 = lpfc_sli_get_buff(phba, pring,
2483 "0342 Ring %d Cannot find buffer for an"
2484 " unsolicited iocb. tag 0x%x\n",
2489 irsp = &(iocbq->
iocb);
2491 iocbq->
context2 = lpfc_sli_get_buff(phba, pring,
2497 "0343 Ring %d Cannot find "
2498 "buffer for an unsolicited iocb"
2499 ". tag 0x%x\n", pring->
ringno,
2503 iocbq->
context3 = lpfc_sli_get_buff(phba, pring,
2509 "0344 Ring %d Cannot find "
2510 "buffer for an unsolicited "
2535 list_del_init(&iocbq->
clist);
2537 irsp = &(saveq->
iocb);
2548 Rctl = w5p->
hcsw.Rctl;
2549 Type = w5p->
hcsw.Type;
2557 w5p->
hcsw.Rctl = Rctl;
2562 if (!lpfc_complete_unsol_iocb(phba, pring, saveq, Rctl, Type))
2564 "0313 Ring %d handler: unexpected Rctl x%x "
2565 "Type x%x received\n",
2566 pring->
ringno, Rctl, Type);
2584 lpfc_sli_iocbq_lookup(
struct lpfc_hba *phba,
2593 if (iotag != 0 && iotag <= phba->sli.last_iotag) {
2594 cmd_iocb = phba->
sli.iocbq_lookup[
iotag];
2595 list_del_init(&cmd_iocb->
list);
2604 "0317 iotag x%x is out off "
2605 "range: max iotag x%x wd0 x%x\n",
2606 iotag, phba->
sli.last_iotag,
2624 lpfc_sli_iocbq_lookup_by_tag(
struct lpfc_hba *phba,
2629 if (iotag != 0 && iotag <= phba->sli.last_iotag) {
2630 cmd_iocb = phba->
sli.iocbq_lookup[
iotag];
2633 list_del_init(&cmd_iocb->
list);
2640 "0372 iotag x%x is out off range: max iotag (x%x)\n",
2641 iotag, phba->
sli.last_iotag);
2668 unsigned long iflag;
2672 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq);
2673 spin_unlock_irqrestore(&phba->
hbalock, iflag);
2700 spin_unlock_irqrestore(&phba->
hbalock,
2714 spin_unlock_irqrestore(&phba->
hbalock,
2730 spin_unlock_irqrestore(
2744 spin_unlock_irqrestore(
2764 spin_unlock_irqrestore(
2769 (cmdiocbp->
iocb_cmpl) (phba, cmdiocbp, saveq);
2784 "0322 Ring %d handler: "
2785 "unexpected completion IoTag x%x "
2786 "Data: x%x x%x x%x x%x\n",
2818 "0312 Ring %d handler: portRspPut %d "
2819 "is bigger than rsp ring %d\n",
2856 sli_intr = phba->
sli.slistat.sli_intr;
2858 if (phba->
sli.slistat.sli_prev_intr > sli_intr)
2859 cnt = (((
uint64_t)(-1) - phba->
sli.slistat.sli_prev_intr) +
2862 cnt = (sli_intr - phba->
sli.slistat.sli_prev_intr);
2866 phba->
sli.slistat.sli_ips =
cnt;
2868 phba->
sli.slistat.sli_prev_intr = sli_intr;
2914 unsigned long iflag;
2918 pring->
stats.iocb_event++;
2924 portRspMax = pring->
sli.
sli3.numRiocb;
2926 if (
unlikely(portRspPut >= portRspMax)) {
2927 lpfc_sli_rsp_pointers_error(phba, pring);
2928 spin_unlock_irqrestore(&phba->
hbalock, iflag);
2932 spin_unlock_irqrestore(&phba->
hbalock, iflag);
2938 while (pring->
sli.
sli3.rspidx != portRspPut) {
2944 entry = lpfc_resp_iocb(phba, pring);
2947 if (++pring->
sli.
sli3.rspidx >= portRspMax)
2953 INIT_LIST_HEAD(&(rspiocbq.
list));
2954 irsp = &rspiocbq.
iocb;
2957 pring->
stats.iocb_rsp++;
2968 spin_unlock_irqrestore(&phba->
hbalock, iflag);
2975 "0336 Rsp Ring %d error: IOCB Data: "
2976 "x%x x%x x%x x%x x%x x%x x%x x%x\n",
2997 "0333 IOCB cmd 0x%x"
2998 " processed. Skipping"
3004 cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring,
3011 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3018 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3019 lpfc_sli_process_unsol_iocb(phba, pring, &rspiocbq);
3030 phba->
brd_no, adaptermsg);
3034 "0334 Unknown IOCB command "
3035 "Data: x%x, x%x x%x x%x x%x\n",
3053 if (pring->
sli.
sli3.rspidx == portRspPut)
3058 pring->
stats.iocb_rsp_full++;
3065 pring->
stats.iocb_cmd_empty++;
3069 lpfc_sli_resume_iocb(phba, pring);
3077 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3110 unsigned long iflag;
3119 irsp = &rspiocbp->
iocb;
3128 irsp = &(saveq->
iocb);
3132 pring->
stats.iocb_rsp++;
3141 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3149 "0328 Rsp Ring %d error: "
3154 "x%x x%x x%x x%x\n",
3181 type = lpfc_sli_iocb_cmd_type(iocb_cmd_type);
3184 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3185 rc = lpfc_sli_process_sol_iocb(phba, pring, saveq);
3190 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3191 rc = lpfc_sli_process_unsol_iocb(phba, pring, saveq);
3200 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring,
3205 spin_unlock_irqrestore(&phba->
hbalock,
3212 __lpfc_sli_release_iocbq(phba,
3225 phba->
brd_no, adaptermsg);
3229 "0335 Unknown IOCB "
3230 "command Data: x%x "
3244 __lpfc_sli_release_iocbq(phba, rspiocbp);
3246 __lpfc_sli_release_iocbq(phba, saveq);
3250 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3282 lpfc_sli_handle_slow_ring_event_s3(
struct lpfc_hba *phba,
3290 unsigned long iflag;
3295 pring->
stats.iocb_event++;
3301 portRspMax = pring->
sli.
sli3.numRiocb;
3303 if (portRspPut >= portRspMax) {
3309 "0303 Ring %d handler: portRspPut %d "
3310 "is bigger than rsp ring %d\n",
3311 pring->
ringno, portRspPut, portRspMax);
3314 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3323 while (pring->
sli.
sli3.rspidx != portRspPut) {
3337 entry = lpfc_resp_iocb(phba, pring);
3341 if (rspiocbp ==
NULL) {
3343 "completion.\n", __func__);
3349 irsp = &rspiocbp->
iocb;
3351 if (++pring->
sli.
sli3.rspidx >= portRspMax)
3356 "IOCB rsp ring: wd4:x%08x wd6:x%08x wd7:x%08x",
3365 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3367 rspiocbp = lpfc_sli_sp_handle_rspiocb(phba, pring, rspiocbp);
3375 if (pring->
sli.
sli3.rspidx == portRspPut) {
3382 pring->
stats.iocb_rsp_full++;
3390 pring->
stats.iocb_cmd_empty++;
3394 lpfc_sli_resume_iocb(phba, pring);
3401 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3418 lpfc_sli_handle_slow_ring_event_s4(
struct lpfc_hba *phba,
3424 unsigned long iflag;
3428 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3429 while (!list_empty(&phba->
sli4_hba.sp_queue_event)) {
3434 spin_unlock_irqrestore(&phba->
hbalock, iflag);
3441 irspiocbq = lpfc_sli4_els_wcqe_to_rspiocbq(phba,
3444 lpfc_sli_sp_handle_rspiocb(phba, pring,
3482 spin_lock_irq(&phba->
hbalock);
3483 list_splice_init(&pring->
txq, &completions);
3490 spin_unlock_irq(&phba->
hbalock);
3518 spin_lock_irq(&phba->
hbalock);
3520 list_splice_init(&pring->
txq, &
txq);
3529 spin_unlock_irq(&phba->
hbalock);
3561 if (lpfc_readl(phba->
HSregaddr, &status))
3570 while (((status & mask) != mask) &&
3587 if (lpfc_readl(phba->
HSregaddr, &status)) {
3594 if ((status & HS_FFERM) || (i >= 20)) {
3596 "2751 Adapter failed to restart, "
3597 "status reg x%x, FW Data: A8 x%x AC x%x\n",
3658 #define BARRIER_TEST_PATTERN (0xdeadbeef)
3672 uint32_t hc_copy, ha_copy, resp_data;
3677 if (hdrtype != 0x80 ||
3689 if (lpfc_readl(phba->
HCregaddr, &hc_copy))
3695 if (lpfc_readl(phba->
HAregaddr, &ha_copy))
3700 phba->
pport->stopped = 1;
3711 for (i = 0; i < 50; i++) {
3712 if (lpfc_readl((resp_buf + 1), &resp_data))
3720 if (lpfc_readl((resp_buf + 1), &resp_data))
3724 phba->
pport->stopped)
3732 for (i = 0; i < 500; i++) {
3733 if (lpfc_readl(resp_buf, &resp_data))
3735 if (resp_data != mbox)
3744 if (lpfc_readl(phba->
HAregaddr, &ha_copy))
3746 if (!(ha_copy & HA_ERATT))
3754 phba->
pport->stopped = 1;
3788 "0329 Kill HBA Data: x%x x%x\n",
3796 spin_lock_irq(&phba->
hbalock);
3797 if (lpfc_readl(phba->
HCregaddr, &status)) {
3798 spin_unlock_irq(&phba->
hbalock);
3806 spin_unlock_irq(&phba->
hbalock);
3816 "2752 KILL_BOARD command failed retval %d\n",
3818 spin_lock_irq(&phba->
hbalock);
3820 spin_unlock_irq(&phba->
hbalock);
3824 spin_lock_irq(&phba->
hbalock);
3826 spin_unlock_irq(&phba->
hbalock);
3835 if (lpfc_readl(phba->
HAregaddr, &ha_copy))
3837 while ((i++ < 30) && !(ha_copy &
HA_ERATT)) {
3839 if (lpfc_readl(phba->
HAregaddr, &ha_copy))
3844 if (ha_copy & HA_ERATT) {
3846 phba->
pport->stopped = 1;
3848 spin_lock_irq(&phba->
hbalock);
3852 spin_unlock_irq(&phba->
hbalock);
3857 return ha_copy & HA_ERATT ? 0 : 1;
3883 "0325 Reset HBA Data: x%x x%x\n",
3889 phba->
pport->fc_myDID = 0;
3890 phba->
pport->fc_prevDID = 0;
3912 pring = &psli->
ring[
i];
3915 pring->
sli.
sli3.next_cmdidx = 0;
3916 pring->
sli.
sli3.local_getidx = 0;
3944 "0295 Reset HBA Data: x%x x%x\n",
3950 phba->
pport->fc_myDID = 0;
3951 phba->
pport->fc_prevDID = 0;
3953 spin_lock_irq(&phba->
hbalock);
3955 phba->
fcf.fcf_flag = 0;
3956 spin_unlock_irq(&phba->
hbalock);
3960 "0389 Performing PCI function reset!\n");
3991 lpfc_sli_brdrestart_s3(
struct lpfc_hba *phba)
3999 spin_lock_irq(&phba->
hbalock);
4008 "0337 Restart HBA Data: x%x x%x\n",
4023 if (phba->
pport->port_state)
4032 phba->
pport->stopped = 0;
4035 spin_unlock_irq(&phba->
hbalock);
4044 if (hba_aer_enabled)
4062 lpfc_sli_brdrestart_s4(
struct lpfc_hba *phba)
4070 "0296 Restart HBA Data: x%x x%x\n",
4078 spin_lock_irq(&phba->
hbalock);
4079 phba->
pport->stopped = 0;
4082 spin_unlock_irq(&phba->
hbalock);
4088 if (hba_aer_enabled)
4120 lpfc_sli_chipset_init(
struct lpfc_hba *phba)
4125 if (lpfc_readl(phba->
HSregaddr, &status))
4144 "0436 Adapter failed to init, "
4145 "timeout, status reg x%x, "
4146 "FW Data: A8 x%x AC x%x\n", status,
4154 if (status & HS_FFERM) {
4159 "0437 Adapter failed to init, "
4160 "chipset, status reg x%x, "
4161 "FW Data: A8 x%x AC x%x\n", status,
4181 if (lpfc_readl(phba->
HSregaddr, &status))
4186 if (status & HS_FFERM) {
4190 "0438 Adapter failed to init, chipset, "
4192 "FW Data: A8 x%x AC x%x\n", status,
4229 lpfc_sli_hbq_entry_count(
void)
4235 for (i = 0; i < hbq_count; ++
i)
4249 return lpfc_sli_hbq_entry_count() *
sizeof(
struct lpfc_hbq_entry);
4262 lpfc_sli_hbq_setup(
struct lpfc_hba *phba)
4284 hbq_entry_index = 0;
4285 for (hbqno = 0; hbqno < hbq_count; ++hbqno) {
4286 phba->
hbqs[hbqno].next_hbqPutIdx = 0;
4287 phba->
hbqs[hbqno].hbqPutIdx = 0;
4288 phba->
hbqs[hbqno].local_hbqGetIdx = 0;
4289 phba->
hbqs[hbqno].entry_count =
4292 hbq_entry_index, pmb);
4293 hbq_entry_index += phba->
hbqs[hbqno].entry_count;
4301 "1805 Adapter failed to init. "
4302 "Data: x%x x%x x%x\n",
4316 for (hbqno = 0; hbqno < hbq_count; ++hbqno)
4317 lpfc_sli_hbqbuf_init_hbqs(phba, hbqno);
4331 lpfc_sli4_rb_setup(
struct lpfc_hba *phba)
4337 lpfc_sli_hbqbuf_init_hbqs(phba, 0);
4367 while (resetcount < 2 && !
done) {
4368 spin_lock_irq(&phba->
hbalock);
4370 spin_unlock_irq(&phba->
hbalock);
4373 rc = lpfc_sli_chipset_init(phba);
4377 spin_lock_irq(&phba->
hbalock);
4379 spin_unlock_irq(&phba->
hbalock);
4404 "0442 Adapter failed to init, mbxCmd x%x "
4405 "CONFIG_PORT, mbxStatus x%x Data: x%x\n",
4407 spin_lock_irq(&phba->
hbalock);
4409 spin_unlock_irq(&phba->
hbalock);
4413 spin_lock_irq(&phba->
hbalock);
4415 spin_unlock_irq(&phba->
hbalock);
4421 "3110 Port did not grant ASABT\n");
4426 goto do_prep_failed;
4431 goto do_prep_failed;
4448 "2850 Security Crypto Active. FIPS x%d "
4454 "2856 Config Port Security Crypto "
4471 "0443 Adapter did not grant "
4509 "1824 NPIV enabled: Override lpfc_sli_mode "
4510 "parameter (%d) to auto (0).\n",
4521 "1819 Unrecognized lpfc_sli_mode "
4531 "1820 Unable to select SLI-3. "
4532 "Not supported by adapter.\n");
4533 if (rc && mode != 2)
4536 goto lpfc_sli_hba_setup_error;
4543 "2709 This device supports "
4544 "Advanced Error Reporting (AER)\n");
4545 spin_lock_irq(&phba->
hbalock);
4547 spin_unlock_irq(&phba->
hbalock);
4550 "2708 This device does not support "
4551 "Advanced Error Reporting (AER)\n");
4566 "0444 Firmware in SLI %x mode. Max_vpi %d\n",
4568 rc = lpfc_sli_ring_map(phba);
4571 goto lpfc_sli_hba_setup_error;
4582 phba->
vpi_bmask = kzalloc(longs *
sizeof(
unsigned long),
4586 goto lpfc_sli_hba_setup_error;
4595 goto lpfc_sli_hba_setup_error;
4597 for (i = 0; i < phba->
max_vpi; i++)
4604 rc = lpfc_sli_hbq_setup(phba);
4606 goto lpfc_sli_hba_setup_error;
4608 spin_lock_irq(&phba->
hbalock);
4610 spin_unlock_irq(&phba->
hbalock);
4614 goto lpfc_sli_hba_setup_error;
4618 lpfc_sli_hba_setup_error:
4621 "0445 Firmware initialization failed\n");
4634 lpfc_sli4_read_fcoe_params(
struct lpfc_hba *phba)
4652 mqe = &mboxq->
u.
mqe;
4655 goto out_free_mboxq;
4662 "(%d):2571 Mailbox cmd x%x Status x%x "
4663 "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x "
4664 "x%x x%x x%x x%x x%x x%x x%x x%x x%x "
4665 "CQ: x%x x%x x%x x%x\n",
4667 bf_get(lpfc_mqe_command, mqe),
4668 bf_get(lpfc_mqe_status, mqe),
4679 mboxq->
mcqe.mcqe_tag0, mboxq->
mcqe.mcqe_tag1,
4680 mboxq->
mcqe.trailer);
4686 goto out_free_mboxq;
4693 goto out_free_mboxq;
4738 dma_size = *vpd_size;
4743 if (!dmabuf->
virt) {
4755 mqe = &mboxq->
u.
mqe;
4775 if (mqe->
un.
read_rev.avail_vpd_len < *vpd_size)
4798 lpfc_sli4_retrieve_pport_name(
struct lpfc_hba *phba)
4804 void *virtaddr =
NULL;
4806 uint32_t shdr_status, shdr_add_status;
4808 char cport_name = 0;
4822 goto retrieve_ppname;
4829 if (alloclen < reqlen) {
4831 "3084 Allocated DMA memory size (%d) is "
4832 "less than the requested DMA memory size "
4833 "(%d)\n", alloclen, reqlen);
4835 goto out_free_mboxq;
4842 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
4843 if (shdr_status || shdr_add_status || rc) {
4845 "3085 Mailbox x%x (x%x/x%x) failed, "
4846 "rc:x%x, status:x%x, add_status:x%x\n",
4850 rc, shdr_status, shdr_add_status);
4852 goto out_free_mboxq;
4857 bf_get(lpfc_cntl_attr_lnk_type, cntl_attr);
4859 bf_get(lpfc_cntl_attr_lnk_numb, cntl_attr);
4861 "3086 lnk_type:%d, lnk_numb:%d\n",
4871 get_port_name = &mboxq->
u.
mqe.un.get_port_name;
4874 bf_set(lpfc_mbx_get_port_name_lnk_type, &get_port_name->
u.
request,
4878 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
4879 if (shdr_status || shdr_add_status || rc) {
4881 "3087 Mailbox x%x (x%x/x%x) failed: "
4882 "rc:x%x, status:x%x, add_status:x%x\n",
4886 rc, shdr_status, shdr_add_status);
4888 goto out_free_mboxq;
4890 switch (phba->
sli4_hba.lnk_info.lnk_no) {
4892 cport_name =
bf_get(lpfc_mbx_get_port_name_name0,
4897 cport_name =
bf_get(lpfc_mbx_get_port_name_name1,
4902 cport_name =
bf_get(lpfc_mbx_get_port_name_name2,
4907 cport_name =
bf_get(lpfc_mbx_get_port_name_name3,
4916 phba->
Port[0] = cport_name;
4917 phba->
Port[1] =
'\0';
4919 "3091 SLI get port name: %s\n", phba->
Port);
4940 lpfc_sli4_arm_cqeq_intr(
struct lpfc_hba *phba)
4951 }
while (++fcp_eqidx < phba->cfg_fcp_io_channel);
4989 sizeof(struct lpfc_sli4_cfg_mhdr));
5013 rsrc_info = &mbox->
u.
mqe.un.rsrc_extent_info;
5014 if (
bf_get(lpfc_mbox_hdr_status,
5015 &rsrc_info->
header.cfg_shdr.response)) {
5017 "2930 Failed to get resource extents "
5018 "Status 0x%x Add'l Status 0x%x\n",
5019 bf_get(lpfc_mbox_hdr_status,
5020 &rsrc_info->
header.cfg_shdr.response),
5021 bf_get(lpfc_mbox_hdr_add_status,
5022 &rsrc_info->
header.cfg_shdr.response));
5027 *extnt_count =
bf_get(lpfc_mbx_get_rsrc_extent_info_cnt,
5029 *extnt_size =
bf_get(lpfc_mbx_get_rsrc_extent_info_size,
5033 "3162 Retrieved extents type-%d from port: count:%d, "
5034 "size:%d\n", type, *extnt_count, *extnt_size);
5059 uint16_t curr_ext_cnt, rsrc_ext_cnt;
5075 rsrc_blk_list = &phba->
sli4_hba.lpfc_rpi_blk_list;
5081 rsrc_blk_list = &phba->
sli4_hba.lpfc_xri_blk_list;
5084 rsrc_blk_list = &phba->
sli4_hba.lpfc_vfi_blk_list;
5092 if (rsrc_entry->
rsrc_size != rsrc_ext_size)
5096 if (curr_ext_cnt != rsrc_ext_cnt || size_diff != 0)
5129 req_len = extnt_cnt *
sizeof(
uint16_t);
5143 if (req_len > emb_len) {
5144 req_len = extnt_cnt *
sizeof(
uint16_t) +
5153 if (alloc_len < req_len) {
5155 "2982 Allocated DMA memory size (x%x) is "
5156 "less than the requested DMA memory "
5157 "size (x%x)\n", alloc_len, req_len);
5188 uint16_t rsrc_id_cnt, rsrc_cnt, rsrc_size;
5192 unsigned long longs;
5193 unsigned long *
bmask;
5198 void *virtaddr =
NULL;
5209 if ((rsrc_cnt == 0) || (rsrc_size == 0)) {
5211 "3009 No available Resource Extents "
5212 "for resource type 0x%x: Count: 0x%x, "
5213 "Size 0x%x\n", type, rsrc_cnt,
5219 "2903 Post resource extents type-0x%x: "
5220 "count:%d, size %d\n", type, rsrc_cnt, rsrc_size);
5226 rc = lpfc_sli4_cfg_post_extnts(phba, rsrc_cnt, type, &emb, mbox);
5239 rsrc_ext = &mbox->
u.
mqe.un.alloc_rsrc_extents;
5240 id_array = &rsrc_ext->
u.
rsp.id[0];
5241 rsrc_cnt =
bf_get(lpfc_mbx_rsrc_cnt, &rsrc_ext->
u.
rsp);
5245 rsrc_cnt =
bf_get(lpfc_mbx_rsrc_cnt, n_rsrc);
5246 id_array = &n_rsrc->
id;
5250 rsrc_id_cnt = rsrc_cnt * rsrc_size;
5259 phba->
sli4_hba.rpi_bmask = kzalloc(longs *
5260 sizeof(
unsigned long),
5266 phba->
sli4_hba.rpi_ids = kzalloc(rsrc_id_cnt *
5280 phba->
sli4_hba.next_rpi = rsrc_id_cnt;
5285 ext_blk_list = &phba->
sli4_hba.lpfc_rpi_blk_list;
5289 sizeof(
unsigned long),
5295 phba->
vpi_ids = kzalloc(rsrc_id_cnt *
5310 phba->
sli4_hba.xri_bmask = kzalloc(longs *
5311 sizeof(
unsigned long),
5317 phba->
sli4_hba.max_cfg_param.xri_used = 0;
5318 phba->
sli4_hba.xri_ids = kzalloc(rsrc_id_cnt *
5330 ext_blk_list = &phba->
sli4_hba.lpfc_xri_blk_list;
5333 phba->
sli4_hba.vfi_bmask = kzalloc(longs *
5334 sizeof(
unsigned long),
5340 phba->
sli4_hba.vfi_ids = kzalloc(rsrc_id_cnt *
5352 ext_blk_list = &phba->
sli4_hba.lpfc_vfi_blk_list;
5359 ext_blk_list =
NULL;
5369 for (i = 0, j = 0, k = 0; i < rsrc_cnt; i++) {
5371 rsrc_id =
bf_get(lpfc_mbx_rsrc_id_word4_0,
5374 rsrc_id =
bf_get(lpfc_mbx_rsrc_id_word4_1,
5387 rsrc_start = rsrc_id;
5389 phba->
sli4_hba.scsi_xri_start = rsrc_start +
5392 while (rsrc_id < (rsrc_start + rsrc_size)) {
5457 dealloc_rsrc = &mbox->
u.
mqe.un.dealloc_rsrc_extents;
5458 if (
bf_get(lpfc_mbox_hdr_status,
5459 &dealloc_rsrc->
header.cfg_shdr.response)) {
5461 "2919 Failed to release resource extents "
5462 "for type %d - Status 0x%x Add'l Status 0x%x. "
5463 "Resource memory not released.\n",
5465 bf_get(lpfc_mbox_hdr_status,
5466 &dealloc_rsrc->
header.cfg_shdr.response),
5467 bf_get(lpfc_mbox_hdr_add_status,
5468 &dealloc_rsrc->
header.cfg_shdr.response));
5481 list_del_init(&rsrc_blk->
list);
5490 list_del_init(&rsrc_blk->
list);
5500 list_del_init(&rsrc_blk->
list);
5508 list_del_init(&rsrc_blk->
list);
5534 unsigned long longs;
5536 if (!phba->
sli4_hba.rpi_hdrs_in_use)
5538 if (phba->
sli4_hba.extents_in_use) {
5551 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba,
5555 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba,
5559 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba,
5563 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba,
5577 "2931 Detected extent resource "
5578 "change. Reallocating all "
5580 rc = lpfc_sli4_dealloc_extent(phba,
5582 rc = lpfc_sli4_dealloc_extent(phba,
5584 rc = lpfc_sli4_dealloc_extent(phba,
5586 rc = lpfc_sli4_dealloc_extent(phba,
5624 count = phba->
sli4_hba.max_cfg_param.max_rpi;
5625 base = phba->
sli4_hba.max_cfg_param.rpi_base;
5627 phba->
sli4_hba.rpi_bmask = kzalloc(longs *
5628 sizeof(
unsigned long),
5634 phba->
sli4_hba.rpi_ids = kzalloc(count *
5639 goto free_rpi_bmask;
5642 for (i = 0; i <
count; i++)
5643 phba->
sli4_hba.rpi_ids[i] = base + i;
5646 count = phba->
sli4_hba.max_cfg_param.max_vpi;
5647 base = phba->
sli4_hba.max_cfg_param.vpi_base;
5650 sizeof(
unsigned long),
5656 phba->
vpi_ids = kzalloc(count *
5661 goto free_vpi_bmask;
5664 for (i = 0; i <
count; i++)
5668 count = phba->
sli4_hba.max_cfg_param.max_xri;
5669 base = phba->
sli4_hba.max_cfg_param.xri_base;
5671 phba->
sli4_hba.xri_bmask = kzalloc(longs *
5672 sizeof(
unsigned long),
5678 phba->
sli4_hba.max_cfg_param.xri_used = 0;
5679 phba->
sli4_hba.xri_ids = kzalloc(count *
5684 goto free_xri_bmask;
5687 for (i = 0; i <
count; i++)
5688 phba->
sli4_hba.xri_ids[i] = base + i;
5691 count = phba->
sli4_hba.max_cfg_param.max_vfi;
5692 base = phba->
sli4_hba.max_cfg_param.vfi_base;
5694 phba->
sli4_hba.vfi_bmask = kzalloc(longs *
5695 sizeof(
unsigned long),
5701 phba->
sli4_hba.vfi_ids = kzalloc(count *
5706 goto free_vfi_bmask;
5709 for (i = 0; i <
count; i++)
5710 phba->
sli4_hba.vfi_ids[i] = base + i;
5749 if (phba->
sli4_hba.extents_in_use) {
5791 void *virtaddr =
NULL;
5801 blk_list_head = &phba->
sli4_hba.lpfc_xri_blk_list;
5804 blk_list_head = &phba->
sli4_hba.lpfc_vfi_blk_list;
5807 blk_list_head = &phba->
sli4_hba.lpfc_rpi_blk_list;
5815 if (curr_blks == 0) {
5829 req_len = curr_blks *
sizeof(
uint16_t);
5844 if (req_len > emb_len) {
5845 req_len = curr_blks *
sizeof(
uint16_t) +
5859 if (alloc_len < req_len) {
5861 "2983 Allocated DMA memory size (x%x) is "
5862 "less than the requested DMA memory "
5863 "size (x%x)\n", alloc_len, req_len);
5892 rsrc_ext = &mbox->
u.
mqe.un.alloc_rsrc_extents;
5893 shdr = &rsrc_ext->
header.cfg_shdr;
5894 *extnt_cnt =
bf_get(lpfc_mbx_rsrc_cnt, &rsrc_ext->
u.
rsp);
5899 *extnt_cnt =
bf_get(lpfc_mbx_rsrc_cnt, n_rsrc);
5904 "2984 Failed to read allocated resources "
5905 "for type %d - Status 0x%x Add'l Status 0x%x.\n",
5932 lpfc_sli4_repost_els_sgl_list(
struct lpfc_hba *phba)
5937 int status, post_cnt = 0, num_posted = 0, block_cnt = 0;
5938 int last_xritag =
NO_XRI;
5946 list_splice_init(&phba->
sli4_hba.lpfc_sgl_list, &allc_sgl_list);
5950 &allc_sgl_list,
list) {
5951 list_del_init(&sglq_entry->
list);
5953 if ((last_xritag !=
NO_XRI) &&
5956 list_splice_init(&prep_sgl_list, &blck_sgl_list);
5957 post_cnt = block_cnt - 1;
5966 list_splice_init(&prep_sgl_list,
5968 post_cnt = block_cnt;
5978 if (num_posted == phba->
sli4_hba.els_xri_cnt) {
5979 if (post_cnt == 0) {
5980 list_splice_init(&prep_sgl_list,
5982 post_cnt = block_cnt;
5983 }
else if (block_cnt == 1) {
5985 sglq_entry->
phys, 0,
5995 "3159 Failed to post els "
5996 "sgl, xritag:x%x\n",
6000 spin_lock_irq(&phba->
hbalock);
6002 spin_unlock_irq(&phba->
hbalock);
6012 status = lpfc_sli4_post_els_sgl_list(phba, &blck_sgl_list,
6017 list_splice_init(&blck_sgl_list, &post_sgl_list);
6024 "3160 Failed to post els sgl-list, "
6029 list_splice_init(&blck_sgl_list, &free_sgl_list);
6030 spin_lock_irq(&phba->
hbalock);
6031 phba->
sli4_hba.els_xri_cnt -= post_cnt;
6032 spin_unlock_irq(&phba->
hbalock);
6047 if (!list_empty(&post_sgl_list)) {
6049 list_splice_init(&post_sgl_list,
6054 "3161 Failure to post els sgl to port.\n");
6092 spin_lock_irq(&phba->
hbalock);
6094 spin_unlock_irq(&phba->
hbalock);
6113 rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size);
6118 mqe = &mboxq->
u.
mqe;
6135 "0376 READ_REV Error. SLI Level %d "
6136 "FCoE enabled %d\n",
6149 lpfc_sli4_read_fcoe_params(phba))
6151 "2570 Failed to read FCoE parameters\n");
6157 rc = lpfc_sli4_retrieve_pport_name(phba);
6160 "3080 Successful retrieving SLI4 device "
6161 "physical port name: %s.\n", phba->
Port);
6171 "0377 Error %d parsing vpd. "
6172 "Using defaults.\n", rc);
6181 phba->
vpd.
rev.fcphHigh =
bf_get(lpfc_mbx_rd_rev_fcph_high,
6183 phba->
vpd.
rev.fcphLow =
bf_get(lpfc_mbx_rd_rev_fcph_low,
6185 phba->
vpd.
rev.feaLevelHigh =
bf_get(lpfc_mbx_rd_rev_ftr_lvl_high,
6187 phba->
vpd.
rev.feaLevelLow =
bf_get(lpfc_mbx_rd_rev_ftr_lvl_low,
6196 "(%d):0380 READ_REV Status x%x "
6197 "fw_rev:%s fcphHi:%x fcphLo:%x flHi:%x flLo:%x\n",
6199 bf_get(lpfc_mqe_status, mqe),
6202 phba->
vpd.
rev.feaLevelHigh, phba->
vpd.
rev.feaLevelLow);
6221 "0378 No support for fcpi mode.\n");
6247 "0379 Feature Mismatch Data: x%08x %08x "
6258 spin_lock_irq(&phba->
hbalock);
6260 spin_unlock_irq(&phba->
hbalock);
6269 "2920 Failed to alloc Resource IDs "
6282 mboxq->
vport = vport;
6299 "0382 READ_SPARAM command failed "
6300 "status %d, mbxStatus x%x\n",
6301 rc,
bf_get(lpfc_mqe_status, mqe));
6317 "1400 Failed to update xri-sgl size and "
6318 "mapping: %d\n", rc);
6323 rc = lpfc_sli4_repost_els_sgl_list(phba);
6326 "0582 Error %d during els sgl post "
6336 "0383 Error %d during scsi sgl post "
6348 "0393 Error %d during rpi post operation\n",
6359 "3089 Failed to allocate queues\n");
6361 goto out_stop_timers;
6367 "0381 Error %d during queue setup.\n ", rc);
6368 goto out_destroy_queue;
6372 lpfc_sli4_arm_cqeq_intr(phba);
6378 spin_lock_irq(&phba->
hbalock);
6380 spin_unlock_irq(&phba->
hbalock);
6383 lpfc_sli4_rb_setup(phba);
6386 phba->
fcf.fcf_flag = 0;
6387 phba->
fcf.current_rec.flag = 0;
6407 "2829 This device supports "
6408 "Advanced Error Reporting (AER)\n");
6409 spin_lock_irq(&phba->
hbalock);
6411 spin_unlock_irq(&phba->
hbalock);
6414 "2830 This device does not support "
6415 "Advanced Error Reporting (AER)\n");
6429 goto out_unset_queue;
6431 phba->
fcf.fcfi =
bf_get(lpfc_reg_fcfi_fcfi,
6432 &mboxq->
u.
mqe.un.reg_fcfi);
6442 spin_lock_irq(&phba->
hbalock);
6444 spin_unlock_irq(&phba->
hbalock);
6448 "3103 Adapter Link is disabled.\n");
6453 "3104 Adapter failed to issue "
6454 "DOWN_LINK mbox cmd, rc:x%x\n", rc);
6455 goto out_unset_queue;
6462 goto out_unset_queue;
6495 unsigned long iflag;
6502 spin_unlock_irqrestore(&phba->
pport->work_port_lock, iflag);
6531 spin_lock_irq(&phba->
hbalock);
6532 if (pmbox ==
NULL) {
6535 "0353 Active Mailbox cleared - mailbox timeout "
6537 spin_unlock_irq(&phba->
hbalock);
6543 "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n",
6545 phba->
pport->port_state,
6547 phba->
sli.mbox_active);
6548 spin_unlock_irq(&phba->
hbalock);
6554 spin_lock_irq(&phba->
pport->work_port_lock);
6556 spin_unlock_irq(&phba->
pport->work_port_lock);
6557 spin_lock_irq(&phba->
hbalock);
6560 spin_unlock_irq(&phba->
hbalock);
6566 "0345 Resetting board due to mailbox timeout\n");
6608 unsigned long drvr_flag = 0;
6611 int processing_queue = 0;
6618 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6621 processing_queue = 1;
6624 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6632 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6635 "1806 Mbox x%x failed. No vport\n",
6638 goto out_not_finished;
6644 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6645 goto out_not_finished;
6650 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6651 goto out_not_finished;
6660 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6664 "(%d):0311 Mailbox command x%x cannot "
6665 "issue Data: x%x x%x\n",
6668 goto out_not_finished;
6672 if (lpfc_readl(phba->
HCregaddr, &hc_copy) ||
6674 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6676 "(%d):2528 Mailbox command x%x cannot "
6677 "issue Data: x%x x%x\n",
6680 goto out_not_finished;
6691 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6695 "(%d):2529 Mailbox command x%x "
6696 "cannot issue Data: x%x x%x\n",
6700 goto out_not_finished;
6704 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6707 "(%d):2530 Mailbox command x%x "
6708 "cannot issue Data: x%x x%x\n",
6712 goto out_not_finished;
6722 "(%d):0308 Mbox cmd issue - BUSY Data: "
6723 "x%x x%x x%x x%x\n",
6729 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6734 "MBOX Bsy vport: cmd:x%x mb:x%x x%x",
6741 "MBOX Bsy: cmd:x%x mb:x%x x%x",
6752 if (flag != MBX_POLL) {
6756 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6759 "(%d):2531 Mailbox command x%x "
6760 "cannot issue Data: x%x x%x\n",
6764 goto out_not_finished;
6773 "(%d):0309 Mailbox cmd x%x issue Data: x%x x%x "
6783 "MBOX Send vport: cmd:x%x mb:x%x x%x",
6790 "MBOX Send: cmd:x%x mb:x%x x%x",
6797 evtctr = psli->
slistat.mbox_event;
6839 lpfc_memcpy_to_slim(to_slim, &mb->
un.
varWords[0],
6880 spin_unlock_irqrestore(&phba->
hbalock,
6882 goto out_not_finished;
6887 if (lpfc_readl(phba->
HAregaddr, &ha_copy)) {
6888 spin_unlock_irqrestore(&phba->
hbalock,
6890 goto out_not_finished;
6896 while (((word0 &
OWN_CHIP) == OWN_CHIP) ||
6901 spin_unlock_irqrestore(&phba->
hbalock,
6903 goto out_not_finished;
6908 if (((word0 & OWN_CHIP) != OWN_CHIP)
6909 && (evtctr != psli->
slistat.mbox_event))
6913 spin_unlock_irqrestore(&phba->
hbalock,
6929 if (((slimword0 & OWN_CHIP) != OWN_CHIP)
6941 if (lpfc_readl(phba->
HAregaddr, &ha_copy)) {
6942 spin_unlock_irqrestore(&phba->
hbalock,
6944 goto out_not_finished;
6963 lpfc_memcpy_from_slim(pmbox->
context2,
6977 spin_unlock_irqrestore(&phba->
hbalock, drvr_flag);
6981 if (processing_queue) {
7001 lpfc_sli4_async_mbox_block(
struct lpfc_hba *phba)
7005 unsigned long timeout = 0;
7008 spin_lock_irq(&phba->
hbalock);
7013 if (phba->
sli.mbox_active)
7015 phba->
sli.mbox_active) *
7017 spin_unlock_irq(&phba->
hbalock);
7020 while (phba->
sli.mbox_active) {
7032 spin_lock_irq(&phba->
hbalock);
7034 spin_unlock_irq(&phba->
hbalock);
7051 lpfc_sli4_async_mbox_unblock(
struct lpfc_hba *phba)
7055 spin_lock_irq(&phba->
hbalock);
7058 spin_unlock_irq(&phba->
hbalock);
7068 spin_unlock_irq(&phba->
hbalock);
7089 unsigned long timeout;
7097 db_ready =
bf_get(lpfc_bmbx_rdy, &bmbx_reg);
7103 }
while (!db_ready);
7128 unsigned long iflag;
7142 spin_unlock_irqrestore(&phba->
hbalock, iflag);
7144 "(%d):2532 Mailbox command x%x (x%x/x%x) "
7145 "cannot issue Data: x%x x%x\n",
7155 phba->
sli.mbox_active = mboxq;
7156 spin_unlock_irqrestore(&phba->
hbalock, iflag);
7159 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq);
7168 mbx_cmnd =
bf_get(lpfc_mqe_command, mb);
7174 dma_address = &phba->
sli4_hba.bmbx.dma_address;
7178 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq);
7186 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq);
7200 mcqe_status =
bf_get(lpfc_mcqe_status, &mbox_rgn->
mcqe);
7208 bf_set(lpfc_mqe_status, mb,
7215 "(%d):0356 Mailbox cmd x%x (x%x/x%x) Status x%x "
7216 "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x x%x x%x"
7217 " x%x x%x CQ: x%x x%x x%x x%x\n",
7218 mboxq->
vport ? mboxq->
vport->vpi : 0, mbx_cmnd,
7221 bf_get(lpfc_mqe_status, mb),
7229 mboxq->
mcqe.mcqe_tag0, mboxq->
mcqe.mcqe_tag1,
7230 mboxq->
mcqe.trailer);
7236 spin_unlock_irqrestore(&phba->
hbalock, iflag);
7257 unsigned long iflags;
7266 "(%d):2544 Mailbox command x%x (x%x/x%x) "
7267 "cannot issue Data: x%x x%x\n",
7273 goto out_not_finished;
7278 if (flag == MBX_POLL)
7279 rc = lpfc_sli4_post_sync_mbox(phba, mboxq);
7284 "(%d):2541 Mailbox command x%x "
7285 "(x%x/x%x) failure: "
7286 "mqe_sta: x%x mcqe_sta: x%x/x%x "
7296 bf_get(lpfc_mcqe_ext_status,
7300 }
else if (flag == MBX_POLL) {
7302 "(%d):2542 Try to issue mailbox command "
7303 "x%x (x%x/x%x) synchronously ahead of async"
7304 "mailbox command queue: x%x x%x\n",
7311 rc = lpfc_sli4_async_mbox_block(phba);
7314 rc = lpfc_sli4_post_sync_mbox(phba, mboxq);
7318 "(%d):2597 Sync Mailbox command "
7319 "x%x (x%x/x%x) failure: "
7320 "mqe_sta: x%x mcqe_sta: x%x/x%x "
7330 bf_get(lpfc_mcqe_ext_status,
7334 lpfc_sli4_async_mbox_unblock(phba);
7343 "(%d):2543 Mailbox command x%x (x%x/x%x) "
7344 "cannot issue Data: x%x x%x\n",
7350 goto out_not_finished;
7357 spin_unlock_irqrestore(&phba->
hbalock, iflags);
7359 "(%d):0354 Mbox cmd issue - Enqueue Data: "
7360 "x%x (x%x/x%x) x%x x%x x%x\n",
7365 phba->
pport->port_state,
7390 unsigned long iflags;
7401 spin_unlock_irqrestore(&phba->
hbalock, iflags);
7405 spin_unlock_irqrestore(&phba->
hbalock, iflags);
7409 spin_unlock_irqrestore(&phba->
hbalock, iflags);
7411 "0384 There is pending active mailbox cmd\n");
7423 spin_unlock_irqrestore(&phba->
hbalock, iflags);
7426 phba->
sli.mbox_active = mboxq;
7427 spin_unlock_irqrestore(&phba->
hbalock, iflags);
7433 goto out_not_finished;
7436 mqe = &mboxq->
u.
mqe;
7437 mbx_cmnd =
bf_get(lpfc_mqe_command, mqe);
7444 "(%d):0355 Mailbox cmd x%x (x%x/x%x) issue Data: "
7446 mboxq->
vport ? mboxq->
vport->vpi : 0, mbx_cmnd,
7455 "MBOX Send vport: cmd:x%x mb:x%x x%x",
7461 "MBOX Send: cmd:x%x mb:x%x x%x",
7469 rc = lpfc_sli4_mq_put(phba->
sli4_hba.mbx_wq, mqe);
7472 "(%d):2533 Mailbox command x%x (x%x/x%x) "
7473 "cannot issue Data: x%x x%x\n",
7479 goto out_not_finished;
7486 if (phba->
sli.mbox_active) {
7493 spin_unlock_irqrestore(&phba->
hbalock, iflags);
7533 lpfc_sli_handle_slow_ring_event_s3;
7541 lpfc_sli_handle_slow_ring_event_s4;
7548 "1420 Invalid HBA PCI-device group: 0x%x\n",
7642 "1807 IOCB x%x failed. No vport\n",
7712 while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) &&
7713 (nextiocb = lpfc_sli_next_iocb(phba, pring, &piocb)))
7714 lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb);
7717 lpfc_sli_update_ring(phba, pring);
7719 lpfc_sli_update_full_ring(phba, pring);
7727 pring->
stats.iocb_cmd_delay++;
7771 if (!piocbq || !sglq)
7775 icmd = &piocbq->
iocb;
7794 for (i = 0; i < numBdes; i++) {
7800 if ((i+1) == numBdes)
7801 bf_set(lpfc_sli4_sge_last, sgl, 1);
7803 bf_set(lpfc_sli4_sge_last, sgl, 0);
7820 bf_set(lpfc_sli4_sge_offset, sgl, offset);
7821 bf_set(lpfc_sli4_sge_type, sgl,
7823 offset += bde.tus.f.bdeSize;
7839 bf_set(lpfc_sli4_sge_last, sgl, 1);
7858 lpfc_sli4_scmd_to_wqidx_distr(
struct lpfc_hba *phba)
7919 wqe->
generic.wqe_com.word7 = 0;
7936 xmit_len = wqe->
generic.bde.tus.f.bdeSize;
7938 for (i = 0; i < numBdes; i++) {
7956 "2007 Only Limited Edition cmd Format"
7957 " supported 0x%x\n",
7962 wqe->
els_req.payload_len = xmit_len;
7970 ct = ((iocbq->
iocb.ulpCt_h << 1) | iocbq->
iocb.ulpCt_l);
7981 if_type =
bf_get(lpfc_sli_intf_if_type,
7991 iocbq->
vport->fc_myDID);
7999 }
else if (pcmd && iocbq->
context1) {
8046 ((iocbq->
iocb.ulpCt_h << 1) | iocbq->
iocb.ulpCt_l));
8058 xmit_len +
sizeof(
struct fcp_rsp);
8081 xmit_len +
sizeof(
struct fcp_rsp);
8122 for (i = 0; i < numBdes; i++) {
8126 xmit_len += bde.tus.f.bdeSize;
8129 wqe->
gen_req.request_payload_len = xmit_len;
8133 if (iocbq->
iocb.ulpCt_h || iocbq->
iocb.ulpCt_l) {
8134 ct = ((iocbq->
iocb.ulpCt_h << 1) | iocbq->
iocb.ulpCt_l);
8136 "2015 Invalid CT %x command 0x%x\n",
8161 if_type =
bf_get(lpfc_sli_intf_if_type,
8167 iocbq->
vport->fc_myDID);
8175 ((iocbq->
iocb.ulpCt_h << 1) | iocbq->
iocb.ulpCt_l));
8179 if (!iocbq->
iocb.ulpCt_h && iocbq->
iocb.ulpCt_l)
8195 iocbq->
vport->fc_myDID);
8208 if (abrt_iotag != 0 && abrt_iotag <= phba->sli.last_iotag) {
8209 abrtiocbq = phba->
sli.iocbq_lookup[abrt_iotag];
8227 ((iocbq->
iocb.ulpCt_h << 1) | iocbq->
iocb.ulpCt_l));
8301 "2014 Invalid command 0x%x\n",
8309 wqe->
generic.wqe_com.abort_tag = abort_tag;
8353 sglq = __lpfc_sli_get_sglq(phba, piocb);
8381 if (
NO_XRI == lpfc_sli4_bpl2sgl(phba, piocb, sglq))
8385 if (lpfc_sli4_iocb2wqe(phba, piocb, &wqe))
8394 if (lpfc_sli4_wq_put(phba->
sli4_hba.els_wq, &wqe))
8397 lpfc_sli_ringtxcmpl_put(phba, pring, piocb);
8444 "1419 Invalid HBA PCI-device group: 0x%x\n",
8474 unsigned long iflags;
8481 idx = lpfc_sli4_scmd_to_wqidx_distr(phba);
8485 pring = &phba->
sli.ring[ring_number];
8489 spin_unlock_irqrestore(&pring->
ring_lock, iflags);
8501 lpfc_sli4_eq_clr_intr(fpeq);
8506 while ((eqe = lpfc_sli4_eq_get(fpeq))) {
8507 lpfc_sli4_hba_handle_eqe(phba,
8509 fpeq->EQ_processed++;
8519 pring = &phba->
sli.ring[ring_number];
8523 spin_unlock_irqrestore(&pring->
ring_lock, iflags);
8530 spin_unlock_irqrestore(&phba->
hbalock, iflags);
8547 lpfc_extra_ring_setup(
struct lpfc_hba *phba)
8574 pring->
prt[0].profile = 0;
8577 pring->
prt[0].lpfc_sli_rcv_unsol_event =
NULL;
8594 lpfc_sli_abts_err_handler(
struct lpfc_hba *phba,
8606 "3092 Port generated ABTS async event "
8607 "on vpi %d rpi %d status 0x%x\n",
8623 "3095 Event Context not found, no "
8624 "action on vpi %d rpi %d status 0x%x, reason 0x%x\n",
8649 "3115 Node Context not found, driver "
8650 "ignoring abts err event\n");
8654 vport = ndlp->
vport;
8656 "3116 Port generated FCP XRI ABORT event on "
8657 "vpi %d rpi %d xri x%x status 0x%x parameter x%x\n",
8659 bf_get(lpfc_wcqe_xa_xri, axri),
8660 bf_get(lpfc_wcqe_xa_status, axri),
8688 lpfc_sli_async_event_handler(
struct lpfc_hba * phba,
8697 icmd = &iocbq->
iocb;
8708 "0347 Adapter is very hot, please take "
8709 "corrective action. temperature : %d Celsius\n",
8714 "0340 Adapter temperature is OK now. "
8715 "temperature : %d Celsius\n",
8720 shost = lpfc_shost_from_vport(phba->
pport);
8722 sizeof(temp_event_data), (
char *) &temp_event_data,
8726 lpfc_sli_abts_err_handler(phba, iocbq);
8731 "0346 Ring %d handler: unexpected ASYNC_STATUS"
8733 "W0 0x%08x W1 0x%08x W2 0x%08x W3 0x%08x\n"
8734 "W4 0x%08x W5 0x%08x W6 0x%08x W7 0x%08x\n"
8735 "W8 0x%08x W9 0x%08x W10 0x%08x W11 0x%08x\n"
8736 "W12 0x%08x W13 0x%08x W14 0x%08x W15 0x%08x\n",
8738 iocb_w[0], iocb_w[1], iocb_w[2], iocb_w[3],
8739 iocb_w[4], iocb_w[5], iocb_w[6], iocb_w[7],
8740 iocb_w[8], iocb_w[9], iocb_w[10], iocb_w[11],
8741 iocb_w[12], iocb_w[13], iocb_w[14], iocb_w[15]);
8762 int i, totiocbsize = 0;
8779 pring = &psli->
ring[
i];
8832 lpfc_sli_async_event_handler;
8834 pring->
prt[0].profile = 0;
8837 pring->
prt[0].lpfc_sli_rcv_unsol_event =
8839 pring->
prt[1].profile = 0;
8842 pring->
prt[1].lpfc_sli_rcv_unsol_event =
8844 pring->
prt[2].profile = 0;
8849 pring->
prt[2].lpfc_sli_rcv_unsol_event =
8851 pring->
prt[3].profile = 0;
8856 pring->
prt[3].lpfc_sli_rcv_unsol_event =
8859 pring->
prt[4].profile = 0;
8862 pring->
prt[4].lpfc_sli_rcv_unsol_event =
8866 totiocbsize += (pring->
sli.
sli3.numCiocb *
8873 "SLI2 SLIM Data: x%x x%lx\n",
8874 phba->
brd_no, totiocbsize,
8878 lpfc_extra_ring_setup(phba);
8902 spin_lock_irq(&phba->
hbalock);
8903 INIT_LIST_HEAD(&psli->
mboxq);
8907 pring = &psli->
ring[
i];
8909 pring->
sli.
sli3.next_cmdidx = 0;
8910 pring->
sli.
sli3.local_getidx = 0;
8912 INIT_LIST_HEAD(&pring->
txq);
8913 INIT_LIST_HEAD(&pring->
txcmplq);
8919 spin_unlock_irq(&phba->
hbalock);
8939 lpfc_sli_mbox_sys_flush(
struct lpfc_hba *phba)
8944 unsigned long iflag;
8949 list_splice_init(&phba->
sli.mboxq, &completions);
8957 list_splice_init(&phba->
sli.mboxq_cmpl, &completions);
8958 spin_unlock_irqrestore(&phba->
hbalock, iflag);
8961 while (!list_empty(&completions)) {
8995 unsigned long flags = 0;
9002 pring = &psli->
ring[
i];
9003 prev_pring_flag = pring->
flag;
9015 if (iocb->
vport != vport)
9017 list_move_tail(&iocb->
list, &completions);
9024 if (iocb->
vport != vport)
9029 pring->
flag = prev_pring_flag;
9032 spin_unlock_irqrestore(&phba->
hbalock, flags);
9062 unsigned long flags = 0;
9074 pring = &psli->
ring[
i];
9086 list_splice_init(&pring->
txq, &completions);
9090 spin_unlock_irqrestore(&phba->
hbalock, flags);
9097 list_splice_init(&phba->
elsbuf, &completions);
9100 spin_unlock_irqrestore(&phba->
hbalock, flags);
9102 while (!list_empty(&completions)) {
9114 spin_unlock_irqrestore(&phba->
pport->work_port_lock, flags);
9139 for (i = 0; i < (
int)cnt; i +=
sizeof (
uint32_t)) {
9167 for (i = 0; i < (
int)cnt; i +=
sizeof(
uint32_t)) {
9192 spin_lock_irq(&phba->
hbalock);
9195 spin_unlock_irq(&phba->
hbalock);
9213 spin_lock_irq(&phba->
hbalock);
9220 spin_unlock_irq(&phba->
hbalock);
9247 spin_lock_irq(&phba->
hbalock);
9250 list_del_init(&mp->
list);
9252 spin_unlock_irq(&phba->
hbalock);
9257 spin_unlock_irq(&phba->
hbalock);
9259 "0402 Cannot find virtual addr for buffer tag on "
9260 "ring %d Data x%lx x%p x%p x%x\n",
9261 pring->
ringno, (
unsigned long) tag,
9291 spin_lock_irq(&phba->
hbalock);
9293 if (mp->
phys == phys) {
9294 list_del_init(&mp->
list);
9296 spin_unlock_irq(&phba->
hbalock);
9301 spin_unlock_irq(&phba->
hbalock);
9303 "0410 Cannot find virtual addr for mapped buf on "
9304 "ring %d Data x%llx x%p x%p x%x\n",
9305 pring->
ringno, (
unsigned long long)phys,
9338 spin_lock_irq(&phba->
hbalock);
9340 if (abort_iotag != 0 &&
9341 abort_iotag <= phba->sli.last_iotag)
9343 phba->
sli.iocbq_lookup[abort_iotag];
9353 "0327 Cannot abort els iocb %p "
9354 "with tag %x context %x, abort status %x, "
9356 abort_iocb, abort_iotag, abort_context,
9359 spin_unlock_irq(&phba->
hbalock);
9384 "0139 Ignoring ELS cmd tag x%x completion Data: "
9416 unsigned long iflags;
9423 icmd = &cmdiocb->
iocb;
9431 if (abtsiocbp ==
NULL)
9439 iabt = &abtsiocbp->
iocb;
9461 abtsiocbp->
iocb_cmpl = lpfc_sli_abort_els_cmpl;
9464 "0339 Abort xri x%x, original iotag x%x, "
9465 "abort cmd iotag x%x\n",
9475 spin_unlock_irqrestore(&pring->
ring_lock, iflags);
9482 __lpfc_sli_release_iocbq(phba, abtsiocbp);
9518 icmd = &cmdiocb->
iocb;
9533 cmdiocb->
iocb_cmpl = lpfc_ignore_els_cmpl;
9534 goto abort_iotag_exit;
9538 retval = lpfc_sli_abort_iotag_issue(phba, pring, cmdiocb);
9569 spin_lock_irq(&phba->
hbalock);
9572 list_splice_init(&pring->
txq, &completions);
9577 lpfc_sli_abort_iotag_issue(phba, pring, iocb);
9579 spin_unlock_irq(&phba->hbalock);
9595 struct lpfc_sli *psli = &phba->sli;
9600 pring = &psli->
ring[
i];
9601 lpfc_sli_iocb_ring_abort(phba, pring);
9638 if (iocbq->
vport != vport)
9648 if ((lpfc_cmd->
rdata->pnode) &&
9649 (lpfc_cmd->
rdata->pnode->nlp_sid == tgt_id) &&
9654 if ((lpfc_cmd->
rdata->pnode) &&
9655 (lpfc_cmd->
rdata->pnode->nlp_sid == tgt_id))
9697 for (i = 1, sum = 0; i <= phba->
sli.last_iotag; i++) {
9698 iocbq = phba->
sli.iocbq_lookup[
i];
9700 if (lpfc_sli_validate_fcp_iocb (iocbq, vport, tgt_id, lun_id,
9723 "3096 ABORT_XRI_CN completing on xri x%x "
9724 "original iotag x%x, abort cmd iotag x%x "
9725 "status 0x%x, reason 0x%x\n",
9763 int errcnt = 0, ret_val = 0;
9766 for (i = 1; i <= phba->
sli.last_iotag; i++) {
9767 iocbq = phba->
sli.iocbq_lookup[
i];
9769 if (lpfc_sli_validate_fcp_iocb(iocbq, vport, tgt_id, lun_id,
9775 if (abtsiocb ==
NULL) {
9796 if (lpfc_is_link_up(phba))
9833 lpfc_sli_wake_iocb_wait(
struct lpfc_hba *phba,
9838 unsigned long iflags;
9843 if (cmdiocbq->
context2 && rspiocbq)
9858 spin_unlock_irqrestore(&phba->
hbalock, iflags);
9875 lpfc_chk_iocb_flg(
struct lpfc_hba *phba,
9878 unsigned long iflags;
9883 spin_unlock_irqrestore(&phba->
hbalock, iflags);
9926 long timeleft, timeout_req = 0;
9940 piocb->
iocb_cmpl = lpfc_sli_wake_iocb_wait;
9945 if (lpfc_readl(phba->
HCregaddr, &creg_val))
9955 timeout_req = timeout *
HZ;
9962 "0331 IOCB wake signaled\n");
9963 }
else if (timeleft == 0) {
9965 "0338 IOCB wait timeout error - no "
9966 "wake response Data x%x\n", timeout);
9970 "0330 IOCB wake NOT set, "
9972 timeout, (timeleft /
jiffies));
9977 "2818 Max IOCBs %d txq cnt %d txcmplq cnt %d\n",
9982 "0332 IOCB wait issue failed, Data x%x\n",
9988 if (lpfc_readl(phba->
HCregaddr, &creg_val))
10035 unsigned long flag;
10067 spin_unlock_irqrestore(&phba->
hbalock, flag);
10092 unsigned long timeout;
10097 lpfc_sli_mbox_sys_flush(phba);
10102 spin_lock_irq(&phba->
hbalock);
10109 if (phba->
sli.mbox_active)
10111 phba->
sli.mbox_active) *
10113 spin_unlock_irq(&phba->
hbalock);
10115 while (phba->
sli.mbox_active) {
10125 spin_unlock_irq(&phba->
hbalock);
10127 lpfc_sli_mbox_sys_flush(phba);
10142 lpfc_sli_eratt_read(
struct lpfc_hba *phba)
10147 if (lpfc_readl(phba->
HAregaddr, &ha_copy))
10152 if (lpfc_sli_read_hs(phba))
10195 lpfc_sli4_eratt_read(
struct lpfc_hba *phba)
10197 uint32_t uerr_sta_hi, uerr_sta_lo;
10205 if_type =
bf_get(lpfc_sli_intf_if_type, &phba->
sli4_hba.sli_intf);
10208 if (lpfc_readl(phba->
sli4_hba.u.if_type0.UERRLOregaddr,
10210 lpfc_readl(phba->
sli4_hba.u.if_type0.UERRHIregaddr,
10217 if ((~phba->
sli4_hba.ue_mask_lo & uerr_sta_lo) ||
10218 (~phba->
sli4_hba.ue_mask_hi & uerr_sta_hi)) {
10220 "1423 HBA Unrecoverable error: "
10221 "uerr_lo_reg=0x%x, uerr_hi_reg=0x%x, "
10222 "ue_mask_lo_reg=0x%x, "
10223 "ue_mask_hi_reg=0x%x\n",
10224 uerr_sta_lo, uerr_sta_hi,
10235 if (lpfc_readl(phba->
sli4_hba.u.if_type2.STATUSregaddr,
10236 &portstat_reg.word0) ||
10237 lpfc_readl(phba->
sli4_hba.PSMPHRregaddr,
10244 if (
bf_get(lpfc_sliport_status_err, &portstat_reg)) {
10250 "2885 Port Status Event: "
10251 "port status reg 0x%x, "
10252 "port smphr reg 0x%x, "
10253 "error 1=0x%x, error 2=0x%x\n",
10254 portstat_reg.word0,
10266 "2886 HBA Error Attention on unsupported "
10267 "if type %d.", if_type);
10296 spin_lock_irq(&phba->
hbalock);
10299 spin_unlock_irq(&phba->
hbalock);
10308 spin_unlock_irq(&phba->
hbalock);
10314 spin_unlock_irq(&phba->
hbalock);
10322 ha_copy = lpfc_sli_eratt_read(phba);
10326 ha_copy = lpfc_sli4_eratt_read(phba);
10330 "0299 Invalid SLI revision (%d)\n",
10335 spin_unlock_irq(&phba->
hbalock);
10351 lpfc_intr_state_check(
struct lpfc_hba *phba)
10358 phba->
sli.slistat.sli_intr++;
10395 unsigned long iflag;
10420 if (lpfc_intr_state_check(phba))
10424 if (lpfc_readl(phba->
HAregaddr, &ha_copy))
10430 ha_copy &= ~HA_ERATT;
10432 if (ha_copy & HA_ERATT) {
10435 ha_copy &= ~HA_ERATT;
10446 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10451 if (lpfc_readl(phba->
HCregaddr, &hc_copy))
10461 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10467 if (work_ha_copy) {
10468 if (work_ha_copy &
HA_LATT) {
10476 if (lpfc_readl(phba->
HCregaddr, &control))
10481 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10484 work_ha_copy &= ~HA_LATT;
10487 if (work_ha_copy & ~(HA_ERATT | HA_MBATT | HA_LATT)) {
10492 status = (work_ha_copy &
10497 if (lpfc_readl(phba->
HCregaddr, &control))
10501 "ISR slow ring: ctl:x%x stat:x%x isrcnt:x%x",
10507 "ISR Disable ring:"
10508 "pwork:x%x hawork:x%x wait:x%x",
10520 "ISR slow ring: pwork:"
10521 "x%x hawork:x%x wait:x%x",
10526 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10530 if (work_ha_copy & HA_ERATT) {
10531 if (lpfc_sli_read_hs(phba))
10548 if ((work_ha_copy & HA_MBATT) && (phba->
sli.mbox_active)) {
10549 pmb = phba->
sli.mbox_active;
10550 pmbox = &pmb->
u.
mb;
10552 vport = pmb->
vport;
10557 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10564 "(%d):0304 Stray Mailbox "
10565 "Interrupt mbxCommand x%x "
10567 (vport ? vport->
vpi : 0),
10571 work_ha_copy &= ~HA_MBATT;
10573 phba->
sli.mbox_active =
NULL;
10574 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10592 "MBOX dflt rpi: : "
10593 "status:x%x rpi:x%x",
10624 "0350 rc should have"
10625 "been MBX_BUSY\n");
10627 goto send_current_mbox;
10631 &phba->
pport->work_port_lock,
10633 phba->
pport->work_port_events &=
10635 spin_unlock_irqrestore(
10636 &phba->
pport->work_port_lock,
10641 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10643 if ((work_ha_copy & HA_MBATT) &&
10644 (phba->
sli.mbox_active ==
NULL)) {
10653 LOG_SLI,
"0349 rc should be "
10658 phba->
work_ha |= work_ha_copy;
10659 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10664 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10694 unsigned long iflag;
10699 phba = (
struct lpfc_hba *) dev_id;
10710 if (lpfc_intr_state_check(phba))
10713 if (lpfc_readl(phba->
HAregaddr, &ha_copy))
10722 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10728 spin_unlock_irqrestore(&phba->
hbalock, iflag);
10751 if (status & HA_RXMASK) {
10789 phba = (
struct lpfc_hba *) dev_id;
10795 if (lpfc_intr_state_check(phba))
10807 }
else if (phba->
ha_copy & HA_ERATT) {
10825 if (lpfc_readl(phba->
HCregaddr, &hc_copy)) {
10868 if ((status1 & HA_RXMASK) || (status2 &
HA_RXMASK))
10874 return (sp_irq_rc ==
IRQ_HANDLED) ? sp_irq_rc : fp_irq_rc;
10889 spin_lock_irq(&phba->
hbalock);
10891 spin_unlock_irq(&phba->
hbalock);
10893 while (!list_empty(&phba->
sli4_hba.sp_fcp_xri_aborted_work_queue)) {
10895 spin_lock_irq(&phba->
hbalock);
10898 spin_unlock_irq(&phba->
hbalock);
10918 spin_lock_irq(&phba->
hbalock);
10920 spin_unlock_irq(&phba->
hbalock);
10922 while (!list_empty(&phba->
sli4_hba.sp_els_xri_aborted_work_queue)) {
10924 spin_lock_irq(&phba->
hbalock);
10927 spin_unlock_irq(&phba->
hbalock);
10947 lpfc_sli4_iocb_param_transfer(
struct lpfc_hba *phba,
10952 unsigned long iflags;
10956 memcpy((
char *)pIocbIn + offset, (
char *)pIocbOut + offset,
10959 status =
bf_get(lpfc_wcqe_c_status, wcqe);
10977 if (
bf_get(lpfc_wcqe_c_bg_edir, wcqe))
10983 if (
bf_get(lpfc_wcqe_c_bg_ge, wcqe))
10986 if (
bf_get(lpfc_wcqe_c_bg_ae, wcqe))
10989 if (
bf_get(lpfc_wcqe_c_bg_re, wcqe))
10994 if (
bf_get(lpfc_wcqe_c_bg_tdpv, wcqe)) {
11012 if (
bf_get(lpfc_wcqe_c_xb, wcqe)) {
11015 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11031 lpfc_sli4_els_wcqe_to_rspiocbq(
struct lpfc_hba *phba,
11037 unsigned long iflags;
11039 wcqe = &irspiocbq->
cq_event.cqe.wcqe_cmpl;
11041 pring->
stats.iocb_event++;
11043 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring,
11044 bf_get(lpfc_wcqe_c_request_tag, wcqe));
11045 spin_unlock_irqrestore(&pring->
ring_lock, iflags);
11049 "0386 ELS complete with no corresponding "
11050 "cmdiocb: iotag (%d)\n",
11051 bf_get(lpfc_wcqe_c_request_tag, wcqe));
11057 lpfc_sli4_iocb_param_transfer(phba, irspiocbq, cmdiocbq, wcqe);
11076 unsigned long iflags;
11079 "0392 Async Event: word0:x%x, word1:x%x, "
11080 "word2:x%x, word3:x%x\n", mcqe->
word0,
11087 "0394 Failed to allocate CQ_EVENT entry\n");
11097 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11121 unsigned long iflags;
11123 bool workposted =
false;
11127 if (!
bf_get(lpfc_trailer_completed, mcqe))
11128 goto out_no_mqe_complete;
11132 pmb = phba->
sli.mbox_active;
11135 "1832 No pending MBOX command to handle\n");
11136 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11137 goto out_no_mqe_complete;
11139 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11143 vport = pmb->
vport;
11157 mcqe_status =
bf_get(lpfc_mcqe_status, mcqe);
11160 bf_set(lpfc_mqe_status, mqe,
11166 "MBOX dflt rpi: status:x%x rpi:x%x",
11185 "have been MBX_BUSY\n");
11187 goto send_current_mbox;
11192 spin_unlock_irqrestore(&phba->
pport->work_port_lock, iflags);
11198 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11206 phba->
sli.mbox_active =
NULL;
11207 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11210 out_no_mqe_complete:
11211 if (
bf_get(lpfc_trailer_consumed, mcqe))
11212 lpfc_sli4_mq_release(phba->
sli4_hba.mbx_wq);
11237 if (!
bf_get(lpfc_trailer_async, &mcqe))
11238 workposted = lpfc_sli4_sp_handle_mbox_event(phba, &mcqe);
11240 workposted = lpfc_sli4_sp_handle_async_event(phba, &mcqe);
11259 unsigned long iflags;
11266 "0387 NO IOCBQ data: txq_cnt=%d iocb_cnt=%d "
11267 "fcp_txcmplq_cnt=%d, els_txcmplq_cnt=%d\n",
11275 memcpy(&irspiocbq->
cq_event.cqe.wcqe_cmpl, wcqe,
sizeof(*wcqe));
11280 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11294 lpfc_sli4_sp_handle_rel_wcqe(
struct lpfc_hba *phba,
11301 if (
bf_get(lpfc_wcqe_r_wq_id, wcqe) == phba->
sli4_hba.els_wq->queue_id)
11302 lpfc_sli4_wq_release(phba->
sli4_hba.els_wq,
11303 bf_get(lpfc_wcqe_r_wqe_index, wcqe));
11306 "2579 Slow-path wqe consume event carries "
11307 "miss-matched qid: wcqe-qid=x%x, sp-qid=x%x\n",
11308 bf_get(lpfc_wcqe_r_wqe_index, wcqe),
11323 lpfc_sli4_sp_handle_abort_xri_wcqe(
struct lpfc_hba *phba,
11327 bool workposted =
false;
11329 unsigned long iflags;
11335 "0602 Failed to allocate CQ_EVENT entry\n");
11345 &phba->
sli4_hba.sp_fcp_xri_aborted_work_queue);
11348 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11354 &phba->
sli4_hba.sp_els_xri_aborted_work_queue);
11357 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11362 "0603 Invalid work queue CQE subtype (x%x)\n",
11364 workposted =
false;
11382 bool workposted =
false;
11387 unsigned long iflags;
11394 rq_id =
bf_get(lpfc_rcqe_rq_id_v1, rcqe);
11396 rq_id =
bf_get(lpfc_rcqe_rq_id, rcqe);
11400 status =
bf_get(lpfc_rcqe_status, rcqe);
11404 "2537 Receive Frame Truncated!!\n");
11405 hrq->RQ_buf_trunc++;
11407 lpfc_sli4_rq_release(hrq, drq);
11409 dma_buf = lpfc_sli_hbqbuf_get(&phba->
hbqs[0].hbq_buffer_list);
11411 hrq->RQ_no_buf_found++;
11412 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11422 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11427 hrq->RQ_no_posted_buf++;
11431 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11455 bool workposted =
false;
11461 switch (
bf_get(lpfc_cqe_code, &cqevt)) {
11465 workposted = lpfc_sli4_sp_handle_els_wcqe(phba, cq,
11470 lpfc_sli4_sp_handle_rel_wcqe(phba,
11476 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq,
11483 workposted = lpfc_sli4_sp_handle_rcqe(phba,
11488 "0388 Not a valid WCQE code: x%x\n",
11489 bf_get(lpfc_cqe_code, &cqevt));
11514 bool workposted =
false;
11522 if (childq->queue_id == cqid) {
11530 "0365 Slow-path CQ identifier "
11531 "(%d) does not exist\n", cqid);
11536 switch (cq->
type) {
11538 while ((cqe = lpfc_sli4_cq_get(cq))) {
11539 workposted |= lpfc_sli4_sp_handle_mcqe(phba, cqe);
11546 while ((cqe = lpfc_sli4_cq_get(cq))) {
11548 workposted |= lpfc_sli4_fp_handle_wcqe(phba, cq,
11551 workposted |= lpfc_sli4_sp_handle_cqe(phba, cq,
11558 if (ecount > cq->CQ_max_cqe)
11559 cq->CQ_max_cqe = ecount;
11563 "0370 Invalid completion queue type (%d)\n",
11571 "0371 No entry from the CQ: identifier "
11598 unsigned long iflags;
11605 if (((
bf_get(lpfc_wcqe_c_status, wcqe) ==
11613 "0373 FCP complete error: status=x%x, "
11614 "hw_status=x%x, total_data_specified=%d, "
11615 "parameter=x%x, word3=x%x\n",
11616 bf_get(lpfc_wcqe_c_status, wcqe),
11617 bf_get(lpfc_wcqe_c_hw_status, wcqe),
11624 pring->
stats.iocb_event++;
11625 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring,
11626 bf_get(lpfc_wcqe_c_request_tag, wcqe));
11627 spin_unlock_irqrestore(&pring->
ring_lock, iflags);
11630 "0374 FCP complete with no corresponding "
11631 "cmdiocb: iotag (%d)\n",
11632 bf_get(lpfc_wcqe_c_request_tag, wcqe));
11637 "0375 FCP cmdiocb not callback function "
11639 bf_get(lpfc_wcqe_c_request_tag, wcqe));
11644 lpfc_sli4_iocb_param_transfer(phba, &irspiocbq, cmdiocbq, wcqe);
11649 spin_unlock_irqrestore(&phba->
hbalock, iflags);
11653 (cmdiocbq->
iocb_cmpl)(phba, cmdiocbq, &irspiocbq);
11670 bool wqid_matched =
false;
11674 fcp_wqid =
bf_get(lpfc_wcqe_r_wq_id, wcqe);
11676 if (childwq->
queue_id == fcp_wqid) {
11677 lpfc_sli4_wq_release(childwq,
11678 bf_get(lpfc_wcqe_r_wqe_index, wcqe));
11679 wqid_matched =
true;
11684 if (wqid_matched !=
true)
11686 "2580 Fast-path wqe consume event carries "
11687 "miss-matched qid: wcqe-qid=x%x\n", fcp_wqid);
11703 bool workposted =
false;
11709 switch (
bf_get(lpfc_wcqe_c_code, &wcqe)) {
11714 lpfc_sli4_fp_handle_fcp_wcqe(phba, cq,
11718 cq->CQ_release_wqe++;
11720 lpfc_sli4_fp_handle_rel_wcqe(phba, cq,
11724 cq->CQ_xri_aborted++;
11727 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq,
11732 "0144 Not a valid WCQE code: x%x\n",
11733 bf_get(lpfc_wcqe_c_code, &wcqe));
11757 bool workposted =
false;
11763 "0366 Not a valid completion "
11764 "event: majorcode=x%x, minorcode=x%x\n",
11775 lpfc_sli4_sp_handle_eqe(phba, eqe,
11782 "3146 Fast-path completion queues "
11783 "does not exist\n");
11790 "0367 Fast-path completion queue "
11791 "(%d) does not exist\n", qidx);
11797 "0368 Miss-matched fast-path completion "
11798 "queue identifier: eqcqid=%d, fcpcqid=%d\n",
11804 while ((cqe = lpfc_sli4_cq_get(cq))) {
11805 workposted |= lpfc_sli4_fp_handle_wcqe(phba, cq, cqe);
11811 if (ecount > cq->CQ_max_cqe)
11812 cq->CQ_max_cqe = ecount;
11817 "0369 No entry from fast-path completion "
11818 "queue fcpcqid=%d\n", cq->
queue_id);
11834 while ((eqe = lpfc_sli4_eq_get(eq)))
11874 unsigned long iflag;
11880 phba = fcp_eq_hdl->
phba;
11881 fcp_eqidx = fcp_eq_hdl->
idx;
11889 fpeq = phba->
sli4_hba.hba_eq[fcp_eqidx];
11895 lpfc_sli4_eq_clr_intr(fpeq);
11903 if (
unlikely(lpfc_intr_state_check(phba))) {
11904 fpeq->EQ_badstate++;
11909 lpfc_sli4_eq_flush(phba, fpeq);
11910 spin_unlock_irqrestore(&phba->
hbalock, iflag);
11919 while ((eqe = lpfc_sli4_eq_get(fpeq))) {
11920 lpfc_sli4_hba_handle_eqe(phba, eqe, fcp_eqidx);
11923 fpeq->EQ_processed++;
11927 if (ecount > fpeq->EQ_max_eqe)
11928 fpeq->EQ_max_eqe = ecount;
11934 fpeq->EQ_no_entry++;
11944 "0358 MSI-X interrupt with no EQE\n");
11977 bool hba_handled =
false;
11991 &phba->
sli4_hba.fcp_eq_hdl[fcp_eqidx]);
11993 hba_handled |=
true;
12015 while (!list_empty(&queue->
page_list)) {
12042 int x, total_qe_count;
12046 if (!phba->
sli4_hba.pc_sli4_params.supported)
12054 hw_page_size))/hw_page_size;
12055 INIT_LIST_HEAD(&queue->
list);
12058 for (x = 0, total_qe_count = 0; x < queue->
page_count; x++) {
12063 hw_page_size, &dmabuf->
phys,
12065 if (!dmabuf->
virt) {
12073 dma_pointer = dmabuf->
virt;
12074 for (; total_qe_count < entry_count &&
12075 dma_pointer < (hw_page_size + dmabuf->
virt);
12076 total_qe_count++, dma_pointer += entry_size) {
12077 queue->
qe[total_qe_count].
address = dma_pointer;
12091 queue->
phba = phba;
12122 uint32_t shdr_status, shdr_add_status;
12135 sizeof(struct lpfc_sli4_cfg_mhdr));
12139 eq_delay = &mbox->
u.
mqe.un.eq_delay;
12151 eq = phba->
sli4_hba.hba_eq[fcp_eqidx];
12169 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
12170 if (shdr_status || shdr_add_status || rc) {
12172 "2512 MODIFY_EQ_DELAY mailbox failed with "
12173 "status x%x add_status x%x, mbx status x%x\n",
12174 shdr_status, shdr_add_status, rc);
12208 uint32_t shdr_status, shdr_add_status;
12216 if (!phba->
sli4_hba.pc_sli4_params.supported)
12223 sizeof(struct lpfc_sli4_cfg_mhdr));
12227 eq_create = &mbox->
u.
mqe.un.eq_create;
12232 bf_set(lpfc_eq_context_valid, &eq_create->
u.
request.context, 1);
12238 bf_set(lpfc_eq_context_delay_multi, &eq_create->
u.
request.context,
12243 "0360 Unsupported EQ count. (%d)\n",
12282 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
12283 if (shdr_status || shdr_add_status || rc) {
12285 "2500 EQ_CREATE mailbox failed with "
12286 "status x%x add_status x%x, mbx status x%x\n",
12287 shdr_status, shdr_add_status, rc);
12331 uint32_t shdr_status, shdr_add_status;
12338 if (!phba->
sli4_hba.pc_sli4_params.supported)
12345 sizeof(struct lpfc_sli4_cfg_mhdr));
12349 cq_create = &mbox->
u.
mqe.un.cq_create;
12353 bf_set(lpfc_cq_context_event, &cq_create->
u.
request.context, 1);
12354 bf_set(lpfc_cq_context_valid, &cq_create->
u.
request.context, 1);
12356 phba->
sli4_hba.pc_sli4_params.cqv);
12369 "0361 Unsupported CQ count. (%d)\n",
12400 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
12401 if (shdr_status || shdr_add_status || rc) {
12403 "2501 CQ_CREATE mailbox failed with "
12404 "status x%x add_status x%x, mbx status x%x\n",
12405 shdr_status, shdr_add_status, rc);
12456 mq_create = &mbox->
u.
mqe.un.mq_create;
12461 bf_set(lpfc_mq_context_valid, &mq_create->
u.
request.context, 1);
12464 bf_set(lpfc_mq_context_ring_size, &mq_create->
u.
request.context,
12468 bf_set(lpfc_mq_context_ring_size, &mq_create->
u.
request.context,
12472 bf_set(lpfc_mq_context_ring_size, &mq_create->
u.
request.context,
12476 bf_set(lpfc_mq_context_ring_size, &mq_create->
u.
request.context,
12518 uint32_t shdr_status, shdr_add_status;
12525 if (!phba->
sli4_hba.pc_sli4_params.supported)
12532 sizeof(struct lpfc_sli4_cfg_mhdr));
12537 mq_create_ext = &mbox->
u.
mqe.un.mq_create_ext;
12539 bf_set(lpfc_mbx_mq_create_ext_num_pages,
12541 bf_set(lpfc_mbx_mq_create_ext_async_evt_link,
12543 bf_set(lpfc_mbx_mq_create_ext_async_evt_fip,
12545 bf_set(lpfc_mbx_mq_create_ext_async_evt_group5,
12547 bf_set(lpfc_mbx_mq_create_ext_async_evt_fc,
12549 bf_set(lpfc_mbx_mq_create_ext_async_evt_sli,
12551 bf_set(lpfc_mq_context_valid, &mq_create_ext->
u.
request.context, 1);
12553 phba->
sli4_hba.pc_sli4_params.mqv);
12558 bf_set(lpfc_mq_context_cq_id, &mq_create_ext->
u.
request.context,
12563 "0362 Unsupported MQ count. (%d)\n",
12571 bf_set(lpfc_mq_context_ring_size,
12572 &mq_create_ext->
u.
request.context,
12576 bf_set(lpfc_mq_context_ring_size,
12577 &mq_create_ext->
u.
request.context,
12581 bf_set(lpfc_mq_context_ring_size,
12582 &mq_create_ext->
u.
request.context,
12586 bf_set(lpfc_mq_context_ring_size,
12587 &mq_create_ext->
u.
request.context,
12603 "2795 MQ_CREATE_EXT failed with "
12604 "status x%x. Failback to MQ_CREATE.\n",
12606 lpfc_mq_create_fb_init(phba, mq, mbox, cq);
12607 mq_create = &mbox->
u.
mqe.un.mq_create;
12616 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
12617 if (shdr_status || shdr_add_status || rc) {
12619 "2502 MQ_CREATE mailbox failed with "
12620 "status x%x add_status x%x, mbx status x%x\n",
12621 shdr_status, shdr_add_status, rc);
12672 uint32_t shdr_status, shdr_add_status;
12675 struct dma_address *
page;
12680 if (!phba->
sli4_hba.pc_sli4_params.supported)
12687 sizeof(struct lpfc_sli4_cfg_mhdr));
12691 wq_create = &mbox->
u.
mqe.un.wq_create;
12698 phba->
sli4_hba.pc_sli4_params.wqv);
12705 bf_set(lpfc_mbx_wq_create_wqe_size,
12710 bf_set(lpfc_mbx_wq_create_wqe_size,
12729 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
12730 if (shdr_status || shdr_add_status || rc) {
12732 "2503 WQ_CREATE mailbox failed with "
12733 "status x%x add_status x%x, mbx status x%x\n",
12734 shdr_status, shdr_add_status, rc);
12816 uint32_t shdr_status, shdr_add_status;
12821 if (!hrq || !drq || !cq)
12823 if (!phba->
sli4_hba.pc_sli4_params.supported)
12832 sizeof(struct lpfc_sli4_cfg_mhdr));
12836 rq_create = &mbox->
u.
mqe.un.rq_create;
12839 phba->
sli4_hba.pc_sli4_params.rqv);
12841 bf_set(lpfc_rq_context_rqe_count_1,
12845 bf_set(lpfc_rq_context_rqe_size,
12848 bf_set(lpfc_rq_context_page_size,
12855 "2535 Unsupported RQ count. (%d)\n",
12863 bf_set(lpfc_rq_context_rqe_count,
12868 bf_set(lpfc_rq_context_rqe_count,
12873 bf_set(lpfc_rq_context_rqe_count,
12878 bf_set(lpfc_rq_context_rqe_count,
12900 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
12901 if (shdr_status || shdr_add_status || rc) {
12903 "2504 RQ_CREATE mailbox failed with "
12904 "status x%x add_status x%x, mbx status x%x\n",
12905 shdr_status, shdr_add_status, rc);
12925 phba->
sli4_hba.pc_sli4_params.rqv);
12927 bf_set(lpfc_rq_context_rqe_count_1,
12932 bf_set(lpfc_rq_context_page_size, &rq_create->
u.
request.context,
12938 "2536 Unsupported RQ count. (%d)\n",
12946 bf_set(lpfc_rq_context_rqe_count,
12951 bf_set(lpfc_rq_context_rqe_count,
12956 bf_set(lpfc_rq_context_rqe_count,
12961 bf_set(lpfc_rq_context_rqe_count,
12983 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
12984 if (shdr_status || shdr_add_status || rc) {
13025 uint32_t shdr_status, shdr_add_status;
13035 sizeof(struct lpfc_sli4_cfg_mhdr));
13039 bf_set(lpfc_mbx_eq_destroy_q_id, &mbox->
u.
mqe.un.eq_destroy.u.request,
13047 &mbox->
u.
mqe.un.eq_destroy.header.cfg_shdr;
13049 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13050 if (shdr_status || shdr_add_status || rc) {
13052 "2505 EQ_DESTROY mailbox failed with "
13053 "status x%x add_status x%x, mbx status x%x\n",
13054 shdr_status, shdr_add_status, rc);
13059 list_del_init(&eq->
list);
13081 uint32_t shdr_status, shdr_add_status;
13091 sizeof(struct lpfc_sli4_cfg_mhdr));
13095 bf_set(lpfc_mbx_cq_destroy_q_id, &mbox->
u.
mqe.un.cq_destroy.u.request,
13102 &mbox->
u.
mqe.un.wq_create.header.cfg_shdr;
13104 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13105 if (shdr_status || shdr_add_status || rc) {
13107 "2506 CQ_DESTROY mailbox failed with "
13108 "status x%x add_status x%x, mbx status x%x\n",
13109 shdr_status, shdr_add_status, rc);
13113 list_del_init(&cq->
list);
13135 uint32_t shdr_status, shdr_add_status;
13145 sizeof(struct lpfc_sli4_cfg_mhdr));
13149 bf_set(lpfc_mbx_mq_destroy_q_id, &mbox->
u.
mqe.un.mq_destroy.u.request,
13156 &mbox->
u.
mqe.un.mq_destroy.header.cfg_shdr;
13158 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13159 if (shdr_status || shdr_add_status || rc) {
13161 "2507 MQ_DESTROY mailbox failed with "
13162 "status x%x add_status x%x, mbx status x%x\n",
13163 shdr_status, shdr_add_status, rc);
13167 list_del_init(&mq->
list);
13189 uint32_t shdr_status, shdr_add_status;
13199 sizeof(struct lpfc_sli4_cfg_mhdr));
13203 bf_set(lpfc_mbx_wq_destroy_q_id, &mbox->
u.
mqe.un.wq_destroy.u.request,
13209 &mbox->
u.
mqe.un.wq_destroy.header.cfg_shdr;
13211 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13212 if (shdr_status || shdr_add_status || rc) {
13214 "2508 WQ_DESTROY mailbox failed with "
13215 "status x%x add_status x%x, mbx status x%x\n",
13216 shdr_status, shdr_add_status, rc);
13220 list_del_init(&wq->
list);
13243 uint32_t shdr_status, shdr_add_status;
13253 sizeof(struct lpfc_sli4_cfg_mhdr));
13257 bf_set(lpfc_mbx_rq_destroy_q_id, &mbox->
u.
mqe.un.rq_destroy.u.request,
13264 &mbox->
u.
mqe.un.rq_destroy.header.cfg_shdr;
13266 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13267 if (shdr_status || shdr_add_status || rc) {
13269 "2509 RQ_DESTROY mailbox failed with "
13270 "status x%x add_status x%x, mbx status x%x\n",
13271 shdr_status, shdr_add_status, rc);
13276 bf_set(lpfc_mbx_rq_destroy_q_id, &mbox->
u.
mqe.un.rq_destroy.u.request,
13280 &mbox->
u.
mqe.un.rq_destroy.header.cfg_shdr;
13282 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13283 if (shdr_status || shdr_add_status || rc) {
13285 "2510 RQ_DESTROY mailbox failed with "
13286 "status x%x add_status x%x, mbx status x%x\n",
13287 shdr_status, shdr_add_status, rc);
13290 list_del_init(&hrq->
list);
13291 list_del_init(&drq->
list);
13327 uint32_t shdr_status, shdr_add_status;
13333 "0364 Invalid param:\n");
13347 &mbox->
u.
mqe.un.post_sgl_pages;
13348 bf_set(lpfc_post_sgl_pages_xri, post_sgl_pages, xritag);
13349 bf_set(lpfc_post_sgl_pages_xricnt, post_sgl_pages, 1);
13369 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13372 if (shdr_status || shdr_add_status || rc) {
13374 "2511 POST_SGL mailbox failed with "
13375 "status x%x add_status x%x, mbx status x%x\n",
13376 shdr_status, shdr_add_status, rc);
13404 spin_lock_irq(&phba->
hbalock);
13406 phba->
sli4_hba.max_cfg_param.max_xri, 0);
13407 if (xri >= phba->
sli4_hba.max_cfg_param.max_xri) {
13408 spin_unlock_irq(&phba->
hbalock);
13412 phba->
sli4_hba.max_cfg_param.xri_used++;
13414 spin_unlock_irq(&phba->
hbalock);
13429 phba->
sli4_hba.max_cfg_param.xri_used--;
13443 spin_lock_irq(&phba->
hbalock);
13445 spin_unlock_irq(&phba->
hbalock);
13464 if (xri_index ==
NO_XRI)
13466 "2004 Failed to allocate XRI.last XRITAG is %d"
13467 " Max XRI is %d, Used XRI is %d\n",
13469 phba->
sli4_hba.max_cfg_param.max_xri,
13470 phba->
sli4_hba.max_cfg_param.xri_used);
13486 lpfc_sli4_post_els_sgl_list(
struct lpfc_hba *phba,
13495 uint32_t reqlen, alloclen, pg_pairs;
13499 uint32_t shdr_status, shdr_add_status;
13506 "2559 Block sgl registration required DMA "
13507 "size (%d) great than a page\n", reqlen);
13519 if (alloclen < reqlen) {
13521 "0285 Allocated DMA memory size (%d) is "
13522 "less than the requested DMA memory "
13523 "size (%d)\n", alloclen, reqlen);
13552 bf_set(lpfc_post_sgl_pages_xri, sgl, xritag_start);
13553 bf_set(lpfc_post_sgl_pages_xricnt, sgl, phba->
sli4_hba.els_xri_cnt);
13563 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13566 if (shdr_status || shdr_add_status || rc) {
13568 "2513 POST_SGL_BLOCK mailbox command failed "
13569 "status x%x add_status x%x mbx status x%x\n",
13570 shdr_status, shdr_add_status, rc);
13597 uint32_t reqlen, alloclen, pg_pairs;
13601 uint32_t shdr_status, shdr_add_status;
13607 sizeof(union lpfc_sli4_cfg_shdr) + sizeof(uint32_t);
13610 "0217 Block sgl registration required DMA "
13611 "size (%d) great than a page\n", reqlen);
13617 "0283 Failed to allocate mbox cmd memory\n");
13626 if (alloclen < reqlen) {
13628 "2561 Allocated DMA memory size (%d) is "
13629 "less than the requested DMA memory "
13630 "size (%d)\n", alloclen, reqlen);
13652 pdma_phys_bpl1 = 0;
13659 xritag_start = psb->
cur_iocbq.sli4_xritag;
13663 bf_set(lpfc_post_sgl_pages_xri, sgl, xritag_start);
13664 bf_set(lpfc_post_sgl_pages_xricnt, sgl, pg_pairs);
13674 shdr = (
union lpfc_sli4_cfg_shdr *) &sgl->
cfg_shdr;
13676 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
13679 if (shdr_status || shdr_add_status || rc) {
13681 "2564 POST_SGL_BLOCK mailbox command failed "
13682 "status x%x add_status x%x mbx status x%x\n",
13683 shdr_status, shdr_add_status, rc);
13740 return lpfc_fc_frame_check(phba, fc_hdr);
13757 "2538 Received frame rctl:%s type:%s "
13758 "Frame Data:%08x %08x %08x %08x %08x %08x\n",
13767 "2539 Dropped frame rctl:%s type:%s\n",
13769 type_names[fc_hdr->
fh_type]);
13788 return bf_get(fc_vft_hdr_vf_id, fc_vft_hdr);
13815 return phba->
pport;
13818 return phba->
pport;
13821 if (vports !=
NULL)
13822 for (i = 0; i <= phba->
max_vpi && vports[
i] !=
NULL; i++) {
13823 if (phba->
fcf.fcfi == fcfi &&
13824 vports[i]->
vfi == lpfc_fc_hdr_get_vfi(fc_hdr) &&
13877 list_del_init(&dmabuf->
hbuf.list);
13880 list_del_init(&d_buf->
list);
13905 unsigned long timeout;
13906 int abort_count = 0;
13921 list_del_init(&dmabuf->
hbuf.list);
13924 list_del_init(&d_buf->
list);
13955 INIT_LIST_HEAD(&dmabuf->
dbuf.list);
13978 temp_hdr = seq_dmabuf->
hbuf.virt;
13981 list_del_init(&seq_dmabuf->
hbuf.list);
13991 if (list_empty(&seq_dmabuf->
dbuf.list)) {
13992 temp_hdr = dmabuf->
hbuf.virt;
14006 list_add(&dmabuf->
dbuf.list, &temp_dmabuf->
dbuf.list);
14030 lpfc_sli4_abort_partial_seq(
struct lpfc_vport *vport,
14039 INIT_LIST_HEAD(&dmabuf->
dbuf.list);
14040 INIT_LIST_HEAD(&dmabuf->
hbuf.list);
14057 list_del_init(&d_buf->
list);
14076 lpfc_sli4_seq_abort_rsp_cmpl(
struct lpfc_hba *phba,
14086 "3154 BLS ABORT RSP failed, data: x%x/x%x\n",
14105 for (i = 0; i < phba->
sli4_hba.max_cfg_param.max_xri; i++) {
14106 if (xri == phba->
sli4_hba.xri_ids[i])
14121 lpfc_sli4_seq_abort_rsp(
struct lpfc_hba *phba,
14131 if (!lpfc_is_link_up(phba))
14141 "1268 Find ndlp returned NULL for oxid:x%x "
14142 "SID:x%x\n", oxid, sid);
14154 icmd = &ctiocb->
iocb;
14171 ctiocb->
iocb_cmpl = lpfc_sli4_seq_abort_rsp_cmpl;
14185 (xri == oxid) ? rxid : oxid, 0);
14190 if (xri > (phba->
sli4_hba.max_cfg_param.max_xri +
14191 phba->
sli4_hba.max_cfg_param.xri_base) ||
14193 phba->
sli4_hba.max_cfg_param.xri_base)) {
14200 if (fctl & FC_FC_EX_CTX) {
14218 "1200 Send BLS cmd x%x on oxid x%x Data: x%x\n",
14224 "2925 Failed to issue CT ABTS RSP x%x on "
14225 "xri x%x, Data x%x\n",
14258 if (fctl & FC_FC_EX_CTX) {
14268 abts_par = lpfc_sli4_abort_partial_seq(vport, dmabuf);
14271 if (abts_par ==
false)
14272 lpfc_sli4_send_seq_to_ulp(vport, dmabuf);
14277 lpfc_sli4_seq_abort_rsp(phba, &fc_hdr);
14293 lpfc_seq_complete(
struct hbq_dmabuf *dmabuf)
14321 if (fctl & FC_FC_END_SEQ)
14353 list_del_init(&seq_dmabuf->
hbuf.list);
14378 vport->
phba->vpi_ids[vport->
vpi];
14386 tot_len =
bf_get(lpfc_rcqe_length,
14387 &seq_dmabuf->
cq_event.cqe.rcqe_cmpl);
14390 iocbq = first_iocbq;
14409 len =
bf_get(lpfc_rcqe_length,
14410 &hbq_buf->
cq_event.cqe.rcqe_cmpl);
14433 len =
bf_get(lpfc_rcqe_length,
14434 &hbq_buf->
cq_event.cqe.rcqe_cmpl);
14442 return first_iocbq;
14446 lpfc_sli4_send_seq_to_ulp(
struct lpfc_vport *vport,
14450 struct lpfc_iocbq *iocbq, *curr_iocb, *next_iocb;
14454 iocbq = lpfc_prep_seq(vport, seq_dmabuf);
14457 "2707 Ring %d handler: Failed to allocate "
14458 "iocb Rctl x%x Type x%x received\n",
14463 if (!lpfc_complete_unsol_iocb(phba,
14468 "2540 Ring %d handler: unexpected Rctl "
14469 "x%x Type x%x received\n",
14476 list_del_init(&curr_iocb->
list);
14507 if (lpfc_fc_frame_check(phba, fc_hdr)) {
14511 if ((
bf_get(lpfc_cqe_code,
14513 fcfi =
bf_get(lpfc_rcqe_fcf_id_v1,
14516 fcfi =
bf_get(lpfc_rcqe_fcf_id,
14519 vport = lpfc_fc_frame_to_vport(phba, fc_hdr, fcfi);
14551 seq_dmabuf = lpfc_fc_frame_add(vport, dmabuf);
14558 if (!lpfc_seq_complete(seq_dmabuf))
14562 lpfc_sli4_send_seq_to_ulp(vport, seq_dmabuf);
14594 if (!phba->
sli4_hba.rpi_hdrs_in_use)
14596 if (phba->
sli4_hba.extents_in_use)
14612 "2008 Error %d posting all rpi "
14645 uint32_t shdr_status, shdr_add_status;
14649 if (!phba->
sli4_hba.rpi_hdrs_in_use)
14651 if (phba->
sli4_hba.extents_in_use)
14658 "2001 Unable to allocate memory for issuing "
14659 "SLI_CONFIG_SPECIAL mailbox command\n");
14664 hdr_tmpl = &mboxq->
u.
mqe.un.hdr_tmpl;
14673 bf_set(lpfc_mbx_post_hdr_tmpl_rpi_offset, hdr_tmpl,
14675 bf_set(lpfc_mbx_post_hdr_tmpl_page_cnt,
14683 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
14686 if (shdr_status || shdr_add_status || rc) {
14688 "2514 POST_RPI_HDR mailbox failed with "
14689 "status x%x add_status x%x, mbx status x%x\n",
14690 shdr_status, shdr_add_status, rc);
14717 max_rpi = phba->
sli4_hba.max_cfg_param.max_rpi;
14718 rpi_limit = phba->
sli4_hba.next_rpi;
14724 spin_lock_irq(&phba->
hbalock);
14726 if (rpi >= rpi_limit)
14730 phba->
sli4_hba.max_cfg_param.rpi_used++;
14739 (phba->
sli4_hba.rpi_count >= max_rpi)) {
14740 spin_unlock_irq(&phba->
hbalock);
14748 if (!phba->
sli4_hba.rpi_hdrs_in_use) {
14749 spin_unlock_irq(&phba->
hbalock);
14760 spin_unlock_irq(&phba->
hbalock);
14765 "2002 Error Could not grow rpi "
14789 phba->
sli4_hba.max_cfg_param.rpi_used--;
14803 spin_lock_irq(&phba->
hbalock);
14805 spin_unlock_irq(&phba->
hbalock);
14855 "2010 Resume RPI Mailbox failed "
14856 "status %d, mbxStatus x%x\n", rc,
14890 "2022 INIT VPI Mailbox failed "
14891 "status %d, mbxStatus x%x\n", rc,
14915 uint32_t shdr_status, shdr_add_status;
14921 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
14923 if ((shdr_status || shdr_add_status) &&
14926 "2558 ADD_FCF_RECORD mailbox failed with "
14927 "status x%x add_status x%x\n",
14928 shdr_status, shdr_add_status);
14957 "2009 Failed to allocate mbox for ADD_FCF cmd\n");
14961 req_len =
sizeof(
struct fcf_record) + sizeof(union lpfc_sli4_cfg_shdr) +
14968 if (alloc_len < req_len) {
14970 "2523 Allocated DMA memory size (x%x) is "
14971 "less than the requested DMA memory "
14972 "size (x%x)\n", alloc_len, req_len);
14988 fcfindex =
bf_get(lpfc_fcf_record_fcf_index, fcf_record);
14989 bytep = virt_addr +
sizeof(
union lpfc_sli4_cfg_shdr);
15000 mboxq->
mbox_cmpl = lpfc_mbx_cmpl_add_fcf_record;
15004 "2515 ADD_FCF_RECORD mailbox failed with "
15005 "status 0x%x\n", rc);
15029 memset(fcf_record, 0,
sizeof(
struct fcf_record));
15033 bf_set(lpfc_fcf_record_mac_0, fcf_record, phba->
fc_map[0]);
15034 bf_set(lpfc_fcf_record_mac_1, fcf_record, phba->
fc_map[1]);
15035 bf_set(lpfc_fcf_record_mac_2, fcf_record, phba->
fc_map[2]);
15039 bf_set(lpfc_fcf_record_fc_map_0, fcf_record, phba->
fc_map[0]);
15040 bf_set(lpfc_fcf_record_fc_map_1, fcf_record, phba->
fc_map[1]);
15041 bf_set(lpfc_fcf_record_fc_map_2, fcf_record, phba->
fc_map[2]);
15042 bf_set(lpfc_fcf_record_fcf_valid, fcf_record, 1);
15043 bf_set(lpfc_fcf_record_fcf_avail, fcf_record, 1);
15044 bf_set(lpfc_fcf_record_fcf_index, fcf_record, fcf_index);
15045 bf_set(lpfc_fcf_record_mac_addr_prov, fcf_record,
15077 "2000 Failed to allocate mbox for "
15080 goto fail_fcf_scan;
15086 goto fail_fcf_scan;
15092 spin_lock_irq(&phba->
hbalock);
15094 spin_unlock_irq(&phba->
hbalock);
15102 phba->
fcf.eligible_fcf_cnt = 0;
15110 spin_lock_irq(&phba->
hbalock);
15112 spin_unlock_irq(&phba->
hbalock);
15137 "2763 Failed to allocate mbox for "
15140 goto fail_fcf_read;
15146 goto fail_fcf_read;
15158 if (
error && mboxq)
15183 "2758 Failed to allocate mbox for "
15186 goto fail_fcf_read;
15192 goto fail_fcf_read;
15204 if (
error && mboxq)
15234 "3060 Last IDX %d\n", last_index);
15235 if (list_empty(&phba->
fcf.fcf_pri_list)) {
15237 "3061 Last IDX %d\n", last_index);
15246 sizeof(*phba->
fcf.fcf_rr_bmask));
15247 spin_lock_irq(&phba->
hbalock);
15256 next_fcf_pri = fcf_pri->
fcf_rec.priority;
15257 spin_unlock_irq(&phba->
hbalock);
15258 if (fcf_pri->
fcf_rec.priority == next_fcf_pri) {
15264 spin_lock_irq(&phba->
hbalock);
15271 if (!next_fcf_pri && !list_empty(&phba->
fcf.fcf_pri_list)) {
15279 next_fcf_pri = fcf_pri->
fcf_rec.priority;
15280 spin_unlock_irq(&phba->
hbalock);
15281 if (fcf_pri->
fcf_rec.priority == next_fcf_pri) {
15287 spin_lock_irq(&phba->
hbalock);
15291 spin_unlock_irq(&phba->
hbalock);
15312 next_fcf_index = (phba->
fcf.current_rec.fcf_indx + 1) %
15332 next_fcf_index == phba->
fcf.current_rec.fcf_indx) {
15340 goto next_priority;
15342 "2844 No roundrobin failover FCF available\n");
15347 "3063 Only FCF available idx %d, flag %x\n",
15349 phba->
fcf.fcf_pri[next_fcf_index].fcf_rec.flag);
15350 return next_fcf_index;
15355 phba->
fcf.fcf_pri[next_fcf_index].fcf_rec.flag &
15357 goto next_priority;
15360 "2845 Get next roundrobin failover FCF (x%x)\n",
15363 return next_fcf_index;
15383 "2610 FCF (x%x) reached driver's book "
15384 "keeping dimension:x%x\n",
15392 "2790 Set FCF (x%x) to roundrobin FCF failover "
15393 "bmask\n", fcf_index);
15413 "2762 FCF (x%x) reached driver's book "
15414 "keeping dimension:x%x\n",
15419 spin_lock_irq(&phba->
hbalock);
15421 if (fcf_pri->
fcf_rec.fcf_index == fcf_index) {
15422 list_del_init(&fcf_pri->
list);
15426 spin_unlock_irq(&phba->
hbalock);
15430 "2791 Clear FCF (x%x) from roundrobin failover "
15431 "bmask\n", fcf_index);
15446 uint32_t shdr_status, shdr_add_status;
15448 redisc_fcf = &mbox->
u.
mqe.un.redisc_fcf_tbl;
15450 shdr_status =
bf_get(lpfc_mbox_hdr_status,
15451 &redisc_fcf->
header.cfg_shdr.response);
15452 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status,
15453 &redisc_fcf->
header.cfg_shdr.response);
15454 if (shdr_status || shdr_add_status) {
15456 "2746 Requesting for FCF rediscovery failed "
15457 "status x%x add_status x%x\n",
15458 shdr_status, shdr_add_status);
15460 spin_lock_irq(&phba->
hbalock);
15462 spin_unlock_irq(&phba->
hbalock);
15469 spin_lock_irq(&phba->
hbalock);
15471 spin_unlock_irq(&phba->
hbalock);
15481 "2775 Start FCF rediscover quiescent timer\n");
15512 "2745 Failed to allocate mbox for "
15513 "requesting FCF rediscover.\n");
15518 sizeof(struct lpfc_sli4_cfg_mhdr));
15523 redisc_fcf = &mbox->
u.
mqe.un.redisc_fcf_tbl;
15525 bf_set(lpfc_mbx_redisc_fcf_count, redisc_fcf, 0);
15574 lpfc_sli_get_config_region23(
struct lpfc_hba *phba,
char *rgn23_data)
15587 "2600 failed to allocate mailbox memory\n");
15598 "2601 failed to read config "
15599 "region 23, rc 0x%x Status 0x%x\n",
15613 rgn23_data + offset,
15632 lpfc_sli4_get_config_region23(
struct lpfc_hba *phba,
char *rgn23_data)
15646 "3105 failed to allocate mailbox memory\n");
15652 mqe = &mboxq->
u.
mqe;
15658 if (data_length == 0)
15695 data_size = lpfc_sli_get_config_region23(phba, rgn23_data);
15697 if_type =
bf_get(lpfc_sli_intf_if_type,
15701 data_size = lpfc_sli4_get_config_region23(phba, rgn23_data);
15710 "2619 Config region 23 has bad signature\n");
15718 "2620 Config region 23 has bad version\n");
15724 while (offset < data_size) {
15733 (rgn23_data[offset + 3] != 0)) {
15734 offset += rgn23_data[offset + 1] * 4 + 4;
15739 sub_tlv_len = rgn23_data[offset + 1] * 4;
15746 while ((offset < data_size) &&
15747 (tlv_offset < sub_tlv_len)) {
15754 offset += rgn23_data[offset + 1] * 4 + 4;
15755 tlv_offset += rgn23_data[offset + 1] * 4 + 4;
15760 if (!rgn23_data[offset + 2])
15798 uint32_t shdr_status, shdr_add_status;
15814 wr_object->
u.
request.write_offset = *offset;
15816 wr_object->
u.
request.object_name[0] =
15826 wr_object->
u.
request.bde[
i].tus.f.bdeSize =
15828 written += (size - written);
15831 wr_object->
u.
request.bde[
i].tus.f.bdeSize =
15838 bf_set(lpfc_wr_object_write_length, &wr_object->
u.
request, written);
15848 shdr_add_status =
bf_get(lpfc_mbox_hdr_add_status, &shdr->
response);
15851 if (shdr_status || shdr_add_status || rc) {
15853 "3025 Write Object mailbox failed with "
15854 "status x%x add_status x%x, mbx status x%x\n",
15855 shdr_status, shdr_add_status, rc);
15858 *offset += wr_object->
u.
response.actual_write_length;
15879 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
15884 spin_lock_irq(&phba->
hbalock);
15886 if (mb->
vport != vport)
15897 mb = phba->
sli.mbox_active;
15898 if (mb && (mb->
vport == vport)) {
15918 if ((mb->
vport != vport) ||
15932 spin_unlock_irq(&phba->
hbalock);
15936 spin_lock_irq(&phba->
hbalock);
15940 }
while (restart_loop);
15942 spin_unlock_irq(&phba->
hbalock);
15945 while (!list_empty(&mbox_cmd_list)) {
15966 if (act_mbx_ndlp) {
15991 unsigned long iflags = 0;
15992 char *fail_msg =
NULL;
16000 spin_unlock_irqrestore(&phba->
hbalock, iflags);
16007 spin_unlock_irqrestore(&phba->
hbalock, iflags);
16009 "2823 txq empty and txq_cnt is %d\n ",
16013 sglq = __lpfc_sli_get_sglq(phba, piocbq);
16016 spin_unlock_irqrestore(&phba->
hbalock, iflags);
16025 if (
NO_XRI == lpfc_sli4_bpl2sgl(phba, piocbq, sglq))
16026 fail_msg =
"to convert bpl to sgl";
16027 else if (lpfc_sli4_iocb2wqe(phba, piocbq, &wqe))
16028 fail_msg =
"to convert iocb to wqe";
16029 else if (lpfc_sli4_wq_put(phba->
sli4_hba.els_wq, &wqe))
16030 fail_msg =
" - Wq is full";
16032 lpfc_sli_ringtxcmpl_put(phba, pring, piocbq);
16037 "2822 IOCB failed %s iotag 0x%x "
16043 spin_unlock_irqrestore(&phba->
hbalock, iflags);