aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c251
1 files changed, 100 insertions, 151 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index b903d3b7b730..c34d3cf4f19c 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -50,7 +50,7 @@
50 * and the BPL BDE is setup in the IOCB. 50 * and the BPL BDE is setup in the IOCB.
51 */ 51 */
52static struct lpfc_scsi_buf * 52static struct lpfc_scsi_buf *
53lpfc_get_scsi_buf(struct lpfc_hba * phba) 53lpfc_new_scsi_buf(struct lpfc_hba * phba)
54{ 54{
55 struct lpfc_scsi_buf *psb; 55 struct lpfc_scsi_buf *psb;
56 struct ulp_bde64 *bpl; 56 struct ulp_bde64 *bpl;
@@ -88,6 +88,7 @@ lpfc_get_scsi_buf(struct lpfc_hba * phba)
88 kfree (psb); 88 kfree (psb);
89 return NULL; 89 return NULL;
90 } 90 }
91 psb->cur_iocbq.iocb_flag |= LPFC_IO_FCP;
91 92
92 psb->fcp_cmnd = psb->data; 93 psb->fcp_cmnd = psb->data;
93 psb->fcp_rsp = psb->data + sizeof(struct fcp_cmnd); 94 psb->fcp_rsp = psb->data + sizeof(struct fcp_cmnd);
@@ -135,11 +136,19 @@ lpfc_get_scsi_buf(struct lpfc_hba * phba)
135 return psb; 136 return psb;
136} 137}
137 138
138static void 139struct lpfc_scsi_buf*
139lpfc_free_scsi_buf(struct lpfc_scsi_buf * psb) 140lpfc_sli_get_scsi_buf(struct lpfc_hba * phba)
140{ 141{
141 struct lpfc_hba *phba = psb->scsi_hba; 142 struct lpfc_scsi_buf * lpfc_cmd = NULL;
143 struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list;
144
145 list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list);
146 return lpfc_cmd;
147}
142 148
149static void
150lpfc_release_scsi_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb)
151{
143 /* 152 /*
144 * There are only two special cases to consider. (1) the scsi command 153 * There are only two special cases to consider. (1) the scsi command
145 * requested scatter-gather usage or (2) the scsi command allocated 154 * requested scatter-gather usage or (2) the scsi command allocated
@@ -157,6 +166,7 @@ lpfc_free_scsi_buf(struct lpfc_scsi_buf * psb)
157 } 166 }
158 } 167 }
159 168
169 psb->pCmd = NULL;
160 list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list); 170 list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list);
161} 171}
162 172
@@ -431,12 +441,11 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
431 *lp, *(lp + 3), cmd->retries, cmd->resid); 441 *lp, *(lp + 3), cmd->retries, cmd->resid);
432 } 442 }
433 443
444 cmd->scsi_done(cmd);
445
434 spin_lock_irqsave(phba->host->host_lock, iflag); 446 spin_lock_irqsave(phba->host->host_lock, iflag);
435 lpfc_free_scsi_buf(lpfc_cmd); 447 lpfc_release_scsi_buf(phba, lpfc_cmd);
436 cmd->host_scribble = NULL;
437 spin_unlock_irqrestore(phba->host->host_lock, iflag); 448 spin_unlock_irqrestore(phba->host->host_lock, iflag);
438
439 cmd->scsi_done(cmd);
440} 449}
441 450
442static void 451static void
@@ -623,8 +632,7 @@ static int
623lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba) 632lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba)
624{ 633{
625 struct lpfc_iocbq *iocbq; 634 struct lpfc_iocbq *iocbq;
626 struct lpfc_iocbq *iocbqrsp = NULL; 635 struct lpfc_iocbq *iocbqrsp;
627 struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list;
628 int ret; 636 int ret;
629 637
630 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET); 638 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET);
@@ -633,7 +641,8 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba)
633 641
634 lpfc_cmd->scsi_hba = phba; 642 lpfc_cmd->scsi_hba = phba;
635 iocbq = &lpfc_cmd->cur_iocbq; 643 iocbq = &lpfc_cmd->cur_iocbq;
636 list_remove_head(lpfc_iocb_list, iocbqrsp, struct lpfc_iocbq, list); 644 iocbqrsp = lpfc_sli_get_iocbq(phba);
645
637 if (!iocbqrsp) 646 if (!iocbqrsp)
638 return FAILED; 647 return FAILED;
639 648
@@ -652,44 +661,10 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba)
652 lpfc_cmd->status = IOSTAT_DRIVER_REJECT; 661 lpfc_cmd->status = IOSTAT_DRIVER_REJECT;
653 } 662 }
654 663
655 /*
656 * All outstanding txcmplq I/Os should have been aborted by the target.
657 * Unfortunately, some targets do not abide by this forcing the driver
658 * to double check.
659 */
660 lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
661 lpfc_cmd->pCmd->device->id,
662 lpfc_cmd->pCmd->device->lun, 0, LPFC_CTX_TGT);
663
664 lpfc_sli_release_iocbq(phba, iocbqrsp); 664 lpfc_sli_release_iocbq(phba, iocbqrsp);
665 return ret; 665 return ret;
666} 666}
667 667
668static void
669lpfc_scsi_cmd_iocb_cleanup (struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
670 struct lpfc_iocbq *pIocbOut)
671{
672 unsigned long iflag;
673 struct lpfc_scsi_buf *lpfc_cmd =
674 (struct lpfc_scsi_buf *) pIocbIn->context1;
675
676 spin_lock_irqsave(phba->host->host_lock, iflag);
677 lpfc_free_scsi_buf(lpfc_cmd);
678 spin_unlock_irqrestore(phba->host->host_lock, iflag);
679}
680
681static void
682lpfc_scsi_cmd_iocb_cmpl_aborted(struct lpfc_hba *phba,
683 struct lpfc_iocbq *pIocbIn,
684 struct lpfc_iocbq *pIocbOut)
685{
686 struct scsi_cmnd *ml_cmd =
687 ((struct lpfc_scsi_buf *) pIocbIn->context1)->pCmd;
688
689 lpfc_scsi_cmd_iocb_cleanup (phba, pIocbIn, pIocbOut);
690 ml_cmd->host_scribble = NULL;
691}
692
693const char * 668const char *
694lpfc_info(struct Scsi_Host *host) 669lpfc_info(struct Scsi_Host *host)
695{ 670{
@@ -726,9 +701,8 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
726 struct lpfc_sli *psli = &phba->sli; 701 struct lpfc_sli *psli = &phba->sli;
727 struct lpfc_rport_data *rdata = cmnd->device->hostdata; 702 struct lpfc_rport_data *rdata = cmnd->device->hostdata;
728 struct lpfc_nodelist *ndlp = rdata->pnode; 703 struct lpfc_nodelist *ndlp = rdata->pnode;
729 struct lpfc_scsi_buf *lpfc_cmd = NULL; 704 struct lpfc_scsi_buf *lpfc_cmd;
730 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); 705 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
731 struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list;
732 int err; 706 int err;
733 707
734 err = fc_remote_port_chkready(rport); 708 err = fc_remote_port_chkready(rport);
@@ -745,8 +719,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
745 cmnd->result = ScsiResult(DID_BUS_BUSY, 0); 719 cmnd->result = ScsiResult(DID_BUS_BUSY, 0);
746 goto out_fail_command; 720 goto out_fail_command;
747 } 721 }
748 722 lpfc_cmd = lpfc_sli_get_scsi_buf (phba);
749 list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list);
750 if (lpfc_cmd == NULL) { 723 if (lpfc_cmd == NULL) {
751 printk(KERN_WARNING "%s: No buffer available - list empty, " 724 printk(KERN_WARNING "%s: No buffer available - list empty, "
752 "total count %d\n", __FUNCTION__, phba->total_scsi_bufs); 725 "total count %d\n", __FUNCTION__, phba->total_scsi_bufs);
@@ -776,7 +749,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
776 return 0; 749 return 0;
777 750
778 out_host_busy_free_buf: 751 out_host_busy_free_buf:
779 lpfc_free_scsi_buf(lpfc_cmd); 752 lpfc_release_scsi_buf(phba, lpfc_cmd);
780 cmnd->host_scribble = NULL; 753 cmnd->host_scribble = NULL;
781 out_host_busy: 754 out_host_busy:
782 return SCSI_MLQUEUE_HOST_BUSY; 755 return SCSI_MLQUEUE_HOST_BUSY;
@@ -792,116 +765,92 @@ __lpfc_abort_handler(struct scsi_cmnd *cmnd)
792 struct lpfc_hba *phba = 765 struct lpfc_hba *phba =
793 (struct lpfc_hba *)cmnd->device->host->hostdata[0]; 766 (struct lpfc_hba *)cmnd->device->host->hostdata[0];
794 struct lpfc_sli_ring *pring = &phba->sli.ring[phba->sli.fcp_ring]; 767 struct lpfc_sli_ring *pring = &phba->sli.ring[phba->sli.fcp_ring];
795 struct lpfc_iocbq *iocb, *next_iocb; 768 struct lpfc_iocbq *iocb;
796 struct lpfc_iocbq *abtsiocb = NULL; 769 struct lpfc_iocbq *abtsiocb;
797 struct lpfc_scsi_buf *lpfc_cmd; 770 struct lpfc_scsi_buf *lpfc_cmd;
798 struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list;
799 IOCB_t *cmd, *icmd; 771 IOCB_t *cmd, *icmd;
800 unsigned long snum;
801 unsigned int id, lun;
802 unsigned int loop_count = 0; 772 unsigned int loop_count = 0;
803 int ret = IOCB_SUCCESS; 773 int ret = SUCCESS;
804 774
805 /*
806 * If the host_scribble data area is NULL, then the driver has already
807 * completed this command, but the midlayer did not see the completion
808 * before the eh fired. Just return SUCCESS.
809 */
810 lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble;
811 if (!lpfc_cmd)
812 return SUCCESS;
813 775
814 /* save these now since lpfc_cmd can be freed */ 776 lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble;
815 id = lpfc_cmd->pCmd->device->id; 777 BUG_ON(!lpfc_cmd);
816 lun = lpfc_cmd->pCmd->device->lun;
817 snum = lpfc_cmd->pCmd->serial_number;
818 778
819 list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { 779 /*
820 cmd = &iocb->iocb; 780 * If pCmd field of the corresponding lpfc_scsi_buf structure
821 if (iocb->context1 != lpfc_cmd) 781 * points to a different SCSI command, then the driver has
822 continue; 782 * already completed this command, but the midlayer did not
783 * see the completion before the eh fired. Just return
784 * SUCCESS.
785 */
786 iocb = &lpfc_cmd->cur_iocbq;
787 if (lpfc_cmd->pCmd != cmnd)
788 goto out;
823 789
824 list_del_init(&iocb->list); 790 BUG_ON(iocb->context1 != lpfc_cmd);
825 pring->txq_cnt--;
826 if (!iocb->iocb_cmpl)
827 lpfc_sli_release_iocbq(phba, iocb);
828 else {
829 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
830 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
831 lpfc_scsi_cmd_iocb_cmpl_aborted(phba, iocb, iocb);
832 }
833 791
792 abtsiocb = lpfc_sli_get_iocbq(phba);
793 if (abtsiocb == NULL) {
794 ret = FAILED;
834 goto out; 795 goto out;
835 } 796 }
836 797
837 list_remove_head(lpfc_iocb_list, abtsiocb, struct lpfc_iocbq, list);
838 if (abtsiocb == NULL)
839 return FAILED;
840
841 /* 798 /*
842 * The scsi command was not in the txq. Check the txcmplq and if it is 799 * The scsi command can not be in txq and it is in flight because the
843 * found, send an abort to the FW. 800 * pCmd is still pointig at the SCSI command we have to abort. There
801 * is no need to search the txcmplq. Just send an abort to the FW.
844 */ 802 */
845 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) {
846 if (iocb->context1 != lpfc_cmd)
847 continue;
848 803
849 iocb->iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl_aborted; 804 cmd = &iocb->iocb;
850 cmd = &iocb->iocb; 805 icmd = &abtsiocb->iocb;
851 icmd = &abtsiocb->iocb; 806 icmd->un.acxri.abortType = ABORT_TYPE_ABTS;
852 icmd->un.acxri.abortType = ABORT_TYPE_ABTS; 807 icmd->un.acxri.abortContextTag = cmd->ulpContext;
853 icmd->un.acxri.abortContextTag = cmd->ulpContext; 808 icmd->un.acxri.abortIoTag = cmd->ulpIoTag;
854 icmd->un.acxri.abortIoTag = cmd->ulpIoTag;
855
856 icmd->ulpLe = 1;
857 icmd->ulpClass = cmd->ulpClass;
858 if (phba->hba_state >= LPFC_LINK_UP)
859 icmd->ulpCommand = CMD_ABORT_XRI_CN;
860 else
861 icmd->ulpCommand = CMD_CLOSE_XRI_CN;
862 809
863 abtsiocb->iocb_cmpl = lpfc_sli_abort_fcp_cmpl; 810 icmd->ulpLe = 1;
864 if (lpfc_sli_issue_iocb(phba, pring, abtsiocb, 0) == 811 icmd->ulpClass = cmd->ulpClass;
865 IOCB_ERROR) { 812 if (phba->hba_state >= LPFC_LINK_UP)
866 lpfc_sli_release_iocbq(phba, abtsiocb); 813 icmd->ulpCommand = CMD_ABORT_XRI_CN;
867 ret = IOCB_ERROR; 814 else
868 break; 815 icmd->ulpCommand = CMD_CLOSE_XRI_CN;
869 }
870 816
871 /* Wait for abort to complete */ 817 abtsiocb->iocb_cmpl = lpfc_sli_abort_fcp_cmpl;
872 while (cmnd->host_scribble) 818 if (lpfc_sli_issue_iocb(phba, pring, abtsiocb, 0) == IOCB_ERROR) {
873 { 819 lpfc_sli_release_iocbq(phba, abtsiocb);
874 spin_unlock_irq(phba->host->host_lock); 820 ret = FAILED;
875 set_current_state(TASK_UNINTERRUPTIBLE); 821 goto out;
876 schedule_timeout(LPFC_ABORT_WAIT*HZ); 822 }
877 spin_lock_irq(phba->host->host_lock);
878 if (++loop_count
879 > (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT)
880 break;
881 }
882 823
883 if(cmnd->host_scribble) { 824 /* Wait for abort to complete */
884 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 825 while (lpfc_cmd->pCmd == cmnd)
885 "%d:0748 abort handler timed " 826 {
886 "out waiting for abort to " 827 spin_unlock_irq(phba->host->host_lock);
887 "complete. Data: " 828 set_current_state(TASK_UNINTERRUPTIBLE);
888 "x%x x%x x%x x%lx\n", 829 schedule_timeout(LPFC_ABORT_WAIT*HZ);
889 phba->brd_no, ret, id, lun, snum); 830 spin_lock_irq(phba->host->host_lock);
890 cmnd->host_scribble = NULL; 831 if (++loop_count
891 iocb->iocb_cmpl = lpfc_scsi_cmd_iocb_cleanup; 832 > (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT)
892 ret = IOCB_ERROR; 833 break;
893 } 834 }
894 835
895 break; 836 if (lpfc_cmd->pCmd == cmnd) {
837 ret = FAILED;
838 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
839 "%d:0748 abort handler timed out waiting for "
840 "abort to complete: ret %#x, ID %d, LUN %d, "
841 "snum %#lx\n",
842 phba->brd_no, ret, cmnd->device->id,
843 cmnd->device->lun, cmnd->serial_number);
896 } 844 }
897 845
898 out: 846 out:
899 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 847 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
900 "%d:0749 SCSI layer issued abort device " 848 "%d:0749 SCSI layer issued abort device: ret %#x, "
901 "Data: x%x x%x x%x x%lx\n", 849 "ID %d, LUN %d, snum %#lx\n",
902 phba->brd_no, ret, id, lun, snum); 850 phba->brd_no, ret, cmnd->device->id,
851 cmnd->device->lun, cmnd->serial_number);
903 852
904 return ret == IOCB_SUCCESS ? SUCCESS : FAILED; 853 return ret;
905} 854}
906 855
907static int 856static int
@@ -919,10 +868,8 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
919{ 868{
920 struct Scsi_Host *shost = cmnd->device->host; 869 struct Scsi_Host *shost = cmnd->device->host;
921 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; 870 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];
922 struct lpfc_scsi_buf *lpfc_cmd = NULL; 871 struct lpfc_scsi_buf *lpfc_cmd;
923 struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list; 872 struct lpfc_iocbq *iocbq, *iocbqrsp;
924 struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list;
925 struct lpfc_iocbq *iocbq, *iocbqrsp = NULL;
926 struct lpfc_rport_data *rdata = cmnd->device->hostdata; 873 struct lpfc_rport_data *rdata = cmnd->device->hostdata;
927 struct lpfc_nodelist *pnode = rdata->pnode; 874 struct lpfc_nodelist *pnode = rdata->pnode;
928 int ret = FAILED; 875 int ret = FAILED;
@@ -946,7 +893,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
946 break; 893 break;
947 } 894 }
948 895
949 list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list); 896 lpfc_cmd = lpfc_sli_get_scsi_buf (phba);
950 if (lpfc_cmd == NULL) 897 if (lpfc_cmd == NULL)
951 goto out; 898 goto out;
952 899
@@ -961,7 +908,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
961 iocbq = &lpfc_cmd->cur_iocbq; 908 iocbq = &lpfc_cmd->cur_iocbq;
962 909
963 /* get a buffer for this IOCB command response */ 910 /* get a buffer for this IOCB command response */
964 list_remove_head(lpfc_iocb_list, iocbqrsp, struct lpfc_iocbq, list); 911 iocbqrsp = lpfc_sli_get_iocbq(phba);
965 if (iocbqrsp == NULL) 912 if (iocbqrsp == NULL)
966 goto out_free_scsi_buf; 913 goto out_free_scsi_buf;
967 914
@@ -1002,9 +949,10 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
1002 } 949 }
1003 950
1004 if (cnt) { 951 if (cnt) {
1005 lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 952 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
1006 "%d:0719 LUN Reset I/O flush failure: cnt x%x\n", 953 "%d:0719 LUN Reset I/O flush failure: cnt x%x\n",
1007 phba->brd_no, cnt); 954 phba->brd_no, cnt);
955 ret = FAILED;
1008 } 956 }
1009 957
1010 lpfc_sli_release_iocbq(phba, iocbqrsp); 958 lpfc_sli_release_iocbq(phba, iocbqrsp);
@@ -1016,7 +964,7 @@ out_free_scsi_buf:
1016 phba->brd_no, lpfc_cmd->pCmd->device->id, 964 phba->brd_no, lpfc_cmd->pCmd->device->id,
1017 lpfc_cmd->pCmd->device->lun, ret, lpfc_cmd->status, 965 lpfc_cmd->pCmd->device->lun, ret, lpfc_cmd->status,
1018 lpfc_cmd->result); 966 lpfc_cmd->result);
1019 lpfc_free_scsi_buf(lpfc_cmd); 967 lpfc_release_scsi_buf(phba, lpfc_cmd);
1020out: 968out:
1021 return ret; 969 return ret;
1022} 970}
@@ -1044,10 +992,9 @@ __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1044 int ret = FAILED, i, err_count = 0; 992 int ret = FAILED, i, err_count = 0;
1045 int cnt, loopcnt; 993 int cnt, loopcnt;
1046 unsigned int midlayer_id = 0; 994 unsigned int midlayer_id = 0;
1047 struct lpfc_scsi_buf * lpfc_cmd = NULL; 995 struct lpfc_scsi_buf * lpfc_cmd;
1048 struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list;
1049 996
1050 list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list); 997 lpfc_cmd = lpfc_sli_get_scsi_buf (phba);
1051 if (lpfc_cmd == NULL) 998 if (lpfc_cmd == NULL)
1052 goto out; 999 goto out;
1053 1000
@@ -1111,10 +1058,12 @@ __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1111 phba->brd_no, cnt, i); 1058 phba->brd_no, cnt, i);
1112 } 1059 }
1113 1060
1114 if (!err_count) 1061 if (cnt == 0)
1115 ret = SUCCESS; 1062 ret = SUCCESS;
1063 else
1064 ret = FAILED;
1116 1065
1117 lpfc_free_scsi_buf(lpfc_cmd); 1066 lpfc_release_scsi_buf(phba, lpfc_cmd);
1118 lpfc_printf_log(phba, 1067 lpfc_printf_log(phba,
1119 KERN_ERR, 1068 KERN_ERR,
1120 LOG_FCP, 1069 LOG_FCP,
@@ -1174,7 +1123,7 @@ lpfc_slave_alloc(struct scsi_device *sdev)
1174 } 1123 }
1175 1124
1176 for (i = 0; i < num_to_alloc; i++) { 1125 for (i = 0; i < num_to_alloc; i++) {
1177 scsi_buf = lpfc_get_scsi_buf(phba); 1126 scsi_buf = lpfc_new_scsi_buf(phba);
1178 if (!scsi_buf) { 1127 if (!scsi_buf) {
1179 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1128 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
1180 "%d:0706 Failed to allocate command " 1129 "%d:0706 Failed to allocate command "