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>
This commit is contained in:
committed by
Martin K. Petersen
parent
783e0dc4f6
commit
ec89146215
@@ -2295,6 +2295,47 @@ done:
|
||||
return rval;
|
||||
}
|
||||
|
||||
static int
|
||||
qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job)
|
||||
{
|
||||
struct Scsi_Host *host = bsg_job->shost;
|
||||
scsi_qla_host_t *vha = shost_priv(host);
|
||||
int rval;
|
||||
struct qla_dport_diag *dd;
|
||||
|
||||
if (!IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw))
|
||||
return -EPERM;
|
||||
|
||||
dd = kmalloc(sizeof(*dd), GFP_KERNEL);
|
||||
if (!dd) {
|
||||
ql_log(ql_log_warn, vha, 0x70db,
|
||||
"Failed to allocate memory for dport.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
sg_copy_to_buffer(bsg_job->request_payload.sg_list,
|
||||
bsg_job->request_payload.sg_cnt, dd, sizeof(*dd));
|
||||
|
||||
rval = qla26xx_dport_diagnostics(
|
||||
vha, dd->buf, sizeof(dd->buf), dd->options);
|
||||
if (rval == QLA_SUCCESS) {
|
||||
sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
|
||||
bsg_job->reply_payload.sg_cnt, dd, sizeof(*dd));
|
||||
}
|
||||
|
||||
bsg_job->reply->reply_payload_rcv_len = sizeof(*dd);
|
||||
bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] =
|
||||
rval ? EXT_STATUS_MAILBOX : EXT_STATUS_OK;
|
||||
|
||||
bsg_job->reply_len = sizeof(*bsg_job->reply);
|
||||
bsg_job->reply->result = DID_OK << 16;
|
||||
bsg_job->job_done(bsg_job);
|
||||
|
||||
kfree(dd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
|
||||
{
|
||||
@@ -2362,6 +2403,9 @@ qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
|
||||
case QL_VND_GET_PRIV_STATS:
|
||||
return qla2x00_get_priv_stats(bsg_job);
|
||||
|
||||
case QL_VND_DPORT_DIAGNOSTICS:
|
||||
return qla2x00_do_dport_diagnostics(bsg_job);
|
||||
|
||||
default:
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user