• Minwoo Im's avatar
    scsi: mpt3sas: support target smid for [abort|query] task · 8f55c307
    Minwoo Im authored
    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.
    
    Current code does not support to check target IPTT tag from the tm_request.
    This patch introduces to check TaskMID given from the userspace as a target
    tag.  We have a rule of relationship between
    (struct request *req->tag) and smid in mpt3sas_base.c:
    
    3318 u16
    3319 mpt3sas_base_get_smid_scsiio(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx,
    3320         struct scsi_cmnd *scmd)
    3321 {
    3322         struct scsiio_tracker *request = scsi_cmd_priv(scmd);
    3323         unsigned int tag = scmd->request->tag;
    3324         u16 smid;
    3325
    3326         smid = tag + 1;
    
    So if we want to abort a request tagged #X, then we can pass (X + 1) to
    this IOCTL handler.  Otherwise, user space just can pass 0 TaskMID to abort
    the first outstanding smid which is legacy behaviour.
    
    Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
    Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
    Cc: Sathya Prakash <sathya.prakash@broadcom.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: MPT-FusionLinux.pdl@broadcom.com
    Signed-off-by: default avatarMinwoo Im <minwoo.im@samsung.com>
    Acked-by: default avatarSreekanth Reddy <sreekanth.reddy@broadcom.com>
    Signed-off-by: default avatarMinwoo Im <minwoo.im.dev@gmail.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    8f55c307
mpt3sas_ctl.c 98.1 KB