diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2012-02-09 14:15:44 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-19 09:20:10 -0500 |
commit | b7bfbe12dc7223096005338a3099b2eec685bc30 (patch) | |
tree | 26425e563c6b2fa04816282fb01e23cc582ad73f /drivers | |
parent | af11f64dfd634e8116b7c4e2422e0e0c698b91c1 (diff) |
[SCSI] qla2xxx: Prep zero-length BSG data-transfer requests.
During command failure/non-recognition, the upper-layer
FC-transport expects the drivers to set
job-reply->reply_payload_rcv_len. Do this in a consistent manner
to avoid duplication.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index b2b664483ab4..020714329ee2 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c | |||
@@ -108,8 +108,6 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) | |||
108 | uint32_t len; | 108 | uint32_t len; |
109 | uint32_t oper; | 109 | uint32_t oper; |
110 | 110 | ||
111 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
112 | |||
113 | if (!(IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || IS_QLA82XX(ha))) { | 111 | if (!(IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || IS_QLA82XX(ha))) { |
114 | ret = -EINVAL; | 112 | ret = -EINVAL; |
115 | goto exit_fcp_prio_cfg; | 113 | goto exit_fcp_prio_cfg; |
@@ -729,7 +727,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
729 | if (qla81xx_get_port_config(vha, config)) { | 727 | if (qla81xx_get_port_config(vha, config)) { |
730 | ql_log(ql_log_warn, vha, 0x701f, | 728 | ql_log(ql_log_warn, vha, 0x701f, |
731 | "Get port config failed.\n"); | 729 | "Get port config failed.\n"); |
732 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
733 | bsg_job->reply->result = (DID_ERROR << 16); | 730 | bsg_job->reply->result = (DID_ERROR << 16); |
734 | rval = -EPERM; | 731 | rval = -EPERM; |
735 | goto done_free_dma_req; | 732 | goto done_free_dma_req; |
@@ -743,8 +740,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
743 | new_config)) { | 740 | new_config)) { |
744 | ql_log(ql_log_warn, vha, 0x7024, | 741 | ql_log(ql_log_warn, vha, 0x7024, |
745 | "Internal loopback failed.\n"); | 742 | "Internal loopback failed.\n"); |
746 | bsg_job->reply->reply_payload_rcv_len = | ||
747 | 0; | ||
748 | bsg_job->reply->result = | 743 | bsg_job->reply->result = |
749 | (DID_ERROR << 16); | 744 | (DID_ERROR << 16); |
750 | rval = -EPERM; | 745 | rval = -EPERM; |
@@ -756,8 +751,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
756 | */ | 751 | */ |
757 | if (qla81xx_reset_internal_loopback(vha, | 752 | if (qla81xx_reset_internal_loopback(vha, |
758 | config, 1)) { | 753 | config, 1)) { |
759 | bsg_job->reply->reply_payload_rcv_len = | ||
760 | 0; | ||
761 | bsg_job->reply->result = | 754 | bsg_job->reply->result = |
762 | (DID_ERROR << 16); | 755 | (DID_ERROR << 16); |
763 | rval = -EPERM; | 756 | rval = -EPERM; |
@@ -794,7 +787,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
794 | "MPI reset failed.\n"); | 787 | "MPI reset failed.\n"); |
795 | } | 788 | } |
796 | 789 | ||
797 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
798 | bsg_job->reply->result = (DID_ERROR << 16); | 790 | bsg_job->reply->result = (DID_ERROR << 16); |
799 | rval = -EIO; | 791 | rval = -EIO; |
800 | goto done_free_dma_req; | 792 | goto done_free_dma_req; |
@@ -819,7 +811,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
819 | fw_sts_ptr += sizeof(response); | 811 | fw_sts_ptr += sizeof(response); |
820 | *fw_sts_ptr = command_sent; | 812 | *fw_sts_ptr = command_sent; |
821 | rval = 0; | 813 | rval = 0; |
822 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
823 | bsg_job->reply->result = (DID_ERROR << 16); | 814 | bsg_job->reply->result = (DID_ERROR << 16); |
824 | } else { | 815 | } else { |
825 | ql_dbg(ql_dbg_user, vha, 0x702d, | 816 | ql_dbg(ql_dbg_user, vha, 0x702d, |
@@ -878,7 +869,7 @@ qla84xx_reset(struct fc_bsg_job *bsg_job) | |||
878 | if (rval) { | 869 | if (rval) { |
879 | ql_log(ql_log_warn, vha, 0x7030, | 870 | ql_log(ql_log_warn, vha, 0x7030, |
880 | "Vendor request 84xx reset failed.\n"); | 871 | "Vendor request 84xx reset failed.\n"); |
881 | rval = bsg_job->reply->reply_payload_rcv_len = 0; | 872 | rval = 0; |
882 | bsg_job->reply->result = (DID_ERROR << 16); | 873 | bsg_job->reply->result = (DID_ERROR << 16); |
883 | 874 | ||
884 | } else { | 875 | } else { |
@@ -977,9 +968,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) | |||
977 | ql_log(ql_log_warn, vha, 0x7037, | 968 | ql_log(ql_log_warn, vha, 0x7037, |
978 | "Vendor request 84xx updatefw failed.\n"); | 969 | "Vendor request 84xx updatefw failed.\n"); |
979 | 970 | ||
980 | rval = bsg_job->reply->reply_payload_rcv_len = 0; | 971 | rval = 0; |
981 | bsg_job->reply->result = (DID_ERROR << 16); | 972 | bsg_job->reply->result = (DID_ERROR << 16); |
982 | |||
983 | } else { | 973 | } else { |
984 | ql_dbg(ql_dbg_user, vha, 0x7038, | 974 | ql_dbg(ql_dbg_user, vha, 0x7038, |
985 | "Vendor request 84xx updatefw completed.\n"); | 975 | "Vendor request 84xx updatefw completed.\n"); |
@@ -1165,7 +1155,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) | |||
1165 | ql_log(ql_log_warn, vha, 0x7043, | 1155 | ql_log(ql_log_warn, vha, 0x7043, |
1166 | "Vendor request 84xx mgmt failed.\n"); | 1156 | "Vendor request 84xx mgmt failed.\n"); |
1167 | 1157 | ||
1168 | rval = bsg_job->reply->reply_payload_rcv_len = 0; | 1158 | rval = 0; |
1169 | bsg_job->reply->result = (DID_ERROR << 16); | 1159 | bsg_job->reply->result = (DID_ERROR << 16); |
1170 | 1160 | ||
1171 | } else { | 1161 | } else { |
@@ -1216,8 +1206,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) | |||
1216 | uint16_t mb[MAILBOX_REGISTER_COUNT]; | 1206 | uint16_t mb[MAILBOX_REGISTER_COUNT]; |
1217 | uint8_t *rsp_ptr = NULL; | 1207 | uint8_t *rsp_ptr = NULL; |
1218 | 1208 | ||
1219 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
1220 | |||
1221 | if (!IS_IIDMA_CAPABLE(vha->hw)) { | 1209 | if (!IS_IIDMA_CAPABLE(vha->hw)) { |
1222 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); | 1210 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); |
1223 | return -EINVAL; | 1211 | return -EINVAL; |
@@ -1310,8 +1298,6 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha, | |||
1310 | int valid = 0; | 1298 | int valid = 0; |
1311 | struct qla_hw_data *ha = vha->hw; | 1299 | struct qla_hw_data *ha = vha->hw; |
1312 | 1300 | ||
1313 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
1314 | |||
1315 | if (unlikely(pci_channel_offline(ha->pdev))) | 1301 | if (unlikely(pci_channel_offline(ha->pdev))) |
1316 | return -EINVAL; | 1302 | return -EINVAL; |
1317 | 1303 | ||
@@ -1623,6 +1609,9 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) | |||
1623 | struct Scsi_Host *host; | 1609 | struct Scsi_Host *host; |
1624 | scsi_qla_host_t *vha; | 1610 | scsi_qla_host_t *vha; |
1625 | 1611 | ||
1612 | /* In case no data transferred. */ | ||
1613 | bsg_job->reply->reply_payload_rcv_len = 0; | ||
1614 | |||
1626 | if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { | 1615 | if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { |
1627 | rport = bsg_job->rport; | 1616 | rport = bsg_job->rport; |
1628 | fcport = *(fc_port_t **) rport->dd_data; | 1617 | fcport = *(fc_port_t **) rport->dd_data; |
@@ -1661,6 +1650,7 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) | |||
1661 | case FC_BSG_RPT_CT: | 1650 | case FC_BSG_RPT_CT: |
1662 | default: | 1651 | default: |
1663 | 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; | ||
1664 | break; | 1654 | break; |
1665 | } | 1655 | } |
1666 | return ret; | 1656 | return ret; |