Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp597476ybi; Fri, 12 Jul 2019 01:28:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/2eV2MvOs2Il9sPeqeC1z93CoVbrOo2jkaxdIlnUq1kpRo4ooJPhIZHo4vvU0HxMvBqJy X-Received: by 2002:a17:902:296a:: with SMTP id g97mr9746316plb.115.1562920085329; Fri, 12 Jul 2019 01:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562920085; cv=none; d=google.com; s=arc-20160816; b=xyx6ClTRVIKAq+gSeBzUYNJsvQjioLaEtQ3/RdfSh2v/1cYui/E6Q1ZwrV3feY6d0O RsZU4pZtXoO4awpIdiaQOuKloK752qlXHd2hvPsaqmU/pE8CalL1Air+qnM0iI7RXPfq RyKBUarnDBcP1oi1v4CRzFTN0aLzckDwuxJwYGvGt2Shk9tcfoEx5DDrZWC4/AbzmKAG nc3iVxubHfqXaATsh6h7gs9IYEa8HTRGdU5iOOjoqFdj6QHBWdeV7em9NQBPZsb+jhNV nBRRSWfHn1hO6MyRgS9czHWyXA2j574DFrFs6Nar4ay4Cy87AZf/RxQtAmw5BFqkUcCd oV0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/RTxoumVNtB1PBld0antS4Z7J0pCK7ZhiGq0s+u+T8Q=; b=IhOqYtpcnWiwCqXvK/2XxNcM9rJRBw10RpB9h9DvjfngzyqDh80AzhdJK+b3d8yIWW P7Vy1W2fyaoTDVPcXgMCe/eZWDyETGJIGnQ8MGGCCj6BpaSxe2anCynNx+YUOgP8XckH izlatp1t27uK9M+qast0UlX2Bm1aTSlIRVpQ1UhzWzM2rhhoNRZWc6Ciis2ekqdE48YX vf/YbDbtsSaVPgz7UzewnFwuRZSx+OaKz5avYF2zWES7wERu2xx7FiQg7+zrjXbop4KV QSb3Z+/3M3/CDG3PF4DWkT7PZtHQsoTRUCf88B7hSa0BfqrKxUbxLUOZSsrfv/97pwa/ ZzQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=BAFql+Ha; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si7718203pgd.278.2019.07.12.01.27.48; Fri, 12 Jul 2019 01:28:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=BAFql+Ha; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726462AbfGLIZ7 (ORCPT + 99 others); Fri, 12 Jul 2019 04:25:59 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45211 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfGLIZ7 (ORCPT ); Fri, 12 Jul 2019 04:25:59 -0400 Received: by mail-pf1-f193.google.com with SMTP id r1so3971080pfq.12 for ; Fri, 12 Jul 2019 01:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/RTxoumVNtB1PBld0antS4Z7J0pCK7ZhiGq0s+u+T8Q=; b=BAFql+HaVxohUfVl9mYP/S5YzuA9cwdMGK2nCDIC66akftcSMq/vzOqHPsPfc6/6QO 3jbIxFLWL9RGB511maoma3UoAL51vux8VnJePTL/VCgMZPr6RxN5Bw1+YMc/2Gt+m8we 3O5VAqNXBto7Ij4ZOE6HDlreMkSzh4Wj+AQqk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/RTxoumVNtB1PBld0antS4Z7J0pCK7ZhiGq0s+u+T8Q=; b=J/qIqkykcc4PpXOHoLz2C5HxOvAmC+RRnCl392a2LbOKFmFqN3MD21DDmFV9WdDx2j SIDZwOYLmklqQwyyp5TqQgRHHf4wItJbeCSudx/MfwJSU1R1aAM/a1gOrl2Qhf1uLRsd evbXXZlBGBI/Yijy0OHfzoI4v0YuXOWmmS/h2H1tDyUPM7WSwWCcZKOGF7YLEEL+D+9r AD5BhglrwgnXRrsbnRAODJk0IJVCPwUe/6eThQSj0bG1mIDrPEZrBZ+XY6zkeY/Eazuu dBBqcmf7UNPFZvDPbpLSbsOMtXL169TVbGedgluJrAnfbUH8Nfc5vTmTHNFdYsE09eYk CYeQ== X-Gm-Message-State: APjAAAV7O7eGuBEY8NUZherfzf07CHnxj9/pYiSF+FYUfuIemgUnJjt7 8o5tf9EiJrwdsnSomtlAs7oTKLjdk50kVChong1yIA== X-Received: by 2002:a17:90a:ac14:: with SMTP id o20mr10306970pjq.114.1562919958370; Fri, 12 Jul 2019 01:25:58 -0700 (PDT) MIME-Version: 1.0 References: <20190621063708epcms2p309f4173afabe5de28942ba15d13987f7@epcms2p3> In-Reply-To: <20190621063708epcms2p309f4173afabe5de28942ba15d13987f7@epcms2p3> From: Sreekanth Reddy Date: Fri, 12 Jul 2019 13:55:47 +0530 Message-ID: Subject: Re: [RESEND RFC PATCH] mpt3sas: support target smid for [abort|query] task To: minwoo.im@samsung.com Cc: "sathya.prakash@broadcom.com" , "suganath-prabu.subramani@broadcom.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "MPT-FusionLinux.pdl@broadcom.com" , "linux-kernel@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-block@vger.kernel.org" , Euihyeok Kwon , Sarah Cho , Sanggwan Lee , Gyeongmin Nam Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 12:07 PM Minwoo Im wrote: > > 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. > > Cc: Sathya Prakash > Cc: Suganath Prabu Subramani > Cc: James E.J. Bottomley > Cc: Martin K. Petersen > Cc: MPT-FusionLinux.pdl@broadcom.com > Signed-off-by: Minwoo Im > --- > drivers/scsi/mpt3sas/mpt3sas_ctl.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c > index b2bb47c14d35..5c7539dae713 100644 > --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c > +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c > @@ -596,15 +596,17 @@ _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 (tm_request->TaskMID == st->smid) { I think it will difficult for the user to find the smid that he want to abort. For this user has to enable the scsi logging level and get the tag and pass the ioctl with tag +1 value in TaskMID field. And hence currently driver will loop over all the smid's and if it fines any outstanding smid then it will issue task abort or task query TM for this outstanding smid to the HBA firmware. May be we can do like below, * First check whether user provided "TaskMID" is non zero or not. if user provided TaskMID is non-zero and if this TaskMID is outstanding then driver will issue TaskAbort/QueryTask TM with this TaskMID value else driver will loop over all the smid's and if finds any smid is outstanding then it will issue TaskAbort/QueryTask TM with TaskMID value set to outstanding smid. With the above logic still legacy application will be supported without breaking anything where they provide TaskMID filed as zero. And it also allows the user to abort the IO which he wants. Thanks, Sreekanth > + tm_request->TaskMID = cpu_to_le16(st->smid); > + found = 1; > + } > } > > if (!found) { > dctlprintk(ioc, > - ioc_info(ioc, "%s: handle(0x%04x), lun(%d), no active mid!!\n", > + ioc_info(ioc, "%s: handle(0x%04x), lun(%d), no matched mid(%d)!!\n", > desc, le16_to_cpu(tm_request->DevHandle), > - lun)); > + lun, tm_request->TaskMID)); > tm_reply = ioc->ctl_cmds.reply; > tm_reply->DevHandle = tm_request->DevHandle; > tm_reply->Function = MPI2_FUNCTION_SCSI_TASK_MGMT; > -- > 2.16.1