Lines Matching refs:job

3562 fc_destroy_bsgjob(struct fc_bsg_job *job)  in fc_destroy_bsgjob()  argument
3566 spin_lock_irqsave(&job->job_lock, flags); in fc_destroy_bsgjob()
3567 if (job->ref_cnt) { in fc_destroy_bsgjob()
3568 spin_unlock_irqrestore(&job->job_lock, flags); in fc_destroy_bsgjob()
3571 spin_unlock_irqrestore(&job->job_lock, flags); in fc_destroy_bsgjob()
3573 put_device(job->dev); /* release reference for the request */ in fc_destroy_bsgjob()
3575 kfree(job->request_payload.sg_list); in fc_destroy_bsgjob()
3576 kfree(job->reply_payload.sg_list); in fc_destroy_bsgjob()
3577 kfree(job); in fc_destroy_bsgjob()
3586 fc_bsg_jobdone(struct fc_bsg_job *job) in fc_bsg_jobdone() argument
3588 struct request *req = job->req; in fc_bsg_jobdone()
3592 err = job->req->errors = job->reply->result; in fc_bsg_jobdone()
3596 job->req->sense_len = sizeof(uint32_t); in fc_bsg_jobdone()
3598 job->req->sense_len = job->reply_len; in fc_bsg_jobdone()
3604 WARN_ON(job->reply->reply_payload_rcv_len > rsp->resid_len); in fc_bsg_jobdone()
3607 rsp->resid_len -= min(job->reply->reply_payload_rcv_len, in fc_bsg_jobdone()
3619 struct fc_bsg_job *job = rq->special; in fc_bsg_softirq_done() local
3622 spin_lock_irqsave(&job->job_lock, flags); in fc_bsg_softirq_done()
3623 job->state_flags |= FC_RQST_STATE_DONE; in fc_bsg_softirq_done()
3624 job->ref_cnt--; in fc_bsg_softirq_done()
3625 spin_unlock_irqrestore(&job->job_lock, flags); in fc_bsg_softirq_done()
3628 fc_destroy_bsgjob(job); in fc_bsg_softirq_done()
3638 struct fc_bsg_job *job = (void *) req->special; in fc_bsg_job_timeout() local
3639 struct Scsi_Host *shost = job->shost; in fc_bsg_job_timeout()
3644 if (job->rport && job->rport->port_state == FC_PORTSTATE_BLOCKED) in fc_bsg_job_timeout()
3647 spin_lock_irqsave(&job->job_lock, flags); in fc_bsg_job_timeout()
3648 if (job->state_flags & FC_RQST_STATE_DONE) in fc_bsg_job_timeout()
3651 job->ref_cnt++; in fc_bsg_job_timeout()
3652 spin_unlock_irqrestore(&job->job_lock, flags); in fc_bsg_job_timeout()
3656 err = i->f->bsg_timeout(job); in fc_bsg_job_timeout()
3658 job->ref_cnt--; in fc_bsg_job_timeout()
3702 struct fc_bsg_job *job; in fc_req_to_bsgjob() local
3707 job = kzalloc(sizeof(struct fc_bsg_job) + i->f->dd_bsg_size, in fc_req_to_bsgjob()
3709 if (!job) in fc_req_to_bsgjob()
3721 req->special = job; in fc_req_to_bsgjob()
3722 job->shost = shost; in fc_req_to_bsgjob()
3723 job->rport = rport; in fc_req_to_bsgjob()
3724 job->req = req; in fc_req_to_bsgjob()
3726 job->dd_data = (void *)&job[1]; in fc_req_to_bsgjob()
3727 spin_lock_init(&job->job_lock); in fc_req_to_bsgjob()
3728 job->request = (struct fc_bsg_request *)req->cmd; in fc_req_to_bsgjob()
3729 job->request_len = req->cmd_len; in fc_req_to_bsgjob()
3730 job->reply = req->sense; in fc_req_to_bsgjob()
3731 job->reply_len = SCSI_SENSE_BUFFERSIZE; /* Size of sense buffer in fc_req_to_bsgjob()
3734 ret = fc_bsg_map_buffer(&job->request_payload, req); in fc_req_to_bsgjob()
3739 ret = fc_bsg_map_buffer(&job->reply_payload, rsp); in fc_req_to_bsgjob()
3743 job->job_done = fc_bsg_jobdone; in fc_req_to_bsgjob()
3745 job->dev = &rport->dev; in fc_req_to_bsgjob()
3747 job->dev = &shost->shost_gendev; in fc_req_to_bsgjob()
3748 get_device(job->dev); /* take a reference for the request */ in fc_req_to_bsgjob()
3750 job->ref_cnt = 1; in fc_req_to_bsgjob()
3756 kfree(job->request_payload.sg_list); in fc_req_to_bsgjob()
3758 kfree(job); in fc_req_to_bsgjob()
3778 struct fc_bsg_job *job) in fc_bsg_host_dispatch() argument
3785 switch (job->request->msgcode) { in fc_bsg_host_dispatch()
3797 if ((!job->request_payload.payload_len) || in fc_bsg_host_dispatch()
3798 (!job->reply_payload.payload_len)) { in fc_bsg_host_dispatch()
3807 if ((!job->request_payload.payload_len) || in fc_bsg_host_dispatch()
3808 (!job->reply_payload.payload_len)) { in fc_bsg_host_dispatch()
3817 (job->request->rqst_data.h_vendor.vendor_id != in fc_bsg_host_dispatch()
3830 if (job->request_len < cmdlen) { in fc_bsg_host_dispatch()
3835 ret = i->f->bsg_request(job); in fc_bsg_host_dispatch()
3841 BUG_ON(job->reply_len < sizeof(uint32_t)); in fc_bsg_host_dispatch()
3842 job->reply->reply_payload_rcv_len = 0; in fc_bsg_host_dispatch()
3843 job->reply->result = ret; in fc_bsg_host_dispatch()
3844 job->reply_len = sizeof(uint32_t); in fc_bsg_host_dispatch()
3845 fc_bsg_jobdone(job); in fc_bsg_host_dispatch()
3877 struct fc_rport *rport, struct fc_bsg_job *job) in fc_bsg_rport_dispatch() argument
3884 switch (job->request->msgcode) { in fc_bsg_rport_dispatch()
3893 if ((!job->request_payload.payload_len) || in fc_bsg_rport_dispatch()
3894 (!job->reply_payload.payload_len)) { in fc_bsg_rport_dispatch()
3905 if (job->request_len < cmdlen) { in fc_bsg_rport_dispatch()
3910 ret = i->f->bsg_request(job); in fc_bsg_rport_dispatch()
3916 BUG_ON(job->reply_len < sizeof(uint32_t)); in fc_bsg_rport_dispatch()
3917 job->reply->reply_payload_rcv_len = 0; in fc_bsg_rport_dispatch()
3918 job->reply->result = ret; in fc_bsg_rport_dispatch()
3919 job->reply_len = sizeof(uint32_t); in fc_bsg_rport_dispatch()
3920 fc_bsg_jobdone(job); in fc_bsg_rport_dispatch()
3937 struct fc_bsg_job *job; in fc_bsg_request_handler() local
3970 job = req->special; in fc_bsg_request_handler()
3973 if (job->request_len < sizeof(uint32_t)) { in fc_bsg_request_handler()
3974 BUG_ON(job->reply_len < sizeof(uint32_t)); in fc_bsg_request_handler()
3975 job->reply->reply_payload_rcv_len = 0; in fc_bsg_request_handler()
3976 job->reply->result = -ENOMSG; in fc_bsg_request_handler()
3977 job->reply_len = sizeof(uint32_t); in fc_bsg_request_handler()
3978 fc_bsg_jobdone(job); in fc_bsg_request_handler()
3985 ret = fc_bsg_rport_dispatch(q, shost, rport, job); in fc_bsg_request_handler()
3987 ret = fc_bsg_host_dispatch(q, shost, job); in fc_bsg_request_handler()