public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Hannes Reinecke <hare@suse.de>, Hannes Reinecke <hare@suse.com>
Subject: [PATCHv3 09/10] mpt3sas: always use first reserved smid for ioctl passthrough
Date: Tue, 21 Feb 2017 13:27:08 +0100	[thread overview]
Message-ID: <1487680029-3701-10-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1487680029-3701-1-git-send-email-hare@suse.de>

ioctl passthrough commands require a SCSIIO smid, but cannot
easily integrate with the block layer. But the driver already
has reserved some SCSIIO smids and we're only ever allowing
one ioctl command at a time we can use the first reserved smid
for ioctl commands.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 11 ++++++++---
 drivers/scsi/mpt3sas/mpt3sas_ctl.c  | 10 ++--------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 3f9148c..0875e58 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2432,7 +2432,9 @@ struct scsiio_tracker *
 		ioc->scsi_lookup[i].cb_idx = 0xFF;
 		ioc->scsi_lookup[i].scmd = NULL;
 		ioc->scsi_lookup[i].direct_io = 0;
-		list_add(&ioc->scsi_lookup[i].tracker_list, &ioc->free_list);
+		if (i < ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT)
+			list_add(&ioc->scsi_lookup[i].tracker_list,
+				 &ioc->free_list);
 		spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
 
 		_base_recovery_check(ioc);
@@ -5174,8 +5176,11 @@ struct scsiio_tracker *
 		ioc->scsi_lookup[i].smid = smid;
 		ioc->scsi_lookup[i].scmd = NULL;
 		ioc->scsi_lookup[i].direct_io = 0;
-		list_add_tail(&ioc->scsi_lookup[i].tracker_list,
-		    &ioc->free_list);
+		if (i < ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT)
+			list_add_tail(&ioc->scsi_lookup[i].tracker_list,
+				      &ioc->free_list);
+		else
+			INIT_LIST_HEAD(&ioc->lookup[i].tracker_list);
 	}
 
 	/* hi-priority queue */
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 02fe1c4..23e0ef1 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -719,14 +719,8 @@ enum block_state {
 			goto out;
 		}
 	} else {
-
-		smid = mpt3sas_base_get_smid_scsiio(ioc, ioc->ctl_cb_idx, NULL);
-		if (!smid) {
-			pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
-			    ioc->name, __func__);
-			ret = -EAGAIN;
-			goto out;
-		}
+		/* Use first reserved smid for passthrough ioctls */
+		smid = ioc->scsiio_depth - ioc->host->reserved_cmds;
 	}
 
 	ret = 0;
-- 
1.8.5.6

  parent reply	other threads:[~2017-02-21 12:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 12:26 [PATCHv3 00/10] mpt3sas: Full mq support, part 1 Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 01/10] mpt3sas: switch to pci_alloc_irq_vectors Hannes Reinecke
2017-02-22  8:28   ` Christoph Hellwig
2017-02-22  9:06     ` Hannes Reinecke
2017-02-23  0:52     ` Martin K. Petersen
2017-02-23  8:19       ` Sreekanth Reddy
2017-02-21 12:27 ` [PATCHv3 02/10] mpt3sas: set default value for cb_idx Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 03/10] mpt3sas: use 'list_splice_init()' Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 04/10] mpt3sas: separate out _base_recovery_check() Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 05/10] mpt3sas: open-code _scsih_scsi_lookup_get() Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 06/10] mpt3sas: Introduce mpt3sas_get_st_from_smid() Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 07/10] mpt3sas: check command status before attempting abort Hannes Reinecke
2017-02-22  8:17   ` Sreekanth Reddy
2017-02-21 12:27 ` [PATCHv3 08/10] scsi: allocate reserved commands Hannes Reinecke
2017-02-21 14:13   ` Christoph Hellwig
2017-02-21 12:27 ` Hannes Reinecke [this message]
2017-02-21 14:18   ` [PATCHv3 09/10] mpt3sas: always use first reserved smid for ioctl passthrough Christoph Hellwig
2017-02-21 14:45     ` Hannes Reinecke
2017-02-21 12:27 ` [PATCHv3 10/10] mpt3sas: lockless command submission for scsi-mq Hannes Reinecke
2017-02-21 14:34   ` Christoph Hellwig
2017-02-21 14:58     ` Hannes Reinecke
2017-02-21 15:03       ` Christoph Hellwig

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=1487680029-3701-10-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=sreekanth.reddy@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox