jr->reply_payload_rcv_len = job->reply_payload.payload_len;
jr->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
jr->result = zfcp_ct_els->status ? -EIO : 0;
- job->job_done(job);
+ fc_bsg_jobdone(job, jr->result, jr->reply_payload_rcv_len);
}
static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job)
bsg_reply->reply_payload_rcv_len = job->reply_payload.payload_len;
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
error:
/* free the command buffer */
bsg_reply->result = rc;
if (rc == BFA_STATUS_OK)
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
ibmvfc_free_event(evt);
spin_unlock_irqrestore(vhost->host->host_lock, flags);
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
rc = 0;
out:
dma_unmap_sg(vhost->dev, job->request_payload.sg_list,
-ECONNABORTED : -ETIMEDOUT;
job->reply_len = sizeof(uint32_t);
job->state_flags |= FC_RQST_STATE_DONE;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
kfree(info);
return;
}
job->reply_payload.payload_len;
bsg_reply->result = 0;
job->state_flags |= FC_RQST_STATE_DONE;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
kfree(info);
}
fc_frame_free(fp);
if (job) {
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
}
if (job) {
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
}
job->dd_data = NULL;
/* complete the job back to userspace */
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
spin_lock_irqsave(&phba->ct_ev_lock, flags);
}
}
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
job->dd_data = NULL;
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
job_error:
if (job) {
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
}
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
job->dd_data = NULL;
/* complete the job back to userspace if no error */
if (rc == IOCB_SUCCESS)
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
job_error:
bsg_reply->result = rc;
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
if (job) {
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
}
lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
{
struct fc_bsg_job *job;
+ struct fc_bsg_reply *bsg_reply;
job = lpfc_bsg_issue_mbox_ext_handle_job(phba, pmboxq);
mempool_free(pmboxq, phba->mbox_mem_pool);
/* if the job is still active, call job done */
- if (job)
- job->job_done(job);
-
+ if (job) {
+ bsg_reply = job->reply;
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
+ }
return;
}
lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
{
struct fc_bsg_job *job;
+ struct fc_bsg_reply *bsg_reply;
job = lpfc_bsg_issue_mbox_ext_handle_job(phba, pmboxq);
lpfc_bsg_mbox_ext_session_reset(phba);
/* if the job is still active, call job done */
- if (job)
- job->job_done(job);
+ if (job) {
+ bsg_reply = job->reply;
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
+ }
return;
}
/* wait for additoinal external buffers */
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
job_error:
}
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
}
/* wait for additoinal external buffers */
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
job_error:
/* job done */
bsg_reply->result = 0;
job->dd_data = NULL;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
} else if (rc == 1)
/* job submitted, will complete later*/
rc = 0; /* return zero, no error */
if (job) {
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
job_error:
bsg_reply->result = rc;
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
bsg_reply->result = res;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
sp->free(vha, sp);
}
}
exit_fcp_prio_cfg:
if (!ret)
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return ret;
}
bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
if (!rval)
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
ql_dbg(ql_dbg_user, vha, 0x7031,
"Vendor request 84xx reset completed.\n");
bsg_reply->result = DID_OK;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return rval;
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
if (!rval)
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
dma_pool_free(ha->s_dma_pool, mn, mn_dma);
if (!rval)
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
}
bsg_reply->result = DID_OK;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return rval;
ha->optrom_buffer = NULL;
ha->optrom_state = QLA_SWAITING;
mutex_unlock(&ha->optrom_mutex);
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
ha->optrom_buffer = NULL;
ha->optrom_state = QLA_SWAITING;
mutex_unlock(&ha->optrom_mutex);
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = sizeof(*sr);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = sizeof(*i2c);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = (DID_OK) << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
/* Always return success, vendor rsp carries correct status */
return 0;
}
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
bsg_job->reply_len = sizeof(*bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
stats, stats_dma);
bsg_job->reply_len = sizeof(*bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
kfree(dd);
* fc_bsg_jobdone - completion routine for bsg requests that the LLD has
* completed
* @job: fc_bsg_job that is complete
+ * @result: job reply result
+ * @reply_payload_rcv_len: length of payload received
*/
-static void
-fc_bsg_jobdone(struct fc_bsg_job *job)
+void fc_bsg_jobdone(struct fc_bsg_job *job, int result,
+ unsigned int reply_payload_rcv_len)
{
struct request *req = job->req;
struct request *rsp = req->next_rq;
- struct fc_bsg_reply *bsg_reply = job->reply;
int err;
- err = job->req->errors = bsg_reply->result;
+ err = job->req->errors = result;
if (err < 0)
/* we're only returning the result field in the reply */
req->resid_len = 0;
if (rsp) {
- WARN_ON(bsg_reply->reply_payload_rcv_len > rsp->resid_len);
+ WARN_ON(reply_payload_rcv_len > rsp->resid_len);
/* set reply (bidi) residual */
- rsp->resid_len -= min(bsg_reply->reply_payload_rcv_len,
- rsp->resid_len);
+ rsp->resid_len -= min(reply_payload_rcv_len, rsp->resid_len);
}
blk_complete_request(req);
}
+EXPORT_SYMBOL_GPL(fc_bsg_jobdone);
/**
* fc_bsg_softirq_done - softirq done routine for destroying the bsg requests
if (ret)
goto failjob_rls_rqst_payload;
}
- job->job_done = fc_bsg_jobdone;
if (rport)
job->dev = &rport->dev;
else
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = ret;
job->reply_len = sizeof(uint32_t);
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return FC_DISPATCH_UNLOCKED;
}
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = ret;
job->reply_len = sizeof(uint32_t);
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return FC_DISPATCH_UNLOCKED;
}
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = -ENOMSG;
job->reply_len = sizeof(uint32_t);
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
spin_lock_irq(q->queue_lock);
continue;
}
spinlock_t job_lock;
unsigned int state_flags;
unsigned int ref_cnt;
- void (*job_done)(struct fc_bsg_job *);
struct fc_bsg_request *request;
struct fc_bsg_reply *reply;
struct fc_vport_identifiers *);
int fc_vport_terminate(struct fc_vport *vport);
int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
+void fc_bsg_jobdone(struct fc_bsg_job *job, int result,
+ unsigned int reply_payload_rcv_len);
#endif /* SCSI_TRANSPORT_FC_H */