Message ID | 20190727185337.19299-1-minwoo.im.dev@gmail.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 8f55c307ab577af74efab066ba1e45b0e51e4bae |
Headers | show |
Series | [RESEND] mpt3sas: support target smid for [abort|query] task | expand |
Minwoo, > We can request task management IOCTL > command(MPI2_FUNCTION_SCSI_TASK_MGMT) to /dev/mpt3ctl. If the given > task_type is either abort task or query task, it may need a field > named "Initiator Port Transfer Tag to Manage" in the IU. Applied to 5.4/scsi-queue, thank you!
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c index d4ecfbbe738c..a26c5516ea3e 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c @@ -596,8 +596,16 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, if (priv_data->sas_target->handle != handle) continue; st = scsi_cmd_priv(scmd); - tm_request->TaskMID = cpu_to_le16(st->smid); - found = 1; + + /* + * If the given TaskMID from the user space is zero, then the + * first outstanding smid will be picked up. Otherwise, + * targeted smid will be the one. + */ + if (!tm_request->TaskMID || tm_request->TaskMID == st->smid) { + tm_request->TaskMID = cpu_to_le16(st->smid); + found = 1; + } } if (!found) {