diff options
author | Joe Carnuccio <joe.carnuccio@qlogic.com> | 2016-07-06 11:14:26 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-07-15 15:31:31 -0400 |
commit | ec89146215d124c429bff84b498dccdc4919ffa7 (patch) | |
tree | 36514351c139835450418c285fa176010b2284ad /drivers/scsi/qla2xxx/qla_bsg.c | |
parent | 783e0dc4f66ade6bbd8833b6bae778158d54c1a6 (diff) |
qla2xxx: Add bsg interface to support D_Port Diagnostics.
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_bsg.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index 8cadc4da7d59..592e9249db02 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c | |||
@@ -2296,6 +2296,47 @@ done: | |||
2296 | } | 2296 | } |
2297 | 2297 | ||
2298 | static int | 2298 | static int |
2299 | qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job) | ||
2300 | { | ||
2301 | struct Scsi_Host *host = bsg_job->shost; | ||
2302 | scsi_qla_host_t *vha = shost_priv(host); | ||
2303 | int rval; | ||
2304 | struct qla_dport_diag *dd; | ||
2305 | |||
2306 | if (!IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw)) | ||
2307 | return -EPERM; | ||
2308 | |||
2309 | dd = kmalloc(sizeof(*dd), GFP_KERNEL); | ||
2310 | if (!dd) { | ||
2311 | ql_log(ql_log_warn, vha, 0x70db, | ||
2312 | "Failed to allocate memory for dport.\n"); | ||
2313 | return -ENOMEM; | ||
2314 | } | ||
2315 | |||
2316 | sg_copy_to_buffer(bsg_job->request_payload.sg_list, | ||
2317 | bsg_job->request_payload.sg_cnt, dd, sizeof(*dd)); | ||
2318 | |||
2319 | rval = qla26xx_dport_diagnostics( | ||
2320 | vha, dd->buf, sizeof(dd->buf), dd->options); | ||
2321 | if (rval == QLA_SUCCESS) { | ||
2322 | sg_copy_from_buffer(bsg_job->reply_payload.sg_list, | ||
2323 | bsg_job->reply_payload.sg_cnt, dd, sizeof(*dd)); | ||
2324 | } | ||
2325 | |||
2326 | bsg_job->reply->reply_payload_rcv_len = sizeof(*dd); | ||
2327 | bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = | ||
2328 | rval ? EXT_STATUS_MAILBOX : EXT_STATUS_OK; | ||
2329 | |||
2330 | bsg_job->reply_len = sizeof(*bsg_job->reply); | ||
2331 | bsg_job->reply->result = DID_OK << 16; | ||
2332 | bsg_job->job_done(bsg_job); | ||
2333 | |||
2334 | kfree(dd); | ||
2335 | |||
2336 | return 0; | ||
2337 | } | ||
2338 | |||
2339 | static int | ||
2299 | qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) | 2340 | qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) |
2300 | { | 2341 | { |
2301 | switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) { | 2342 | switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) { |
@@ -2362,6 +2403,9 @@ qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) | |||
2362 | case QL_VND_GET_PRIV_STATS: | 2403 | case QL_VND_GET_PRIV_STATS: |
2363 | return qla2x00_get_priv_stats(bsg_job); | 2404 | return qla2x00_get_priv_stats(bsg_job); |
2364 | 2405 | ||
2406 | case QL_VND_DPORT_DIAGNOSTICS: | ||
2407 | return qla2x00_do_dport_diagnostics(bsg_job); | ||
2408 | |||
2365 | default: | 2409 | default: |
2366 | return -ENOSYS; | 2410 | return -ENOSYS; |
2367 | } | 2411 | } |