diff options
author | Harish Zunjarrao <harish.zunjarrao@qlogic.com> | 2011-08-01 06:26:15 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-27 10:36:32 -0400 |
commit | 8b0402e1383cd51121f05a1d249cde0212c28c99 (patch) | |
tree | 3d189b4ef2e557cf920d137bdc6c04fdd31ddbca /drivers/scsi/qla4xxx/ql4_bsg.c | |
parent | ef7830bb62c9edf34fc4e849a53d7e87bf51de4a (diff) |
[SCSI] qla4xxx: Add get ACB state support using BSG
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_bsg.c')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_bsg.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_bsg.c b/drivers/scsi/qla4xxx/ql4_bsg.c index 15032f130f22..de4db299bfcb 100644 --- a/drivers/scsi/qla4xxx/ql4_bsg.c +++ b/drivers/scsi/qla4xxx/ql4_bsg.c | |||
@@ -139,6 +139,63 @@ leave: | |||
139 | return rval; | 139 | return rval; |
140 | } | 140 | } |
141 | 141 | ||
142 | static int | ||
143 | qla4xxx_get_acb_state(struct bsg_job *bsg_job) | ||
144 | { | ||
145 | struct Scsi_Host *host = iscsi_job_to_shost(bsg_job); | ||
146 | struct scsi_qla_host *ha = to_qla_host(host); | ||
147 | struct iscsi_bsg_request *bsg_req = bsg_job->request; | ||
148 | struct iscsi_bsg_reply *bsg_reply = bsg_job->reply; | ||
149 | uint32_t status[MBOX_REG_COUNT]; | ||
150 | uint32_t acb_idx; | ||
151 | uint32_t ip_idx; | ||
152 | int rval = -EINVAL; | ||
153 | |||
154 | bsg_reply->reply_payload_rcv_len = 0; | ||
155 | |||
156 | if (unlikely(pci_channel_offline(ha->pdev))) | ||
157 | goto leave; | ||
158 | |||
159 | /* Only 4022 and above adapters are supported */ | ||
160 | if (is_qla4010(ha)) | ||
161 | goto leave; | ||
162 | |||
163 | if (ql4xxx_reset_active(ha)) { | ||
164 | ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__); | ||
165 | rval = -EBUSY; | ||
166 | goto leave; | ||
167 | } | ||
168 | |||
169 | if (bsg_job->reply_payload.payload_len < sizeof(status)) { | ||
170 | ql4_printk(KERN_ERR, ha, "%s: invalid payload len %d\n", | ||
171 | __func__, bsg_job->reply_payload.payload_len); | ||
172 | rval = -EINVAL; | ||
173 | goto leave; | ||
174 | } | ||
175 | |||
176 | acb_idx = bsg_req->rqst_data.h_vendor.vendor_cmd[1]; | ||
177 | ip_idx = bsg_req->rqst_data.h_vendor.vendor_cmd[2]; | ||
178 | |||
179 | rval = qla4xxx_get_ip_state(ha, acb_idx, ip_idx, status); | ||
180 | if (rval) { | ||
181 | ql4_printk(KERN_ERR, ha, "%s: get ip state failed\n", | ||
182 | __func__); | ||
183 | bsg_reply->result = DID_ERROR << 16; | ||
184 | rval = -EIO; | ||
185 | } else { | ||
186 | bsg_reply->reply_payload_rcv_len = | ||
187 | sg_copy_from_buffer(bsg_job->reply_payload.sg_list, | ||
188 | bsg_job->reply_payload.sg_cnt, | ||
189 | status, sizeof(status)); | ||
190 | bsg_reply->result = DID_OK << 16; | ||
191 | } | ||
192 | |||
193 | bsg_job_done(bsg_job, bsg_reply->result, | ||
194 | bsg_reply->reply_payload_rcv_len); | ||
195 | leave: | ||
196 | return rval; | ||
197 | } | ||
198 | |||
142 | /** | 199 | /** |
143 | * qla4xxx_process_vendor_specific - handle vendor specific bsg request | 200 | * qla4xxx_process_vendor_specific - handle vendor specific bsg request |
144 | * @job: iscsi_bsg_job to handle | 201 | * @job: iscsi_bsg_job to handle |
@@ -157,6 +214,9 @@ int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job) | |||
157 | case QLISCSI_VND_UPDATE_FLASH: | 214 | case QLISCSI_VND_UPDATE_FLASH: |
158 | return qla4xxx_update_flash(bsg_job); | 215 | return qla4xxx_update_flash(bsg_job); |
159 | 216 | ||
217 | case QLISCSI_VND_GET_ACB_STATE: | ||
218 | return qla4xxx_get_acb_state(bsg_job); | ||
219 | |||
160 | default: | 220 | default: |
161 | ql4_printk(KERN_ERR, ha, "%s: invalid BSG vendor command: " | 221 | ql4_printk(KERN_ERR, ha, "%s: invalid BSG vendor command: " |
162 | "0x%x\n", __func__, bsg_req->msgcode); | 222 | "0x%x\n", __func__, bsg_req->msgcode); |