diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-22 15:55:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-22 15:55:29 -0400 |
commit | 424a6f6ef990b7e9f56f6627bfc6c46b493faeb4 (patch) | |
tree | 0028356ed8003495fbbe1f716f359e3c8ebc35b6 /drivers/scsi/qla2xxx/qla_bsg.c | |
parent | 1ab142d499294b844ecc81e8004db4ce029b0b61 (diff) | |
parent | cd8df932d894f3128c884e3ae1b2b484540513db (diff) |
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
SCSI updates from James Bottomley:
"The update includes the usual assortment of driver updates (lpfc,
qla2xxx, qla4xxx, bfa, bnx2fc, bnx2i, isci, fcoe, hpsa) plus a huge
amount of infrastructure work in the SAS library and transport class
as well as an iSCSI update. There's also a new SCSI based virtio
driver."
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (177 commits)
[SCSI] qla4xxx: Update driver version to 5.02.00-k15
[SCSI] qla4xxx: trivial cleanup
[SCSI] qla4xxx: Fix sparse warning
[SCSI] qla4xxx: Add support for multiple session per host.
[SCSI] qla4xxx: Export CHAP index as sysfs attribute
[SCSI] scsi_transport: Export CHAP index as sysfs attribute
[SCSI] qla4xxx: Add support to display CHAP list and delete CHAP entry
[SCSI] iscsi_transport: Add support to display CHAP list and delete CHAP entry
[SCSI] pm8001: fix endian issue with code optimization.
[SCSI] pm8001: Fix possible racing condition.
[SCSI] pm8001: Fix bogus interrupt state flag issue.
[SCSI] ipr: update PCI ID definitions for new adapters
[SCSI] qla2xxx: handle default case in qla2x00_request_firmware()
[SCSI] isci: improvements in driver unloading routine
[SCSI] isci: improve phy event warnings
[SCSI] isci: debug, provide state-enum-to-string conversions
[SCSI] scsi_transport_sas: 'enable' phys on reset
[SCSI] libsas: don't recover end devices attached to disabled phys
[SCSI] libsas: fixup target_port_protocols for expanders that don't report sata
[SCSI] libsas: set attached device type and target protocols for local phys
...
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_bsg.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 120 |
1 files changed, 56 insertions, 64 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index 2c4714279bcc..f74cc0602f3b 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c | |||
@@ -11,29 +11,36 @@ | |||
11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
12 | 12 | ||
13 | /* BSG support for ELS/CT pass through */ | 13 | /* BSG support for ELS/CT pass through */ |
14 | inline srb_t * | 14 | void |
15 | qla2x00_get_ctx_bsg_sp(scsi_qla_host_t *vha, fc_port_t *fcport, size_t size) | 15 | qla2x00_bsg_job_done(void *data, void *ptr, int res) |
16 | { | 16 | { |
17 | srb_t *sp; | 17 | srb_t *sp = (srb_t *)ptr; |
18 | struct scsi_qla_host *vha = (scsi_qla_host_t *)data; | ||
19 | struct fc_bsg_job *bsg_job = sp->u.bsg_job; | ||
20 | |||
21 | bsg_job->reply->result = res; | ||
22 | bsg_job->job_done(bsg_job); | ||
23 | sp->free(vha, sp); | ||
24 | } | ||
25 | |||
26 | void | ||
27 | qla2x00_bsg_sp_free(void *data, void *ptr) | ||
28 | { | ||
29 | srb_t *sp = (srb_t *)ptr; | ||
30 | struct scsi_qla_host *vha = (scsi_qla_host_t *)data; | ||
31 | struct fc_bsg_job *bsg_job = sp->u.bsg_job; | ||
18 | struct qla_hw_data *ha = vha->hw; | 32 | struct qla_hw_data *ha = vha->hw; |
19 | struct srb_ctx *ctx; | ||
20 | 33 | ||
21 | sp = mempool_alloc(ha->srb_mempool, GFP_KERNEL); | 34 | dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, |
22 | if (!sp) | 35 | bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); |
23 | goto done; | ||
24 | ctx = kzalloc(size, GFP_KERNEL); | ||
25 | if (!ctx) { | ||
26 | mempool_free(sp, ha->srb_mempool); | ||
27 | sp = NULL; | ||
28 | goto done; | ||
29 | } | ||
30 | 36 | ||
31 | memset(sp, 0, sizeof(*sp)); | 37 | dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, |
32 | sp->fcport = fcport; | 38 | bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); |
33 | sp->ctx = ctx; | 39 | |
34 | ctx->iocbs = 1; | 40 | if (sp->type == SRB_CT_CMD || |
35 | done: | 41 | sp->type == SRB_ELS_CMD_HST) |
36 | return sp; | 42 | kfree(sp->fcport); |
43 | mempool_free(sp, vha->hw->srb_mempool); | ||
37 | } | 44 | } |
38 | 45 | ||
39 | int | 46 | int |
@@ -101,8 +108,6 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) | |||
101 | uint32_t len; | 108 | uint32_t len; |
102 | uint32_t oper; | 109 | uint32_t oper; |
103 | 110 | ||
104 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
105 | |||
106 | if (!(IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || IS_QLA82XX(ha))) { | 111 | if (!(IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || IS_QLA82XX(ha))) { |
107 | ret = -EINVAL; | 112 | ret = -EINVAL; |
108 | goto exit_fcp_prio_cfg; | 113 | goto exit_fcp_prio_cfg; |
@@ -217,6 +222,7 @@ exit_fcp_prio_cfg: | |||
217 | bsg_job->job_done(bsg_job); | 222 | bsg_job->job_done(bsg_job); |
218 | return ret; | 223 | return ret; |
219 | } | 224 | } |
225 | |||
220 | static int | 226 | static int |
221 | qla2x00_process_els(struct fc_bsg_job *bsg_job) | 227 | qla2x00_process_els(struct fc_bsg_job *bsg_job) |
222 | { | 228 | { |
@@ -230,7 +236,6 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) | |||
230 | int req_sg_cnt, rsp_sg_cnt; | 236 | int req_sg_cnt, rsp_sg_cnt; |
231 | int rval = (DRIVER_ERROR << 16); | 237 | int rval = (DRIVER_ERROR << 16); |
232 | uint16_t nextlid = 0; | 238 | uint16_t nextlid = 0; |
233 | struct srb_ctx *els; | ||
234 | 239 | ||
235 | if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { | 240 | if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { |
236 | rport = bsg_job->rport; | 241 | rport = bsg_job->rport; |
@@ -337,20 +342,21 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) | |||
337 | } | 342 | } |
338 | 343 | ||
339 | /* Alloc SRB structure */ | 344 | /* Alloc SRB structure */ |
340 | sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_ctx)); | 345 | sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); |
341 | if (!sp) { | 346 | if (!sp) { |
342 | rval = -ENOMEM; | 347 | rval = -ENOMEM; |
343 | goto done_unmap_sg; | 348 | goto done_unmap_sg; |
344 | } | 349 | } |
345 | 350 | ||
346 | els = sp->ctx; | 351 | sp->type = |
347 | els->type = | ||
348 | (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? | 352 | (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? |
349 | SRB_ELS_CMD_RPT : SRB_ELS_CMD_HST); | 353 | SRB_ELS_CMD_RPT : SRB_ELS_CMD_HST); |
350 | els->name = | 354 | sp->name = |
351 | (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? | 355 | (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? |
352 | "bsg_els_rpt" : "bsg_els_hst"); | 356 | "bsg_els_rpt" : "bsg_els_hst"); |
353 | els->u.bsg_job = bsg_job; | 357 | sp->u.bsg_job = bsg_job; |
358 | sp->free = qla2x00_bsg_sp_free; | ||
359 | sp->done = qla2x00_bsg_job_done; | ||
354 | 360 | ||
355 | ql_dbg(ql_dbg_user, vha, 0x700a, | 361 | ql_dbg(ql_dbg_user, vha, 0x700a, |
356 | "bsg rqst type: %s els type: %x - loop-id=%x " | 362 | "bsg rqst type: %s els type: %x - loop-id=%x " |
@@ -362,7 +368,6 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) | |||
362 | if (rval != QLA_SUCCESS) { | 368 | if (rval != QLA_SUCCESS) { |
363 | ql_log(ql_log_warn, vha, 0x700e, | 369 | ql_log(ql_log_warn, vha, 0x700e, |
364 | "qla2x00_start_sp failed = %d\n", rval); | 370 | "qla2x00_start_sp failed = %d\n", rval); |
365 | kfree(sp->ctx); | ||
366 | mempool_free(sp, ha->srb_mempool); | 371 | mempool_free(sp, ha->srb_mempool); |
367 | rval = -EIO; | 372 | rval = -EIO; |
368 | goto done_unmap_sg; | 373 | goto done_unmap_sg; |
@@ -409,7 +414,6 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) | |||
409 | uint16_t loop_id; | 414 | uint16_t loop_id; |
410 | struct fc_port *fcport; | 415 | struct fc_port *fcport; |
411 | char *type = "FC_BSG_HST_CT"; | 416 | char *type = "FC_BSG_HST_CT"; |
412 | struct srb_ctx *ct; | ||
413 | 417 | ||
414 | req_sg_cnt = | 418 | req_sg_cnt = |
415 | dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, | 419 | dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, |
@@ -486,19 +490,20 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) | |||
486 | fcport->loop_id = loop_id; | 490 | fcport->loop_id = loop_id; |
487 | 491 | ||
488 | /* Alloc SRB structure */ | 492 | /* Alloc SRB structure */ |
489 | sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_ctx)); | 493 | sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); |
490 | if (!sp) { | 494 | if (!sp) { |
491 | ql_log(ql_log_warn, vha, 0x7015, | 495 | ql_log(ql_log_warn, vha, 0x7015, |
492 | "qla2x00_get_ctx_bsg_sp failed.\n"); | 496 | "qla2x00_get_sp failed.\n"); |
493 | rval = -ENOMEM; | 497 | rval = -ENOMEM; |
494 | goto done_free_fcport; | 498 | goto done_free_fcport; |
495 | } | 499 | } |
496 | 500 | ||
497 | ct = sp->ctx; | 501 | sp->type = SRB_CT_CMD; |
498 | ct->type = SRB_CT_CMD; | 502 | sp->name = "bsg_ct"; |
499 | ct->name = "bsg_ct"; | 503 | sp->iocbs = qla24xx_calc_ct_iocbs(req_sg_cnt + rsp_sg_cnt); |
500 | ct->iocbs = qla24xx_calc_ct_iocbs(req_sg_cnt + rsp_sg_cnt); | 504 | sp->u.bsg_job = bsg_job; |
501 | ct->u.bsg_job = bsg_job; | 505 | sp->free = qla2x00_bsg_sp_free; |
506 | sp->done = qla2x00_bsg_job_done; | ||
502 | 507 | ||
503 | ql_dbg(ql_dbg_user, vha, 0x7016, | 508 | ql_dbg(ql_dbg_user, vha, 0x7016, |
504 | "bsg rqst type: %s else type: %x - " | 509 | "bsg rqst type: %s else type: %x - " |
@@ -511,7 +516,6 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) | |||
511 | if (rval != QLA_SUCCESS) { | 516 | if (rval != QLA_SUCCESS) { |
512 | ql_log(ql_log_warn, vha, 0x7017, | 517 | ql_log(ql_log_warn, vha, 0x7017, |
513 | "qla2x00_start_sp failed=%d.\n", rval); | 518 | "qla2x00_start_sp failed=%d.\n", rval); |
514 | kfree(sp->ctx); | ||
515 | mempool_free(sp, ha->srb_mempool); | 519 | mempool_free(sp, ha->srb_mempool); |
516 | rval = -EIO; | 520 | rval = -EIO; |
517 | goto done_free_fcport; | 521 | goto done_free_fcport; |
@@ -540,7 +544,7 @@ qla81xx_set_internal_loopback(scsi_qla_host_t *vha, uint16_t *config, | |||
540 | int rval = 0; | 544 | int rval = 0; |
541 | struct qla_hw_data *ha = vha->hw; | 545 | struct qla_hw_data *ha = vha->hw; |
542 | 546 | ||
543 | if (!IS_QLA81XX(ha)) | 547 | if (!IS_QLA81XX(ha) && !IS_QLA83XX(ha)) |
544 | goto done_set_internal; | 548 | goto done_set_internal; |
545 | 549 | ||
546 | new_config[0] = config[0] | (ENABLE_INTERNAL_LOOPBACK << 1); | 550 | new_config[0] = config[0] | (ENABLE_INTERNAL_LOOPBACK << 1); |
@@ -582,7 +586,7 @@ qla81xx_reset_internal_loopback(scsi_qla_host_t *vha, uint16_t *config, | |||
582 | uint16_t new_config[4]; | 586 | uint16_t new_config[4]; |
583 | struct qla_hw_data *ha = vha->hw; | 587 | struct qla_hw_data *ha = vha->hw; |
584 | 588 | ||
585 | if (!IS_QLA81XX(ha)) | 589 | if (!IS_QLA81XX(ha) && !IS_QLA83XX(ha)) |
586 | goto done_reset_internal; | 590 | goto done_reset_internal; |
587 | 591 | ||
588 | memset(new_config, 0 , sizeof(new_config)); | 592 | memset(new_config, 0 , sizeof(new_config)); |
@@ -707,7 +711,7 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
707 | 711 | ||
708 | if ((ha->current_topology == ISP_CFG_F || | 712 | if ((ha->current_topology == ISP_CFG_F || |
709 | (atomic_read(&vha->loop_state) == LOOP_DOWN) || | 713 | (atomic_read(&vha->loop_state) == LOOP_DOWN) || |
710 | (IS_QLA81XX(ha) && | 714 | ((IS_QLA81XX(ha) || IS_QLA83XX(ha)) && |
711 | le32_to_cpu(*(uint32_t *)req_data) == ELS_OPCODE_BYTE | 715 | le32_to_cpu(*(uint32_t *)req_data) == ELS_OPCODE_BYTE |
712 | && req_data_len == MAX_ELS_FRAME_PAYLOAD)) && | 716 | && req_data_len == MAX_ELS_FRAME_PAYLOAD)) && |
713 | elreq.options == EXTERNAL_LOOPBACK) { | 717 | elreq.options == EXTERNAL_LOOPBACK) { |
@@ -717,13 +721,12 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
717 | command_sent = INT_DEF_LB_ECHO_CMD; | 721 | command_sent = INT_DEF_LB_ECHO_CMD; |
718 | rval = qla2x00_echo_test(vha, &elreq, response); | 722 | rval = qla2x00_echo_test(vha, &elreq, response); |
719 | } else { | 723 | } else { |
720 | if (IS_QLA81XX(ha)) { | 724 | if (IS_QLA81XX(ha) || IS_QLA8031(ha)) { |
721 | memset(config, 0, sizeof(config)); | 725 | memset(config, 0, sizeof(config)); |
722 | memset(new_config, 0, sizeof(new_config)); | 726 | memset(new_config, 0, sizeof(new_config)); |
723 | if (qla81xx_get_port_config(vha, config)) { | 727 | if (qla81xx_get_port_config(vha, config)) { |
724 | ql_log(ql_log_warn, vha, 0x701f, | 728 | ql_log(ql_log_warn, vha, 0x701f, |
725 | "Get port config failed.\n"); | 729 | "Get port config failed.\n"); |
726 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
727 | bsg_job->reply->result = (DID_ERROR << 16); | 730 | bsg_job->reply->result = (DID_ERROR << 16); |
728 | rval = -EPERM; | 731 | rval = -EPERM; |
729 | goto done_free_dma_req; | 732 | goto done_free_dma_req; |
@@ -737,8 +740,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
737 | new_config)) { | 740 | new_config)) { |
738 | ql_log(ql_log_warn, vha, 0x7024, | 741 | ql_log(ql_log_warn, vha, 0x7024, |
739 | "Internal loopback failed.\n"); | 742 | "Internal loopback failed.\n"); |
740 | bsg_job->reply->reply_payload_rcv_len = | ||
741 | 0; | ||
742 | bsg_job->reply->result = | 743 | bsg_job->reply->result = |
743 | (DID_ERROR << 16); | 744 | (DID_ERROR << 16); |
744 | rval = -EPERM; | 745 | rval = -EPERM; |
@@ -750,8 +751,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
750 | */ | 751 | */ |
751 | if (qla81xx_reset_internal_loopback(vha, | 752 | if (qla81xx_reset_internal_loopback(vha, |
752 | config, 1)) { | 753 | config, 1)) { |
753 | bsg_job->reply->reply_payload_rcv_len = | ||
754 | 0; | ||
755 | bsg_job->reply->result = | 754 | bsg_job->reply->result = |
756 | (DID_ERROR << 16); | 755 | (DID_ERROR << 16); |
757 | rval = -EPERM; | 756 | rval = -EPERM; |
@@ -788,7 +787,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
788 | "MPI reset failed.\n"); | 787 | "MPI reset failed.\n"); |
789 | } | 788 | } |
790 | 789 | ||
791 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
792 | bsg_job->reply->result = (DID_ERROR << 16); | 790 | bsg_job->reply->result = (DID_ERROR << 16); |
793 | rval = -EIO; | 791 | rval = -EIO; |
794 | goto done_free_dma_req; | 792 | goto done_free_dma_req; |
@@ -813,7 +811,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
813 | fw_sts_ptr += sizeof(response); | 811 | fw_sts_ptr += sizeof(response); |
814 | *fw_sts_ptr = command_sent; | 812 | *fw_sts_ptr = command_sent; |
815 | rval = 0; | 813 | rval = 0; |
816 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
817 | bsg_job->reply->result = (DID_ERROR << 16); | 814 | bsg_job->reply->result = (DID_ERROR << 16); |
818 | } else { | 815 | } else { |
819 | ql_dbg(ql_dbg_user, vha, 0x702d, | 816 | ql_dbg(ql_dbg_user, vha, 0x702d, |
@@ -872,7 +869,7 @@ qla84xx_reset(struct fc_bsg_job *bsg_job) | |||
872 | if (rval) { | 869 | if (rval) { |
873 | ql_log(ql_log_warn, vha, 0x7030, | 870 | ql_log(ql_log_warn, vha, 0x7030, |
874 | "Vendor request 84xx reset failed.\n"); | 871 | "Vendor request 84xx reset failed.\n"); |
875 | rval = bsg_job->reply->reply_payload_rcv_len = 0; | 872 | rval = 0; |
876 | bsg_job->reply->result = (DID_ERROR << 16); | 873 | bsg_job->reply->result = (DID_ERROR << 16); |
877 | 874 | ||
878 | } else { | 875 | } else { |
@@ -971,9 +968,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) | |||
971 | ql_log(ql_log_warn, vha, 0x7037, | 968 | ql_log(ql_log_warn, vha, 0x7037, |
972 | "Vendor request 84xx updatefw failed.\n"); | 969 | "Vendor request 84xx updatefw failed.\n"); |
973 | 970 | ||
974 | rval = bsg_job->reply->reply_payload_rcv_len = 0; | 971 | rval = 0; |
975 | bsg_job->reply->result = (DID_ERROR << 16); | 972 | bsg_job->reply->result = (DID_ERROR << 16); |
976 | |||
977 | } else { | 973 | } else { |
978 | ql_dbg(ql_dbg_user, vha, 0x7038, | 974 | ql_dbg(ql_dbg_user, vha, 0x7038, |
979 | "Vendor request 84xx updatefw completed.\n"); | 975 | "Vendor request 84xx updatefw completed.\n"); |
@@ -1159,7 +1155,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) | |||
1159 | ql_log(ql_log_warn, vha, 0x7043, | 1155 | ql_log(ql_log_warn, vha, 0x7043, |
1160 | "Vendor request 84xx mgmt failed.\n"); | 1156 | "Vendor request 84xx mgmt failed.\n"); |
1161 | 1157 | ||
1162 | rval = bsg_job->reply->reply_payload_rcv_len = 0; | 1158 | rval = 0; |
1163 | bsg_job->reply->result = (DID_ERROR << 16); | 1159 | bsg_job->reply->result = (DID_ERROR << 16); |
1164 | 1160 | ||
1165 | } else { | 1161 | } else { |
@@ -1210,8 +1206,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) | |||
1210 | uint16_t mb[MAILBOX_REGISTER_COUNT]; | 1206 | uint16_t mb[MAILBOX_REGISTER_COUNT]; |
1211 | uint8_t *rsp_ptr = NULL; | 1207 | uint8_t *rsp_ptr = NULL; |
1212 | 1208 | ||
1213 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
1214 | |||
1215 | if (!IS_IIDMA_CAPABLE(vha->hw)) { | 1209 | if (!IS_IIDMA_CAPABLE(vha->hw)) { |
1216 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); | 1210 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); |
1217 | return -EINVAL; | 1211 | return -EINVAL; |
@@ -1304,8 +1298,6 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha, | |||
1304 | int valid = 0; | 1298 | int valid = 0; |
1305 | struct qla_hw_data *ha = vha->hw; | 1299 | struct qla_hw_data *ha = vha->hw; |
1306 | 1300 | ||
1307 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
1308 | |||
1309 | if (unlikely(pci_channel_offline(ha->pdev))) | 1301 | if (unlikely(pci_channel_offline(ha->pdev))) |
1310 | return -EINVAL; | 1302 | return -EINVAL; |
1311 | 1303 | ||
@@ -1331,7 +1323,7 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha, | |||
1331 | start == (ha->flt_region_fw * 4)) | 1323 | start == (ha->flt_region_fw * 4)) |
1332 | valid = 1; | 1324 | valid = 1; |
1333 | else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || | 1325 | else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || |
1334 | IS_QLA8XXX_TYPE(ha)) | 1326 | IS_CNA_CAPABLE(ha) || IS_QLA2031(ha)) |
1335 | valid = 1; | 1327 | valid = 1; |
1336 | if (!valid) { | 1328 | if (!valid) { |
1337 | ql_log(ql_log_warn, vha, 0x7058, | 1329 | ql_log(ql_log_warn, vha, 0x7058, |
@@ -1617,6 +1609,9 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) | |||
1617 | struct Scsi_Host *host; | 1609 | struct Scsi_Host *host; |
1618 | scsi_qla_host_t *vha; | 1610 | scsi_qla_host_t *vha; |
1619 | 1611 | ||
1612 | /* In case no data transferred. */ | ||
1613 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
1614 | |||
1620 | if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { | 1615 | if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { |
1621 | rport = bsg_job->rport; | 1616 | rport = bsg_job->rport; |
1622 | fcport = *(fc_port_t **) rport->dd_data; | 1617 | fcport = *(fc_port_t **) rport->dd_data; |
@@ -1655,6 +1650,7 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) | |||
1655 | case FC_BSG_RPT_CT: | 1650 | case FC_BSG_RPT_CT: |
1656 | default: | 1651 | default: |
1657 | ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n"); | 1652 | ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n"); |
1653 | bsg_job->reply->result = ret; | ||
1658 | break; | 1654 | break; |
1659 | } | 1655 | } |
1660 | return ret; | 1656 | return ret; |
@@ -1669,7 +1665,6 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) | |||
1669 | int cnt, que; | 1665 | int cnt, que; |
1670 | unsigned long flags; | 1666 | unsigned long flags; |
1671 | struct req_que *req; | 1667 | struct req_que *req; |
1672 | struct srb_ctx *sp_bsg; | ||
1673 | 1668 | ||
1674 | /* find the bsg job from the active list of commands */ | 1669 | /* find the bsg job from the active list of commands */ |
1675 | spin_lock_irqsave(&ha->hardware_lock, flags); | 1670 | spin_lock_irqsave(&ha->hardware_lock, flags); |
@@ -1681,11 +1676,9 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) | |||
1681 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { | 1676 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { |
1682 | sp = req->outstanding_cmds[cnt]; | 1677 | sp = req->outstanding_cmds[cnt]; |
1683 | if (sp) { | 1678 | if (sp) { |
1684 | sp_bsg = sp->ctx; | 1679 | if (((sp->type == SRB_CT_CMD) || |
1685 | 1680 | (sp->type == SRB_ELS_CMD_HST)) | |
1686 | if (((sp_bsg->type == SRB_CT_CMD) || | 1681 | && (sp->u.bsg_job == bsg_job)) { |
1687 | (sp_bsg->type == SRB_ELS_CMD_HST)) | ||
1688 | && (sp_bsg->u.bsg_job == bsg_job)) { | ||
1689 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 1682 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
1690 | if (ha->isp_ops->abort_command(sp)) { | 1683 | if (ha->isp_ops->abort_command(sp)) { |
1691 | ql_log(ql_log_warn, vha, 0x7089, | 1684 | ql_log(ql_log_warn, vha, 0x7089, |
@@ -1715,7 +1708,6 @@ done: | |||
1715 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 1708 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
1716 | if (bsg_job->request->msgcode == FC_BSG_HST_CT) | 1709 | if (bsg_job->request->msgcode == FC_BSG_HST_CT) |
1717 | kfree(sp->fcport); | 1710 | kfree(sp->fcport); |
1718 | kfree(sp->ctx); | ||
1719 | mempool_free(sp, ha->srb_mempool); | 1711 | mempool_free(sp, ha->srb_mempool); |
1720 | return 0; | 1712 | return 0; |
1721 | } | 1713 | } |