Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp309142ybi; Thu, 20 Jun 2019 23:37:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPoN04PtCz3Ik6WzMTv6pmH/8xmOXZg5aEwTfFPkN6NbWVHGugiDEsVEnr8L/7TtYAKruR X-Received: by 2002:a63:9502:: with SMTP id p2mr6529631pgd.12.1561099061862; Thu, 20 Jun 2019 23:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561099061; cv=none; d=google.com; s=arc-20160816; b=P0acUfrAOwzjEMXnjmvKz56vfX6nJ1YhW58jRRcn6AQvPaPFDQ7RvRkNsjlO9qvtvP Y7fYz44zvtOhzr8saEtUnzjueyVXtuCNxHultK3pBWBwM3PcPYuuEGefttUnTEfi2rK2 aNHwlqgrcvdzRRUd4NKnUuPLJTwUoSqbBNEl6AIQQCKCfd8rnKm20esX9620/gsHsPkY KkWacx8yXSlXW3VVjQLpd8aWFEgNL5tPyACoq8DhhrcZS3uiiPjQ0F2cMGWKgWdvU1p7 g4Qb1uaGMD7IR+8QsU32sQAVXUMhpzghfIobzbfcFhhWuV470fli1zJQ0Saq04OM2eyn Im6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:cc:to:from:reply-to :subject:mime-version:dkim-signature:dkim-filter; bh=FUXfEF/JZH7Df1KRLWEPZkDMvrBOyREUHuamqsN/wwk=; b=AdkEToTdrq/KA+MUkqZd8iehgCZJTNDs+ZzPDXJxd4jOPf3xv6Eqbc/nJN1G8tXK3/ FFL5u4/vgLXXj73uGxmzHQReHzX15md5Z134jN5hbUijMRPOYV7jcs63YSQP0nGlna6p LEvdIjUYkiqkB1ToFJGho0UOb3Dq9UPqon/xxdEUmw9aajFij/eYZsxfzxBXRTgURiDa vt7kMFqBP3Xn2NqvjfBjhTYzY+opekJoLVAxMfj0GVrfKARHRqCKx/J7pl7d0+5NODV7 l90bnOEvxiNbWvV/aLArstKIMzbsrXXObxDarHYLwR1DfihtpgJv+62/pz71OjIOKyhG lLmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VayEJiU8; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o69si1832757pfo.106.2019.06.20.23.37.26; Thu, 20 Jun 2019 23:37:41 -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=@samsung.com header.s=mail20170921 header.b=VayEJiU8; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726131AbfFUGhR (ORCPT + 99 others); Fri, 21 Jun 2019 02:37:17 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:39281 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbfFUGhQ (ORCPT ); Fri, 21 Jun 2019 02:37:16 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190621063713epoutp0478ab37ea92620d1272466f1e2329b782~qI0zRm8U81506515065epoutp04a for ; Fri, 21 Jun 2019 06:37:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190621063713epoutp0478ab37ea92620d1272466f1e2329b782~qI0zRm8U81506515065epoutp04a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1561099033; bh=FUXfEF/JZH7Df1KRLWEPZkDMvrBOyREUHuamqsN/wwk=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=VayEJiU8NciideFFKQowZke/tdKrSvIws31Vi0UvfXuC9ovTpRmKOZ1nwyjI76Hgh 2NXp06qC+YSxFCwc+ZkjJ2/3eIq5DxbshuOTv/XSzKsTEiEXodvL3SrPPKdibsXsKf ywudkW10xfZ9S1UhpSIaAL+pzlCrU2c3GpwdKG4Q= Received: from epsmges2p3.samsung.com (unknown [182.195.40.187]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190621063710epcas2p107eaab8554a6da203408dd69ba651303~qI0wV7sQ62189321893epcas2p1v; Fri, 21 Jun 2019 06:37:10 +0000 (GMT) X-AuditID: b6c32a47-133ff7000000106e-70-5d0c7b15da6d Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id B9.0F.04206.51B7C0D5; Fri, 21 Jun 2019 15:37:09 +0900 (KST) Mime-Version: 1.0 Subject: [RESEND RFC PATCH] mpt3sas: support target smid for [abort|query] task Reply-To: minwoo.im@samsung.com From: Minwoo Im To: "sathya.prakash@broadcom.com" , "suganath-prabu.subramani@broadcom.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" CC: Minwoo Im , "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 X-Priority: 3 X-Content-Kind-Code: NORMAL X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20190621063708epcms2p309f4173afabe5de28942ba15d13987f7@epcms2p3> Date: Fri, 21 Jun 2019 15:37:08 +0900 X-CMS-MailID: 20190621063708epcms2p309f4173afabe5de28942ba15d13987f7 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIJsWRmVeSWpSXmKPExsWy7bCmua5oNU+swb1+douPK3axWzx852yx 6MY2Jou9t7QtLu+aw2bRfX0Hm8Xy4/+YLJ6dPsBsMfd1A5PFoq3vWS02zLvFYrH+0AQ2i2dn Yhx4PWbdP8vmMWHRAUaPj09vsXj0bVnF6PF5k1wAa1SOTUZqYkpqkUJqXnJ+SmZeuq2Sd3C8 c7ypmYGhrqGlhbmSQl5ibqqtkotPgK5bZg7QhUoKZYk5pUChgMTiYiV9O5ui/NKSVIWM/OIS W6XUgpScAkPDAr3ixNzi0rx0veT8XCtDAwMjU6DKhJyMJ6smMxfsFqo4euE3SwNjA38XIyeH hICJxNZb65i7GLk4hAR2MEpcmdME5HBw8AoISvzdIQxSIywQKHGiaSYbSFhIQF7ixysDiLCm xLvdZ1hBbDYBdYmGqa9YQMaICPxjlPi79C0TiMMscJxZYuHHRawQy3glZrQ/ZYGwpSW2L9/K CGGLStxc/ZYdxn5/bD5UXESi9d5ZZghbUOLBz92MIEdICEhI3HtnB2HWS2xZYQGySkKghVHi xpu1UK36Eo3PP4Kt4hXwlfg/aR9YnEVAVeLJvD1QY1wkDnwqBQkzA721/e0csM+Zgf5av0sf okJZ4sgtFogKPomOw3/ZYf7YMe8JE4StLPHx0CGoGyUlll96zQZhe0hs/zoXrEYIGICzu8+x TWCUn4UI2llI9s5C2LuAkXkVo1hqQXFuemqxUYExcmxuYgQnTy33HYzbzvkcYhTgYFTi4T0w iztWiDWxrLgy9xCjBAezkggvTw5PrBBvSmJlVWpRfnxRaU5q8SFGU6DvJzJLiSbnAxN7Xkm8 oamRmZmBpamFqZmRhZI47ybumzFCAumJJanZqakFqUUwfUwcnFINjNlJ2855u8T5OmxkT73H xBVW1rREnkOhmdEl6ZxuRITq0t5okdLJ6sslNuidW7eLwyth99+1kcV/nHJEjJn8FwQvyFJ5 m1QVMSu5wkwpaJ73z0lPJq/6tiXiStjPuzeYoucGulk/v2d+PPzzl+aOU1ft/JO6lhZPmqWV tMaz44npvAo78Y6DSizFGYmGWsxFxYkA+kuLG7QDAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20190621063708epcms2p309f4173afabe5de28942ba15d13987f7 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { + 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