mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-18 06:50:08 +00:00
[SCSI] mpt2sas: add query task support for MPT2COMMAND ioctl
This patch will find an active mid for a query_task request via the ioctl path. This code is already there for task_abort, so this patch combining code using the same fuction _ctl_set_task_mid(), previously _ctl_do_task_abort(). Signed-off-by: Eric Moore <eric.moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
parent
993e0da7b7
commit
ddf59a35e9
@ -473,7 +473,7 @@ _ctl_poll(struct file *filep, poll_table *wait)
|
||||
}
|
||||
|
||||
/**
|
||||
* _ctl_do_task_abort - assign an active smid to the abort_task
|
||||
* _ctl_set_task_mid - assign an active smid to tm request
|
||||
* @ioc: per adapter object
|
||||
* @karg - (struct mpt2_ioctl_command)
|
||||
* @tm_request - pointer to mf from user space
|
||||
@ -482,7 +482,7 @@ _ctl_poll(struct file *filep, poll_table *wait)
|
||||
* during failure, the reply frame is filled.
|
||||
*/
|
||||
static int
|
||||
_ctl_do_task_abort(struct MPT2SAS_ADAPTER *ioc, struct mpt2_ioctl_command *karg,
|
||||
_ctl_set_task_mid(struct MPT2SAS_ADAPTER *ioc, struct mpt2_ioctl_command *karg,
|
||||
Mpi2SCSITaskManagementRequest_t *tm_request)
|
||||
{
|
||||
u8 found = 0;
|
||||
@ -494,6 +494,14 @@ _ctl_do_task_abort(struct MPT2SAS_ADAPTER *ioc, struct mpt2_ioctl_command *karg,
|
||||
Mpi2SCSITaskManagementReply_t *tm_reply;
|
||||
u32 sz;
|
||||
u32 lun;
|
||||
char *desc = NULL;
|
||||
|
||||
if (tm_request->TaskType == MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK)
|
||||
desc = "abort_task";
|
||||
else if (tm_request->TaskType == MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK)
|
||||
desc = "query_task";
|
||||
else
|
||||
return 0;
|
||||
|
||||
lun = scsilun_to_int((struct scsi_lun *)tm_request->LUN);
|
||||
|
||||
@ -517,13 +525,13 @@ _ctl_do_task_abort(struct MPT2SAS_ADAPTER *ioc, struct mpt2_ioctl_command *karg,
|
||||
spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
|
||||
|
||||
if (!found) {
|
||||
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "ABORT_TASK: "
|
||||
"DevHandle(0x%04x), lun(%d), no active mid!!\n", ioc->name,
|
||||
tm_request->DevHandle, lun));
|
||||
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
|
||||
"handle(0x%04x), lun(%d), no active mid!!\n", ioc->name,
|
||||
desc, tm_request->DevHandle, lun));
|
||||
tm_reply = ioc->ctl_cmds.reply;
|
||||
tm_reply->DevHandle = tm_request->DevHandle;
|
||||
tm_reply->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
|
||||
tm_reply->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK;
|
||||
tm_reply->TaskType = tm_request->TaskType;
|
||||
tm_reply->MsgLength = sizeof(Mpi2SCSITaskManagementReply_t)/4;
|
||||
tm_reply->VP_ID = tm_request->VP_ID;
|
||||
tm_reply->VF_ID = tm_request->VF_ID;
|
||||
@ -535,9 +543,9 @@ _ctl_do_task_abort(struct MPT2SAS_ADAPTER *ioc, struct mpt2_ioctl_command *karg,
|
||||
return 1;
|
||||
}
|
||||
|
||||
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "ABORT_TASK: "
|
||||
"DevHandle(0x%04x), lun(%d), smid(%d)\n", ioc->name,
|
||||
tm_request->DevHandle, lun, tm_request->TaskMID));
|
||||
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
|
||||
"handle(0x%04x), lun(%d), task_mid(%d)\n", ioc->name,
|
||||
desc, tm_request->DevHandle, lun, tm_request->TaskMID));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -739,8 +747,10 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
|
||||
(Mpi2SCSITaskManagementRequest_t *)mpi_request;
|
||||
|
||||
if (tm_request->TaskType ==
|
||||
MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {
|
||||
if (_ctl_do_task_abort(ioc, &karg, tm_request)) {
|
||||
MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK ||
|
||||
tm_request->TaskType ==
|
||||
MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK) {
|
||||
if (_ctl_set_task_mid(ioc, &karg, tm_request)) {
|
||||
mpt2sas_base_free_smid(ioc, smid);
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user