diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 423 |
1 files changed, 223 insertions, 200 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index f4d5a6b00fde..ce5ff2bccba6 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -49,9 +49,8 @@ | |||
49 | lpfc_printf_log(phba, \ | 49 | lpfc_printf_log(phba, \ |
50 | KERN_INFO, \ | 50 | KERN_INFO, \ |
51 | LOG_MBOX | LOG_SLI, \ | 51 | LOG_MBOX | LOG_SLI, \ |
52 | "%d (%d):0311 Mailbox command x%x cannot " \ | 52 | "(%d):0311 Mailbox command x%x cannot " \ |
53 | "issue Data: x%x x%x x%x\n", \ | 53 | "issue Data: x%x x%x x%x\n", \ |
54 | phba->brd_no, \ | ||
55 | pmbox->vport ? pmbox->vport->vpi : 0, \ | 54 | pmbox->vport ? pmbox->vport->vpi : 0, \ |
56 | pmbox->mb.mbxCommand, \ | 55 | pmbox->mb.mbxCommand, \ |
57 | phba->pport->port_state, \ | 56 | phba->pport->port_state, \ |
@@ -231,13 +230,11 @@ lpfc_sli_ring_map(struct lpfc_hba *phba) | |||
231 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 230 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
232 | if (rc != MBX_SUCCESS) { | 231 | if (rc != MBX_SUCCESS) { |
233 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 232 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
234 | "%d:0446 Adapter failed to init (%d), " | 233 | "0446 Adapter failed to init (%d), " |
235 | "mbxCmd x%x CFG_RING, mbxStatus x%x, " | 234 | "mbxCmd x%x CFG_RING, mbxStatus x%x, " |
236 | "ring %d\n", | 235 | "ring %d\n", |
237 | phba->brd_no, rc, | 236 | rc, pmbox->mbxCommand, |
238 | pmbox->mbxCommand, | 237 | pmbox->mbxStatus, i); |
239 | pmbox->mbxStatus, | ||
240 | i); | ||
241 | phba->link_state = LPFC_HBA_ERROR; | 238 | phba->link_state = LPFC_HBA_ERROR; |
242 | ret = -ENXIO; | 239 | ret = -ENXIO; |
243 | break; | 240 | break; |
@@ -296,9 +293,9 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
296 | 293 | ||
297 | if (unlikely(pring->local_getidx >= max_cmd_idx)) { | 294 | if (unlikely(pring->local_getidx >= max_cmd_idx)) { |
298 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 295 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
299 | "%d:0315 Ring %d issue: portCmdGet %d " | 296 | "0315 Ring %d issue: portCmdGet %d " |
300 | "is bigger then cmd ring %d\n", | 297 | "is bigger then cmd ring %d\n", |
301 | phba->brd_no, pring->ringno, | 298 | pring->ringno, |
302 | pring->local_getidx, max_cmd_idx); | 299 | pring->local_getidx, max_cmd_idx); |
303 | 300 | ||
304 | phba->link_state = LPFC_HBA_ERROR; | 301 | phba->link_state = LPFC_HBA_ERROR; |
@@ -366,7 +363,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
366 | if (psli->iocbq_lookup) | 363 | if (psli->iocbq_lookup) |
367 | memcpy(new_arr, old_arr, | 364 | memcpy(new_arr, old_arr, |
368 | ((psli->last_iotag + 1) * | 365 | ((psli->last_iotag + 1) * |
369 | sizeof (struct lpfc_iocbq *))); | 366 | sizeof (struct lpfc_iocbq *))); |
370 | psli->iocbq_lookup = new_arr; | 367 | psli->iocbq_lookup = new_arr; |
371 | psli->iocbq_lookup_len = new_len; | 368 | psli->iocbq_lookup_len = new_len; |
372 | psli->last_iotag = iotag; | 369 | psli->last_iotag = iotag; |
@@ -380,8 +377,8 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
380 | spin_unlock_irq(&phba->hbalock); | 377 | spin_unlock_irq(&phba->hbalock); |
381 | 378 | ||
382 | lpfc_printf_log(phba, KERN_ERR,LOG_SLI, | 379 | lpfc_printf_log(phba, KERN_ERR,LOG_SLI, |
383 | "%d:0318 Failed to allocate IOTAG.last IOTAG is %d\n", | 380 | "0318 Failed to allocate IOTAG.last IOTAG is %d\n", |
384 | phba->brd_no, psli->last_iotag); | 381 | psli->last_iotag); |
385 | 382 | ||
386 | return 0; | 383 | return 0; |
387 | } | 384 | } |
@@ -395,6 +392,14 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
395 | */ | 392 | */ |
396 | nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0; | 393 | nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0; |
397 | 394 | ||
395 | if (pring->ringno == LPFC_ELS_RING) { | ||
396 | lpfc_debugfs_slow_ring_trc(phba, | ||
397 | "IOCB cmd ring: wd4:x%08x wd6:x%08x wd7:x%08x", | ||
398 | *(((uint32_t *) &nextiocb->iocb) + 4), | ||
399 | *(((uint32_t *) &nextiocb->iocb) + 6), | ||
400 | *(((uint32_t *) &nextiocb->iocb) + 7)); | ||
401 | } | ||
402 | |||
398 | /* | 403 | /* |
399 | * Issue iocb command to adapter | 404 | * Issue iocb command to adapter |
400 | */ | 405 | */ |
@@ -527,10 +532,9 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) | |||
527 | if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) { | 532 | if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) { |
528 | lpfc_printf_log(phba, KERN_ERR, | 533 | lpfc_printf_log(phba, KERN_ERR, |
529 | LOG_SLI | LOG_VPORT, | 534 | LOG_SLI | LOG_VPORT, |
530 | "%d:1802 HBQ %d: local_hbqGetIdx " | 535 | "1802 HBQ %d: local_hbqGetIdx " |
531 | "%u is > than hbqp->entry_count %u\n", | 536 | "%u is > than hbqp->entry_count %u\n", |
532 | phba->brd_no, hbqno, | 537 | hbqno, hbqp->local_hbqGetIdx, |
533 | hbqp->local_hbqGetIdx, | ||
534 | hbqp->entry_count); | 538 | hbqp->entry_count); |
535 | 539 | ||
536 | phba->link_state = LPFC_HBA_ERROR; | 540 | phba->link_state = LPFC_HBA_ERROR; |
@@ -541,7 +545,8 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) | |||
541 | return NULL; | 545 | return NULL; |
542 | } | 546 | } |
543 | 547 | ||
544 | return (struct lpfc_hbq_entry *) phba->hbqslimp.virt + hbqp->hbqPutIdx; | 548 | return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt + |
549 | hbqp->hbqPutIdx; | ||
545 | } | 550 | } |
546 | 551 | ||
547 | void | 552 | void |
@@ -549,18 +554,21 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba) | |||
549 | { | 554 | { |
550 | struct lpfc_dmabuf *dmabuf, *next_dmabuf; | 555 | struct lpfc_dmabuf *dmabuf, *next_dmabuf; |
551 | struct hbq_dmabuf *hbq_buf; | 556 | struct hbq_dmabuf *hbq_buf; |
557 | int i, hbq_count; | ||
552 | 558 | ||
559 | hbq_count = lpfc_sli_hbq_count(); | ||
553 | /* Return all memory used by all HBQs */ | 560 | /* Return all memory used by all HBQs */ |
554 | list_for_each_entry_safe(dmabuf, next_dmabuf, | 561 | for (i = 0; i < hbq_count; ++i) { |
555 | &phba->hbq_buffer_list, list) { | 562 | list_for_each_entry_safe(dmabuf, next_dmabuf, |
556 | hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf); | 563 | &phba->hbqs[i].hbq_buffer_list, list) { |
557 | list_del(&hbq_buf->dbuf.list); | 564 | hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf); |
558 | lpfc_hbq_free(phba, hbq_buf->dbuf.virt, hbq_buf->dbuf.phys); | 565 | list_del(&hbq_buf->dbuf.list); |
559 | kfree(hbq_buf); | 566 | (phba->hbqs[i].hbq_free_buffer)(phba, hbq_buf); |
567 | } | ||
560 | } | 568 | } |
561 | } | 569 | } |
562 | 570 | ||
563 | static void | 571 | static struct lpfc_hbq_entry * |
564 | lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, | 572 | lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, |
565 | struct hbq_dmabuf *hbq_buf) | 573 | struct hbq_dmabuf *hbq_buf) |
566 | { | 574 | { |
@@ -574,7 +582,7 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, | |||
574 | 582 | ||
575 | hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr)); | 583 | hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr)); |
576 | hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr)); | 584 | hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr)); |
577 | hbqe->bde.tus.f.bdeSize = FCELSSIZE; | 585 | hbqe->bde.tus.f.bdeSize = hbq_buf->size; |
578 | hbqe->bde.tus.f.bdeFlags = 0; | 586 | hbqe->bde.tus.f.bdeFlags = 0; |
579 | hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w); | 587 | hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w); |
580 | hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag); | 588 | hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag); |
@@ -583,8 +591,9 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, | |||
583 | writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); | 591 | writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); |
584 | /* flush */ | 592 | /* flush */ |
585 | readl(phba->hbq_put + hbqno); | 593 | readl(phba->hbq_put + hbqno); |
586 | list_add_tail(&hbq_buf->dbuf.list, &phba->hbq_buffer_list); | 594 | list_add_tail(&hbq_buf->dbuf.list, &hbqp->hbq_buffer_list); |
587 | } | 595 | } |
596 | return hbqe; | ||
588 | } | 597 | } |
589 | 598 | ||
590 | static struct lpfc_hbq_init lpfc_els_hbq = { | 599 | static struct lpfc_hbq_init lpfc_els_hbq = { |
@@ -592,22 +601,38 @@ static struct lpfc_hbq_init lpfc_els_hbq = { | |||
592 | .entry_count = 200, | 601 | .entry_count = 200, |
593 | .mask_count = 0, | 602 | .mask_count = 0, |
594 | .profile = 0, | 603 | .profile = 0, |
595 | .ring_mask = 1 << LPFC_ELS_RING, | 604 | .ring_mask = (1 << LPFC_ELS_RING), |
596 | .buffer_count = 0, | 605 | .buffer_count = 0, |
597 | .init_count = 20, | 606 | .init_count = 20, |
598 | .add_count = 5, | 607 | .add_count = 5, |
599 | }; | 608 | }; |
600 | 609 | ||
601 | static struct lpfc_hbq_init *lpfc_hbq_defs[] = { | 610 | static struct lpfc_hbq_init lpfc_extra_hbq = { |
611 | .rn = 1, | ||
612 | .entry_count = 200, | ||
613 | .mask_count = 0, | ||
614 | .profile = 0, | ||
615 | .ring_mask = (1 << LPFC_EXTRA_RING), | ||
616 | .buffer_count = 0, | ||
617 | .init_count = 0, | ||
618 | .add_count = 5, | ||
619 | }; | ||
620 | |||
621 | struct lpfc_hbq_init *lpfc_hbq_defs[] = { | ||
602 | &lpfc_els_hbq, | 622 | &lpfc_els_hbq, |
623 | &lpfc_extra_hbq, | ||
603 | }; | 624 | }; |
604 | 625 | ||
605 | int | 626 | static int |
606 | lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) | 627 | lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) |
607 | { | 628 | { |
608 | uint32_t i, start, end; | 629 | uint32_t i, start, end; |
609 | struct hbq_dmabuf *hbq_buffer; | 630 | struct hbq_dmabuf *hbq_buffer; |
610 | 631 | ||
632 | if (!phba->hbqs[hbqno].hbq_alloc_buffer) { | ||
633 | return 0; | ||
634 | } | ||
635 | |||
611 | start = lpfc_hbq_defs[hbqno]->buffer_count; | 636 | start = lpfc_hbq_defs[hbqno]->buffer_count; |
612 | end = count + lpfc_hbq_defs[hbqno]->buffer_count; | 637 | end = count + lpfc_hbq_defs[hbqno]->buffer_count; |
613 | if (end > lpfc_hbq_defs[hbqno]->entry_count) { | 638 | if (end > lpfc_hbq_defs[hbqno]->entry_count) { |
@@ -616,17 +641,14 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) | |||
616 | 641 | ||
617 | /* Populate HBQ entries */ | 642 | /* Populate HBQ entries */ |
618 | for (i = start; i < end; i++) { | 643 | for (i = start; i < end; i++) { |
619 | hbq_buffer = kmalloc(sizeof(struct hbq_dmabuf), | 644 | hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); |
620 | GFP_KERNEL); | ||
621 | if (!hbq_buffer) | 645 | if (!hbq_buffer) |
622 | return 1; | 646 | return 1; |
623 | hbq_buffer->dbuf.virt = lpfc_hbq_alloc(phba, MEM_PRI, | ||
624 | &hbq_buffer->dbuf.phys); | ||
625 | if (hbq_buffer->dbuf.virt == NULL) | ||
626 | return 1; | ||
627 | hbq_buffer->tag = (i | (hbqno << 16)); | 647 | hbq_buffer->tag = (i | (hbqno << 16)); |
628 | lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer); | 648 | if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) |
629 | lpfc_hbq_defs[hbqno]->buffer_count++; | 649 | lpfc_hbq_defs[hbqno]->buffer_count++; |
650 | else | ||
651 | (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); | ||
630 | } | 652 | } |
631 | return 0; | 653 | return 0; |
632 | } | 654 | } |
@@ -650,28 +672,34 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) | |||
650 | { | 672 | { |
651 | struct lpfc_dmabuf *d_buf; | 673 | struct lpfc_dmabuf *d_buf; |
652 | struct hbq_dmabuf *hbq_buf; | 674 | struct hbq_dmabuf *hbq_buf; |
675 | uint32_t hbqno; | ||
676 | |||
677 | hbqno = tag >> 16; | ||
678 | if (hbqno > LPFC_MAX_HBQS) | ||
679 | return NULL; | ||
653 | 680 | ||
654 | list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) { | 681 | list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) { |
655 | hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); | 682 | hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); |
656 | if ((hbq_buf->tag & 0xffff) == tag) { | 683 | if (hbq_buf->tag == tag) { |
657 | return hbq_buf; | 684 | return hbq_buf; |
658 | } | 685 | } |
659 | } | 686 | } |
660 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, | 687 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, |
661 | "%d:1803 Bad hbq tag. Data: x%x x%x\n", | 688 | "1803 Bad hbq tag. Data: x%x x%x\n", |
662 | phba->brd_no, tag, | 689 | tag, lpfc_hbq_defs[tag >> 16]->buffer_count); |
663 | lpfc_hbq_defs[tag >> 16]->buffer_count); | ||
664 | return NULL; | 690 | return NULL; |
665 | } | 691 | } |
666 | 692 | ||
667 | void | 693 | void |
668 | lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *sp) | 694 | lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer) |
669 | { | 695 | { |
670 | uint32_t hbqno; | 696 | uint32_t hbqno; |
671 | 697 | ||
672 | if (sp) { | 698 | if (hbq_buffer) { |
673 | hbqno = sp->tag >> 16; | 699 | hbqno = hbq_buffer->tag >> 16; |
674 | lpfc_sli_hbq_to_firmware(phba, hbqno, sp); | 700 | if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) { |
701 | (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); | ||
702 | } | ||
675 | } | 703 | } |
676 | } | 704 | } |
677 | 705 | ||
@@ -837,12 +865,10 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) | |||
837 | */ | 865 | */ |
838 | if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) == | 866 | if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) == |
839 | MBX_SHUTDOWN) { | 867 | MBX_SHUTDOWN) { |
840 | |||
841 | /* Unknow mailbox command compl */ | 868 | /* Unknow mailbox command compl */ |
842 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | 869 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
843 | "%d (%d):0323 Unknown Mailbox command " | 870 | "(%d):0323 Unknown Mailbox command " |
844 | "%x Cmpl\n", | 871 | "%x Cmpl\n", |
845 | phba->brd_no, | ||
846 | pmb->vport ? pmb->vport->vpi : 0, | 872 | pmb->vport ? pmb->vport->vpi : 0, |
847 | pmbox->mbxCommand); | 873 | pmbox->mbxCommand); |
848 | phba->link_state = LPFC_HBA_ERROR; | 874 | phba->link_state = LPFC_HBA_ERROR; |
@@ -857,10 +883,9 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) | |||
857 | /* Mbox cmd cmpl error - RETRYing */ | 883 | /* Mbox cmd cmpl error - RETRYing */ |
858 | lpfc_printf_log(phba, KERN_INFO, | 884 | lpfc_printf_log(phba, KERN_INFO, |
859 | LOG_MBOX | LOG_SLI, | 885 | LOG_MBOX | LOG_SLI, |
860 | "%d (%d):0305 Mbox cmd cmpl " | 886 | "(%d):0305 Mbox cmd cmpl " |
861 | "error - RETRYing Data: x%x " | 887 | "error - RETRYing Data: x%x " |
862 | "x%x x%x x%x\n", | 888 | "x%x x%x x%x\n", |
863 | phba->brd_no, | ||
864 | pmb->vport ? pmb->vport->vpi :0, | 889 | pmb->vport ? pmb->vport->vpi :0, |
865 | pmbox->mbxCommand, | 890 | pmbox->mbxCommand, |
866 | pmbox->mbxStatus, | 891 | pmbox->mbxStatus, |
@@ -879,9 +904,8 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) | |||
879 | 904 | ||
880 | /* Mailbox cmd <cmd> Cmpl <cmpl> */ | 905 | /* Mailbox cmd <cmd> Cmpl <cmpl> */ |
881 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, | 906 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
882 | "%d (%d):0307 Mailbox cmd x%x Cmpl x%p " | 907 | "(%d):0307 Mailbox cmd x%x Cmpl x%p " |
883 | "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n", | 908 | "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n", |
884 | phba->brd_no, | ||
885 | pmb->vport ? pmb->vport->vpi : 0, | 909 | pmb->vport ? pmb->vport->vpi : 0, |
886 | pmbox->mbxCommand, | 910 | pmbox->mbxCommand, |
887 | pmb->mbox_cmpl, | 911 | pmb->mbox_cmpl, |
@@ -905,21 +929,26 @@ static struct lpfc_dmabuf * | |||
905 | lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag) | 929 | lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag) |
906 | { | 930 | { |
907 | struct hbq_dmabuf *hbq_entry, *new_hbq_entry; | 931 | struct hbq_dmabuf *hbq_entry, *new_hbq_entry; |
932 | uint32_t hbqno; | ||
933 | void *virt; /* virtual address ptr */ | ||
934 | dma_addr_t phys; /* mapped address */ | ||
908 | 935 | ||
909 | hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); | 936 | hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); |
910 | if (hbq_entry == NULL) | 937 | if (hbq_entry == NULL) |
911 | return NULL; | 938 | return NULL; |
912 | list_del(&hbq_entry->dbuf.list); | 939 | list_del(&hbq_entry->dbuf.list); |
913 | new_hbq_entry = kmalloc(sizeof(struct hbq_dmabuf), GFP_ATOMIC); | 940 | |
941 | hbqno = tag >> 16; | ||
942 | new_hbq_entry = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); | ||
914 | if (new_hbq_entry == NULL) | 943 | if (new_hbq_entry == NULL) |
915 | return &hbq_entry->dbuf; | 944 | return &hbq_entry->dbuf; |
916 | new_hbq_entry->dbuf = hbq_entry->dbuf; | ||
917 | new_hbq_entry->tag = -1; | 945 | new_hbq_entry->tag = -1; |
918 | hbq_entry->dbuf.virt = lpfc_hbq_alloc(phba, 0, &hbq_entry->dbuf.phys); | 946 | phys = new_hbq_entry->dbuf.phys; |
919 | if (hbq_entry->dbuf.virt == NULL) { | 947 | virt = new_hbq_entry->dbuf.virt; |
920 | kfree(new_hbq_entry); | 948 | new_hbq_entry->dbuf.phys = hbq_entry->dbuf.phys; |
921 | return &hbq_entry->dbuf; | 949 | new_hbq_entry->dbuf.virt = hbq_entry->dbuf.virt; |
922 | } | 950 | hbq_entry->dbuf.phys = phys; |
951 | hbq_entry->dbuf.virt = virt; | ||
923 | lpfc_sli_free_hbq(phba, hbq_entry); | 952 | lpfc_sli_free_hbq(phba, hbq_entry); |
924 | return &new_hbq_entry->dbuf; | 953 | return &new_hbq_entry->dbuf; |
925 | } | 954 | } |
@@ -965,7 +994,7 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
965 | irsp->un.ulpWord[3]); | 994 | irsp->un.ulpWord[3]); |
966 | if (irsp->ulpBdeCount == 2) | 995 | if (irsp->ulpBdeCount == 2) |
967 | saveq->context3 = lpfc_sli_replace_hbqbuff(phba, | 996 | saveq->context3 = lpfc_sli_replace_hbqbuff(phba, |
968 | irsp->un.ulpWord[15]); | 997 | irsp->unsli3.sli3Words[7]); |
969 | } | 998 | } |
970 | 999 | ||
971 | /* unSolicited Responses */ | 1000 | /* unSolicited Responses */ |
@@ -996,12 +1025,9 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
996 | /* Ring <ringno> handler: unexpected | 1025 | /* Ring <ringno> handler: unexpected |
997 | Rctl <Rctl> Type <Type> received */ | 1026 | Rctl <Rctl> Type <Type> received */ |
998 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1027 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
999 | "%d:0313 Ring %d handler: unexpected Rctl x%x " | 1028 | "0313 Ring %d handler: unexpected Rctl x%x " |
1000 | "Type x%x received\n", | 1029 | "Type x%x received\n", |
1001 | phba->brd_no, | 1030 | pring->ringno, Rctl, Type); |
1002 | pring->ringno, | ||
1003 | Rctl, | ||
1004 | Type); | ||
1005 | } | 1031 | } |
1006 | return 1; | 1032 | return 1; |
1007 | } | 1033 | } |
@@ -1024,10 +1050,9 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, | |||
1024 | } | 1050 | } |
1025 | 1051 | ||
1026 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1052 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1027 | "%d:0317 iotag x%x is out off " | 1053 | "0317 iotag x%x is out off " |
1028 | "range: max iotag x%x wd0 x%x\n", | 1054 | "range: max iotag x%x wd0 x%x\n", |
1029 | phba->brd_no, iotag, | 1055 | iotag, phba->sli.last_iotag, |
1030 | phba->sli.last_iotag, | ||
1031 | *(((uint32_t *) &prspiocb->iocb) + 7)); | 1056 | *(((uint32_t *) &prspiocb->iocb) + 7)); |
1032 | return NULL; | 1057 | return NULL; |
1033 | } | 1058 | } |
@@ -1075,18 +1100,16 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
1075 | * Ring <ringno> handler: unexpected completion IoTag | 1100 | * Ring <ringno> handler: unexpected completion IoTag |
1076 | * <IoTag> | 1101 | * <IoTag> |
1077 | */ | 1102 | */ |
1078 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1103 | lpfc_printf_vlog(cmdiocbp->vport, KERN_WARNING, LOG_SLI, |
1079 | "%d (%d):0322 Ring %d handler: " | 1104 | "0322 Ring %d handler: " |
1080 | "unexpected completion IoTag x%x " | 1105 | "unexpected completion IoTag x%x " |
1081 | "Data: x%x x%x x%x x%x\n", | 1106 | "Data: x%x x%x x%x x%x\n", |
1082 | phba->brd_no, | 1107 | pring->ringno, |
1083 | cmdiocbp->vport->vpi, | 1108 | saveq->iocb.ulpIoTag, |
1084 | pring->ringno, | 1109 | saveq->iocb.ulpStatus, |
1085 | saveq->iocb.ulpIoTag, | 1110 | saveq->iocb.un.ulpWord[4], |
1086 | saveq->iocb.ulpStatus, | 1111 | saveq->iocb.ulpCommand, |
1087 | saveq->iocb.un.ulpWord[4], | 1112 | saveq->iocb.ulpContext); |
1088 | saveq->iocb.ulpCommand, | ||
1089 | saveq->iocb.ulpContext); | ||
1090 | } | 1113 | } |
1091 | } | 1114 | } |
1092 | 1115 | ||
@@ -1104,10 +1127,9 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
1104 | * rsp ring <portRspMax> | 1127 | * rsp ring <portRspMax> |
1105 | */ | 1128 | */ |
1106 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1129 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1107 | "%d:0312 Ring %d handler: portRspPut %d " | 1130 | "0312 Ring %d handler: portRspPut %d " |
1108 | "is bigger then rsp ring %d\n", | 1131 | "is bigger then rsp ring %d\n", |
1109 | phba->brd_no, pring->ringno, | 1132 | pring->ringno, le32_to_cpu(pgp->rspPutInx), |
1110 | le32_to_cpu(pgp->rspPutInx), | ||
1111 | pring->numRiocb); | 1133 | pring->numRiocb); |
1112 | 1134 | ||
1113 | phba->link_state = LPFC_HBA_ERROR; | 1135 | phba->link_state = LPFC_HBA_ERROR; |
@@ -1177,9 +1199,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1177 | if (unlikely(irsp->ulpStatus)) { | 1199 | if (unlikely(irsp->ulpStatus)) { |
1178 | /* Rsp ring <ringno> error: IOCB */ | 1200 | /* Rsp ring <ringno> error: IOCB */ |
1179 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1201 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1180 | "%d:0326 Rsp Ring %d error: IOCB Data: " | 1202 | "0326 Rsp Ring %d error: IOCB Data: " |
1181 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", | 1203 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", |
1182 | phba->brd_no, pring->ringno, | 1204 | pring->ringno, |
1183 | irsp->un.ulpWord[0], | 1205 | irsp->un.ulpWord[0], |
1184 | irsp->un.ulpWord[1], | 1206 | irsp->un.ulpWord[1], |
1185 | irsp->un.ulpWord[2], | 1207 | irsp->un.ulpWord[2], |
@@ -1199,9 +1221,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1199 | */ | 1221 | */ |
1200 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { | 1222 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { |
1201 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1223 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1202 | "%d:0314 IOCB cmd 0x%x" | 1224 | "0314 IOCB cmd 0x%x " |
1203 | " processed. Skipping" | 1225 | "processed. Skipping " |
1204 | " completion", phba->brd_no, | 1226 | "completion", |
1205 | irsp->ulpCommand); | 1227 | irsp->ulpCommand); |
1206 | break; | 1228 | break; |
1207 | } | 1229 | } |
@@ -1226,10 +1248,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1226 | } else { | 1248 | } else { |
1227 | /* Unknown IOCB command */ | 1249 | /* Unknown IOCB command */ |
1228 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1250 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1229 | "%d:0321 Unknown IOCB command " | 1251 | "0321 Unknown IOCB command " |
1230 | "Data: x%x, x%x x%x x%x x%x\n", | 1252 | "Data: x%x, x%x x%x x%x x%x\n", |
1231 | phba->brd_no, type, | 1253 | type, irsp->ulpCommand, |
1232 | irsp->ulpCommand, | ||
1233 | irsp->ulpStatus, | 1254 | irsp->ulpStatus, |
1234 | irsp->ulpIoTag, | 1255 | irsp->ulpIoTag, |
1235 | irsp->ulpContext); | 1256 | irsp->ulpContext); |
@@ -1353,9 +1374,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1353 | 1374 | ||
1354 | /* Rsp ring <ringno> error: IOCB */ | 1375 | /* Rsp ring <ringno> error: IOCB */ |
1355 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1376 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1356 | "%d:0336 Rsp Ring %d error: IOCB Data: " | 1377 | "0336 Rsp Ring %d error: IOCB Data: " |
1357 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", | 1378 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", |
1358 | phba->brd_no, pring->ringno, | 1379 | pring->ringno, |
1359 | irsp->un.ulpWord[0], | 1380 | irsp->un.ulpWord[0], |
1360 | irsp->un.ulpWord[1], | 1381 | irsp->un.ulpWord[1], |
1361 | irsp->un.ulpWord[2], | 1382 | irsp->un.ulpWord[2], |
@@ -1375,10 +1396,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1375 | */ | 1396 | */ |
1376 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { | 1397 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { |
1377 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1398 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1378 | "%d:0333 IOCB cmd 0x%x" | 1399 | "0333 IOCB cmd 0x%x" |
1379 | " processed. Skipping" | 1400 | " processed. Skipping" |
1380 | " completion\n", | 1401 | " completion\n", |
1381 | phba->brd_no, | ||
1382 | irsp->ulpCommand); | 1402 | irsp->ulpCommand); |
1383 | break; | 1403 | break; |
1384 | } | 1404 | } |
@@ -1415,10 +1435,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1415 | } else { | 1435 | } else { |
1416 | /* Unknown IOCB command */ | 1436 | /* Unknown IOCB command */ |
1417 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1437 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1418 | "%d:0334 Unknown IOCB command " | 1438 | "0334 Unknown IOCB command " |
1419 | "Data: x%x, x%x x%x x%x x%x\n", | 1439 | "Data: x%x, x%x x%x x%x x%x\n", |
1420 | phba->brd_no, type, | 1440 | type, irsp->ulpCommand, |
1421 | irsp->ulpCommand, | ||
1422 | irsp->ulpStatus, | 1441 | irsp->ulpStatus, |
1423 | irsp->ulpIoTag, | 1442 | irsp->ulpIoTag, |
1424 | irsp->ulpContext); | 1443 | irsp->ulpContext); |
@@ -1496,10 +1515,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1496 | * rsp ring <portRspMax> | 1515 | * rsp ring <portRspMax> |
1497 | */ | 1516 | */ |
1498 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1517 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1499 | "%d:0303 Ring %d handler: portRspPut %d " | 1518 | "0303 Ring %d handler: portRspPut %d " |
1500 | "is bigger then rsp ring %d\n", | 1519 | "is bigger then rsp ring %d\n", |
1501 | phba->brd_no, pring->ringno, portRspPut, | 1520 | pring->ringno, portRspPut, portRspMax); |
1502 | portRspMax); | ||
1503 | 1521 | ||
1504 | phba->link_state = LPFC_HBA_ERROR; | 1522 | phba->link_state = LPFC_HBA_ERROR; |
1505 | spin_unlock_irqrestore(&phba->hbalock, iflag); | 1523 | spin_unlock_irqrestore(&phba->hbalock, iflag); |
@@ -1542,6 +1560,14 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1542 | if (++pring->rspidx >= portRspMax) | 1560 | if (++pring->rspidx >= portRspMax) |
1543 | pring->rspidx = 0; | 1561 | pring->rspidx = 0; |
1544 | 1562 | ||
1563 | if (pring->ringno == LPFC_ELS_RING) { | ||
1564 | lpfc_debugfs_slow_ring_trc(phba, | ||
1565 | "IOCB rsp ring: wd4:x%08x wd6:x%08x wd7:x%08x", | ||
1566 | *(((uint32_t *) irsp) + 4), | ||
1567 | *(((uint32_t *) irsp) + 6), | ||
1568 | *(((uint32_t *) irsp) + 7)); | ||
1569 | } | ||
1570 | |||
1545 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); | 1571 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); |
1546 | 1572 | ||
1547 | if (list_empty(&(pring->iocb_continueq))) { | 1573 | if (list_empty(&(pring->iocb_continueq))) { |
@@ -1580,13 +1606,12 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1580 | if (irsp->ulpStatus) { | 1606 | if (irsp->ulpStatus) { |
1581 | /* Rsp ring <ringno> error: IOCB */ | 1607 | /* Rsp ring <ringno> error: IOCB */ |
1582 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1608 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1583 | "%d:0328 Rsp Ring %d error: " | 1609 | "0328 Rsp Ring %d error: " |
1584 | "IOCB Data: " | 1610 | "IOCB Data: " |
1585 | "x%x x%x x%x x%x " | 1611 | "x%x x%x x%x x%x " |
1586 | "x%x x%x x%x x%x " | 1612 | "x%x x%x x%x x%x " |
1587 | "x%x x%x x%x x%x " | 1613 | "x%x x%x x%x x%x " |
1588 | "x%x x%x x%x x%x\n", | 1614 | "x%x x%x x%x x%x\n", |
1589 | phba->brd_no, | ||
1590 | pring->ringno, | 1615 | pring->ringno, |
1591 | irsp->un.ulpWord[0], | 1616 | irsp->un.ulpWord[0], |
1592 | irsp->un.ulpWord[1], | 1617 | irsp->un.ulpWord[1], |
@@ -1661,10 +1686,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1661 | } else { | 1686 | } else { |
1662 | /* Unknown IOCB command */ | 1687 | /* Unknown IOCB command */ |
1663 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1688 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1664 | "%d:0335 Unknown IOCB " | 1689 | "0335 Unknown IOCB " |
1665 | "command Data: x%x " | 1690 | "command Data: x%x " |
1666 | "x%x x%x x%x\n", | 1691 | "x%x x%x x%x\n", |
1667 | phba->brd_no, | ||
1668 | irsp->ulpCommand, | 1692 | irsp->ulpCommand, |
1669 | irsp->ulpStatus, | 1693 | irsp->ulpStatus, |
1670 | irsp->ulpIoTag, | 1694 | irsp->ulpIoTag, |
@@ -1892,8 +1916,8 @@ lpfc_sli_brdkill(struct lpfc_hba *phba) | |||
1892 | 1916 | ||
1893 | /* Kill HBA */ | 1917 | /* Kill HBA */ |
1894 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1918 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1895 | "%d:0329 Kill HBA Data: x%x x%x\n", | 1919 | "0329 Kill HBA Data: x%x x%x\n", |
1896 | phba->brd_no, phba->pport->port_state, psli->sli_flag); | 1920 | phba->pport->port_state, psli->sli_flag); |
1897 | 1921 | ||
1898 | if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, | 1922 | if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, |
1899 | GFP_KERNEL)) == 0) | 1923 | GFP_KERNEL)) == 0) |
@@ -1966,7 +1990,7 @@ lpfc_sli_brdreset(struct lpfc_hba *phba) | |||
1966 | 1990 | ||
1967 | /* Reset HBA */ | 1991 | /* Reset HBA */ |
1968 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1992 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1969 | "%d:0325 Reset HBA Data: x%x x%x\n", phba->brd_no, | 1993 | "0325 Reset HBA Data: x%x x%x\n", |
1970 | phba->pport->port_state, psli->sli_flag); | 1994 | phba->pport->port_state, psli->sli_flag); |
1971 | 1995 | ||
1972 | /* perform board reset */ | 1996 | /* perform board reset */ |
@@ -2021,7 +2045,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba) | |||
2021 | 2045 | ||
2022 | /* Restart HBA */ | 2046 | /* Restart HBA */ |
2023 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 2047 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
2024 | "%d:0337 Restart HBA Data: x%x x%x\n", phba->brd_no, | 2048 | "0337 Restart HBA Data: x%x x%x\n", |
2025 | phba->pport->port_state, psli->sli_flag); | 2049 | phba->pport->port_state, psli->sli_flag); |
2026 | 2050 | ||
2027 | word0 = 0; | 2051 | word0 = 0; |
@@ -2086,9 +2110,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2086 | /* Adapter failed to init, timeout, status reg | 2110 | /* Adapter failed to init, timeout, status reg |
2087 | <status> */ | 2111 | <status> */ |
2088 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2112 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2089 | "%d:0436 Adapter failed to init, " | 2113 | "0436 Adapter failed to init, " |
2090 | "timeout, status reg x%x\n", | 2114 | "timeout, status reg x%x\n", status); |
2091 | phba->brd_no, status); | ||
2092 | phba->link_state = LPFC_HBA_ERROR; | 2115 | phba->link_state = LPFC_HBA_ERROR; |
2093 | return -ETIMEDOUT; | 2116 | return -ETIMEDOUT; |
2094 | } | 2117 | } |
@@ -2099,10 +2122,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2099 | /* Adapter failed to init, chipset, status reg | 2122 | /* Adapter failed to init, chipset, status reg |
2100 | <status> */ | 2123 | <status> */ |
2101 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2124 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2102 | "%d:0437 Adapter failed to init, " | 2125 | "0437 Adapter failed to init, " |
2103 | "chipset, status reg x%x\n", | 2126 | "chipset, status reg x%x\n", status); |
2104 | phba->brd_no, | ||
2105 | status); | ||
2106 | phba->link_state = LPFC_HBA_ERROR; | 2127 | phba->link_state = LPFC_HBA_ERROR; |
2107 | return -EIO; | 2128 | return -EIO; |
2108 | } | 2129 | } |
@@ -2129,10 +2150,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2129 | /* ERROR: During chipset initialization */ | 2150 | /* ERROR: During chipset initialization */ |
2130 | /* Adapter failed to init, chipset, status reg <status> */ | 2151 | /* Adapter failed to init, chipset, status reg <status> */ |
2131 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2152 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2132 | "%d:0438 Adapter failed to init, chipset, " | 2153 | "0438 Adapter failed to init, chipset, " |
2133 | "status reg x%x\n", | 2154 | "status reg x%x\n", status); |
2134 | phba->brd_no, | ||
2135 | status); | ||
2136 | phba->link_state = LPFC_HBA_ERROR; | 2155 | phba->link_state = LPFC_HBA_ERROR; |
2137 | return -EIO; | 2156 | return -EIO; |
2138 | } | 2157 | } |
@@ -2147,7 +2166,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2147 | return 0; | 2166 | return 0; |
2148 | } | 2167 | } |
2149 | 2168 | ||
2150 | static int | 2169 | int |
2151 | lpfc_sli_hbq_count(void) | 2170 | lpfc_sli_hbq_count(void) |
2152 | { | 2171 | { |
2153 | return ARRAY_SIZE(lpfc_hbq_defs); | 2172 | return ARRAY_SIZE(lpfc_hbq_defs); |
@@ -2200,8 +2219,8 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba) | |||
2200 | phba->hbqs[hbqno].local_hbqGetIdx = 0; | 2219 | phba->hbqs[hbqno].local_hbqGetIdx = 0; |
2201 | phba->hbqs[hbqno].entry_count = | 2220 | phba->hbqs[hbqno].entry_count = |
2202 | lpfc_hbq_defs[hbqno]->entry_count; | 2221 | lpfc_hbq_defs[hbqno]->entry_count; |
2203 | lpfc_config_hbq(phba, lpfc_hbq_defs[hbqno], hbq_entry_index, | 2222 | lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno], |
2204 | pmb); | 2223 | hbq_entry_index, pmb); |
2205 | hbq_entry_index += phba->hbqs[hbqno].entry_count; | 2224 | hbq_entry_index += phba->hbqs[hbqno].entry_count; |
2206 | 2225 | ||
2207 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 2226 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
@@ -2210,9 +2229,9 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba) | |||
2210 | 2229 | ||
2211 | lpfc_printf_log(phba, KERN_ERR, | 2230 | lpfc_printf_log(phba, KERN_ERR, |
2212 | LOG_SLI | LOG_VPORT, | 2231 | LOG_SLI | LOG_VPORT, |
2213 | "%d:1805 Adapter failed to init. " | 2232 | "1805 Adapter failed to init. " |
2214 | "Data: x%x x%x x%x\n", | 2233 | "Data: x%x x%x x%x\n", |
2215 | phba->brd_no, pmbox->mbxCommand, | 2234 | pmbox->mbxCommand, |
2216 | pmbox->mbxStatus, hbqno); | 2235 | pmbox->mbxStatus, hbqno); |
2217 | 2236 | ||
2218 | phba->link_state = LPFC_HBA_ERROR; | 2237 | phba->link_state = LPFC_HBA_ERROR; |
@@ -2279,10 +2298,9 @@ lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode) | |||
2279 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 2298 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
2280 | if (rc != MBX_SUCCESS) { | 2299 | if (rc != MBX_SUCCESS) { |
2281 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2300 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2282 | "%d:0442 Adapter failed to init, mbxCmd x%x " | 2301 | "0442 Adapter failed to init, mbxCmd x%x " |
2283 | "CONFIG_PORT, mbxStatus x%x Data: x%x\n", | 2302 | "CONFIG_PORT, mbxStatus x%x Data: x%x\n", |
2284 | phba->brd_no, pmb->mb.mbxCommand, | 2303 | pmb->mb.mbxCommand, pmb->mb.mbxStatus, 0); |
2285 | pmb->mb.mbxStatus, 0); | ||
2286 | spin_lock_irq(&phba->hbalock); | 2304 | spin_lock_irq(&phba->hbalock); |
2287 | phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; | 2305 | phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; |
2288 | spin_unlock_irq(&phba->hbalock); | 2306 | spin_unlock_irq(&phba->hbalock); |
@@ -2321,11 +2339,11 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2321 | 2339 | ||
2322 | switch (lpfc_sli_mode) { | 2340 | switch (lpfc_sli_mode) { |
2323 | case 2: | 2341 | case 2: |
2324 | if (phba->cfg_npiv_enable) { | 2342 | if (phba->cfg_enable_npiv) { |
2325 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, | 2343 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, |
2326 | "%d:1824 NPIV enabled: Override lpfc_sli_mode " | 2344 | "1824 NPIV enabled: Override lpfc_sli_mode " |
2327 | "parameter (%d) to auto (0).\n", | 2345 | "parameter (%d) to auto (0).\n", |
2328 | phba->brd_no, lpfc_sli_mode); | 2346 | lpfc_sli_mode); |
2329 | break; | 2347 | break; |
2330 | } | 2348 | } |
2331 | mode = 2; | 2349 | mode = 2; |
@@ -2335,9 +2353,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2335 | break; | 2353 | break; |
2336 | default: | 2354 | default: |
2337 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, | 2355 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, |
2338 | "%d:1819 Unrecognized lpfc_sli_mode " | 2356 | "1819 Unrecognized lpfc_sli_mode " |
2339 | "parameter: %d.\n", | 2357 | "parameter: %d.\n", lpfc_sli_mode); |
2340 | phba->brd_no, lpfc_sli_mode); | ||
2341 | 2358 | ||
2342 | break; | 2359 | break; |
2343 | } | 2360 | } |
@@ -2345,9 +2362,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2345 | rc = lpfc_do_config_port(phba, mode); | 2362 | rc = lpfc_do_config_port(phba, mode); |
2346 | if (rc && lpfc_sli_mode == 3) | 2363 | if (rc && lpfc_sli_mode == 3) |
2347 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, | 2364 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, |
2348 | "%d:1820 Unable to select SLI-3. " | 2365 | "1820 Unable to select SLI-3. " |
2349 | "Not supported by adapter.\n", | 2366 | "Not supported by adapter.\n"); |
2350 | phba->brd_no); | ||
2351 | if (rc && mode != 2) | 2367 | if (rc && mode != 2) |
2352 | rc = lpfc_do_config_port(phba, 2); | 2368 | rc = lpfc_do_config_port(phba, 2); |
2353 | if (rc) | 2369 | if (rc) |
@@ -2366,8 +2382,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2366 | } | 2382 | } |
2367 | 2383 | ||
2368 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 2384 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
2369 | "%d:0444 Firmware in SLI %x mode. Max_vpi %d\n", | 2385 | "0444 Firmware in SLI %x mode. Max_vpi %d\n", |
2370 | phba->brd_no, phba->sli_rev, phba->max_vpi); | 2386 | phba->sli_rev, phba->max_vpi); |
2371 | rc = lpfc_sli_ring_map(phba); | 2387 | rc = lpfc_sli_ring_map(phba); |
2372 | 2388 | ||
2373 | if (rc) | 2389 | if (rc) |
@@ -2392,8 +2408,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2392 | lpfc_sli_hba_setup_error: | 2408 | lpfc_sli_hba_setup_error: |
2393 | phba->link_state = LPFC_HBA_ERROR; | 2409 | phba->link_state = LPFC_HBA_ERROR; |
2394 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 2410 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
2395 | "%d:0445 Firmware initialization failed\n", | 2411 | "0445 Firmware initialization failed\n"); |
2396 | phba->brd_no); | ||
2397 | return rc; | 2412 | return rc; |
2398 | } | 2413 | } |
2399 | 2414 | ||
@@ -2445,9 +2460,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
2445 | 2460 | ||
2446 | /* Mbox cmd <mbxCommand> timeout */ | 2461 | /* Mbox cmd <mbxCommand> timeout */ |
2447 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | 2462 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
2448 | "%d:0310 Mailbox command x%x timeout Data: x%x x%x " | 2463 | "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n", |
2449 | "x%p\n", | ||
2450 | phba->brd_no, | ||
2451 | mb->mbxCommand, | 2464 | mb->mbxCommand, |
2452 | phba->pport->port_state, | 2465 | phba->pport->port_state, |
2453 | phba->sli.sli_flag, | 2466 | phba->sli.sli_flag, |
@@ -2470,8 +2483,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
2470 | lpfc_sli_abort_iocb_ring(phba, pring); | 2483 | lpfc_sli_abort_iocb_ring(phba, pring); |
2471 | 2484 | ||
2472 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | 2485 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
2473 | "%d:0316 Resetting board due to mailbox timeout\n", | 2486 | "0316 Resetting board due to mailbox timeout\n"); |
2474 | phba->brd_no); | ||
2475 | /* | 2487 | /* |
2476 | * lpfc_offline calls lpfc_sli_hba_down which will clean up | 2488 | * lpfc_offline calls lpfc_sli_hba_down which will clean up |
2477 | * on oustanding mailbox commands. | 2489 | * on oustanding mailbox commands. |
@@ -2502,8 +2514,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2502 | if(!pmbox->vport) { | 2514 | if(!pmbox->vport) { |
2503 | lpfc_printf_log(phba, KERN_ERR, | 2515 | lpfc_printf_log(phba, KERN_ERR, |
2504 | LOG_MBOX | LOG_VPORT, | 2516 | LOG_MBOX | LOG_VPORT, |
2505 | "%d:1806 Mbox x%x failed. No vport\n", | 2517 | "1806 Mbox x%x failed. No vport\n", |
2506 | phba->brd_no, | ||
2507 | pmbox->mb.mbxCommand); | 2518 | pmbox->mb.mbxCommand); |
2508 | dump_stack(); | 2519 | dump_stack(); |
2509 | return MBXERR_ERROR; | 2520 | return MBXERR_ERROR; |
@@ -2580,9 +2591,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2580 | 2591 | ||
2581 | /* Mbox cmd issue - BUSY */ | 2592 | /* Mbox cmd issue - BUSY */ |
2582 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, | 2593 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
2583 | "%d (%d):0308 Mbox cmd issue - BUSY Data: " | 2594 | "(%d):0308 Mbox cmd issue - BUSY Data: " |
2584 | "x%x x%x x%x x%x\n", | 2595 | "x%x x%x x%x x%x\n", |
2585 | phba->brd_no, | ||
2586 | pmbox->vport ? pmbox->vport->vpi : 0xffffff, | 2596 | pmbox->vport ? pmbox->vport->vpi : 0xffffff, |
2587 | mb->mbxCommand, phba->pport->port_state, | 2597 | mb->mbxCommand, phba->pport->port_state, |
2588 | psli->sli_flag, flag); | 2598 | psli->sli_flag, flag); |
@@ -2644,9 +2654,9 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2644 | 2654 | ||
2645 | /* Mailbox cmd <cmd> issue */ | 2655 | /* Mailbox cmd <cmd> issue */ |
2646 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, | 2656 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
2647 | "%d (%d):0309 Mailbox cmd x%x issue Data: x%x x%x " | 2657 | "(%d):0309 Mailbox cmd x%x issue Data: x%x x%x " |
2648 | "x%x\n", | 2658 | "x%x\n", |
2649 | phba->brd_no, pmbox->vport ? pmbox->vport->vpi : 0, | 2659 | pmbox->vport ? pmbox->vport->vpi : 0, |
2650 | mb->mbxCommand, phba->pport->port_state, | 2660 | mb->mbxCommand, phba->pport->port_state, |
2651 | psli->sli_flag, flag); | 2661 | psli->sli_flag, flag); |
2652 | 2662 | ||
@@ -2848,8 +2858,7 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
2848 | (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) { | 2858 | (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) { |
2849 | lpfc_printf_log(phba, KERN_ERR, | 2859 | lpfc_printf_log(phba, KERN_ERR, |
2850 | LOG_SLI | LOG_VPORT, | 2860 | LOG_SLI | LOG_VPORT, |
2851 | "%d:1807 IOCB x%x failed. No vport\n", | 2861 | "1807 IOCB x%x failed. No vport\n", |
2852 | phba->brd_no, | ||
2853 | piocb->iocb.ulpCommand); | 2862 | piocb->iocb.ulpCommand); |
2854 | dump_stack(); | 2863 | dump_stack(); |
2855 | return IOCB_ERROR; | 2864 | return IOCB_ERROR; |
@@ -3080,11 +3089,10 @@ lpfc_sli_setup(struct lpfc_hba *phba) | |||
3080 | } | 3089 | } |
3081 | if (totiocbsize > MAX_SLIM_IOCB_SIZE) { | 3090 | if (totiocbsize > MAX_SLIM_IOCB_SIZE) { |
3082 | /* Too many cmd / rsp ring entries in SLI2 SLIM */ | 3091 | /* Too many cmd / rsp ring entries in SLI2 SLIM */ |
3083 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 3092 | printk(KERN_ERR "%d:0462 Too many cmd / rsp ring entries in " |
3084 | "%d:0462 Too many cmd / rsp ring entries in " | 3093 | "SLI2 SLIM Data: x%x x%lx\n", |
3085 | "SLI2 SLIM Data: x%x x%lx\n", | 3094 | phba->brd_no, totiocbsize, |
3086 | phba->brd_no, totiocbsize, | 3095 | (unsigned long) MAX_SLIM_IOCB_SIZE); |
3087 | (unsigned long) MAX_SLIM_IOCB_SIZE); | ||
3088 | } | 3096 | } |
3089 | if (phba->cfg_multi_ring_support == 2) | 3097 | if (phba->cfg_multi_ring_support == 2) |
3090 | lpfc_extra_ring_setup(phba); | 3098 | lpfc_extra_ring_setup(phba); |
@@ -3305,9 +3313,9 @@ lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3305 | 3313 | ||
3306 | spin_unlock_irq(&phba->hbalock); | 3314 | spin_unlock_irq(&phba->hbalock); |
3307 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 3315 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
3308 | "%d:0410 Cannot find virtual addr for mapped buf on " | 3316 | "0410 Cannot find virtual addr for mapped buf on " |
3309 | "ring %d Data x%llx x%p x%p x%x\n", | 3317 | "ring %d Data x%llx x%p x%p x%x\n", |
3310 | phba->brd_no, pring->ringno, (unsigned long long)phys, | 3318 | pring->ringno, (unsigned long long)phys, |
3311 | slp->next, slp->prev, pring->postbufq_cnt); | 3319 | slp->next, slp->prev, pring->postbufq_cnt); |
3312 | return NULL; | 3320 | return NULL; |
3313 | } | 3321 | } |
@@ -3332,12 +3340,11 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
3332 | abort_iocb = phba->sli.iocbq_lookup[abort_iotag]; | 3340 | abort_iocb = phba->sli.iocbq_lookup[abort_iotag]; |
3333 | 3341 | ||
3334 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI, | 3342 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI, |
3335 | "%d:0327 Cannot abort els iocb %p " | 3343 | "0327 Cannot abort els iocb %p " |
3336 | "with tag %x context %x, abort status %x, " | 3344 | "with tag %x context %x, abort status %x, " |
3337 | "abort code %x\n", | 3345 | "abort code %x\n", |
3338 | phba->brd_no, abort_iocb, abort_iotag, | 3346 | abort_iocb, abort_iotag, abort_context, |
3339 | abort_context, irsp->ulpStatus, | 3347 | irsp->ulpStatus, irsp->un.ulpWord[4]); |
3340 | irsp->un.ulpWord[4]); | ||
3341 | 3348 | ||
3342 | /* | 3349 | /* |
3343 | * make sure we have the right iocbq before taking it | 3350 | * make sure we have the right iocbq before taking it |
@@ -3371,9 +3378,9 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
3371 | 3378 | ||
3372 | /* ELS cmd tag <ulpIoTag> completes */ | 3379 | /* ELS cmd tag <ulpIoTag> completes */ |
3373 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3380 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
3374 | "%d (X):0133 Ignoring ELS cmd tag x%x completion Data: " | 3381 | "0133 Ignoring ELS cmd tag x%x completion Data: " |
3375 | "x%x x%x x%x\n", | 3382 | "x%x x%x x%x\n", |
3376 | phba->brd_no, irsp->ulpIoTag, irsp->ulpStatus, | 3383 | irsp->ulpIoTag, irsp->ulpStatus, |
3377 | irsp->un.ulpWord[4], irsp->ulpTimeout); | 3384 | irsp->un.ulpWord[4], irsp->ulpTimeout); |
3378 | if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR) | 3385 | if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR) |
3379 | lpfc_ct_free_iocb(phba, cmdiocb); | 3386 | lpfc_ct_free_iocb(phba, cmdiocb); |
@@ -3439,12 +3446,11 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3439 | 3446 | ||
3440 | abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl; | 3447 | abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl; |
3441 | 3448 | ||
3442 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3449 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, |
3443 | "%d (%d):0339 Abort xri x%x, original iotag x%x, " | 3450 | "0339 Abort xri x%x, original iotag x%x, " |
3444 | "abort cmd iotag x%x\n", | 3451 | "abort cmd iotag x%x\n", |
3445 | phba->brd_no, vport->vpi, | 3452 | iabt->un.acxri.abortContextTag, |
3446 | iabt->un.acxri.abortContextTag, | 3453 | iabt->un.acxri.abortIoTag, abtsiocbp->iotag); |
3447 | iabt->un.acxri.abortIoTag, abtsiocbp->iotag); | ||
3448 | retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0); | 3454 | retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0); |
3449 | 3455 | ||
3450 | abort_iotag_exit: | 3456 | abort_iotag_exit: |
@@ -3457,8 +3463,8 @@ abort_iotag_exit: | |||
3457 | } | 3463 | } |
3458 | 3464 | ||
3459 | static int | 3465 | static int |
3460 | lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, | 3466 | lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport, |
3461 | uint64_t lun_id, uint32_t ctx, | 3467 | uint16_t tgt_id, uint64_t lun_id, |
3462 | lpfc_ctx_cmd ctx_cmd) | 3468 | lpfc_ctx_cmd ctx_cmd) |
3463 | { | 3469 | { |
3464 | struct lpfc_scsi_buf *lpfc_cmd; | 3470 | struct lpfc_scsi_buf *lpfc_cmd; |
@@ -3468,6 +3474,9 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, | |||
3468 | if (!(iocbq->iocb_flag & LPFC_IO_FCP)) | 3474 | if (!(iocbq->iocb_flag & LPFC_IO_FCP)) |
3469 | return rc; | 3475 | return rc; |
3470 | 3476 | ||
3477 | if (iocbq->vport != vport) | ||
3478 | return rc; | ||
3479 | |||
3471 | lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq); | 3480 | lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq); |
3472 | cmnd = lpfc_cmd->pCmd; | 3481 | cmnd = lpfc_cmd->pCmd; |
3473 | 3482 | ||
@@ -3484,10 +3493,6 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, | |||
3484 | if (cmnd->device->id == tgt_id) | 3493 | if (cmnd->device->id == tgt_id) |
3485 | rc = 0; | 3494 | rc = 0; |
3486 | break; | 3495 | break; |
3487 | case LPFC_CTX_CTX: | ||
3488 | if (iocbq->iocb.ulpContext == ctx) | ||
3489 | rc = 0; | ||
3490 | break; | ||
3491 | case LPFC_CTX_HOST: | 3496 | case LPFC_CTX_HOST: |
3492 | rc = 0; | 3497 | rc = 0; |
3493 | break; | 3498 | break; |
@@ -3501,17 +3506,18 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, | |||
3501 | } | 3506 | } |
3502 | 3507 | ||
3503 | int | 3508 | int |
3504 | lpfc_sli_sum_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | 3509 | lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id, |
3505 | uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd ctx_cmd) | 3510 | lpfc_ctx_cmd ctx_cmd) |
3506 | { | 3511 | { |
3512 | struct lpfc_hba *phba = vport->phba; | ||
3507 | struct lpfc_iocbq *iocbq; | 3513 | struct lpfc_iocbq *iocbq; |
3508 | int sum, i; | 3514 | int sum, i; |
3509 | 3515 | ||
3510 | for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) { | 3516 | for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) { |
3511 | iocbq = phba->sli.iocbq_lookup[i]; | 3517 | iocbq = phba->sli.iocbq_lookup[i]; |
3512 | 3518 | ||
3513 | if (lpfc_sli_validate_fcp_iocb (iocbq, tgt_id, lun_id, | 3519 | if (lpfc_sli_validate_fcp_iocb (iocbq, vport, tgt_id, lun_id, |
3514 | 0, ctx_cmd) == 0) | 3520 | ctx_cmd) == 0) |
3515 | sum++; | 3521 | sum++; |
3516 | } | 3522 | } |
3517 | 3523 | ||
@@ -3527,10 +3533,10 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
3527 | } | 3533 | } |
3528 | 3534 | ||
3529 | int | 3535 | int |
3530 | lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | 3536 | lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring, |
3531 | uint16_t tgt_id, uint64_t lun_id, uint32_t ctx, | 3537 | uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd abort_cmd) |
3532 | lpfc_ctx_cmd abort_cmd) | ||
3533 | { | 3538 | { |
3539 | struct lpfc_hba *phba = vport->phba; | ||
3534 | struct lpfc_iocbq *iocbq; | 3540 | struct lpfc_iocbq *iocbq; |
3535 | struct lpfc_iocbq *abtsiocb; | 3541 | struct lpfc_iocbq *abtsiocb; |
3536 | IOCB_t *cmd = NULL; | 3542 | IOCB_t *cmd = NULL; |
@@ -3540,7 +3546,7 @@ lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3540 | for (i = 1; i <= phba->sli.last_iotag; i++) { | 3546 | for (i = 1; i <= phba->sli.last_iotag; i++) { |
3541 | iocbq = phba->sli.iocbq_lookup[i]; | 3547 | iocbq = phba->sli.iocbq_lookup[i]; |
3542 | 3548 | ||
3543 | if (lpfc_sli_validate_fcp_iocb(iocbq, tgt_id, lun_id, 0, | 3549 | if (lpfc_sli_validate_fcp_iocb(iocbq, vport, tgt_id, lun_id, |
3544 | abort_cmd) != 0) | 3550 | abort_cmd) != 0) |
3545 | continue; | 3551 | continue; |
3546 | 3552 | ||
@@ -3647,25 +3653,23 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, | |||
3647 | 3653 | ||
3648 | if (piocb->iocb_flag & LPFC_IO_WAKE) { | 3654 | if (piocb->iocb_flag & LPFC_IO_WAKE) { |
3649 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3655 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
3650 | "%d:0331 IOCB wake signaled\n", | 3656 | "0331 IOCB wake signaled\n"); |
3651 | phba->brd_no); | ||
3652 | } else if (timeleft == 0) { | 3657 | } else if (timeleft == 0) { |
3653 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3658 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
3654 | "%d:0338 IOCB wait timeout error - no " | 3659 | "0338 IOCB wait timeout error - no " |
3655 | "wake response Data x%x\n", | 3660 | "wake response Data x%x\n", timeout); |
3656 | phba->brd_no, timeout); | ||
3657 | retval = IOCB_TIMEDOUT; | 3661 | retval = IOCB_TIMEDOUT; |
3658 | } else { | 3662 | } else { |
3659 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3663 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
3660 | "%d:0330 IOCB wake NOT set, " | 3664 | "0330 IOCB wake NOT set, " |
3661 | "Data x%x x%lx\n", phba->brd_no, | 3665 | "Data x%x x%lx\n", |
3662 | timeout, (timeleft / jiffies)); | 3666 | timeout, (timeleft / jiffies)); |
3663 | retval = IOCB_TIMEDOUT; | 3667 | retval = IOCB_TIMEDOUT; |
3664 | } | 3668 | } |
3665 | } else { | 3669 | } else { |
3666 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3670 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
3667 | "%d:0332 IOCB wait issue failed, Data x%x\n", | 3671 | ":0332 IOCB wait issue failed, Data x%x\n", |
3668 | phba->brd_no, retval); | 3672 | retval); |
3669 | retval = IOCB_ERROR; | 3673 | retval = IOCB_ERROR; |
3670 | } | 3674 | } |
3671 | 3675 | ||
@@ -3850,12 +3854,33 @@ lpfc_intr_handler(int irq, void *dev_id) | |||
3850 | if (status & HA_RXMASK) { | 3854 | if (status & HA_RXMASK) { |
3851 | spin_lock(&phba->hbalock); | 3855 | spin_lock(&phba->hbalock); |
3852 | control = readl(phba->HCregaddr); | 3856 | control = readl(phba->HCregaddr); |
3857 | |||
3858 | lpfc_debugfs_slow_ring_trc(phba, | ||
3859 | "ISR slow ring: ctl:x%x stat:x%x isrcnt:x%x", | ||
3860 | control, status, | ||
3861 | (uint32_t)phba->sli.slistat.sli_intr); | ||
3862 | |||
3853 | if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) { | 3863 | if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) { |
3864 | lpfc_debugfs_slow_ring_trc(phba, | ||
3865 | "ISR Disable ring:" | ||
3866 | "pwork:x%x hawork:x%x wait:x%x", | ||
3867 | phba->work_ha, work_ha_copy, | ||
3868 | (uint32_t)((unsigned long) | ||
3869 | phba->work_wait)); | ||
3870 | |||
3854 | control &= | 3871 | control &= |
3855 | ~(HC_R0INT_ENA << LPFC_ELS_RING); | 3872 | ~(HC_R0INT_ENA << LPFC_ELS_RING); |
3856 | writel(control, phba->HCregaddr); | 3873 | writel(control, phba->HCregaddr); |
3857 | readl(phba->HCregaddr); /* flush */ | 3874 | readl(phba->HCregaddr); /* flush */ |
3858 | } | 3875 | } |
3876 | else { | ||
3877 | lpfc_debugfs_slow_ring_trc(phba, | ||
3878 | "ISR slow ring: pwork:" | ||
3879 | "x%x hawork:x%x wait:x%x", | ||
3880 | phba->work_ha, work_ha_copy, | ||
3881 | (uint32_t)((unsigned long) | ||
3882 | phba->work_wait)); | ||
3883 | } | ||
3859 | spin_unlock(&phba->hbalock); | 3884 | spin_unlock(&phba->hbalock); |
3860 | } | 3885 | } |
3861 | } | 3886 | } |
@@ -3895,12 +3920,10 @@ lpfc_intr_handler(int irq, void *dev_id) | |||
3895 | */ | 3920 | */ |
3896 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | | 3921 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | |
3897 | LOG_SLI, | 3922 | LOG_SLI, |
3898 | "%d (%d):0304 Stray Mailbox " | 3923 | "(%d):0304 Stray Mailbox " |
3899 | "Interrupt mbxCommand x%x " | 3924 | "Interrupt mbxCommand x%x " |
3900 | "mbxStatus x%x\n", | 3925 | "mbxStatus x%x\n", |
3901 | phba->brd_no, | 3926 | (vport ? vport->vpi : 0), |
3902 | (vport | ||
3903 | ? vport->vpi : 0), | ||
3904 | pmbox->mbxCommand, | 3927 | pmbox->mbxCommand, |
3905 | pmbox->mbxStatus); | 3928 | pmbox->mbxStatus); |
3906 | } | 3929 | } |