Lines Matching +full:hba +full:- +full:port +full:- +full:cap

1 // SPDX-License-Identifier: GPL-2.0-only
3 * QLogic Fibre Channel HBA Driver
4 * Copyright (c) 2003-2014 QLogic Corporation
12 #include <linux/bsg-lib.h>
25 struct bsg_job *bsg_job = sp->u.bsg_job; in qla2x00_bsg_job_done()
26 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_bsg_job_done()
27 struct completion *comp = sp->comp; in qla2x00_bsg_job_done()
29 ql_dbg(ql_dbg_user, sp->vha, 0x7009, in qla2x00_bsg_job_done()
31 __func__, sp->handle, res, bsg_job); in qla2x00_bsg_job_done()
34 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_bsg_job_done()
36 bsg_reply->result = res; in qla2x00_bsg_job_done()
37 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_bsg_job_done()
38 bsg_reply->reply_payload_rcv_len); in qla2x00_bsg_job_done()
46 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_bsg_sp_free()
47 struct bsg_job *bsg_job = sp->u.bsg_job; in qla2x00_bsg_sp_free()
48 struct fc_bsg_request *bsg_request = bsg_job->request; in qla2x00_bsg_sp_free()
51 if (sp->type == SRB_FXIOCB_BCMD) { in qla2x00_bsg_sp_free()
53 &bsg_request->rqst_data.h_vendor.vendor_cmd[1]; in qla2x00_bsg_sp_free()
55 if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) in qla2x00_bsg_sp_free()
56 dma_unmap_sg(&ha->pdev->dev, in qla2x00_bsg_sp_free()
57 bsg_job->request_payload.sg_list, in qla2x00_bsg_sp_free()
58 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla2x00_bsg_sp_free()
60 if (piocb_rqst->flags & SRB_FXDISC_RESP_DMA_VALID) in qla2x00_bsg_sp_free()
61 dma_unmap_sg(&ha->pdev->dev, in qla2x00_bsg_sp_free()
62 bsg_job->reply_payload.sg_list, in qla2x00_bsg_sp_free()
63 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla2x00_bsg_sp_free()
66 if (sp->remap.remapped) { in qla2x00_bsg_sp_free()
67 dma_pool_free(ha->purex_dma_pool, sp->remap.rsp.buf, in qla2x00_bsg_sp_free()
68 sp->remap.rsp.dma); in qla2x00_bsg_sp_free()
69 dma_pool_free(ha->purex_dma_pool, sp->remap.req.buf, in qla2x00_bsg_sp_free()
70 sp->remap.req.dma); in qla2x00_bsg_sp_free()
72 dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla2x00_bsg_sp_free()
73 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla2x00_bsg_sp_free()
75 dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, in qla2x00_bsg_sp_free()
76 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla2x00_bsg_sp_free()
80 if (sp->type == SRB_CT_CMD || in qla2x00_bsg_sp_free()
81 sp->type == SRB_FXIOCB_BCMD || in qla2x00_bsg_sp_free()
82 sp->type == SRB_ELS_CMD_HST) { in qla2x00_bsg_sp_free()
83 INIT_WORK(&sp->fcport->free_work, qla2xxx_free_fcport_work); in qla2x00_bsg_sp_free()
84 queue_work(ha->wq, &sp->fcport->free_work); in qla2x00_bsg_sp_free()
122 pri_entry = &pri_cfg->entry[0]; in qla24xx_fcp_prio_cfg_valid()
123 for (i = 0; i < pri_cfg->num_entries; i++) { in qla24xx_fcp_prio_cfg_valid()
124 if (pri_entry->flags & FCP_PRIO_ENTRY_TAG_VALID) in qla24xx_fcp_prio_cfg_valid()
148 struct fc_bsg_request *bsg_request = bsg_job->request; in qla24xx_proc_fcp_prio_cfg_cmd()
149 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla24xx_proc_fcp_prio_cfg_cmd()
151 struct qla_hw_data *ha = vha->hw; in qla24xx_proc_fcp_prio_cfg_cmd()
157 ret = -EINVAL; in qla24xx_proc_fcp_prio_cfg_cmd()
162 oper = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; in qla24xx_proc_fcp_prio_cfg_cmd()
165 if (!ha->fcp_prio_cfg && (oper != QLFC_FCP_PRIO_SET_CONFIG)) { in qla24xx_proc_fcp_prio_cfg_cmd()
166 ret = -EINVAL; in qla24xx_proc_fcp_prio_cfg_cmd()
171 if (ha->flags.fcp_prio_enabled) { in qla24xx_proc_fcp_prio_cfg_cmd()
172 ha->flags.fcp_prio_enabled = 0; in qla24xx_proc_fcp_prio_cfg_cmd()
173 ha->fcp_prio_cfg->attributes &= in qla24xx_proc_fcp_prio_cfg_cmd()
176 bsg_reply->result = DID_OK; in qla24xx_proc_fcp_prio_cfg_cmd()
178 ret = -EINVAL; in qla24xx_proc_fcp_prio_cfg_cmd()
179 bsg_reply->result = (DID_ERROR << 16); in qla24xx_proc_fcp_prio_cfg_cmd()
185 if (!ha->flags.fcp_prio_enabled) { in qla24xx_proc_fcp_prio_cfg_cmd()
186 if (ha->fcp_prio_cfg) { in qla24xx_proc_fcp_prio_cfg_cmd()
187 ha->flags.fcp_prio_enabled = 1; in qla24xx_proc_fcp_prio_cfg_cmd()
188 ha->fcp_prio_cfg->attributes |= in qla24xx_proc_fcp_prio_cfg_cmd()
191 bsg_reply->result = DID_OK; in qla24xx_proc_fcp_prio_cfg_cmd()
193 ret = -EINVAL; in qla24xx_proc_fcp_prio_cfg_cmd()
194 bsg_reply->result = (DID_ERROR << 16); in qla24xx_proc_fcp_prio_cfg_cmd()
201 len = bsg_job->reply_payload.payload_len; in qla24xx_proc_fcp_prio_cfg_cmd()
203 ret = -EINVAL; in qla24xx_proc_fcp_prio_cfg_cmd()
204 bsg_reply->result = (DID_ERROR << 16); in qla24xx_proc_fcp_prio_cfg_cmd()
208 bsg_reply->result = DID_OK; in qla24xx_proc_fcp_prio_cfg_cmd()
209 bsg_reply->reply_payload_rcv_len = in qla24xx_proc_fcp_prio_cfg_cmd()
211 bsg_job->reply_payload.sg_list, in qla24xx_proc_fcp_prio_cfg_cmd()
212 bsg_job->reply_payload.sg_cnt, ha->fcp_prio_cfg, in qla24xx_proc_fcp_prio_cfg_cmd()
218 len = bsg_job->request_payload.payload_len; in qla24xx_proc_fcp_prio_cfg_cmd()
220 bsg_reply->result = (DID_ERROR << 16); in qla24xx_proc_fcp_prio_cfg_cmd()
221 ret = -EINVAL; in qla24xx_proc_fcp_prio_cfg_cmd()
225 if (!ha->fcp_prio_cfg) { in qla24xx_proc_fcp_prio_cfg_cmd()
226 ha->fcp_prio_cfg = vmalloc(FCP_PRIO_CFG_SIZE); in qla24xx_proc_fcp_prio_cfg_cmd()
227 if (!ha->fcp_prio_cfg) { in qla24xx_proc_fcp_prio_cfg_cmd()
231 bsg_reply->result = (DID_ERROR << 16); in qla24xx_proc_fcp_prio_cfg_cmd()
232 ret = -ENOMEM; in qla24xx_proc_fcp_prio_cfg_cmd()
237 memset(ha->fcp_prio_cfg, 0, FCP_PRIO_CFG_SIZE); in qla24xx_proc_fcp_prio_cfg_cmd()
238 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla24xx_proc_fcp_prio_cfg_cmd()
239 bsg_job->request_payload.sg_cnt, ha->fcp_prio_cfg, in qla24xx_proc_fcp_prio_cfg_cmd()
244 if (!qla24xx_fcp_prio_cfg_valid(vha, ha->fcp_prio_cfg, 1)) { in qla24xx_proc_fcp_prio_cfg_cmd()
245 bsg_reply->result = (DID_ERROR << 16); in qla24xx_proc_fcp_prio_cfg_cmd()
246 ret = -EINVAL; in qla24xx_proc_fcp_prio_cfg_cmd()
250 vfree(ha->fcp_prio_cfg); in qla24xx_proc_fcp_prio_cfg_cmd()
251 ha->fcp_prio_cfg = NULL; in qla24xx_proc_fcp_prio_cfg_cmd()
255 ha->flags.fcp_prio_enabled = 0; in qla24xx_proc_fcp_prio_cfg_cmd()
256 if (ha->fcp_prio_cfg->attributes & FCP_PRIO_ATTR_ENABLE) in qla24xx_proc_fcp_prio_cfg_cmd()
257 ha->flags.fcp_prio_enabled = 1; in qla24xx_proc_fcp_prio_cfg_cmd()
259 bsg_reply->result = DID_OK; in qla24xx_proc_fcp_prio_cfg_cmd()
262 ret = -EINVAL; in qla24xx_proc_fcp_prio_cfg_cmd()
267 bsg_job_done(bsg_job, bsg_reply->result, in qla24xx_proc_fcp_prio_cfg_cmd()
268 bsg_reply->reply_payload_rcv_len); in qla24xx_proc_fcp_prio_cfg_cmd()
275 struct fc_bsg_request *bsg_request = bsg_job->request; in qla2x00_process_els()
288 if (bsg_request->msgcode == FC_BSG_RPT_ELS) { in qla2x00_process_els()
291 rval = -ENOMEM; in qla2x00_process_els()
294 fcport = *(fc_port_t **) rport->dd_data; in qla2x00_process_els()
297 ha = vha->hw; in qla2x00_process_els()
302 ha = vha->hw; in qla2x00_process_els()
304 els_cmd = bsg_request->rqst_data.h_els.command_code; in qla2x00_process_els()
309 if (!vha->flags.online) { in qla2x00_process_els()
311 rval = -EIO; in qla2x00_process_els()
319 rval = -EPERM; in qla2x00_process_els()
324 if (bsg_job->request_payload.sg_cnt > 1 || in qla2x00_process_els()
325 bsg_job->reply_payload.sg_cnt > 1) { in qla2x00_process_els()
329 bsg_job->request_payload.sg_cnt, in qla2x00_process_els()
330 bsg_job->reply_payload.sg_cnt); in qla2x00_process_els()
331 rval = -ENOBUFS; in qla2x00_process_els()
336 if (bsg_request->msgcode == FC_BSG_RPT_ELS) { in qla2x00_process_els()
340 if (atomic_read(&fcport->state) != FCS_ONLINE) { in qla2x00_process_els()
342 "Port %06X is not online for ELS passthru.\n", in qla2x00_process_els()
343 fcport->d_id.b24); in qla2x00_process_els()
344 rval = -EIO; in qla2x00_process_els()
349 * preparing the IOCB and mailbox command retrieves port in qla2x00_process_els()
355 rval = -ENOMEM; in qla2x00_process_els()
361 fcport->vha = vha; in qla2x00_process_els()
362 fcport->d_id.b.al_pa = in qla2x00_process_els()
363 bsg_request->rqst_data.h_els.port_id[0]; in qla2x00_process_els()
364 fcport->d_id.b.area = in qla2x00_process_els()
365 bsg_request->rqst_data.h_els.port_id[1]; in qla2x00_process_els()
366 fcport->d_id.b.domain = in qla2x00_process_els()
367 bsg_request->rqst_data.h_els.port_id[2]; in qla2x00_process_els()
368 fcport->loop_id = in qla2x00_process_els()
369 (fcport->d_id.b.al_pa == 0xFD) ? in qla2x00_process_els()
374 dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla2x00_process_els()
375 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla2x00_process_els()
377 dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla2x00_process_els()
378 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla2x00_process_els()
379 rval = -ENOMEM; in qla2x00_process_els()
383 rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, in qla2x00_process_els()
384 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla2x00_process_els()
386 dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, in qla2x00_process_els()
387 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla2x00_process_els()
388 rval = -ENOMEM; in qla2x00_process_els()
392 if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || in qla2x00_process_els()
393 (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { in qla2x00_process_els()
397 "dma_reply_sg_cnt:%x.\n", bsg_job->request_payload.sg_cnt, in qla2x00_process_els()
398 req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); in qla2x00_process_els()
399 rval = -EAGAIN; in qla2x00_process_els()
406 rval = -ENOMEM; in qla2x00_process_els()
410 sp->type = in qla2x00_process_els()
411 (bsg_request->msgcode == FC_BSG_RPT_ELS ? in qla2x00_process_els()
413 sp->name = in qla2x00_process_els()
414 (bsg_request->msgcode == FC_BSG_RPT_ELS ? in qla2x00_process_els()
416 sp->u.bsg_job = bsg_job; in qla2x00_process_els()
417 sp->free = qla2x00_bsg_sp_free; in qla2x00_process_els()
418 sp->done = qla2x00_bsg_job_done; in qla2x00_process_els()
421 "bsg rqst type: %s els type: %x - loop-id=%x " in qla2x00_process_els()
422 "portid=%-2x%02x%02x.\n", type, in qla2x00_process_els()
423 bsg_request->rqst_data.h_els.command_code, fcport->loop_id, in qla2x00_process_els()
424 fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); in qla2x00_process_els()
431 rval = -EIO; in qla2x00_process_els()
437 dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla2x00_process_els()
438 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla2x00_process_els()
439 dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, in qla2x00_process_els()
440 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla2x00_process_els()
457 iocbs += (dsds - 2) / 5; in qla24xx_calc_ct_iocbs()
458 if ((dsds - 2) % 5) in qla24xx_calc_ct_iocbs()
468 struct fc_bsg_request *bsg_request = bsg_job->request; in qla2x00_process_ct()
471 struct qla_hw_data *ha = vha->hw; in qla2x00_process_ct()
479 dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla2x00_process_ct()
480 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla2x00_process_ct()
484 rval = -ENOMEM; in qla2x00_process_ct()
488 rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, in qla2x00_process_ct()
489 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla2x00_process_ct()
493 rval = -ENOMEM; in qla2x00_process_ct()
497 if (!vha->flags.online) { in qla2x00_process_ct()
500 rval = -EIO; in qla2x00_process_ct()
505 (bsg_request->rqst_data.h_ct.preamble_word1 & 0xFF000000) in qla2x00_process_ct()
512 loop_id = vha->mgmt_svr_loop_id; in qla2x00_process_ct()
517 rval = -EINVAL; in qla2x00_process_ct()
522 * IOCB and mailbox command retrieves port specific information in qla2x00_process_ct()
530 rval = -ENOMEM; in qla2x00_process_ct()
535 fcport->vha = vha; in qla2x00_process_ct()
536 fcport->d_id.b.al_pa = bsg_request->rqst_data.h_ct.port_id[0]; in qla2x00_process_ct()
537 fcport->d_id.b.area = bsg_request->rqst_data.h_ct.port_id[1]; in qla2x00_process_ct()
538 fcport->d_id.b.domain = bsg_request->rqst_data.h_ct.port_id[2]; in qla2x00_process_ct()
539 fcport->loop_id = loop_id; in qla2x00_process_ct()
546 rval = -ENOMEM; in qla2x00_process_ct()
550 sp->type = SRB_CT_CMD; in qla2x00_process_ct()
551 sp->name = "bsg_ct"; in qla2x00_process_ct()
552 sp->iocbs = qla24xx_calc_ct_iocbs(req_sg_cnt + rsp_sg_cnt); in qla2x00_process_ct()
553 sp->u.bsg_job = bsg_job; in qla2x00_process_ct()
554 sp->free = qla2x00_bsg_sp_free; in qla2x00_process_ct()
555 sp->done = qla2x00_bsg_job_done; in qla2x00_process_ct()
558 "bsg rqst type: %s else type: %x - " in qla2x00_process_ct()
559 "loop-id=%x portid=%02x%02x%02x.\n", type, in qla2x00_process_ct()
560 (bsg_request->rqst_data.h_ct.preamble_word2 >> 16), in qla2x00_process_ct()
561 fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, in qla2x00_process_ct()
562 fcport->d_id.b.al_pa); in qla2x00_process_ct()
569 rval = -EIO; in qla2x00_process_ct()
577 dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla2x00_process_ct()
578 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla2x00_process_ct()
579 dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, in qla2x00_process_ct()
580 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla2x00_process_ct()
593 struct qla_hw_data *ha = vha->hw; in qla81xx_reset_loopback_mode()
608 ha->notify_dcbx_comp = wait; in qla81xx_reset_loopback_mode()
609 ha->notify_lb_portup_comp = wait2; in qla81xx_reset_loopback_mode()
614 "Set port config failed.\n"); in qla81xx_reset_loopback_mode()
615 ha->notify_dcbx_comp = 0; in qla81xx_reset_loopback_mode()
616 ha->notify_lb_portup_comp = 0; in qla81xx_reset_loopback_mode()
617 rval = -EINVAL; in qla81xx_reset_loopback_mode()
622 if (wait && !wait_for_completion_timeout(&ha->dcbx_comp, in qla81xx_reset_loopback_mode()
626 ha->notify_dcbx_comp = 0; in qla81xx_reset_loopback_mode()
627 ha->notify_lb_portup_comp = 0; in qla81xx_reset_loopback_mode()
628 rval = -EINVAL; in qla81xx_reset_loopback_mode()
635 !wait_for_completion_timeout(&ha->lb_portup_comp, in qla81xx_reset_loopback_mode()
638 "Port up completion not received.\n"); in qla81xx_reset_loopback_mode()
639 ha->notify_lb_portup_comp = 0; in qla81xx_reset_loopback_mode()
640 rval = -EINVAL; in qla81xx_reset_loopback_mode()
644 "Port up completion received.\n"); in qla81xx_reset_loopback_mode()
646 ha->notify_dcbx_comp = 0; in qla81xx_reset_loopback_mode()
647 ha->notify_lb_portup_comp = 0; in qla81xx_reset_loopback_mode()
654 * Set the port configuration to enable the internal or external loopback
664 struct qla_hw_data *ha = vha->hw; in qla81xx_set_loopback_mode()
678 ha->notify_dcbx_comp = 1; in qla81xx_set_loopback_mode()
682 "set port config failed.\n"); in qla81xx_set_loopback_mode()
683 ha->notify_dcbx_comp = 0; in qla81xx_set_loopback_mode()
684 rval = -EINVAL; in qla81xx_set_loopback_mode()
691 rem_tmo = wait_for_completion_timeout(&ha->dcbx_comp, in qla81xx_set_loopback_mode()
693 if (!ha->idc_extend_tmo || rem_tmo) { in qla81xx_set_loopback_mode()
694 ha->idc_extend_tmo = 0; in qla81xx_set_loopback_mode()
697 current_tmo = ha->idc_extend_tmo * HZ; in qla81xx_set_loopback_mode()
698 ha->idc_extend_tmo = 0; in qla81xx_set_loopback_mode()
711 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla81xx_set_loopback_mode()
713 rval = -EINVAL; in qla81xx_set_loopback_mode()
715 if (ha->flags.idc_compl_status) { in qla81xx_set_loopback_mode()
718 rval = -EINVAL; in qla81xx_set_loopback_mode()
719 ha->flags.idc_compl_status = 0; in qla81xx_set_loopback_mode()
725 ha->notify_dcbx_comp = 0; in qla81xx_set_loopback_mode()
726 ha->idc_extend_tmo = 0; in qla81xx_set_loopback_mode()
735 struct fc_bsg_request *bsg_request = bsg_job->request; in qla2x00_process_loopback()
736 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_process_loopback()
739 struct qla_hw_data *ha = vha->hw; in qla2x00_process_loopback()
754 if (!vha->flags.online) { in qla2x00_process_loopback()
756 return -EIO; in qla2x00_process_loopback()
761 elreq.req_sg_cnt = dma_map_sg(&ha->pdev->dev, in qla2x00_process_loopback()
762 bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, in qla2x00_process_loopback()
768 return -ENOMEM; in qla2x00_process_loopback()
771 elreq.rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, in qla2x00_process_loopback()
772 bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, in qla2x00_process_loopback()
778 rval = -ENOMEM; in qla2x00_process_loopback()
782 if ((elreq.req_sg_cnt != bsg_job->request_payload.sg_cnt) || in qla2x00_process_loopback()
783 (elreq.rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { in qla2x00_process_loopback()
788 bsg_job->request_payload.sg_cnt, elreq.req_sg_cnt, in qla2x00_process_loopback()
789 bsg_job->reply_payload.sg_cnt, elreq.rsp_sg_cnt); in qla2x00_process_loopback()
790 rval = -EAGAIN; in qla2x00_process_loopback()
793 req_data_len = rsp_data_len = bsg_job->request_payload.payload_len; in qla2x00_process_loopback()
794 req_data = dma_alloc_coherent(&ha->pdev->dev, req_data_len, in qla2x00_process_loopback()
799 rval = -ENOMEM; in qla2x00_process_loopback()
803 rsp_data = dma_alloc_coherent(&ha->pdev->dev, rsp_data_len, in qla2x00_process_loopback()
808 rval = -ENOMEM; in qla2x00_process_loopback()
813 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_process_loopback()
814 bsg_job->request_payload.sg_cnt, req_data, req_data_len); in qla2x00_process_loopback()
820 elreq.options = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; in qla2x00_process_loopback()
822 bsg_request->rqst_data.h_vendor.vendor_cmd[2]; in qla2x00_process_loopback()
824 if (atomic_read(&vha->loop_state) == LOOP_READY && in qla2x00_process_loopback()
825 ((ha->current_topology == ISP_CFG_F && (elreq.options & 7) >= 2) || in qla2x00_process_loopback()
842 "Get port config failed.\n"); in qla2x00_process_loopback()
843 rval = -EPERM; in qla2x00_process_loopback()
851 rval = -EAGAIN; in qla2x00_process_loopback()
870 rval = -EPERM; in qla2x00_process_loopback()
885 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla2x00_process_loopback()
897 rval = -EIO; in qla2x00_process_loopback()
904 /* Revert back to original port config in qla2x00_process_loopback()
917 &vha->dpc_flags); in qla2x00_process_loopback()
936 bsg_reply->result = (DID_ERROR << 16); in qla2x00_process_loopback()
937 bsg_reply->reply_payload_rcv_len = 0; in qla2x00_process_loopback()
941 bsg_reply->result = (DID_OK << 16); in qla2x00_process_loopback()
942 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_process_loopback()
943 bsg_job->reply_payload.sg_cnt, rsp_data, in qla2x00_process_loopback()
947 bsg_job->reply_len = sizeof(struct fc_bsg_reply) + in qla2x00_process_loopback()
949 fw_sts_ptr = bsg_job->reply + sizeof(struct fc_bsg_reply); in qla2x00_process_loopback()
950 memcpy(bsg_job->reply + sizeof(struct fc_bsg_reply), response, in qla2x00_process_loopback()
956 dma_free_coherent(&ha->pdev->dev, rsp_data_len, in qla2x00_process_loopback()
959 dma_free_coherent(&ha->pdev->dev, req_data_len, in qla2x00_process_loopback()
962 dma_unmap_sg(&ha->pdev->dev, in qla2x00_process_loopback()
963 bsg_job->reply_payload.sg_list, in qla2x00_process_loopback()
964 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla2x00_process_loopback()
966 dma_unmap_sg(&ha->pdev->dev, in qla2x00_process_loopback()
967 bsg_job->request_payload.sg_list, in qla2x00_process_loopback()
968 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla2x00_process_loopback()
970 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_process_loopback()
971 bsg_reply->reply_payload_rcv_len); in qla2x00_process_loopback()
978 struct fc_bsg_request *bsg_request = bsg_job->request; in qla84xx_reset()
980 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla84xx_reset()
982 struct qla_hw_data *ha = vha->hw; in qla84xx_reset()
988 return -EINVAL; in qla84xx_reset()
991 flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; in qla84xx_reset()
1003 bsg_reply->result = DID_OK; in qla84xx_reset()
1004 bsg_job_done(bsg_job, bsg_reply->result, in qla84xx_reset()
1005 bsg_reply->reply_payload_rcv_len); in qla84xx_reset()
1014 struct fc_bsg_request *bsg_request = bsg_job->request; in qla84xx_updatefw()
1015 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla84xx_updatefw()
1018 struct qla_hw_data *ha = vha->hw; in qla84xx_updatefw()
1032 return -EINVAL; in qla84xx_updatefw()
1035 sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla84xx_updatefw()
1036 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla84xx_updatefw()
1040 return -ENOMEM; in qla84xx_updatefw()
1043 if (sg_cnt != bsg_job->request_payload.sg_cnt) { in qla84xx_updatefw()
1047 bsg_job->request_payload.sg_cnt, sg_cnt); in qla84xx_updatefw()
1048 rval = -EAGAIN; in qla84xx_updatefw()
1052 data_len = bsg_job->request_payload.payload_len; in qla84xx_updatefw()
1053 fw_buf = dma_alloc_coherent(&ha->pdev->dev, data_len, in qla84xx_updatefw()
1058 rval = -ENOMEM; in qla84xx_updatefw()
1062 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla84xx_updatefw()
1063 bsg_job->request_payload.sg_cnt, fw_buf, data_len); in qla84xx_updatefw()
1065 mn = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); in qla84xx_updatefw()
1069 rval = -ENOMEM; in qla84xx_updatefw()
1073 flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; in qla84xx_updatefw()
1076 mn->entry_type = VERIFY_CHIP_IOCB_TYPE; in qla84xx_updatefw()
1077 mn->entry_count = 1; in qla84xx_updatefw()
1083 mn->options = cpu_to_le16(options); in qla84xx_updatefw()
1084 mn->fw_ver = cpu_to_le32(fw_ver); in qla84xx_updatefw()
1085 mn->fw_size = cpu_to_le32(data_len); in qla84xx_updatefw()
1086 mn->fw_seq_size = cpu_to_le32(data_len); in qla84xx_updatefw()
1087 put_unaligned_le64(fw_dma, &mn->dsd.address); in qla84xx_updatefw()
1088 mn->dsd.length = cpu_to_le32(data_len); in qla84xx_updatefw()
1089 mn->data_seg_cnt = cpu_to_le16(1); in qla84xx_updatefw()
1102 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla84xx_updatefw()
1103 bsg_reply->result = DID_OK; in qla84xx_updatefw()
1106 dma_pool_free(ha->s_dma_pool, mn, mn_dma); in qla84xx_updatefw()
1109 dma_free_coherent(&ha->pdev->dev, data_len, fw_buf, fw_dma); in qla84xx_updatefw()
1112 dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla84xx_updatefw()
1113 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla84xx_updatefw()
1116 bsg_job_done(bsg_job, bsg_reply->result, in qla84xx_updatefw()
1117 bsg_reply->reply_payload_rcv_len); in qla84xx_updatefw()
1124 struct fc_bsg_request *bsg_request = bsg_job->request; in qla84xx_mgmt_cmd()
1125 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla84xx_mgmt_cmd()
1128 struct qla_hw_data *ha = vha->hw; in qla84xx_mgmt_cmd()
1141 return -EINVAL; in qla84xx_mgmt_cmd()
1144 mn = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); in qla84xx_mgmt_cmd()
1148 return -ENOMEM; in qla84xx_mgmt_cmd()
1151 mn->entry_type = ACCESS_CHIP_IOCB_TYPE; in qla84xx_mgmt_cmd()
1152 mn->entry_count = 1; in qla84xx_mgmt_cmd()
1154 switch (ql84_mgmt->mgmt.cmd) { in qla84xx_mgmt_cmd()
1157 sg_cnt = dma_map_sg(&ha->pdev->dev, in qla84xx_mgmt_cmd()
1158 bsg_job->reply_payload.sg_list, in qla84xx_mgmt_cmd()
1159 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla84xx_mgmt_cmd()
1163 rval = -ENOMEM; in qla84xx_mgmt_cmd()
1169 if (sg_cnt != bsg_job->reply_payload.sg_cnt) { in qla84xx_mgmt_cmd()
1173 bsg_job->reply_payload.sg_cnt, sg_cnt); in qla84xx_mgmt_cmd()
1174 rval = -EAGAIN; in qla84xx_mgmt_cmd()
1178 data_len = bsg_job->reply_payload.payload_len; in qla84xx_mgmt_cmd()
1180 mgmt_b = dma_alloc_coherent(&ha->pdev->dev, data_len, in qla84xx_mgmt_cmd()
1185 rval = -ENOMEM; in qla84xx_mgmt_cmd()
1189 if (ql84_mgmt->mgmt.cmd == QLA84_MGMT_READ_MEM) { in qla84xx_mgmt_cmd()
1190 mn->options = cpu_to_le16(ACO_DUMP_MEMORY); in qla84xx_mgmt_cmd()
1191 mn->parameter1 = in qla84xx_mgmt_cmd()
1193 ql84_mgmt->mgmt.mgmtp.u.mem.start_addr); in qla84xx_mgmt_cmd()
1195 } else if (ql84_mgmt->mgmt.cmd == QLA84_MGMT_GET_INFO) { in qla84xx_mgmt_cmd()
1196 mn->options = cpu_to_le16(ACO_REQUEST_INFO); in qla84xx_mgmt_cmd()
1197 mn->parameter1 = in qla84xx_mgmt_cmd()
1198 cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.info.type); in qla84xx_mgmt_cmd()
1200 mn->parameter2 = in qla84xx_mgmt_cmd()
1202 ql84_mgmt->mgmt.mgmtp.u.info.context); in qla84xx_mgmt_cmd()
1207 sg_cnt = dma_map_sg(&ha->pdev->dev, in qla84xx_mgmt_cmd()
1208 bsg_job->request_payload.sg_list, in qla84xx_mgmt_cmd()
1209 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla84xx_mgmt_cmd()
1214 rval = -ENOMEM; in qla84xx_mgmt_cmd()
1220 if (sg_cnt != bsg_job->request_payload.sg_cnt) { in qla84xx_mgmt_cmd()
1224 bsg_job->request_payload.sg_cnt, sg_cnt); in qla84xx_mgmt_cmd()
1225 rval = -EAGAIN; in qla84xx_mgmt_cmd()
1229 data_len = bsg_job->request_payload.payload_len; in qla84xx_mgmt_cmd()
1230 mgmt_b = dma_alloc_coherent(&ha->pdev->dev, data_len, in qla84xx_mgmt_cmd()
1235 rval = -ENOMEM; in qla84xx_mgmt_cmd()
1239 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla84xx_mgmt_cmd()
1240 bsg_job->request_payload.sg_cnt, mgmt_b, data_len); in qla84xx_mgmt_cmd()
1242 mn->options = cpu_to_le16(ACO_LOAD_MEMORY); in qla84xx_mgmt_cmd()
1243 mn->parameter1 = in qla84xx_mgmt_cmd()
1244 cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.mem.start_addr); in qla84xx_mgmt_cmd()
1248 mn->options = cpu_to_le16(ACO_CHANGE_CONFIG_PARAM); in qla84xx_mgmt_cmd()
1249 mn->parameter1 = in qla84xx_mgmt_cmd()
1250 cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.config.id); in qla84xx_mgmt_cmd()
1252 mn->parameter2 = in qla84xx_mgmt_cmd()
1253 cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.config.param0); in qla84xx_mgmt_cmd()
1255 mn->parameter3 = in qla84xx_mgmt_cmd()
1256 cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.config.param1); in qla84xx_mgmt_cmd()
1260 rval = -EIO; in qla84xx_mgmt_cmd()
1264 if (ql84_mgmt->mgmt.cmd != QLA84_MGMT_CHNG_CONFIG) { in qla84xx_mgmt_cmd()
1265 mn->total_byte_cnt = cpu_to_le32(ql84_mgmt->mgmt.len); in qla84xx_mgmt_cmd()
1266 mn->dseg_count = cpu_to_le16(1); in qla84xx_mgmt_cmd()
1267 put_unaligned_le64(mgmt_dma, &mn->dsd.address); in qla84xx_mgmt_cmd()
1268 mn->dsd.length = cpu_to_le32(ql84_mgmt->mgmt.len); in qla84xx_mgmt_cmd()
1283 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla84xx_mgmt_cmd()
1284 bsg_reply->result = DID_OK; in qla84xx_mgmt_cmd()
1286 if ((ql84_mgmt->mgmt.cmd == QLA84_MGMT_READ_MEM) || in qla84xx_mgmt_cmd()
1287 (ql84_mgmt->mgmt.cmd == QLA84_MGMT_GET_INFO)) { in qla84xx_mgmt_cmd()
1288 bsg_reply->reply_payload_rcv_len = in qla84xx_mgmt_cmd()
1289 bsg_job->reply_payload.payload_len; in qla84xx_mgmt_cmd()
1291 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla84xx_mgmt_cmd()
1292 bsg_job->reply_payload.sg_cnt, mgmt_b, in qla84xx_mgmt_cmd()
1299 dma_free_coherent(&ha->pdev->dev, data_len, mgmt_b, mgmt_dma); in qla84xx_mgmt_cmd()
1302 dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, in qla84xx_mgmt_cmd()
1303 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla84xx_mgmt_cmd()
1305 dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, in qla84xx_mgmt_cmd()
1306 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla84xx_mgmt_cmd()
1309 dma_pool_free(ha->s_dma_pool, mn, mn_dma); in qla84xx_mgmt_cmd()
1312 bsg_job_done(bsg_job, bsg_reply->result, in qla84xx_mgmt_cmd()
1313 bsg_reply->reply_payload_rcv_len); in qla84xx_mgmt_cmd()
1320 struct fc_bsg_request *bsg_request = bsg_job->request; in qla24xx_iidma()
1321 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla24xx_iidma()
1331 if (!IS_IIDMA_CAPABLE(vha->hw)) { in qla24xx_iidma()
1333 return -EINVAL; in qla24xx_iidma()
1337 if (port_param->fc_scsi_addr.dest_type != EXT_DEF_TYPE_WWPN) { in qla24xx_iidma()
1340 return -EINVAL; in qla24xx_iidma()
1343 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla24xx_iidma()
1344 if (fcport->port_type != FCT_TARGET) in qla24xx_iidma()
1347 if (memcmp(port_param->fc_scsi_addr.dest_addr.wwpn, in qla24xx_iidma()
1348 fcport->port_name, sizeof(fcport->port_name))) in qla24xx_iidma()
1357 "Failed to find port.\n"); in qla24xx_iidma()
1358 return -EINVAL; in qla24xx_iidma()
1361 if (atomic_read(&fcport->state) != FCS_ONLINE) { in qla24xx_iidma()
1363 "Port is not online.\n"); in qla24xx_iidma()
1364 return -EINVAL; in qla24xx_iidma()
1367 if (fcport->flags & FCF_LOGIN_NEEDED) { in qla24xx_iidma()
1369 "Remote port not logged in flags = 0x%x.\n", fcport->flags); in qla24xx_iidma()
1370 return -EINVAL; in qla24xx_iidma()
1373 if (port_param->mode) in qla24xx_iidma()
1374 rval = qla2x00_set_idma_speed(vha, fcport->loop_id, in qla24xx_iidma()
1375 port_param->speed, mb); in qla24xx_iidma()
1377 rval = qla2x00_get_idma_speed(vha, fcport->loop_id, in qla24xx_iidma()
1378 &port_param->speed, mb); in qla24xx_iidma()
1382 "iiDMA cmd failed for %8phN -- " in qla24xx_iidma()
1383 "%04x %x %04x %04x.\n", fcport->port_name, in qla24xx_iidma()
1384 rval, fcport->fp_speed, mb[0], mb[1]); in qla24xx_iidma()
1387 if (!port_param->mode) { in qla24xx_iidma()
1388 bsg_job->reply_len = sizeof(struct fc_bsg_reply) + in qla24xx_iidma()
1398 bsg_reply->result = DID_OK; in qla24xx_iidma()
1399 bsg_job_done(bsg_job, bsg_reply->result, in qla24xx_iidma()
1400 bsg_reply->reply_payload_rcv_len); in qla24xx_iidma()
1410 struct fc_bsg_request *bsg_request = bsg_job->request; in qla2x00_optrom_setup()
1413 struct qla_hw_data *ha = vha->hw; in qla2x00_optrom_setup()
1415 if (unlikely(pci_channel_offline(ha->pdev))) in qla2x00_optrom_setup()
1416 return -EINVAL; in qla2x00_optrom_setup()
1418 start = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; in qla2x00_optrom_setup()
1419 if (start > ha->optrom_size) { in qla2x00_optrom_setup()
1421 "start %d > optrom_size %d.\n", start, ha->optrom_size); in qla2x00_optrom_setup()
1422 return -EINVAL; in qla2x00_optrom_setup()
1425 if (ha->optrom_state != QLA_SWAITING) { in qla2x00_optrom_setup()
1427 "optrom_state %d.\n", ha->optrom_state); in qla2x00_optrom_setup()
1428 return -EBUSY; in qla2x00_optrom_setup()
1431 ha->optrom_region_start = start; in qla2x00_optrom_setup()
1434 if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0) in qla2x00_optrom_setup()
1436 else if (start == (ha->flt_region_boot * 4) || in qla2x00_optrom_setup()
1437 start == (ha->flt_region_fw * 4)) in qla2x00_optrom_setup()
1446 bsg_job->request_payload.payload_len); in qla2x00_optrom_setup()
1447 return -EINVAL; in qla2x00_optrom_setup()
1450 ha->optrom_region_size = start + in qla2x00_optrom_setup()
1451 bsg_job->request_payload.payload_len > ha->optrom_size ? in qla2x00_optrom_setup()
1452 ha->optrom_size - start : in qla2x00_optrom_setup()
1453 bsg_job->request_payload.payload_len; in qla2x00_optrom_setup()
1454 ha->optrom_state = QLA_SWRITING; in qla2x00_optrom_setup()
1456 ha->optrom_region_size = start + in qla2x00_optrom_setup()
1457 bsg_job->reply_payload.payload_len > ha->optrom_size ? in qla2x00_optrom_setup()
1458 ha->optrom_size - start : in qla2x00_optrom_setup()
1459 bsg_job->reply_payload.payload_len; in qla2x00_optrom_setup()
1460 ha->optrom_state = QLA_SREADING; in qla2x00_optrom_setup()
1463 ha->optrom_buffer = vzalloc(ha->optrom_region_size); in qla2x00_optrom_setup()
1464 if (!ha->optrom_buffer) { in qla2x00_optrom_setup()
1467 "(%x)\n", ha->optrom_region_size); in qla2x00_optrom_setup()
1469 ha->optrom_state = QLA_SWAITING; in qla2x00_optrom_setup()
1470 return -ENOMEM; in qla2x00_optrom_setup()
1479 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_read_optrom()
1482 struct qla_hw_data *ha = vha->hw; in qla2x00_read_optrom()
1485 if (ha->flags.nic_core_reset_hdlr_active) in qla2x00_read_optrom()
1486 return -EBUSY; in qla2x00_read_optrom()
1488 mutex_lock(&ha->optrom_mutex); in qla2x00_read_optrom()
1491 mutex_unlock(&ha->optrom_mutex); in qla2x00_read_optrom()
1495 ha->isp_ops->read_optrom(vha, ha->optrom_buffer, in qla2x00_read_optrom()
1496 ha->optrom_region_start, ha->optrom_region_size); in qla2x00_read_optrom()
1498 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_read_optrom()
1499 bsg_job->reply_payload.sg_cnt, ha->optrom_buffer, in qla2x00_read_optrom()
1500 ha->optrom_region_size); in qla2x00_read_optrom()
1502 bsg_reply->reply_payload_rcv_len = ha->optrom_region_size; in qla2x00_read_optrom()
1503 bsg_reply->result = DID_OK; in qla2x00_read_optrom()
1504 vfree(ha->optrom_buffer); in qla2x00_read_optrom()
1505 ha->optrom_buffer = NULL; in qla2x00_read_optrom()
1506 ha->optrom_state = QLA_SWAITING; in qla2x00_read_optrom()
1507 mutex_unlock(&ha->optrom_mutex); in qla2x00_read_optrom()
1508 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_read_optrom()
1509 bsg_reply->reply_payload_rcv_len); in qla2x00_read_optrom()
1516 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_update_optrom()
1519 struct qla_hw_data *ha = vha->hw; in qla2x00_update_optrom()
1522 mutex_lock(&ha->optrom_mutex); in qla2x00_update_optrom()
1525 mutex_unlock(&ha->optrom_mutex); in qla2x00_update_optrom()
1530 ha->flags.isp82xx_no_md_cap = 1; in qla2x00_update_optrom()
1532 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_update_optrom()
1533 bsg_job->request_payload.sg_cnt, ha->optrom_buffer, in qla2x00_update_optrom()
1534 ha->optrom_region_size); in qla2x00_update_optrom()
1536 rval = ha->isp_ops->write_optrom(vha, ha->optrom_buffer, in qla2x00_update_optrom()
1537 ha->optrom_region_start, ha->optrom_region_size); in qla2x00_update_optrom()
1540 bsg_reply->result = -EINVAL; in qla2x00_update_optrom()
1541 rval = -EINVAL; in qla2x00_update_optrom()
1543 bsg_reply->result = DID_OK; in qla2x00_update_optrom()
1545 vfree(ha->optrom_buffer); in qla2x00_update_optrom()
1546 ha->optrom_buffer = NULL; in qla2x00_update_optrom()
1547 ha->optrom_state = QLA_SWAITING; in qla2x00_update_optrom()
1548 mutex_unlock(&ha->optrom_mutex); in qla2x00_update_optrom()
1549 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_update_optrom()
1550 bsg_reply->reply_payload_rcv_len); in qla2x00_update_optrom()
1557 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_update_fru_versions()
1560 struct qla_hw_data *ha = vha->hw; in qla2x00_update_fru_versions()
1567 void *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); in qla2x00_update_fru_versions()
1570 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_update_fru_versions()
1575 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_update_fru_versions()
1576 bsg_job->request_payload.sg_cnt, list, sizeof(bsg)); in qla2x00_update_fru_versions()
1578 image = list->version; in qla2x00_update_fru_versions()
1579 count = list->count; in qla2x00_update_fru_versions()
1580 while (count--) { in qla2x00_update_fru_versions()
1581 memcpy(sfp, &image->field_info, sizeof(image->field_info)); in qla2x00_update_fru_versions()
1583 image->field_address.device, image->field_address.offset, in qla2x00_update_fru_versions()
1584 sizeof(image->field_info), image->field_address.option); in qla2x00_update_fru_versions()
1586 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_update_fru_versions()
1593 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = 0; in qla2x00_update_fru_versions()
1596 dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); in qla2x00_update_fru_versions()
1599 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla2x00_update_fru_versions()
1600 bsg_reply->result = DID_OK << 16; in qla2x00_update_fru_versions()
1601 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_update_fru_versions()
1602 bsg_reply->reply_payload_rcv_len); in qla2x00_update_fru_versions()
1610 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_read_fru_status()
1613 struct qla_hw_data *ha = vha->hw; in qla2x00_read_fru_status()
1618 uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); in qla2x00_read_fru_status()
1621 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_read_fru_status()
1626 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_read_fru_status()
1627 bsg_job->request_payload.sg_cnt, sr, sizeof(*sr)); in qla2x00_read_fru_status()
1630 sr->field_address.device, sr->field_address.offset, in qla2x00_read_fru_status()
1631 sizeof(sr->status_reg), sr->field_address.option); in qla2x00_read_fru_status()
1632 sr->status_reg = *sfp; in qla2x00_read_fru_status()
1635 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_read_fru_status()
1640 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_read_fru_status()
1641 bsg_job->reply_payload.sg_cnt, sr, sizeof(*sr)); in qla2x00_read_fru_status()
1643 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = 0; in qla2x00_read_fru_status()
1646 dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); in qla2x00_read_fru_status()
1649 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla2x00_read_fru_status()
1650 bsg_reply->reply_payload_rcv_len = sizeof(*sr); in qla2x00_read_fru_status()
1651 bsg_reply->result = DID_OK << 16; in qla2x00_read_fru_status()
1652 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_read_fru_status()
1653 bsg_reply->reply_payload_rcv_len); in qla2x00_read_fru_status()
1661 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_write_fru_status()
1664 struct qla_hw_data *ha = vha->hw; in qla2x00_write_fru_status()
1669 uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); in qla2x00_write_fru_status()
1672 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_write_fru_status()
1677 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_write_fru_status()
1678 bsg_job->request_payload.sg_cnt, sr, sizeof(*sr)); in qla2x00_write_fru_status()
1680 *sfp = sr->status_reg; in qla2x00_write_fru_status()
1682 sr->field_address.device, sr->field_address.offset, in qla2x00_write_fru_status()
1683 sizeof(sr->status_reg), sr->field_address.option); in qla2x00_write_fru_status()
1686 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_write_fru_status()
1691 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = 0; in qla2x00_write_fru_status()
1694 dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); in qla2x00_write_fru_status()
1697 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla2x00_write_fru_status()
1698 bsg_reply->result = DID_OK << 16; in qla2x00_write_fru_status()
1699 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_write_fru_status()
1700 bsg_reply->reply_payload_rcv_len); in qla2x00_write_fru_status()
1708 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_write_i2c()
1711 struct qla_hw_data *ha = vha->hw; in qla2x00_write_i2c()
1716 uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); in qla2x00_write_i2c()
1719 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_write_i2c()
1724 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_write_i2c()
1725 bsg_job->request_payload.sg_cnt, i2c, sizeof(*i2c)); in qla2x00_write_i2c()
1727 memcpy(sfp, i2c->buffer, i2c->length); in qla2x00_write_i2c()
1729 i2c->device, i2c->offset, i2c->length, i2c->option); in qla2x00_write_i2c()
1732 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_write_i2c()
1737 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = 0; in qla2x00_write_i2c()
1740 dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); in qla2x00_write_i2c()
1743 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla2x00_write_i2c()
1744 bsg_reply->result = DID_OK << 16; in qla2x00_write_i2c()
1745 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_write_i2c()
1746 bsg_reply->reply_payload_rcv_len); in qla2x00_write_i2c()
1754 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_read_i2c()
1757 struct qla_hw_data *ha = vha->hw; in qla2x00_read_i2c()
1762 uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); in qla2x00_read_i2c()
1765 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_read_i2c()
1770 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_read_i2c()
1771 bsg_job->request_payload.sg_cnt, i2c, sizeof(*i2c)); in qla2x00_read_i2c()
1774 i2c->device, i2c->offset, i2c->length, i2c->option); in qla2x00_read_i2c()
1777 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_read_i2c()
1782 memcpy(i2c->buffer, sfp, i2c->length); in qla2x00_read_i2c()
1783 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_read_i2c()
1784 bsg_job->reply_payload.sg_cnt, i2c, sizeof(*i2c)); in qla2x00_read_i2c()
1786 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = 0; in qla2x00_read_i2c()
1789 dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); in qla2x00_read_i2c()
1792 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla2x00_read_i2c()
1793 bsg_reply->reply_payload_rcv_len = sizeof(*i2c); in qla2x00_read_i2c()
1794 bsg_reply->result = DID_OK << 16; in qla2x00_read_i2c()
1795 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_read_i2c()
1796 bsg_reply->reply_payload_rcv_len); in qla2x00_read_i2c()
1804 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla24xx_process_bidir_cmd()
1807 struct qla_hw_data *ha = vha->hw; in qla24xx_process_bidir_cmd()
1825 if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla24xx_process_bidir_cmd()
1826 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || in qla24xx_process_bidir_cmd()
1827 test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { in qla24xx_process_bidir_cmd()
1833 if (!vha->flags.online) { in qla24xx_process_bidir_cmd()
1841 if (vha->device_flags & DFLG_NO_CABLE) { in qla24xx_process_bidir_cmd()
1849 if (ha->current_topology != ISP_CFG_F) { in qla24xx_process_bidir_cmd()
1857 if (ha->operating_mode != P2P) { in qla24xx_process_bidir_cmd()
1864 mutex_lock(&ha->selflogin_lock); in qla24xx_process_bidir_cmd()
1865 if (vha->self_login_loop_id == 0) { in qla24xx_process_bidir_cmd()
1867 vha->bidir_fcport.vha = vha; in qla24xx_process_bidir_cmd()
1868 vha->bidir_fcport.d_id.b.al_pa = vha->d_id.b.al_pa; in qla24xx_process_bidir_cmd()
1869 vha->bidir_fcport.d_id.b.area = vha->d_id.b.area; in qla24xx_process_bidir_cmd()
1870 vha->bidir_fcport.d_id.b.domain = vha->d_id.b.domain; in qla24xx_process_bidir_cmd()
1871 vha->bidir_fcport.loop_id = vha->loop_id; in qla24xx_process_bidir_cmd()
1873 if (qla2x00_fabric_login(vha, &(vha->bidir_fcport), &nextlid)) { in qla24xx_process_bidir_cmd()
1875 "Failed to login port %06X for bidirectional IOCB\n", in qla24xx_process_bidir_cmd()
1876 vha->bidir_fcport.d_id.b24); in qla24xx_process_bidir_cmd()
1877 mutex_unlock(&ha->selflogin_lock); in qla24xx_process_bidir_cmd()
1881 vha->self_login_loop_id = nextlid - 1; in qla24xx_process_bidir_cmd()
1885 mutex_unlock(&ha->selflogin_lock); in qla24xx_process_bidir_cmd()
1887 vha->bidir_fcport.loop_id = vha->self_login_loop_id; in qla24xx_process_bidir_cmd()
1889 req_sg_cnt = dma_map_sg(&ha->pdev->dev, in qla24xx_process_bidir_cmd()
1890 bsg_job->request_payload.sg_list, in qla24xx_process_bidir_cmd()
1891 bsg_job->request_payload.sg_cnt, in qla24xx_process_bidir_cmd()
1899 rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, in qla24xx_process_bidir_cmd()
1900 bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, in qla24xx_process_bidir_cmd()
1908 if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || in qla24xx_process_bidir_cmd()
1909 (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { in qla24xx_process_bidir_cmd()
1914 bsg_job->request_payload.sg_cnt, req_sg_cnt, in qla24xx_process_bidir_cmd()
1915 bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); in qla24xx_process_bidir_cmd()
1920 req_data_len = bsg_job->request_payload.payload_len; in qla24xx_process_bidir_cmd()
1921 rsp_data_len = bsg_job->reply_payload.payload_len; in qla24xx_process_bidir_cmd()
1931 sp = qla2x00_get_sp(vha, &(vha->bidir_fcport), GFP_KERNEL); in qla24xx_process_bidir_cmd()
1939 /*Populate srb->ctx with bidir ctx*/ in qla24xx_process_bidir_cmd()
1940 sp->u.bsg_job = bsg_job; in qla24xx_process_bidir_cmd()
1941 sp->free = qla2x00_bsg_sp_free; in qla24xx_process_bidir_cmd()
1942 sp->type = SRB_BIDI_CMD; in qla24xx_process_bidir_cmd()
1943 sp->done = qla2x00_bsg_job_done; in qla24xx_process_bidir_cmd()
1955 mempool_free(sp, ha->srb_mempool); in qla24xx_process_bidir_cmd()
1957 dma_unmap_sg(&ha->pdev->dev, in qla24xx_process_bidir_cmd()
1958 bsg_job->reply_payload.sg_list, in qla24xx_process_bidir_cmd()
1959 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qla24xx_process_bidir_cmd()
1961 dma_unmap_sg(&ha->pdev->dev, in qla24xx_process_bidir_cmd()
1962 bsg_job->request_payload.sg_list, in qla24xx_process_bidir_cmd()
1963 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qla24xx_process_bidir_cmd()
1969 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = rval; in qla24xx_process_bidir_cmd()
1970 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla24xx_process_bidir_cmd()
1971 bsg_reply->reply_payload_rcv_len = 0; in qla24xx_process_bidir_cmd()
1972 bsg_reply->result = (DID_OK) << 16; in qla24xx_process_bidir_cmd()
1973 bsg_job_done(bsg_job, bsg_reply->result, in qla24xx_process_bidir_cmd()
1974 bsg_reply->reply_payload_rcv_len); in qla24xx_process_bidir_cmd()
1982 struct fc_bsg_request *bsg_request = bsg_job->request; in qlafx00_mgmt_cmd()
1985 struct qla_hw_data *ha = vha->hw; in qlafx00_mgmt_cmd()
1995 &bsg_request->rqst_data.h_vendor.vendor_cmd[1]; in qlafx00_mgmt_cmd()
2001 if (!vha->flags.online) { in qlafx00_mgmt_cmd()
2004 rval = -EIO; in qlafx00_mgmt_cmd()
2008 if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) { in qlafx00_mgmt_cmd()
2009 req_sg_cnt = dma_map_sg(&ha->pdev->dev, in qlafx00_mgmt_cmd()
2010 bsg_job->request_payload.sg_list, in qlafx00_mgmt_cmd()
2011 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qlafx00_mgmt_cmd()
2015 rval = -ENOMEM; in qlafx00_mgmt_cmd()
2020 if (piocb_rqst->flags & SRB_FXDISC_RESP_DMA_VALID) { in qlafx00_mgmt_cmd()
2021 rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, in qlafx00_mgmt_cmd()
2022 bsg_job->reply_payload.sg_list, in qlafx00_mgmt_cmd()
2023 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qlafx00_mgmt_cmd()
2027 rval = -ENOMEM; in qlafx00_mgmt_cmd()
2034 "dma_reply_sg_cnt: %x\n", bsg_job->request_payload.sg_cnt, in qlafx00_mgmt_cmd()
2035 req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); in qlafx00_mgmt_cmd()
2038 * IOCB and mailbox command retrieves port specific information in qlafx00_mgmt_cmd()
2046 rval = -ENOMEM; in qlafx00_mgmt_cmd()
2055 rval = -ENOMEM; in qlafx00_mgmt_cmd()
2060 fcport->vha = vha; in qlafx00_mgmt_cmd()
2061 fcport->loop_id = le32_to_cpu(piocb_rqst->dataword); in qlafx00_mgmt_cmd()
2063 sp->type = SRB_FXIOCB_BCMD; in qlafx00_mgmt_cmd()
2064 sp->name = "bsg_fx_mgmt"; in qlafx00_mgmt_cmd()
2065 sp->iocbs = qla24xx_calc_ct_iocbs(req_sg_cnt + rsp_sg_cnt); in qlafx00_mgmt_cmd()
2066 sp->u.bsg_job = bsg_job; in qlafx00_mgmt_cmd()
2067 sp->free = qla2x00_bsg_sp_free; in qlafx00_mgmt_cmd()
2068 sp->done = qla2x00_bsg_job_done; in qlafx00_mgmt_cmd()
2072 type, piocb_rqst->func_type, fcport->loop_id); in qlafx00_mgmt_cmd()
2078 mempool_free(sp, ha->srb_mempool); in qlafx00_mgmt_cmd()
2079 rval = -EIO; in qlafx00_mgmt_cmd()
2088 if (piocb_rqst->flags & SRB_FXDISC_RESP_DMA_VALID) in qlafx00_mgmt_cmd()
2089 dma_unmap_sg(&ha->pdev->dev, in qlafx00_mgmt_cmd()
2090 bsg_job->reply_payload.sg_list, in qlafx00_mgmt_cmd()
2091 bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); in qlafx00_mgmt_cmd()
2093 if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) in qlafx00_mgmt_cmd()
2094 dma_unmap_sg(&ha->pdev->dev, in qlafx00_mgmt_cmd()
2095 bsg_job->request_payload.sg_list, in qlafx00_mgmt_cmd()
2096 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); in qlafx00_mgmt_cmd()
2105 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla26xx_serdes_op()
2113 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla26xx_serdes_op()
2114 bsg_job->request_payload.sg_cnt, &sr, sizeof(sr)); in qla26xx_serdes_op()
2119 bsg_reply->reply_payload_rcv_len = 0; in qla26xx_serdes_op()
2123 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla26xx_serdes_op()
2124 bsg_job->reply_payload.sg_cnt, &sr, sizeof(sr)); in qla26xx_serdes_op()
2125 bsg_reply->reply_payload_rcv_len = sizeof(sr); in qla26xx_serdes_op()
2130 rval = -EINVAL; in qla26xx_serdes_op()
2134 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla26xx_serdes_op()
2137 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla26xx_serdes_op()
2138 bsg_reply->result = DID_OK << 16; in qla26xx_serdes_op()
2139 bsg_job_done(bsg_job, bsg_reply->result, in qla26xx_serdes_op()
2140 bsg_reply->reply_payload_rcv_len); in qla26xx_serdes_op()
2147 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla8044_serdes_op()
2155 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla8044_serdes_op()
2156 bsg_job->request_payload.sg_cnt, &sr, sizeof(sr)); in qla8044_serdes_op()
2161 bsg_reply->reply_payload_rcv_len = 0; in qla8044_serdes_op()
2165 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla8044_serdes_op()
2166 bsg_job->reply_payload.sg_cnt, &sr, sizeof(sr)); in qla8044_serdes_op()
2167 bsg_reply->reply_payload_rcv_len = sizeof(sr); in qla8044_serdes_op()
2172 rval = -EINVAL; in qla8044_serdes_op()
2176 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla8044_serdes_op()
2179 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla8044_serdes_op()
2180 bsg_reply->result = DID_OK << 16; in qla8044_serdes_op()
2181 bsg_job_done(bsg_job, bsg_reply->result, in qla8044_serdes_op()
2182 bsg_reply->reply_payload_rcv_len); in qla8044_serdes_op()
2189 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla27xx_get_flash_upd_cap()
2192 struct qla_hw_data *ha = vha->hw; in qla27xx_get_flash_upd_cap()
2193 struct qla_flash_update_caps cap; in qla27xx_get_flash_upd_cap() local
2196 return -EPERM; in qla27xx_get_flash_upd_cap()
2198 memset(&cap, 0, sizeof(cap)); in qla27xx_get_flash_upd_cap()
2199 cap.capabilities = (uint64_t)ha->fw_attributes_ext[1] << 48 | in qla27xx_get_flash_upd_cap()
2200 (uint64_t)ha->fw_attributes_ext[0] << 32 | in qla27xx_get_flash_upd_cap()
2201 (uint64_t)ha->fw_attributes_h << 16 | in qla27xx_get_flash_upd_cap()
2202 (uint64_t)ha->fw_attributes; in qla27xx_get_flash_upd_cap()
2204 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla27xx_get_flash_upd_cap()
2205 bsg_job->reply_payload.sg_cnt, &cap, sizeof(cap)); in qla27xx_get_flash_upd_cap()
2206 bsg_reply->reply_payload_rcv_len = sizeof(cap); in qla27xx_get_flash_upd_cap()
2208 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla27xx_get_flash_upd_cap()
2211 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla27xx_get_flash_upd_cap()
2212 bsg_reply->result = DID_OK << 16; in qla27xx_get_flash_upd_cap()
2213 bsg_job_done(bsg_job, bsg_reply->result, in qla27xx_get_flash_upd_cap()
2214 bsg_reply->reply_payload_rcv_len); in qla27xx_get_flash_upd_cap()
2221 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla27xx_set_flash_upd_cap()
2224 struct qla_hw_data *ha = vha->hw; in qla27xx_set_flash_upd_cap()
2226 struct qla_flash_update_caps cap; in qla27xx_set_flash_upd_cap() local
2229 return -EPERM; in qla27xx_set_flash_upd_cap()
2231 memset(&cap, 0, sizeof(cap)); in qla27xx_set_flash_upd_cap()
2232 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla27xx_set_flash_upd_cap()
2233 bsg_job->request_payload.sg_cnt, &cap, sizeof(cap)); in qla27xx_set_flash_upd_cap()
2235 online_fw_attr = (uint64_t)ha->fw_attributes_ext[1] << 48 | in qla27xx_set_flash_upd_cap()
2236 (uint64_t)ha->fw_attributes_ext[0] << 32 | in qla27xx_set_flash_upd_cap()
2237 (uint64_t)ha->fw_attributes_h << 16 | in qla27xx_set_flash_upd_cap()
2238 (uint64_t)ha->fw_attributes; in qla27xx_set_flash_upd_cap()
2240 if (online_fw_attr != cap.capabilities) { in qla27xx_set_flash_upd_cap()
2241 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla27xx_set_flash_upd_cap()
2243 return -EINVAL; in qla27xx_set_flash_upd_cap()
2246 if (cap.outage_duration < MAX_LOOP_TIMEOUT) { in qla27xx_set_flash_upd_cap()
2247 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla27xx_set_flash_upd_cap()
2249 return -EINVAL; in qla27xx_set_flash_upd_cap()
2252 bsg_reply->reply_payload_rcv_len = 0; in qla27xx_set_flash_upd_cap()
2254 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla27xx_set_flash_upd_cap()
2257 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla27xx_set_flash_upd_cap()
2258 bsg_reply->result = DID_OK << 16; in qla27xx_set_flash_upd_cap()
2259 bsg_job_done(bsg_job, bsg_reply->result, in qla27xx_set_flash_upd_cap()
2260 bsg_reply->reply_payload_rcv_len); in qla27xx_set_flash_upd_cap()
2267 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla27xx_get_bbcr_data()
2270 struct qla_hw_data *ha = vha->hw; in qla27xx_get_bbcr_data()
2277 return -EPERM; in qla27xx_get_bbcr_data()
2281 if (vha->flags.bbcr_enable) in qla27xx_get_bbcr_data()
2296 state = (vha->bbcr >> 12) & 0x1; in qla27xx_get_bbcr_data()
2303 bbcr.negotiated_bbscn = (vha->bbcr >> 8) & 0xf; in qla27xx_get_bbcr_data()
2306 bbcr.configured_bbscn = vha->bbcr & 0xf; in qla27xx_get_bbcr_data()
2310 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla27xx_get_bbcr_data()
2311 bsg_job->reply_payload.sg_cnt, &bbcr, sizeof(bbcr)); in qla27xx_get_bbcr_data()
2312 bsg_reply->reply_payload_rcv_len = sizeof(bbcr); in qla27xx_get_bbcr_data()
2314 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; in qla27xx_get_bbcr_data()
2316 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla27xx_get_bbcr_data()
2317 bsg_reply->result = DID_OK << 16; in qla27xx_get_bbcr_data()
2318 bsg_job_done(bsg_job, bsg_reply->result, in qla27xx_get_bbcr_data()
2319 bsg_reply->reply_payload_rcv_len); in qla27xx_get_bbcr_data()
2326 struct fc_bsg_request *bsg_request = bsg_job->request; in qla2x00_get_priv_stats()
2327 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_get_priv_stats()
2330 struct qla_hw_data *ha = vha->hw; in qla2x00_get_priv_stats()
2331 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_get_priv_stats()
2335 uint32_t *cmd = bsg_request->rqst_data.h_vendor.vendor_cmd; in qla2x00_get_priv_stats()
2338 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_get_priv_stats()
2339 return -ENODEV; in qla2x00_get_priv_stats()
2341 if (unlikely(pci_channel_offline(ha->pdev))) in qla2x00_get_priv_stats()
2342 return -ENODEV; in qla2x00_get_priv_stats()
2345 return -EBUSY; in qla2x00_get_priv_stats()
2348 return -EPERM; in qla2x00_get_priv_stats()
2350 stats = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stats), &stats_dma, in qla2x00_get_priv_stats()
2355 return -ENOMEM; in qla2x00_get_priv_stats()
2363 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_get_priv_stats()
2364 bsg_job->reply_payload.sg_cnt, stats, sizeof(*stats)); in qla2x00_get_priv_stats()
2367 bsg_reply->reply_payload_rcv_len = sizeof(*stats); in qla2x00_get_priv_stats()
2368 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_get_priv_stats()
2371 bsg_job->reply_len = sizeof(*bsg_reply); in qla2x00_get_priv_stats()
2372 bsg_reply->result = DID_OK << 16; in qla2x00_get_priv_stats()
2373 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_get_priv_stats()
2374 bsg_reply->reply_payload_rcv_len); in qla2x00_get_priv_stats()
2376 dma_free_coherent(&ha->pdev->dev, sizeof(*stats), in qla2x00_get_priv_stats()
2385 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_do_dport_diagnostics()
2391 if (!IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw) && in qla2x00_do_dport_diagnostics()
2392 !IS_QLA28XX(vha->hw)) in qla2x00_do_dport_diagnostics()
2393 return -EPERM; in qla2x00_do_dport_diagnostics()
2399 return -ENOMEM; in qla2x00_do_dport_diagnostics()
2402 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_do_dport_diagnostics()
2403 bsg_job->request_payload.sg_cnt, dd, sizeof(*dd)); in qla2x00_do_dport_diagnostics()
2406 vha, dd->buf, sizeof(dd->buf), dd->options); in qla2x00_do_dport_diagnostics()
2408 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_do_dport_diagnostics()
2409 bsg_job->reply_payload.sg_cnt, dd, sizeof(*dd)); in qla2x00_do_dport_diagnostics()
2412 bsg_reply->reply_payload_rcv_len = sizeof(*dd); in qla2x00_do_dport_diagnostics()
2413 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_do_dport_diagnostics()
2416 bsg_job->reply_len = sizeof(*bsg_reply); in qla2x00_do_dport_diagnostics()
2417 bsg_reply->result = DID_OK << 16; in qla2x00_do_dport_diagnostics()
2418 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_do_dport_diagnostics()
2419 bsg_reply->reply_payload_rcv_len); in qla2x00_do_dport_diagnostics()
2429 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_do_dport_diagnostics_v2()
2438 if (!IS_DPORT_CAPABLE(vha->hw)) in qla2x00_do_dport_diagnostics_v2()
2439 return -EPERM; in qla2x00_do_dport_diagnostics_v2()
2443 return -ENOMEM; in qla2x00_do_dport_diagnostics_v2()
2445 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_do_dport_diagnostics_v2()
2446 bsg_job->request_payload.sg_cnt, dd, sizeof(*dd)); in qla2x00_do_dport_diagnostics_v2()
2448 options = dd->options; in qla2x00_do_dport_diagnostics_v2()
2452 vha->dport_status & DPORT_DIAG_IN_PROGRESS) { in qla2x00_do_dport_diagnostics_v2()
2453 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_do_dport_diagnostics_v2()
2459 if (vha->dport_status & DPORT_DIAG_CHIP_RESET_IN_PROGRESS && in qla2x00_do_dport_diagnostics_v2()
2462 vha->dport_status &= ~DPORT_DIAG_CHIP_RESET_IN_PROGRESS; in qla2x00_do_dport_diagnostics_v2()
2466 if (vha->dport_status & DPORT_DIAG_CHIP_RESET_IN_PROGRESS && in qla2x00_do_dport_diagnostics_v2()
2468 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_do_dport_diagnostics_v2()
2476 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_do_dport_diagnostics_v2()
2480 dd->mbx1 = mcp->mb[0]; in qla2x00_do_dport_diagnostics_v2()
2481 dd->mbx2 = mcp->mb[1]; in qla2x00_do_dport_diagnostics_v2()
2482 vha->dport_status |= DPORT_DIAG_IN_PROGRESS; in qla2x00_do_dport_diagnostics_v2()
2484 dd->mbx1 = le16_to_cpu(vha->dport_data[1]); in qla2x00_do_dport_diagnostics_v2()
2485 dd->mbx2 = le16_to_cpu(vha->dport_data[2]); in qla2x00_do_dport_diagnostics_v2()
2488 dd->mbx1 = mcp->mb[0]; in qla2x00_do_dport_diagnostics_v2()
2489 dd->mbx2 = mcp->mb[1]; in qla2x00_do_dport_diagnostics_v2()
2490 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = in qla2x00_do_dport_diagnostics_v2()
2495 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_do_dport_diagnostics_v2()
2496 bsg_job->reply_payload.sg_cnt, dd, sizeof(*dd)); in qla2x00_do_dport_diagnostics_v2()
2498 bsg_reply->reply_payload_rcv_len = sizeof(*dd); in qla2x00_do_dport_diagnostics_v2()
2499 bsg_job->reply_len = sizeof(*bsg_reply); in qla2x00_do_dport_diagnostics_v2()
2500 bsg_reply->result = DID_OK << 16; in qla2x00_do_dport_diagnostics_v2()
2501 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_do_dport_diagnostics_v2()
2502 bsg_reply->reply_payload_rcv_len); in qla2x00_do_dport_diagnostics_v2()
2513 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_get_flash_image_status()
2514 struct qla_hw_data *ha = vha->hw; in qla2x00_get_flash_image_status()
2535 __func__, vha->host_no, regions.global_image, in qla2x00_get_flash_image_status()
2539 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_get_flash_image_status()
2540 bsg_job->reply_payload.sg_cnt, &regions, sizeof(regions)); in qla2x00_get_flash_image_status()
2542 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; in qla2x00_get_flash_image_status()
2543 bsg_reply->reply_payload_rcv_len = sizeof(regions); in qla2x00_get_flash_image_status()
2544 bsg_reply->result = DID_OK << 16; in qla2x00_get_flash_image_status()
2545 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla2x00_get_flash_image_status()
2546 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_get_flash_image_status()
2547 bsg_reply->reply_payload_rcv_len); in qla2x00_get_flash_image_status()
2556 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_manage_host_stats()
2562 if (!vha->flags.online) { in qla2x00_manage_host_stats()
2564 return -EIO; in qla2x00_manage_host_stats()
2567 req_data_len = bsg_job->request_payload.payload_len; in qla2x00_manage_host_stats()
2571 return -EIO; in qla2x00_manage_host_stats()
2577 return -ENOMEM; in qla2x00_manage_host_stats()
2581 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_manage_host_stats()
2582 bsg_job->request_payload.sg_cnt, req_data, in qla2x00_manage_host_stats()
2585 switch (req_data->action) { in qla2x00_manage_host_stats()
2587 ret = qla2xxx_stop_stats(vha->host, req_data->stat_type); in qla2x00_manage_host_stats()
2590 ret = qla2xxx_start_stats(vha->host, req_data->stat_type); in qla2x00_manage_host_stats()
2593 ret = qla2xxx_reset_stats(vha->host, req_data->stat_type); in qla2x00_manage_host_stats()
2597 ret = -EIO; in qla2x00_manage_host_stats()
2605 bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); in qla2x00_manage_host_stats()
2607 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; in qla2x00_manage_host_stats()
2608 bsg_reply->reply_payload_rcv_len = in qla2x00_manage_host_stats()
2609 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_manage_host_stats()
2610 bsg_job->reply_payload.sg_cnt, in qla2x00_manage_host_stats()
2614 bsg_reply->result = DID_OK; in qla2x00_manage_host_stats()
2615 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_manage_host_stats()
2616 bsg_reply->reply_payload_rcv_len); in qla2x00_manage_host_stats()
2625 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_get_host_stats()
2637 req_data_len = bsg_job->request_payload.payload_len; in qla2x00_get_host_stats()
2641 return -EIO; in qla2x00_get_host_stats()
2647 return -ENOMEM; in qla2x00_get_host_stats()
2651 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_get_host_stats()
2652 bsg_job->request_payload.sg_cnt, req_data, req_data_len); in qla2x00_get_host_stats()
2655 tmp_stat_type = req_data->stat_type; in qla2x00_get_host_stats()
2673 if (response_len > bsg_job->reply_payload.payload_len) { in qla2x00_get_host_stats()
2675 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_BUFFER_TOO_SMALL; in qla2x00_get_host_stats()
2676 bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); in qla2x00_get_host_stats()
2678 bsg_reply->reply_payload_rcv_len = in qla2x00_get_host_stats()
2679 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_get_host_stats()
2680 bsg_job->reply_payload.sg_cnt, &rsp_data, in qla2x00_get_host_stats()
2683 bsg_reply->result = DID_OK; in qla2x00_get_host_stats()
2684 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_get_host_stats()
2685 bsg_reply->reply_payload_rcv_len); in qla2x00_get_host_stats()
2691 ret = -ENOMEM; in qla2x00_get_host_stats()
2695 ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, in qla2x00_get_host_stats()
2699 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; in qla2x00_get_host_stats()
2701 bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_get_host_stats()
2702 bsg_job->reply_payload.sg_cnt, in qla2x00_get_host_stats()
2704 bsg_reply->result = DID_OK; in qla2x00_get_host_stats()
2705 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_get_host_stats()
2706 bsg_reply->reply_payload_rcv_len); in qla2x00_get_host_stats()
2719 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2xxx_find_rport()
2720 if (fcport->rport->number == tgt_num) in qla2xxx_find_rport()
2721 return fcport->rport; in qla2xxx_find_rport()
2730 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_get_tgt_stats()
2738 if (!vha->flags.online) { in qla2x00_get_tgt_stats()
2740 return -EIO; in qla2x00_get_tgt_stats()
2743 req_data_len = bsg_job->request_payload.payload_len; in qla2x00_get_tgt_stats()
2747 return -EIO; in qla2x00_get_tgt_stats()
2753 return -ENOMEM; in qla2x00_get_tgt_stats()
2757 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_get_tgt_stats()
2758 bsg_job->request_payload.sg_cnt, in qla2x00_get_tgt_stats()
2768 return -ENOMEM; in qla2x00_get_tgt_stats()
2771 if (response_len > bsg_job->reply_payload.payload_len) { in qla2x00_get_tgt_stats()
2772 data->status = EXT_STATUS_BUFFER_TOO_SMALL; in qla2x00_get_tgt_stats()
2773 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_BUFFER_TOO_SMALL; in qla2x00_get_tgt_stats()
2774 bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); in qla2x00_get_tgt_stats()
2776 bsg_reply->reply_payload_rcv_len = in qla2x00_get_tgt_stats()
2777 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_get_tgt_stats()
2778 bsg_job->reply_payload.sg_cnt, data, in qla2x00_get_tgt_stats()
2781 bsg_reply->result = DID_OK; in qla2x00_get_tgt_stats()
2782 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_get_tgt_stats()
2783 bsg_reply->reply_payload_rcv_len); in qla2x00_get_tgt_stats()
2787 rport = qla2xxx_find_rport(vha, req_data->tgt_id); in qla2x00_get_tgt_stats()
2789 ql_log(ql_log_warn, vha, 0x0000, "target %d not found.\n", req_data->tgt_id); in qla2x00_get_tgt_stats()
2791 data->status = EXT_STATUS_INVALID_PARAM; in qla2x00_get_tgt_stats()
2795 ret = qla2xxx_get_tgt_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, in qla2x00_get_tgt_stats()
2798 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; in qla2x00_get_tgt_stats()
2800 bsg_reply->reply_payload_rcv_len = in qla2x00_get_tgt_stats()
2801 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_get_tgt_stats()
2802 bsg_job->reply_payload.sg_cnt, data, in qla2x00_get_tgt_stats()
2804 bsg_reply->result = DID_OK; in qla2x00_get_tgt_stats()
2805 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_get_tgt_stats()
2806 bsg_reply->reply_payload_rcv_len); in qla2x00_get_tgt_stats()
2819 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_manage_host_port()
2825 req_data_len = bsg_job->request_payload.payload_len; in qla2x00_manage_host_port()
2829 return -EIO; in qla2x00_manage_host_port()
2835 return -ENOMEM; in qla2x00_manage_host_port()
2839 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_manage_host_port()
2840 bsg_job->request_payload.sg_cnt, req_data, req_data_len); in qla2x00_manage_host_port()
2842 switch (req_data->action) { in qla2x00_manage_host_port()
2844 ret = qla2xxx_enable_port(vha->host); in qla2x00_manage_host_port()
2847 ret = qla2xxx_disable_port(vha->host); in qla2x00_manage_host_port()
2851 ret = -EIO; in qla2x00_manage_host_port()
2859 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; in qla2x00_manage_host_port()
2860 bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_port_resp); in qla2x00_manage_host_port()
2862 bsg_reply->reply_payload_rcv_len = in qla2x00_manage_host_port()
2863 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_manage_host_port()
2864 bsg_job->reply_payload.sg_cnt, &rsp_data, in qla2x00_manage_host_port()
2866 bsg_reply->result = DID_OK; in qla2x00_manage_host_port()
2867 bsg_job_done(bsg_job, bsg_reply->result, in qla2x00_manage_host_port()
2868 bsg_reply->reply_payload_rcv_len); in qla2x00_manage_host_port()
2876 struct fc_bsg_request *bsg_request = bsg_job->request; in qla2x00_process_vendor_specific()
2879 __func__, bsg_request->rqst_data.h_vendor.vendor_cmd[0]); in qla2x00_process_vendor_specific()
2881 switch (bsg_request->rqst_data.h_vendor.vendor_cmd[0]) { in qla2x00_process_vendor_specific()
2974 return -ENOSYS; in qla2x00_process_vendor_specific()
2981 struct fc_bsg_request *bsg_request = bsg_job->request; in qla24xx_bsg_request()
2982 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla24xx_bsg_request()
2983 int ret = -EINVAL; in qla24xx_bsg_request()
2989 bsg_reply->reply_payload_rcv_len = 0; in qla24xx_bsg_request()
2991 if (bsg_request->msgcode == FC_BSG_RPT_ELS) { in qla24xx_bsg_request()
3002 /* Disable port will bring down the chip, allow enable command */ in qla24xx_bsg_request()
3003 if (bsg_request->rqst_data.h_vendor.vendor_cmd[0] == QL_VND_MANAGE_HOST_PORT || in qla24xx_bsg_request()
3004 bsg_request->rqst_data.h_vendor.vendor_cmd[0] == QL_VND_GET_HOST_STATS) in qla24xx_bsg_request()
3007 if (vha->hw->flags.port_isolated) { in qla24xx_bsg_request()
3008 bsg_reply->result = DID_ERROR; in qla24xx_bsg_request()
3010 return -EPERM; in qla24xx_bsg_request()
3015 "BSG: ISP abort active/needed -- cmd=%d.\n", in qla24xx_bsg_request()
3016 bsg_request->msgcode); in qla24xx_bsg_request()
3017 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla24xx_bsg_request()
3018 return -EBUSY; in qla24xx_bsg_request()
3021 if (test_bit(PFLG_DRIVER_REMOVING, &vha->pci_flags)) { in qla24xx_bsg_request()
3022 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla24xx_bsg_request()
3023 return -EIO; in qla24xx_bsg_request()
3029 __func__, bsg_request->msgcode, bsg_job); in qla24xx_bsg_request()
3031 switch (bsg_request->msgcode) { in qla24xx_bsg_request()
3059 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_bsg_found()
3061 struct qla_hw_data *ha = vha->hw; in qla_bsg_found()
3072 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla_bsg_found()
3073 req = qpair->req; in qla_bsg_found()
3075 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in qla_bsg_found()
3076 sp = req->outstanding_cmds[cnt]; in qla_bsg_found()
3078 (sp->type == SRB_CT_CMD || in qla_bsg_found()
3079 sp->type == SRB_ELS_CMD_HST || in qla_bsg_found()
3080 sp->type == SRB_ELS_CMD_HST_NOLOGIN) && in qla_bsg_found()
3081 sp->u.bsg_job == bsg_job) { in qla_bsg_found()
3084 sp->comp = &comp; in qla_bsg_found()
3088 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla_bsg_found()
3093 if (ha->flags.eeh_busy) { in qla_bsg_found()
3098 bsg_job, sp, sp->handle); in qla_bsg_found()
3100 rval = ha->isp_ops->abort_command(sp); in qla_bsg_found()
3103 bsg_job, sp, sp->handle, rval); in qla_bsg_found()
3109 ratov_j = ha->r_a_tov / 10 * 4 * 1000; in qla_bsg_found()
3115 bsg_job, sp, sp->handle); in qla_bsg_found()
3122 bsg_job, sp, sp->handle); in qla_bsg_found()
3138 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla_bsg_found()
3143 if (req->outstanding_cmds[cnt] && in qla_bsg_found()
3144 req->outstanding_cmds[cnt]->u.bsg_job != bsg_job) { in qla_bsg_found()
3146 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla_bsg_found()
3149 req->outstanding_cmds[cnt] = NULL; in qla_bsg_found()
3150 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla_bsg_found()
3153 sp->comp = NULL; in qla_bsg_found()
3154 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla_bsg_found()
3155 bsg_reply->result = -ENXIO; in qla_bsg_found()
3156 bsg_reply->reply_payload_rcv_len = 0; in qla_bsg_found()
3160 __func__, bsg_job, bsg_reply->result, sp); in qla_bsg_found()
3162 bsg_job_done(bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); in qla_bsg_found()
3170 struct fc_bsg_request *bsg_request = bsg_job->request; in qla24xx_bsg_timeout()
3172 struct qla_hw_data *ha = vha->hw; in qla24xx_bsg_timeout()
3178 __func__, bsg_job, bsg_request->msgcode, in qla24xx_bsg_timeout()
3179 bsg_request->rqst_data.h_vendor.vendor_cmd[0]); in qla24xx_bsg_timeout()
3187 if (qla_bsg_found(ha->base_qpair, bsg_job)) in qla24xx_bsg_timeout()
3191 for (i = 0; i < ha->max_qpairs; i++) { in qla24xx_bsg_timeout()
3192 qpair = vha->hw->queue_pair_map[i]; in qla24xx_bsg_timeout()
3207 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla2x00_mailbox_passthru()
3209 int ret = -EINVAL; in qla2x00_mailbox_passthru()
3214 req_data_len = bsg_job->request_payload.payload_len; in qla2x00_mailbox_passthru()
3217 return -EIO; in qla2x00_mailbox_passthru()
3223 return -ENOMEM; in qla2x00_mailbox_passthru()
3227 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla2x00_mailbox_passthru()
3228 bsg_job->request_payload.sg_cnt, req_data, ptsize); in qla2x00_mailbox_passthru()
3229 ret = qla_mailbox_passthru(vha, req_data->mbx_in, req_data->mbx_out); in qla2x00_mailbox_passthru()
3232 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla2x00_mailbox_passthru()
3233 bsg_job->reply_payload.sg_cnt, req_data, ptsize); in qla2x00_mailbox_passthru()
3235 bsg_reply->reply_payload_rcv_len = ptsize; in qla2x00_mailbox_passthru()
3237 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; in qla2x00_mailbox_passthru()
3239 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_ERR; in qla2x00_mailbox_passthru()
3241 bsg_job->reply_len = sizeof(*bsg_job->reply); in qla2x00_mailbox_passthru()
3242 bsg_reply->result = DID_OK << 16; in qla2x00_mailbox_passthru()
3243 bsg_job_done(bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); in qla2x00_mailbox_passthru()