All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minwoo Im <minwoo.im@samsung.com>
To: "sreekanth.reddy@broadcom.com" <sreekanth.reddy@broadcom.com>,
	"sathya.prakash@broadcom.com" <sathya.prakash@broadcom.com>,
	"suganath-prabu.subramani@broadcom.com" 
	<suganath-prabu.subramani@broadcom.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: Minwoo Im <minwoo.im@samsung.com>,
	"MPT-FusionLinux.pdl@broadcom.com"
	<MPT-FusionLinux.pdl@broadcom.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Euihyeok Kwon <eh81.kwon@samsung.com>,
	Sarah Cho <sohyeon.jo@samsung.com>,
	Sanggwan Lee <sanggwan.lee@samsung.com>,
	Gyeongmin Nam <gm.nam@samsung.com>,
	Sungjun Park <sj1228.park@samsung.com>,
	"minwoo.im.dev@gmail.com" <minwoo.im.dev@gmail.com>
Subject: [PATCH V2] mpt3sas: support target smid for [abort|query] task
Date: Sun, 14 Jul 2019 12:44:15 +0900	[thread overview]
Message-ID: <20190714034415epcms2p25f9787cb71993a30f58524d2f355b543@epcms2p2> (raw)
In-Reply-To: CGME20190714034415epcms2p25f9787cb71993a30f58524d2f355b543@epcms2p2

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: Minwoo Im <minwoo.im@samsung.com>
---
 drivers/scsi/mpt3sas/mpt3sas_ctl.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index b2bb47c14d35..f6b8fd90610a 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) {
-- 
2.16.1


       reply	other threads:[~2019-07-14  3:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190714034415epcms2p25f9787cb71993a30f58524d2f355b543@epcms2p2>
2019-07-14  3:44 ` Minwoo Im [this message]
2019-07-14  3:44   ` [PATCH V2] mpt3sas: support target smid for [abort|query] task Minwoo Im
2019-07-15  6:13   ` Hannes Reinecke
2019-07-17 12:12     ` Minwoo Im
2019-07-17 12:12       ` Minwoo Im
2019-07-23 11:27     ` Sreekanth Reddy
2019-07-23 11:27       ` Sreekanth Reddy
2019-07-23 13:33       ` Minwoo Im
2019-07-23 13:33         ` Minwoo Im
2019-07-25 16:53       ` Minwoo Im
2019-07-25 16:53         ` Minwoo Im
     [not found]   ` <CGME20190714034415epcms2p25f9787cb71993a30f58524d2f355b543@epcms2p7>
2019-07-16  5:44     ` Minwoo Im
2019-07-16  5:44       ` Minwoo Im
2019-07-26  9:49   ` Sreekanth Reddy
2019-07-26  9:49     ` Sreekanth Reddy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190714034415epcms2p25f9787cb71993a30f58524d2f355b543@epcms2p2 \
    --to=minwoo.im@samsung.com \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=eh81.kwon@samsung.com \
    --cc=gm.nam@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=minwoo.im.dev@gmail.com \
    --cc=sanggwan.lee@samsung.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=sj1228.park@samsung.com \
    --cc=sohyeon.jo@samsung.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.