All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org
Cc: David.Carroll@microsemi.com, Gana.Sridaran@microsemi.com,
	Scott.Benesh@microsemi.com
Subject: [PATCH V3 13/24] aacraid: Added support to set QD of attached drives
Date: Fri, 27 Jan 2017 11:28:42 -0800	[thread overview]
Message-ID: <20170127192853.10082-14-RaghavaAditya.Renukunta@microsemi.com> (raw)
In-Reply-To: <20170127192853.10082-1-RaghavaAditya.Renukunta@microsemi.com>

Added support to set qd of drives in slave_configure.This only works for
HBA1000 attached drives.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>

---
Changes in  V2:
None

Changes in  V3:
None

 drivers/scsi/aacraid/linit.c | 100 ++++++++++++++++++++++++++++---------------
 1 file changed, 66 insertions(+), 34 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 1912e7b..77d07b7 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -401,20 +401,33 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
 static int aac_slave_configure(struct scsi_device *sdev)
 {
 	struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata;
-	if (aac->jbod && (sdev->type == TYPE_DISK))
-		sdev->removable = 1;
-	if ((sdev->type == TYPE_DISK) &&
+	int chn, tid, is_native_device = 0;
+
+	chn = aac_logical_to_phys(sdev_channel(sdev));
+	tid = sdev_id(sdev);
+	if (chn < AAC_MAX_BUSES && tid < AAC_MAX_TARGETS &&
+		aac->hba_map[chn][tid].devtype == AAC_DEVTYPE_NATIVE_RAW)
+		is_native_device = 1;
+
+
+	if (!is_native_device) {
+		if (aac->jbod && (sdev->type == TYPE_DISK))
+			sdev->removable = 1;
+		if ((sdev->type == TYPE_DISK) &&
 			(sdev_channel(sdev) != CONTAINER_CHANNEL) &&
 			(!aac->jbod || sdev->inq_periph_qual) &&
 			(!aac->raid_scsi_mode || (sdev_channel(sdev) != 2))) {
-		if (expose_physicals == 0)
-			return -ENXIO;
-		if (expose_physicals < 0)
-			sdev->no_uld_attach = 1;
+			if (expose_physicals == 0)
+				return -ENXIO;
+			if (expose_physicals < 0)
+				sdev->no_uld_attach = 1;
+		}
 	}
-	if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
+
+	if (is_native_device ||
+		(sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
 			(!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) &&
-			!sdev->no_uld_attach) {
+			!sdev->no_uld_attach)) {
 		struct scsi_device * dev;
 		struct Scsi_Host *host = sdev->host;
 		unsigned num_lsu = 0;
@@ -428,34 +441,41 @@ static int aac_slave_configure(struct scsi_device *sdev)
 		 */
 		if (sdev->request_queue->rq_timeout < (45 * HZ))
 			blk_queue_rq_timeout(sdev->request_queue, 45*HZ);
-		for (cid = 0; cid < aac->maximum_num_containers; ++cid)
-			if (aac->fsa_dev[cid].valid)
-				++num_lsu;
-		__shost_for_each_device(dev, host) {
-			if (dev->tagged_supported && (dev->type == TYPE_DISK) &&
+		if (!is_native_device) {
+			for (cid = 0; cid < aac->maximum_num_containers; ++cid)
+				if (aac->fsa_dev[cid].valid)
+					++num_lsu;
+			__shost_for_each_device(dev, host) {
+				if (dev->tagged_supported &&
+					(dev->type == TYPE_DISK) &&
 					(!aac->raid_scsi_mode ||
-						(sdev_channel(sdev) != 2)) &&
+					(sdev_channel(sdev) != 2)) &&
 					!dev->no_uld_attach) {
-				if ((sdev_channel(dev) != CONTAINER_CHANNEL)
-				 || !aac->fsa_dev[sdev_id(dev)].valid)
-					++num_lsu;
-			} else
-				++num_one;
+					if ((sdev_channel(dev)
+						!= CONTAINER_CHANNEL)
+					 || !aac->fsa_dev[sdev_id(dev)].valid) {
+						++num_lsu;
+					}
+				} else {
+					++num_one;
+				}
+			}
+			if (num_lsu == 0)
+				++num_lsu;
+			depth = (host->can_queue - num_one) / num_lsu;
+			if (depth > 256)
+				depth = 256;
+			else if (depth < 2)
+				depth = 2;
+			scsi_change_queue_depth(sdev, depth);
+		} else {
+			scsi_change_queue_depth(sdev,
+				aac->hba_map[chn][tid].qd_limit);
 		}
-		if (num_lsu == 0)
-			++num_lsu;
-		depth = (host->can_queue - num_one) / num_lsu;
-		if (depth > 256)
-			depth = 256;
-		else if (depth < 2)
-			depth = 2;
-		scsi_change_queue_depth(sdev, depth);
-	} else {
-		scsi_change_queue_depth(sdev, 1);
-
-		sdev->tagged_supported = 1;
 	}
 
+	sdev->tagged_supported = 1;
+
 	return 0;
 }
 
@@ -470,6 +490,15 @@ static int aac_slave_configure(struct scsi_device *sdev)
 
 static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
 {
+	struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata);
+	int chn, tid, is_native_device = 0;
+
+	chn = aac_logical_to_phys(sdev_channel(sdev));
+	tid = sdev_id(sdev);
+	if (chn < AAC_MAX_BUSES && tid < AAC_MAX_TARGETS &&
+		aac->hba_map[chn][tid].devtype == AAC_DEVTYPE_NATIVE_RAW)
+		is_native_device = 1;
+
 	if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
 	    (sdev_channel(sdev) == CONTAINER_CHANNEL)) {
 		struct scsi_device * dev;
@@ -491,9 +520,12 @@ static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
 		else if (depth < 2)
 			depth = 2;
 		return scsi_change_queue_depth(sdev, depth);
+	} else if (is_native_device) {
+		scsi_change_queue_depth(sdev, aac->hba_map[chn][tid].qd_limit);
+	} else {
+		scsi_change_queue_depth(sdev, 1);
 	}
-
-	return scsi_change_queue_depth(sdev, 1);
+	return sdev->queue_depth;
 }
 
 static ssize_t aac_show_raid_level(struct device *dev, struct device_attribute *attr, char *buf)
-- 
2.7.4


  parent reply	other threads:[~2017-01-28  3:43 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 19:28 [PATCH V3 00/24] aacraid: Patchset for Smart Family Support Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 01/24] aacraid: Remove duplicate irq management code Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 02/24] aacraid: Added aacraid.h include guard Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 03/24] aacraid: added support for init_struct_8 Raghava Aditya Renukunta
2017-01-30  9:15   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 04/24] aacraid: Added sa firmware support Raghava Aditya Renukunta
2017-01-30  9:23   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 05/24] aacraid: Retrieve and update the device types Raghava Aditya Renukunta
2017-01-30  9:35   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 06/24] aacraid: Reworked scsi command submission path Raghava Aditya Renukunta
2017-01-30  9:38   ` Johannes Thumshirn
2017-01-30 20:17     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 07/24] aacraid: Process Error for response I/O Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 08/24] aacraid: Added support for response path Raghava Aditya Renukunta
2017-01-30  9:50   ` Johannes Thumshirn
2017-01-30 20:16     ` Raghava Aditya Renukunta
2017-01-31  8:02       ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 09/24] aacraid: Added support for read medium error Raghava Aditya Renukunta
2017-01-30  9:55   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 10/24] aacraid: Reworked aac_command_thread Raghava Aditya Renukunta
2017-01-30 10:11   ` Johannes Thumshirn
2017-01-30 20:11     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 11/24] aacraid: Added support for periodic wellness sync Raghava Aditya Renukunta
2017-01-30 10:27   ` Johannes Thumshirn
2017-01-30 20:07     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 12/24] aacraid: Retrieve Queue Depth from Adapter FW Raghava Aditya Renukunta
2017-01-30 10:31   ` Johannes Thumshirn
2017-01-30 20:05     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` Raghava Aditya Renukunta [this message]
2017-01-30 10:39   ` [PATCH V3 13/24] aacraid: Added support to set QD of attached drives Johannes Thumshirn
2017-01-30 20:01     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 14/24] aacraid: Added support for hotplug Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 15/24] aacraid: Include HBA direct interface Raghava Aditya Renukunta
2017-01-30 11:02   ` Johannes Thumshirn
2017-01-30 20:00     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 16/24] aacraid: Add task management functionality Raghava Aditya Renukunta
2017-01-30 11:19   ` Johannes Thumshirn
2017-01-30 19:59     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 17/24] aacraid: Added support to abort cmd and reset lun Raghava Aditya Renukunta
2017-01-30 11:24   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 18/24] aacraid: VPD 83 type3 support Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 19/24] aacraid: Added new IWBR reset Raghava Aditya Renukunta
2017-01-30 11:39   ` Johannes Thumshirn
2017-01-30 19:56     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 20/24] aacraid: Added ioctl to trigger IOP/IWBR reset Raghava Aditya Renukunta
2017-01-30 11:41   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 21/24] aacraid: Retrieve HBA host information ioctl Raghava Aditya Renukunta
2017-01-30 11:43   ` Johannes Thumshirn
2017-01-30 19:53     ` Raghava Aditya Renukunta
2017-01-27 19:28 ` [PATCH V3 22/24] aacraid: Update copyrights Raghava Aditya Renukunta
2017-01-30 11:43   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 23/24] aacraid: Change Driver Version Prefix Raghava Aditya Renukunta
2017-01-30 11:44   ` Johannes Thumshirn
2017-01-27 19:28 ` [PATCH V3 24/24] aacraid: update version Raghava Aditya Renukunta
2017-01-30 11:44   ` Johannes Thumshirn

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=20170127192853.10082-14-RaghavaAditya.Renukunta@microsemi.com \
    --to=raghavaaditya.renukunta@microsemi.com \
    --cc=David.Carroll@microsemi.com \
    --cc=Gana.Sridaran@microsemi.com \
    --cc=Scott.Benesh@microsemi.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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.