diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index bf80cdefb506..a246410ce9df 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -59,6 +59,8 @@ static char *dif_op_str[] = { | |||
59 | }; | 59 | }; |
60 | static void | 60 | static void |
61 | lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); | 61 | lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); |
62 | static void | ||
63 | lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); | ||
62 | 64 | ||
63 | static void | 65 | static void |
64 | lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) | 66 | lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) |
@@ -596,7 +598,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc) | |||
596 | iocb->ulpClass = CLASS3; | 598 | iocb->ulpClass = CLASS3; |
597 | psb->status = IOSTAT_SUCCESS; | 599 | psb->status = IOSTAT_SUCCESS; |
598 | /* Put it back into the SCSI buffer list */ | 600 | /* Put it back into the SCSI buffer list */ |
599 | lpfc_release_scsi_buf_s4(phba, psb); | 601 | lpfc_release_scsi_buf_s3(phba, psb); |
600 | 602 | ||
601 | } | 603 | } |
602 | 604 | ||
@@ -2766,7 +2768,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
2766 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 2768 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
2767 | struct lpfc_hba *phba = vport->phba; | 2769 | struct lpfc_hba *phba = vport->phba; |
2768 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; | 2770 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; |
2769 | struct lpfc_nodelist *ndlp = rdata->pnode; | 2771 | struct lpfc_nodelist *ndlp; |
2770 | struct lpfc_scsi_buf *lpfc_cmd; | 2772 | struct lpfc_scsi_buf *lpfc_cmd; |
2771 | struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); | 2773 | struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); |
2772 | int err; | 2774 | int err; |
@@ -2776,6 +2778,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
2776 | cmnd->result = err; | 2778 | cmnd->result = err; |
2777 | goto out_fail_command; | 2779 | goto out_fail_command; |
2778 | } | 2780 | } |
2781 | ndlp = rdata->pnode; | ||
2779 | 2782 | ||
2780 | if (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && | 2783 | if (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && |
2781 | scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { | 2784 | scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { |
@@ -3154,9 +3157,15 @@ static int | |||
3154 | lpfc_chk_tgt_mapped(struct lpfc_vport *vport, struct scsi_cmnd *cmnd) | 3157 | lpfc_chk_tgt_mapped(struct lpfc_vport *vport, struct scsi_cmnd *cmnd) |
3155 | { | 3158 | { |
3156 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; | 3159 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; |
3157 | struct lpfc_nodelist *pnode = rdata->pnode; | 3160 | struct lpfc_nodelist *pnode; |
3158 | unsigned long later; | 3161 | unsigned long later; |
3159 | 3162 | ||
3163 | if (!rdata) { | ||
3164 | lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, | ||
3165 | "0797 Tgt Map rport failure: rdata x%p\n", rdata); | ||
3166 | return FAILED; | ||
3167 | } | ||
3168 | pnode = rdata->pnode; | ||
3160 | /* | 3169 | /* |
3161 | * If target is not in a MAPPED state, delay until | 3170 | * If target is not in a MAPPED state, delay until |
3162 | * target is rediscovered or devloss timeout expires. | 3171 | * target is rediscovered or devloss timeout expires. |
@@ -3241,12 +3250,18 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
3241 | struct Scsi_Host *shost = cmnd->device->host; | 3250 | struct Scsi_Host *shost = cmnd->device->host; |
3242 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 3251 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
3243 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; | 3252 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; |
3244 | struct lpfc_nodelist *pnode = rdata->pnode; | 3253 | struct lpfc_nodelist *pnode; |
3245 | unsigned tgt_id = cmnd->device->id; | 3254 | unsigned tgt_id = cmnd->device->id; |
3246 | unsigned int lun_id = cmnd->device->lun; | 3255 | unsigned int lun_id = cmnd->device->lun; |
3247 | struct lpfc_scsi_event_header scsi_event; | 3256 | struct lpfc_scsi_event_header scsi_event; |
3248 | int status; | 3257 | int status; |
3249 | 3258 | ||
3259 | if (!rdata) { | ||
3260 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, | ||
3261 | "0798 Device Reset rport failure: rdata x%p\n", rdata); | ||
3262 | return FAILED; | ||
3263 | } | ||
3264 | pnode = rdata->pnode; | ||
3250 | fc_block_scsi_eh(cmnd); | 3265 | fc_block_scsi_eh(cmnd); |
3251 | 3266 | ||
3252 | status = lpfc_chk_tgt_mapped(vport, cmnd); | 3267 | status = lpfc_chk_tgt_mapped(vport, cmnd); |
@@ -3300,12 +3315,18 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd) | |||
3300 | struct Scsi_Host *shost = cmnd->device->host; | 3315 | struct Scsi_Host *shost = cmnd->device->host; |
3301 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 3316 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
3302 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; | 3317 | struct lpfc_rport_data *rdata = cmnd->device->hostdata; |
3303 | struct lpfc_nodelist *pnode = rdata->pnode; | 3318 | struct lpfc_nodelist *pnode; |
3304 | unsigned tgt_id = cmnd->device->id; | 3319 | unsigned tgt_id = cmnd->device->id; |
3305 | unsigned int lun_id = cmnd->device->lun; | 3320 | unsigned int lun_id = cmnd->device->lun; |
3306 | struct lpfc_scsi_event_header scsi_event; | 3321 | struct lpfc_scsi_event_header scsi_event; |
3307 | int status; | 3322 | int status; |
3308 | 3323 | ||
3324 | if (!rdata) { | ||
3325 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, | ||
3326 | "0799 Target Reset rport failure: rdata x%p\n", rdata); | ||
3327 | return FAILED; | ||
3328 | } | ||
3329 | pnode = rdata->pnode; | ||
3309 | fc_block_scsi_eh(cmnd); | 3330 | fc_block_scsi_eh(cmnd); |
3310 | 3331 | ||
3311 | status = lpfc_chk_tgt_mapped(vport, cmnd); | 3332 | status = lpfc_chk_tgt_mapped(vport, cmnd); |
@@ -3486,6 +3507,8 @@ lpfc_slave_alloc(struct scsi_device *sdev) | |||
3486 | "Allocated %d buffers.\n", | 3507 | "Allocated %d buffers.\n", |
3487 | num_to_alloc, num_allocated); | 3508 | num_to_alloc, num_allocated); |
3488 | } | 3509 | } |
3510 | if (num_allocated > 0) | ||
3511 | phba->total_scsi_bufs += num_allocated; | ||
3489 | return 0; | 3512 | return 0; |
3490 | } | 3513 | } |
3491 | 3514 | ||