Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7102792ybi; Thu, 13 Jun 2019 09:35:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9R1uhHHaQymN/iUH/WKyH+qXt7c3zrozQwfEbx9TH+GpLB2A4c0uqQT9lvbPMqSkEn+c+ X-Received: by 2002:a63:d551:: with SMTP id v17mr21195954pgi.365.1560443731788; Thu, 13 Jun 2019 09:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560443731; cv=none; d=google.com; s=arc-20160816; b=iOK01MUOrZlGxPSCXyccp2efKmIgouyVRh1xVGqsDSYIajkCqJktF0RBYOHaPYwjcM dlHLInPrACZadEiWwy98oYQefxLGcZiOwyimjXcVRvrMT+F7Ouzzp65ZNIf5mgF03V1P axWaVUZ9/vQIKQDr9epdeCky7cw2PmPiqVn0ga2zi880Iw19kt4kaTIwtsfFMOZJHlBX nLkwX0I/aoHBx8YyHzk+7vg6Xn82/QHS8N7Z58jHq5SmJC805E0CDCxgwj0IlfJlJSrh meskb0iXQwwaFFT3Nynj/hpFzguIlMfiIQjQ8UMfzQ+B+AWpSU+mMKf9ZKN5gR91FPOc Wq8A== 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=wzSwN4u5LkJkQagGovrAV/IuOaYbJLihVMExvb/oMPM=; b=eHochpu/a6I35DB2CGskjdR1CFz5u9OSpVMSoAAPRW1G7RRf9auxcfXg0SflCCRrgk coEaRftHGR2ZFRRfCE29n4OqfLQd3SpBbngKBopmwyJlRGbvOqY/yOVB4pXmFqcZdGjL Vo1wkC6kvPFbmJrMAsVfjlo9nZH3Dg5dtLg9/qbb7CeuOFHA2K/UzKcQDB8BVomHZdlK cL3OM6Z5eVAskr6UCQSLc89754akiZPaSHfMs4nIjV3LH/hWQGb35Lu57p/ngAD5oJA9 pLm8OQ5FbQaYoHAKXBTEq8l1SEgRyD2nomYjcl9I2vQnn8C32cyY89Sh6xL1FYHe7TKA ubSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=hBHQOEPI; 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 d5si8165plo.396.2019.06.13.09.35.16; Thu, 13 Jun 2019 09:35:31 -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=hBHQOEPI; 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 S1730785AbfFMQeD (ORCPT + 99 others); Thu, 13 Jun 2019 12:34:03 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:40785 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730786AbfFMHyJ (ORCPT ); Thu, 13 Jun 2019 03:54:09 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190613075406epoutp0118888d0ed51c51b6a9d2229321968b97~nsto0COR71458114581epoutp01D for ; Thu, 13 Jun 2019 07:54:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190613075406epoutp0118888d0ed51c51b6a9d2229321968b97~nsto0COR71458114581epoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1560412446; bh=wzSwN4u5LkJkQagGovrAV/IuOaYbJLihVMExvb/oMPM=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=hBHQOEPIsoO+aFxvTpZVyEDoiRfWPbcqbS76HzOopffB651/CNE+UmP2jXBCZOPEY +stdDLx4EHVyIRqh/YirI3DBLQ/Ux5DsntttvV6ch02rbaPhGnscRKchRQrOeBsY0q AQgkLTcbswCN1InDhnDFwBoK0xBT8ipWoXVrnze8= Received: from epsmges2p3.samsung.com (unknown [182.195.40.182]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190613075403epcas2p3b01bba2d3999339258a2b3a6897295fd~nstmLD5ZS3243632436epcas2p3L; Thu, 13 Jun 2019 07:54:03 +0000 (GMT) X-AuditID: b6c32a47-5a93e9c00000106e-dc-5d02011aba0c Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 91.BE.04206.A11020D5; Thu, 13 Jun 2019 16:54:02 +0900 (KST) Mime-Version: 1.0 Subject: [RFC PATCH] mpt3sas: support target smid for [abort|query] task Reply-To: minwoo.im@samsung.com From: Minwoo Im To: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "MPT-FusionLinux.pdl@broadcom.com" CC: Minwoo Im , "sathya.prakash@broadcom.com" , "chaitra.basappa@broadcom.com" , "suganath-prabu.subramani@broadcom.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , Sarah Cho , Sungjun Park , Gyeongmin Nam , Sanggwan Lee 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: <20190613075402epcms2p7dbd2e2f7c80bd2aef2c5dd3736393d36@epcms2p7> Date: Thu, 13 Jun 2019 16:54:02 +0900 X-CMS-MailID: 20190613075402epcms2p7dbd2e2f7c80bd2aef2c5dd3736393d36 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA01Se0hTURzu3Hu9TfPGaVn9WtDsRkiSua1mx9CIlFqkYfRfKOviLiru1e60 7IGL3iplSVDLzIyyjLLMx2pBNXvQE8perugBaS83Gz3ogdVeUv995+P7fb/vO+fIaHkjq5CV mO2izSwYeTaO6eyeTlIUiCpQPX+sJD7fOYq89meRpqedFOm5UM+S6iculjTf+E2R/tuXaXLw o4MiTR2DMeRMg5ch1Td1pNVTy5L+O/nzOZ3z5V1WV9t0GekCfV5Gt7O9Bek+t03Oi1lhzCgW BYNoSxTNhRZDibkok1+yXJ+l16ap1CnqdDKHTzQLJjGTz87JS1lYYgwm5BPLBWNZkMoTJIlP nZdhs5TZxcRii2TP5EWrwWhVq60zJcEklZmLZhZaTHPVKpVGG1SuNBbvP30FWd14zfE/TsaB 9nFVSCYDPBtO+xVVKE4mxy4EHcd2MSGew2NgyDU2BMdiHXxtDUM5VsL3D6oqFBtkp4PffScm hFmcBI69H5iQSwK+geBtux+FDjT+Q0Nz7SMqpALMwb5tfUwET4Ku5g4UweOg96Rv5DAevH4o yifAlhd36QgeA69+uFEkMsAL/7wIrIT24yS0CvBmBE8HTkVHU2Hj20B4FYdz4Yv7fTgog6fB bc91NqLJhvsnnoV5Otiry1dPhzzpYLHWC6kR+6lw1ctEFKNhe/fQyOEiroY30VJTIeDxRENO hOYHH6PuOni0pyY8K8fLwPn4JlWLlM5/V+v8b6/z395GRLeg8aJVMhWJksY66//HbEPh35m8 yIU67+V4EJYhPp7DcahAHiOUSxUmDwIZzSdwmtIRBXLOIFSsFW0Wva3MKEoepA3W300rxhVa gn/dbNertZq0NFW6lmjTNISfwLWN6s2X4yLBLpaKolW0Dc9RsliFA+l/vPl1WPmpsid/aMae pT1JjiTXlOQa5cbU+g3dPd2tvsZATbu3RnOk92fCemHa3IfXOuqULecG6P2LK39XZKyBbMOl B5tWWrya+LZtA+UldWxA8SRPVAxOiVdvfbeqtPDit6GsWyO4uvPVa4+uXuDKXRdLYt3pvGlH F5V+Vn5gMc9IxYI6mbZJwl8JXOrOswMAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20190613075402epcms2p7dbd2e2f7c80bd2aef2c5dd3736393d36 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. 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