* [PATCH 00/10] handles queue_depth adjustments in scsi_error.c
@ 2009-09-03 22:22 Vasu Dev
2009-09-03 22:22 ` [PATCH 01/10] scsi-ml: modify change_queue_depth to take in reason why it is being called Vasu Dev
` (10 more replies)
0 siblings, 11 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:22 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
This patch series moves the QUEUE_FULL and then the ramp
up code from drivers like qla2xxx and lpfc to scsi-ml.
The change_queue_depth callback is used to allow the
drivers to adjust the queue depth, so LLDs do not have
to worry about parsing the sense, see some additional
info on these changes in first RFC cover at:-
http://www.spinics.net/lists/linux-scsi/msg35959.html
I've tested this series with libfc/fcoe for queue_depth
ramp down and up.
This series is based on scsi-misc -rc7 and also cleanly
applies & works on top recently submitted 64 fcoe patches
series by Rob "[PATCH 00/64] libfc, libfcoe and fcoe
updates for scsi-misc"
I'm posting this series with Mike and Christof patches
per this mail thread discussion
http://marc.info/?l=linux-scsi&m=125196587107768&w=2
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
Christof Schmitt (1):
zfcp: Adapt change_queue_depth for queue full tracking
Mike Christie (4):
drivers: convert fc drivers calling scsi_track_queue_full
drivers: convert drivers setting the change_queue_depth callback
scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
scsi-ml: modify change_queue_depth to take in reason why it is being called
Vasu Dev (5):
libfc: adds queue_depth ramp up to libfc
fcoe, libfc: fix an libfc issue with queue ramp down in libfc
scsi: add common queue_depth ramp up code
scsi: adds sdev->queue_ramp_up_period to sysfs
scsi: updates sdev to add queue_depth ramp up code
drivers/ata/libata-scsi.c | 7 +++
drivers/ata/sata_nv.c | 2 -
drivers/message/fusion/mptscsih.c | 9 +++-
drivers/message/fusion/mptscsih.h | 3 +
drivers/s390/scsi/zfcp_scsi.c | 21 ++++++++-
drivers/scsi/3w-9xxx.c | 5 ++
drivers/scsi/3w-xxxx.c | 5 ++
drivers/scsi/53c700.c | 5 ++
drivers/scsi/aacraid/linit.c | 6 ++-
drivers/scsi/arcmsr/arcmsr_hba.c | 5 ++
drivers/scsi/fcoe/fcoe.c | 2 -
drivers/scsi/hptiop.c | 5 ++
drivers/scsi/ibmvscsi/ibmvfc.c | 7 +++
drivers/scsi/ibmvscsi/ibmvscsi.c | 7 +++
drivers/scsi/ipr.c | 7 +++
drivers/scsi/libfc/fc_fcp.c | 47 ++++++++++-----------
drivers/scsi/libiscsi.c | 4 +-
drivers/scsi/libsas/sas_scsi_host.c | 6 ++-
drivers/scsi/lpfc/lpfc_scsi.c | 75 ++++++++++++++++++---------------
drivers/scsi/megaraid/megaraid_mbox.c | 7 +++
drivers/scsi/mpt2sas/mpt2sas_scsih.c | 10 +++-
drivers/scsi/qla2xxx/qla_isr.c | 32 --------------
drivers/scsi/qla2xxx/qla_os.c | 32 +++++++++++++-
drivers/scsi/scsi.c | 10 ++++
drivers/scsi/scsi_error.c | 62 +++++++++++++++++++++++++++
drivers/scsi/scsi_scan.c | 1
drivers/scsi/scsi_sysfs.c | 41 +++++++++++++++++-
include/linux/libata.h | 2 -
include/scsi/libfc.h | 2 -
include/scsi/libiscsi.h | 3 +
include/scsi/libsas.h | 3 +
include/scsi/scsi_device.h | 8 ++--
include/scsi/scsi_host.h | 8 +++-
33 files changed, 317 insertions(+), 132 deletions(-)
--
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 01/10] scsi-ml: modify change_queue_depth to take in reason why it is being called
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
@ 2009-09-03 22:22 ` Vasu Dev
2009-09-03 22:22 ` [PATCH 02/10] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
` (9 subsequent siblings)
10 siblings, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:22 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
From: Mike Christie <michaelc@cs.wisc.edu>
This patch modifies scsi_host_tematepl->change_queue_depth so that
it takes an argument indicating why it is being called. This will be
used so that if a LLD needs to do some extra processing when
handling queue fulls or later ramp ups, it can do so.
To simplify the review, this patch only modifies scsi-ml. The next
patches will convert each driver.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/scsi_sysfs.c | 3 ++-
include/scsi/scsi_host.h | 8 +++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 91482f2..4530626 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -766,7 +766,8 @@ sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr,
if (depth < 1)
return -EINVAL;
- retval = sht->change_queue_depth(sdev, depth);
+ retval = sht->change_queue_depth(sdev, depth,
+ SCSI_QDEPTH_DEFAULT);
if (retval < 0)
return retval;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b62a097..854d510 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -43,6 +43,12 @@ struct blk_queue_tags;
#define DISABLE_CLUSTERING 0
#define ENABLE_CLUSTERING 1
+enum {
+ SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */
+ SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */
+ SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshhold event */
+};
+
struct scsi_host_template {
struct module *module;
const char *name;
@@ -294,7 +300,7 @@ struct scsi_host_template {
*
* Status: OPTIONAL
*/
- int (* change_queue_depth)(struct scsi_device *, int);
+ int (* change_queue_depth)(struct scsi_device *, int, int);
/*
* Fill in this function to allow the changing of tag types
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 02/10] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
2009-09-03 22:22 ` [PATCH 01/10] scsi-ml: modify change_queue_depth to take in reason why it is being called Vasu Dev
@ 2009-09-03 22:22 ` Vasu Dev
2009-09-13 0:52 ` [PATCH 02/10 v2] " Vasu Dev
2009-09-03 22:22 ` [PATCH 03/10] drivers: convert drivers setting the change_queue_depth callback Vasu Dev
` (8 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:22 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
From: Mike Christie <michaelc@cs.wisc.edu>
This has scsi-ml call the change_queue_depth functions when
we get a QUEUE_FULL. It will only change the queue depth if
change_queue_depth is set because the LLD may have to
modify some internal resources, so I thought this would
be the safest route.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/scsi_error.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 877204d..7d1b862 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -331,6 +331,27 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
}
}
+static void scsi_handle_queue_full(struct scsi_device *sdev)
+{
+ struct scsi_host_template *sht = sdev->host->hostt;
+ struct scsi_device *tmp_sdev;
+
+ if (!sht->change_queue_depth)
+ return;
+
+ shost_for_each_device(tmp_sdev, sdev->host) {
+ if (tmp_sdev->id != sdev->id)
+ continue;
+ /*
+ * We do not know the number of commands that were at
+ * the device when we got the queue full so we start
+ * from the highest possible value and work our way down.
+ */
+ sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth - 1,
+ SCSI_QDEPTH_QFULL);
+ }
+}
+
/**
* scsi_eh_completed_normally - Disposition a eh cmd on return from LLD.
* @scmd: SCSI cmd to examine.
@@ -387,8 +408,10 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
* let issuer deal with this, it could be just fine
*/
return SUCCESS;
- case BUSY:
case QUEUE_FULL:
+ scsi_handle_queue_full(scmd->device);
+ /* fall through */
+ case BUSY:
default:
return FAILED;
}
@@ -1384,6 +1407,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
*/
switch (status_byte(scmd->result)) {
case QUEUE_FULL:
+ scsi_handle_queue_full(scmd->device);
/*
* the case of trying to send too many commands to a
* tagged queueing device.
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 03/10] drivers: convert drivers setting the change_queue_depth callback
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
2009-09-03 22:22 ` [PATCH 01/10] scsi-ml: modify change_queue_depth to take in reason why it is being called Vasu Dev
2009-09-03 22:22 ` [PATCH 02/10] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
@ 2009-09-03 22:22 ` Vasu Dev
2009-09-10 22:22 ` [PATCH 03/10 v2] " Vasu Dev
2009-09-03 22:22 ` [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full Vasu Dev
` (7 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:22 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
From: Mike Christie <michaelc@cs.wisc.edu>
This is a simple port of the drivers setting a change_queue_depth
callback but were not tracking queue fulls. In the patch I just have
these LLDs adjust the queue depth if the user was requesting it.
Patch is only compile tested.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/ata/libata-scsi.c | 7 ++++++-
drivers/ata/sata_nv.c | 2 +-
drivers/message/fusion/mptscsih.c | 9 +++++++--
drivers/message/fusion/mptscsih.h | 3 ++-
drivers/s390/scsi/zfcp_scsi.c | 5 ++++-
drivers/scsi/3w-9xxx.c | 5 ++++-
drivers/scsi/3w-xxxx.c | 5 ++++-
drivers/scsi/53c700.c | 5 ++++-
drivers/scsi/aacraid/linit.c | 6 +++++-
drivers/scsi/arcmsr/arcmsr_hba.c | 5 ++++-
drivers/scsi/hptiop.c | 5 ++++-
drivers/scsi/ibmvscsi/ibmvfc.c | 7 ++++++-
drivers/scsi/ibmvscsi/ibmvscsi.c | 7 ++++++-
drivers/scsi/ipr.c | 7 ++++++-
drivers/scsi/libfc/fc_fcp.c | 4 +++-
drivers/scsi/libiscsi.c | 4 +++-
drivers/scsi/libsas/sas_scsi_host.c | 6 +++++-
drivers/scsi/megaraid/megaraid_mbox.c | 7 ++++++-
drivers/scsi/mpt2sas/mpt2sas_scsih.c | 10 +++++++---
drivers/scsi/qla2xxx/qla_os.c | 6 ++++--
include/linux/libata.h | 2 +-
include/scsi/libfc.h | 2 +-
include/scsi/libiscsi.h | 3 ++-
include/scsi/libsas.h | 3 ++-
24 files changed, 97 insertions(+), 28 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index d0dfeef..050fae6 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1212,6 +1212,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
* ata_scsi_change_queue_depth - SCSI callback for queue depth config
* @sdev: SCSI device to configure queue depth for
* @queue_depth: new queue depth
+ * @reason: calling context
*
* This is libata standard hostt->change_queue_depth callback.
* SCSI will call into this callback when user tries to set queue
@@ -1223,12 +1224,16 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
* RETURNS:
* Newly configured queue depth.
*/
-int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+ int reason)
{
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *dev;
unsigned long flags;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (queue_depth < 1 || queue_depth == sdev->queue_depth)
return sdev->queue_depth;
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 86a4058..9bb4afb 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)
ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
if (strncmp(model_num, "Maxtor", 6) == 0) {
- ata_scsi_change_queue_depth(sdev, 1);
+ ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_DEFAULT);
ata_dev_printk(dev, KERN_NOTICE,
"Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth);
}
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 0e402eb..5af9edb 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2265,11 +2265,12 @@ mptscsih_slave_destroy(struct scsi_device *sdev)
* mptscsih_change_queue_depth - This function will set a devices queue depth
* @sdev: per scsi_device pointer
* @qdepth: requested queue depth
+ * @reason: calling context
*
* Adding support for new 'change_queue_depth' api.
*/
int
-mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
+mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
MPT_SCSI_HOST *hd = shost_priv(sdev->host);
VirtTarget *vtarget;
@@ -2281,6 +2282,9 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
starget = scsi_target(sdev);
vtarget = starget->hostdata;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (ioc->bus_type == SPI) {
if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES))
max_depth = 1;
@@ -2347,7 +2351,8 @@ mptscsih_slave_configure(struct scsi_device *sdev)
ioc->name, vtarget->negoFlags, vtarget->maxOffset,
vtarget->minSyncFactor));
- mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH);
+ mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH,
+ SCSI_QDEPTH_DEFAULT);
dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"tagged %d, simple %d, ordered %d\n",
ioc->name,sdev->tagged_supported, sdev->simple_tags,
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index e0b33e0..45a5ff3 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -128,7 +128,8 @@ extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_F
extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
-extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
+extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason);
extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
extern struct device_attribute *mptscsih_host_attrs[];
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 6925a17..bdff1bf 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -28,8 +28,11 @@ char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu)
return fcp_sns_info_ptr;
}
-static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth)
+static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
return sdev->queue_depth;
}
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 36c21b1..f7d52d8 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -186,8 +186,11 @@ static ssize_t twa_show_stats(struct device *dev,
} /* End twa_show_stats() */
/* This function will set a devices queue depth */
-static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
if (queue_depth > TW_Q_LENGTH-2)
queue_depth = TW_Q_LENGTH-2;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index faa0fcf..927f5ce 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -521,8 +521,11 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,
} /* End tw_show_stats() */
/* This function will set a devices queue depth */
-static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
if (queue_depth > TW_Q_LENGTH-2)
queue_depth = TW_Q_LENGTH-2;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index f5a9add..a5a493d 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -2082,8 +2082,11 @@ NCR_700_slave_destroy(struct scsi_device *SDp)
}
static int
-NCR_700_change_queue_depth(struct scsi_device *SDp, int depth)
+NCR_700_change_queue_depth(struct scsi_device *SDp, int depth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (depth > NCR_700_MAX_TAGS)
depth = NCR_700_MAX_TAGS;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 9b97c3e..e9373a2 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -472,8 +472,12 @@ static int aac_slave_configure(struct scsi_device *sdev)
* total capacity and the queue depth supported by the target device.
*/
-static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
+static int aac_change_queue_depth(struct scsi_device *sdev, int depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
(sdev_channel(sdev) == CONTAINER_CHANNEL)) {
struct scsi_device * dev;
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 80aac01..47d5d19 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -98,8 +98,11 @@ static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);
static const char *arcmsr_info(struct Scsi_Host *);
static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev,
- int queue_depth)
+ int queue_depth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
queue_depth = ARCMSR_MAX_CMD_PERLUN;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index c596ab5..19620e9 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -847,10 +847,13 @@ static int hptiop_reset(struct scsi_cmnd *scp)
}
static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev,
- int queue_depth)
+ int queue_depth, int reason)
{
struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (queue_depth > hba->max_requests)
queue_depth = hba->max_requests;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index bb2c696..07e2e35 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -2478,12 +2478,17 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
* ibmvfc_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct
* @qdepth: depth to set
+ * @reason: calling context
*
* Return value:
* actual depth set
**/
-static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (qdepth > IBMVFC_MAX_CMDS_PER_LUN)
qdepth = IBMVFC_MAX_CMDS_PER_LUN;
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 9928704..15fa8c7 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1638,12 +1638,17 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev)
* ibmvscsi_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct
* @qdepth: depth to set
+ * @reason: calling context
*
* Return value:
* actual depth set
**/
-static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN)
qdepth = IBMVSCSI_MAX_CMDS_PER_LUN;
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 5f04550..d40d5c7 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3367,16 +3367,21 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) { return 0; };
* ipr_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct
* @qdepth: depth to set
+ * @reason: calling context
*
* Return value:
* actual depth set
**/
-static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason)
{
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
struct ipr_resource_entry *res;
unsigned long lock_flags = 0;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
res = (struct ipr_resource_entry *)sdev->hostdata;
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 7d5ffcb..20b88cd 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2062,8 +2062,10 @@ int fc_slave_alloc(struct scsi_device *sdev)
}
EXPORT_SYMBOL(fc_slave_alloc);
-int fc_change_queue_depth(struct scsi_device *sdev, int qdepth)
+int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
return sdev->queue_depth;
}
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index a751f62..dc4f86a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1539,8 +1539,10 @@ fault:
}
EXPORT_SYMBOL_GPL(iscsi_queuecommand);
-int iscsi_change_queue_depth(struct scsi_device *sdev, int depth)
+int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
return sdev->queue_depth;
}
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 1c558d3..14b1319 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -820,10 +820,14 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)
ata_port_disable(dev->sata_dev.ap);
}
-int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth)
+int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth,
+ int reason)
{
int res = min(new_depth, SAS_MAX_QD);
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (scsi_dev->tagged_supported)
scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev),
res);
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 234f0b7..fd181c2 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -335,12 +335,17 @@ static struct device_attribute *megaraid_sdev_attrs[] = {
* megaraid_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct
* @qdepth: depth to set
+ * @reason: calling context
*
* Return value:
* actual depth set
*/
-static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (qdepth > MBOX_MAX_SCSI_CMDS)
qdepth = MBOX_MAX_SCSI_CMDS;
scsi_adjust_queue_depth(sdev, 0, qdepth);
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 2e9a444..6e6ee0d 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1085,16 +1085,20 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
* _scsih_change_queue_depth - setting device queue depth
* @sdev: scsi device struct
* @qdepth: requested queue depth
+ * @reason: calling context
*
* Returns queue depth.
*/
static int
-_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
+_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
struct Scsi_Host *shost = sdev->host;
int max_depth;
int tag_type;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
max_depth = shost->can_queue;
if (!sdev->tagged_supported)
max_depth = 1;
@@ -1524,7 +1528,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
r_level, raid_device->handle,
(unsigned long long)raid_device->wwid,
raid_device->num_pds, ds);
- _scsih_change_queue_depth(sdev, qdepth);
+ _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT);
return 0;
}
@@ -1570,7 +1574,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
_scsih_display_sata_capabilities(ioc, sas_device, sdev);
}
- _scsih_change_queue_depth(sdev, qdepth);
+ _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT);
if (ssp_target)
sas_read_port_mode_page(sdev);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d7b2713..c05c460 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -137,7 +137,7 @@ static int qla2xxx_eh_target_reset(struct scsi_cmnd *);
static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
-static int qla2x00_change_queue_depth(struct scsi_device *, int);
+static int qla2x00_change_queue_depth(struct scsi_device *, int, int);
static int qla2x00_change_queue_type(struct scsi_device *, int);
struct scsi_host_template qla2xxx_driver_template = {
@@ -1223,8 +1223,10 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
}
static int
-qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth)
+qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
return sdev->queue_depth;
}
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e5b6e33..a4744c8 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1010,7 +1010,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
extern int ata_scsi_slave_config(struct scsi_device *sdev);
extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
- int queue_depth);
+ int queue_depth, int reason);
extern struct ata_device *ata_dev_pair(struct ata_device *adev);
extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index c2b928c..861a3b5 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -904,7 +904,7 @@ int fc_slave_alloc(struct scsi_device *sdev);
/*
* Adjust the queue depth.
*/
-int fc_change_queue_depth(struct scsi_device *sdev, int qdepth);
+int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason);
/*
* Change the tag type.
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 61afeb5..b0188b6 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -332,7 +332,8 @@ struct iscsi_host {
/*
* scsi host template
*/
-extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth);
+extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth,
+ int reason);
extern int iscsi_eh_abort(struct scsi_cmnd *sc);
extern int iscsi_eh_target_reset(struct scsi_cmnd *sc);
extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index e78d3b6..9eaa3f0 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -634,7 +634,8 @@ extern int sas_target_alloc(struct scsi_target *);
extern int sas_slave_alloc(struct scsi_device *);
extern int sas_slave_configure(struct scsi_device *);
extern void sas_slave_destroy(struct scsi_device *);
-extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
+extern int sas_change_queue_depth(struct scsi_device *, int new_depth,
+ int reason);
extern int sas_change_queue_type(struct scsi_device *, int qt);
extern int sas_bios_param(struct scsi_device *,
struct block_device *,
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
` (2 preceding siblings ...)
2009-09-03 22:22 ` [PATCH 03/10] drivers: convert drivers setting the change_queue_depth callback Vasu Dev
@ 2009-09-03 22:22 ` Vasu Dev
2009-09-04 13:47 ` Alex.Iannicelli
2009-09-07 20:44 ` [PATCH v2] drivers: convert libfc " Vasu Dev
2009-09-03 22:22 ` [PATCH 05/10] scsi: updates sdev to add queue_depth ramp up code Vasu Dev
` (6 subsequent siblings)
10 siblings, 2 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:22 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
From: Mike Christie <michaelc@cs.wisc.edu>
This converts the fc drivers that were using scsi_track_queue_full
to track the queue full from the change_queue_depth callback.
I have not yet tested the qla2xxx or lpfc parts.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
--
Adds check to ignore SCSI_QDEPTH_QFULL in case the
ql2xqfulltracking is not set.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/libfc/fc_fcp.c | 26 +++++---------
drivers/scsi/lpfc/lpfc_scsi.c | 75 ++++++++++++++++++++++------------------
drivers/scsi/qla2xxx/qla_isr.c | 32 -----------------
drivers/scsi/qla2xxx/qla_os.c | 30 ++++++++++++++--
4 files changed, 77 insertions(+), 86 deletions(-)
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 20b88cd..d919c2a 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1814,21 +1814,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
sc_cmd->result = DID_OK << 16;
if (fsp->scsi_resid)
CMD_RESID_LEN(sc_cmd) = fsp->scsi_resid;
- } else if (fsp->cdb_status == QUEUE_FULL) {
- struct scsi_device *tmp_sdev;
- struct scsi_device *sdev = sc_cmd->device;
-
- shost_for_each_device(tmp_sdev, sdev->host) {
- if (tmp_sdev->id != sdev->id)
- continue;
-
- if (tmp_sdev->queue_depth > 1) {
- scsi_track_queue_full(tmp_sdev,
- tmp_sdev->
- queue_depth - 1);
- }
- }
- sc_cmd->result = (DID_OK << 16) | fsp->cdb_status;
} else {
/*
* transport level I/O was ok but scsi
@@ -2064,9 +2049,16 @@ EXPORT_SYMBOL(fc_slave_alloc);
int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
- if (reason != SCSI_QDEPTH_DEFAULT)
+ switch (reason) {
+ case SCSI_QDEPTH_DEFAULT:
+ scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+ break;
+ case SCSI_QDEPTH_QFULL:
+ scsi_track_queue_full(sdev, qdepth);
+ break;
+ default:
return -EOPNOTSUPP;
- scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+ }
return sdev->queue_depth;
}
EXPORT_SYMBOL(fc_change_queue_depth);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 61d0897..2d39d84 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -2189,7 +2189,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
int result;
struct scsi_device *tmp_sdev;
- int depth = 0;
unsigned long flags;
struct lpfc_fast_path_event *fast_path_evt;
struct Scsi_Host *shost = cmd->device->host;
@@ -2388,39 +2387,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
}
/*
- * Check for queue full. If the lun is reporting queue full, then
- * back off the lun queue depth to prevent target overloads.
- */
- if (result == SAM_STAT_TASK_SET_FULL && pnode &&
- NLP_CHK_NODE_ACT(pnode)) {
- pnode->last_q_full_time = jiffies;
-
- shost_for_each_device(tmp_sdev, shost) {
- if (tmp_sdev->id != scsi_id)
- continue;
- depth = scsi_track_queue_full(tmp_sdev,
- tmp_sdev->queue_depth - 1);
- }
- /*
- * The queue depth cannot be lowered any more.
- * Modify the returned error code to store
- * the final depth value set by
- * scsi_track_queue_full.
- */
- if (depth == -1)
- depth = shost->cmd_per_lun;
-
- if (depth) {
- lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
- "0711 detected queue full - lun queue "
- "depth adjusted to %d.\n", depth);
- lpfc_send_sdev_queuedepth_change_event(phba, vport,
- pnode, 0xFFFFFFFF,
- depth+1, depth);
- }
- }
-
- /*
* If there is a thread waiting for command completion
* wake up the thread.
*/
@@ -3551,6 +3517,45 @@ lpfc_slave_configure(struct scsi_device *sdev)
return 0;
}
+static int lpfc_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+ int reason)
+{
+ struct Scsi_Host *shost = sdev->host;
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
+ struct lpfc_hba *phba = vport->phba;
+ struct lpfc_rport_data *rdata = sdev->hostdata;
+ struct lpfc_nodelist *pnode = rdata->pnode;
+ int depth;
+
+ if (reason != SCSI_QDEPTH_QFULL)
+ return -EOPNOTSUPP;
+
+ if (!pnode || !NLP_CHK_NODE_ACT(pnode))
+ return -EINVAL;
+
+ pnode->last_q_full_time = jiffies;
+
+ depth = scsi_track_queue_full(sdev, queue_depth);
+ /*
+ * The queue depth cannot be lowered any more.
+ * Modify the returned error code to store
+ * the final depth value set by
+ * scsi_track_queue_full.
+ */
+ if (depth == -1)
+ depth = shost->cmd_per_lun;
+
+ if (depth) {
+ lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
+ "0711 detected queue full - lun queue "
+ "depth adjusted to %d.\n", depth);
+ lpfc_send_sdev_queuedepth_change_event(phba, vport,
+ pnode, 0xFFFFFFFF,
+ depth + 1, depth);
+ }
+ return sdev->queue_depth;
+}
+
/**
* lpfc_slave_destroy - slave_destroy entry point of SHT data structure
* @sdev: Pointer to scsi_device.
@@ -3574,6 +3579,7 @@ struct scsi_host_template lpfc_template = {
.eh_device_reset_handler = lpfc_device_reset_handler,
.eh_target_reset_handler = lpfc_target_reset_handler,
.eh_bus_reset_handler = lpfc_bus_reset_handler,
+ .change_queue_depth = lpfc_change_queue_depth,
.slave_alloc = lpfc_slave_alloc,
.slave_configure = lpfc_slave_configure,
.slave_destroy = lpfc_slave_destroy,
@@ -3596,6 +3602,7 @@ struct scsi_host_template lpfc_vport_template = {
.eh_device_reset_handler = lpfc_device_reset_handler,
.eh_target_reset_handler = lpfc_target_reset_handler,
.eh_bus_reset_handler = lpfc_bus_reset_handler,
+ .change_queue_depth = lpfc_change_queue_depth,
.slave_alloc = lpfc_slave_alloc,
.slave_configure = lpfc_slave_configure,
.slave_destroy = lpfc_slave_destroy,
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 74fa6f9..66fda3a 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -836,20 +836,6 @@ qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, void *data)
sdev->queue_depth));
}
-static void
-qla2x00_adjust_sdev_qdepth_down(struct scsi_device *sdev, void *data)
-{
- fc_port_t *fcport = data;
-
- if (!scsi_track_queue_full(sdev, sdev->queue_depth - 1))
- return;
-
- DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
- "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
- fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
- sdev->queue_depth));
-}
-
static inline void
qla2x00_ramp_up_queue_depth(scsi_qla_host_t *vha, struct req_que *req,
srb_t *sp)
@@ -1176,13 +1162,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
"scsi(%ld): QUEUE FULL status detected "
"0x%x-0x%x.\n", vha->host_no, comp_status,
scsi_status));
-
- /* Adjust queue depth for all luns on the port. */
- if (!ql2xqfulltracking)
- break;
- fcport->last_queue_full = jiffies;
- starget_for_each_device(cp->device->sdev_target,
- fcport, qla2x00_adjust_sdev_qdepth_down);
break;
}
if (lscsi_status != SS_CHECK_CONDITION)
@@ -1233,17 +1212,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
"scsi(%ld): QUEUE FULL status detected "
"0x%x-0x%x.\n", vha->host_no, comp_status,
scsi_status));
-
- /*
- * Adjust queue depth for all luns on the
- * port.
- */
- if (!ql2xqfulltracking)
- break;
- fcport->last_queue_full = jiffies;
- starget_for_each_device(
- cp->device->sdev_target, fcport,
- qla2x00_adjust_sdev_qdepth_down);
break;
}
if (lscsi_status != SS_CHECK_CONDITION)
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index c05c460..9652aac 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1222,12 +1222,36 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
sdev->hostdata = NULL;
}
+static void qla2x00_handle_queue_full(struct scsi_device *sdev, int qdepth)
+{
+ fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
+
+ fcport->last_queue_full = jiffies;
+
+ if (!scsi_track_queue_full(sdev, qdepth))
+ return;
+
+ DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
+ "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
+ fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
+ sdev->queue_depth));
+}
+
static int
qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
- if (reason != SCSI_QDEPTH_DEFAULT)
- return -EOPNOTSUPP;
- scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+ switch (reason) {
+ case SCSI_QDEPTH_DEFAULT:
+ scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+ break;
+ case SCSI_QDEPTH_QFULL:
+ if (!ql2xqfulltracking)
+ qla2x00_handle_queue_full(sdev, qdepth);
+ break;
+ default:
+ return EOPNOTSUPP;
+ }
+
return sdev->queue_depth;
}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 05/10] scsi: updates sdev to add queue_depth ramp up code
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
` (3 preceding siblings ...)
2009-09-03 22:22 ` [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full Vasu Dev
@ 2009-09-03 22:22 ` Vasu Dev
2009-09-03 22:22 ` [PATCH 06/10] scsi: adds sdev->queue_ramp_up_period to sysfs Vasu Dev
` (5 subsequent siblings)
10 siblings, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:22 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
Current FC HBA queue_depth ramp up code depends on :-
1. last queue full time.
2. last queue ramp up time.
3. ramp up period (time interval)
The sdev already has last_queue_full_time field to track last
queue full time but stored value is truncated by last four bits.
So this patch updates last_queue_full_time without truncating
last 4 bits to store complete value and then updates its only
current usages in scsi_track_queue_full to ignore last four bits
to keep current usages same. This will allow same
last_queue_full_time used by scsi_track_queue_full and queue_depth
ramp up code.
Adds additional new sdev fields for above 2 and 3 items.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/scsi.c | 10 ++++++++--
include/scsi/scsi_device.h | 6 +++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index b6e0307..bffaa9c 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -937,10 +937,16 @@ EXPORT_SYMBOL(scsi_adjust_queue_depth);
*/
int scsi_track_queue_full(struct scsi_device *sdev, int depth)
{
- if ((jiffies >> 4) == sdev->last_queue_full_time)
+
+ /*
+ * Don't let QUEUE_FULLs on the same
+ * jiffies count, they could all be from
+ * same event.
+ */
+ if ((jiffies >> 4) == (sdev->last_queue_full_time >> 4))
return 0;
- sdev->last_queue_full_time = (jiffies >> 4);
+ sdev->last_queue_full_time = jiffies;
if (sdev->last_queue_full_depth != depth) {
sdev->last_queue_full_count = 1;
sdev->last_queue_full_depth = depth;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 9af48cb..041d4f9 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -83,9 +83,9 @@ struct scsi_device {
unsigned short queue_depth; /* How deep of a queue we want */
unsigned short last_queue_full_depth; /* These two are used by */
unsigned short last_queue_full_count; /* scsi_track_queue_full() */
- unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same
- jiffie count on our counter, they
- could all be from the same event. */
+ unsigned long last_queue_full_time; /* last queue full time */
+ unsigned long queue_ramp_up_period; /* ramp up period in jiffies */
+ unsigned long last_queue_ramp_up; /* last queue ramp up time */
unsigned int id, lun, channel;
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 06/10] scsi: adds sdev->queue_ramp_up_period to sysfs
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
` (4 preceding siblings ...)
2009-09-03 22:22 ` [PATCH 05/10] scsi: updates sdev to add queue_depth ramp up code Vasu Dev
@ 2009-09-03 22:22 ` Vasu Dev
2009-09-03 22:23 ` [PATCH 07/10] scsi: add common queue_depth ramp up code Vasu Dev
` (4 subsequent siblings)
10 siblings, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:22 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
Adds sysfs functions to show or store sdev->queue_ramp_up_period.
Adds queue_ramp_up_period to sysfs if change_queue_depth is
supported since ramp up is needed only in case the dynamic
queue_depth change is supported first.
Initializes queue_ramp_up_period to 120HZ jiffies as initial
default value, it is same as used in lpfc and qla2xxx.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/scsi_scan.c | 1 +
drivers/scsi/scsi_sysfs.c | 38 ++++++++++++++++++++++++++++++++++++--
include/scsi/scsi_device.h | 2 ++
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index c447838..0e6db8b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -251,6 +251,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
sdev->model = scsi_null_device_strs;
sdev->rev = scsi_null_device_strs;
sdev->host = shost;
+ sdev->queue_ramp_up_period = SCSI_DEFAULT_RAMP_UP_PERIOD;
sdev->id = starget->id;
sdev->lun = lun;
sdev->channel = starget->channel;
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 4530626..9759349 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -779,6 +779,36 @@ static struct device_attribute sdev_attr_queue_depth_rw =
sdev_store_queue_depth_rw);
static ssize_t
+sdev_show_queue_ramp_up_period(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct scsi_device *sdev;
+ sdev = to_scsi_device(dev);
+ return snprintf(buf, 20, "%lu\n", sdev->queue_ramp_up_period);
+}
+
+static ssize_t
+sdev_store_queue_ramp_up_period(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct scsi_device *sdev = to_scsi_device(dev);
+ unsigned long period;
+
+ if (strict_strtoul(buf, 10, &period))
+ return -EINVAL;
+
+ sdev->queue_ramp_up_period = period;
+ return period;
+}
+
+static struct device_attribute sdev_attr_queue_ramp_up_period =
+ __ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,
+ sdev_show_queue_ramp_up_period,
+ sdev_store_queue_ramp_up_period);
+
+static ssize_t
sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -870,8 +900,12 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
get_device(&sdev->sdev_gendev);
/* create queue files, which may be writable, depending on the host */
- if (sdev->host->hostt->change_queue_depth)
- error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw);
+ if (sdev->host->hostt->change_queue_depth) {
+ error = device_create_file(&sdev->sdev_gendev,
+ &sdev_attr_queue_depth_rw);
+ error = device_create_file(&sdev->sdev_gendev,
+ &sdev_attr_queue_ramp_up_period);
+ }
else
error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth);
if (error) {
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 041d4f9..899f501 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -85,6 +85,8 @@ struct scsi_device {
unsigned short last_queue_full_count; /* scsi_track_queue_full() */
unsigned long last_queue_full_time; /* last queue full time */
unsigned long queue_ramp_up_period; /* ramp up period in jiffies */
+#define SCSI_DEFAULT_RAMP_UP_PERIOD (120 * HZ)
+
unsigned long last_queue_ramp_up; /* last queue ramp up time */
unsigned int id, lun, channel;
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 07/10] scsi: add common queue_depth ramp up code
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
` (5 preceding siblings ...)
2009-09-03 22:22 ` [PATCH 06/10] scsi: adds sdev->queue_ramp_up_period to sysfs Vasu Dev
@ 2009-09-03 22:23 ` Vasu Dev
2009-09-11 16:31 ` Mike Christie
2009-09-03 22:23 ` [PATCH 08/10] fcoe, libfc: fix an libfc issue with queue ramp down in libfc Vasu Dev
` (3 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:23 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
Adds scsi_handle_queue_ramp_up to ramp up queue_depth on
successful completion of IO. The scsi_handle_queue_ramp_up
will do ramp up on all luns of a target, just same as
ramp down done on all luns on a target.
However ramp up is skipped if lapsed time since either
last queue ramp up or down is less than LLD specified
queue_ramp_up_period.
The ramp up is also skipped in case the change_queue_depth
is not supported by LLD.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/scsi_error.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 7d1b862..c820ee7 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -331,6 +331,40 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
}
}
+static void scsi_handle_queue_ramp_up(struct scsi_device *sdev)
+{
+ struct scsi_host_template *sht = sdev->host->hostt;
+ struct scsi_device *tmp_sdev;
+
+ if (!sht->change_queue_depth)
+ return;
+
+ if (time_before(jiffies,
+ sdev->last_queue_ramp_up + sdev->queue_ramp_up_period))
+ return;
+
+ if (time_before(jiffies,
+ sdev->last_queue_full_time + sdev->queue_ramp_up_period))
+ return;
+
+ /*
+ * Walk all devices of a target and do
+ * ramp up on them.
+ */
+ shost_for_each_device(tmp_sdev, sdev->host) {
+ if ((tmp_sdev->channel != sdev->channel) ||
+ (tmp_sdev->id != sdev->id))
+ continue;
+ /*
+ * call back into LLD to increase queue_depth by one
+ * with ramp up reason code.
+ */
+ sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1,
+ SCSI_QDEPTH_RAMP_UP);
+ sdev->last_queue_ramp_up = jiffies;
+ }
+}
+
static void scsi_handle_queue_full(struct scsi_device *sdev)
{
struct scsi_host_template *sht = sdev->host->hostt;
@@ -392,6 +426,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
*/
switch (status_byte(scmd->result)) {
case GOOD:
+ scsi_handle_queue_ramp_up(scmd->device);
case COMMAND_TERMINATED:
return SUCCESS;
case CHECK_CONDITION:
@@ -1421,6 +1456,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
*/
return ADD_TO_MLQUEUE;
case GOOD:
+ scsi_handle_queue_ramp_up(scmd->device);
case COMMAND_TERMINATED:
return SUCCESS;
case TASK_ABORTED:
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 08/10] fcoe, libfc: fix an libfc issue with queue ramp down in libfc
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
` (6 preceding siblings ...)
2009-09-03 22:23 ` [PATCH 07/10] scsi: add common queue_depth ramp up code Vasu Dev
@ 2009-09-03 22:23 ` Vasu Dev
2009-09-10 22:15 ` Robert Love
2009-09-03 22:23 ` [PATCH 09/10] libfc: adds queue_depth ramp up to libfc Vasu Dev
` (2 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:23 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
The cmd_per_lun value is used by scsi-ml as fall back lowest
queue_depth value but in case of libfc cmd_per_lun is set to
same value as max queue_depth = 32.
So this patch reduces cmd_per_lun value to 3 and configures
each lun with default max queue_depth 32 in fc_slave_alloc.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 2 +-
drivers/scsi/libfc/fc_fcp.c | 14 ++++++--------
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 757aa28..49dff32 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -125,7 +125,7 @@ static struct scsi_host_template fcoe_shost_template = {
.change_queue_depth = fc_change_queue_depth,
.change_queue_type = fc_change_queue_type,
.this_id = -1,
- .cmd_per_lun = 32,
+ .cmd_per_lun = 3,
.can_queue = FCOE_MAX_OUTSTANDING_COMMANDS,
.use_clustering = ENABLE_CLUSTERING,
.sg_tablesize = SG_ALL,
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index d919c2a..b49f48b 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2031,18 +2031,16 @@ EXPORT_SYMBOL(fc_eh_host_reset);
int fc_slave_alloc(struct scsi_device *sdev)
{
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
- int queue_depth;
if (!rport || fc_remote_port_chkready(rport))
return -ENXIO;
- if (sdev->tagged_supported) {
- if (sdev->host->hostt->cmd_per_lun)
- queue_depth = sdev->host->hostt->cmd_per_lun;
- else
- queue_depth = FC_FCP_DFLT_QUEUE_DEPTH;
- scsi_activate_tcq(sdev, queue_depth);
- }
+ if (sdev->tagged_supported)
+ scsi_activate_tcq(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
+ else
+ scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
+ FC_FCP_DFLT_QUEUE_DEPTH);
+
return 0;
}
EXPORT_SYMBOL(fc_slave_alloc);
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 09/10] libfc: adds queue_depth ramp up to libfc
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
` (7 preceding siblings ...)
2009-09-03 22:23 ` [PATCH 08/10] fcoe, libfc: fix an libfc issue with queue ramp down in libfc Vasu Dev
@ 2009-09-03 22:23 ` Vasu Dev
2009-09-10 22:18 ` Robert Love
2009-09-03 22:23 ` [PATCH 10/10] zfcp: Adapt change_queue_depth for queue full tracking Vasu Dev
2009-10-13 21:59 ` [PATCH 00/10] handles queue_depth adjustments in scsi_error.c James Bottomley
10 siblings, 1 reply; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:23 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
Increases queue_depth by one on fc_change_queue_depth call back
with reason SCSI_QDEPTH_RAMP_UP.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/libfc/fc_fcp.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index b49f48b..71b49b0 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
case SCSI_QDEPTH_QFULL:
scsi_track_queue_full(sdev, qdepth);
break;
+ case SCSI_QDEPTH_RAMP_UP:
+ if (qdepth <= FC_FCP_DFLT_QUEUE_DEPTH)
+ scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
+ qdepth);
+ break;
default:
return -EOPNOTSUPP;
}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 10/10] zfcp: Adapt change_queue_depth for queue full tracking
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
` (8 preceding siblings ...)
2009-09-03 22:23 ` [PATCH 09/10] libfc: adds queue_depth ramp up to libfc Vasu Dev
@ 2009-09-03 22:23 ` Vasu Dev
2009-10-13 21:59 ` [PATCH 00/10] handles queue_depth adjustments in scsi_error.c James Bottomley
10 siblings, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-03 22:23 UTC (permalink / raw)
To: James Bottomley, linux-scsi
Cc: Andrew Vasquez, James Smart, Mike Christie, Robert Love,
Christof Schmitt
From: Christof Schmitt <christof.schmitt@de.ibm.com>
Adapt the change_queue_depth callback in zfcp for the new reason
parameter. Simply pass each call back to the SCSI midlayer, there are
no resource adjustments necessary for zfcp.
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/s390/scsi/zfcp_scsi.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index bdff1bf..287ebb8 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -31,9 +31,21 @@ char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu)
static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
int reason)
{
- if (reason != SCSI_QDEPTH_DEFAULT)
+ switch (reason) {
+ case SCSI_QDEPTH_DEFAULT:
+ scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
+ break;
+ case SCSI_QDEPTH_QFULL:
+ scsi_track_queue_full(sdev, depth);
+ break;
+ case SCSI_QDEPTH_RAMP_UP:
+ if (depth <= default_depth)
+ scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
+ depth);
+ break;
+ default:
return -EOPNOTSUPP;
- scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
+ }
return sdev->queue_depth;
}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* RE: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
2009-09-03 22:22 ` [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full Vasu Dev
@ 2009-09-04 13:47 ` Alex.Iannicelli
2009-09-04 21:43 ` Vasu Dev
2009-09-07 20:44 ` [PATCH v2] drivers: convert libfc " Vasu Dev
1 sibling, 1 reply; 29+ messages in thread
From: Alex.Iannicelli @ 2009-09-04 13:47 UTC (permalink / raw)
To: vasu.dev, James.Bottomley, linux-scsi
Cc: andrew.vasquez, James.Smart, michaelc, robert.w.love,
christof.schmitt, Alex.Iannicelli
It looks like you moved the ramp up functionality into the scsi layer, but did not move the ramp up code from the lpfc driver in the lpfc_scsi_cmd_iocb_cmpl routine (just above the code that was removed for the ramp down in this patch) to the new lpfc_change_queue_depth routine. I think that this new routine should handle both ramp up and ramp down but you have it only handling the ramp down case.
-Alex
> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> owner@vger.kernel.org] On Behalf Of Vasu Dev
> Sent: Thursday, September 03, 2009 6:23 PM
> To: James Bottomley; linux-scsi@vger.kernel.org
> Cc: Andrew Vasquez; Smart, James; Mike Christie; Robert Love; Christof
> Schmitt
> Subject: [PATCH 04/10] drivers: convert fc drivers calling
> scsi_track_queue_full
>
> From: Mike Christie <michaelc@cs.wisc.edu>
>
> This converts the fc drivers that were using scsi_track_queue_full
> to track the queue full from the change_queue_depth callback.
>
> I have not yet tested the qla2xxx or lpfc parts.
>
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
>
> --
> Adds check to ignore SCSI_QDEPTH_QFULL in case the
> ql2xqfulltracking is not set.
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> ---
>
> drivers/scsi/libfc/fc_fcp.c | 26 +++++---------
> drivers/scsi/lpfc/lpfc_scsi.c | 75 ++++++++++++++++++++++----------
> --------
> drivers/scsi/qla2xxx/qla_isr.c | 32 -----------------
> drivers/scsi/qla2xxx/qla_os.c | 30 ++++++++++++++--
> 4 files changed, 77 insertions(+), 86 deletions(-)
>
> diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
> index 20b88cd..d919c2a 100644
> --- a/drivers/scsi/libfc/fc_fcp.c
> +++ b/drivers/scsi/libfc/fc_fcp.c
> @@ -1814,21 +1814,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
> sc_cmd->result = DID_OK << 16;
> if (fsp->scsi_resid)
> CMD_RESID_LEN(sc_cmd) = fsp->scsi_resid;
> - } else if (fsp->cdb_status == QUEUE_FULL) {
> - struct scsi_device *tmp_sdev;
> - struct scsi_device *sdev = sc_cmd->device;
> -
> - shost_for_each_device(tmp_sdev, sdev->host) {
> - if (tmp_sdev->id != sdev->id)
> - continue;
> -
> - if (tmp_sdev->queue_depth > 1) {
> - scsi_track_queue_full(tmp_sdev,
> - tmp_sdev->
> - queue_depth - 1);
> - }
> - }
> - sc_cmd->result = (DID_OK << 16) | fsp->cdb_status;
> } else {
> /*
> * transport level I/O was ok but scsi
> @@ -2064,9 +2049,16 @@ EXPORT_SYMBOL(fc_slave_alloc);
>
> int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int
> reason)
> {
> - if (reason != SCSI_QDEPTH_DEFAULT)
> + switch (reason) {
> + case SCSI_QDEPTH_DEFAULT:
> + scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
> qdepth);
> + break;
> + case SCSI_QDEPTH_QFULL:
> + scsi_track_queue_full(sdev, qdepth);
> + break;
> + default:
> return -EOPNOTSUPP;
> - scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
> + }
> return sdev->queue_depth;
> }
> EXPORT_SYMBOL(fc_change_queue_depth);
> diff --git a/drivers/scsi/lpfc/lpfc_scsi.c
> b/drivers/scsi/lpfc/lpfc_scsi.c
> index 61d0897..2d39d84 100644
> --- a/drivers/scsi/lpfc/lpfc_scsi.c
> +++ b/drivers/scsi/lpfc/lpfc_scsi.c
> @@ -2189,7 +2189,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba,
> struct lpfc_iocbq *pIocbIn,
> struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
> int result;
> struct scsi_device *tmp_sdev;
> - int depth = 0;
> unsigned long flags;
> struct lpfc_fast_path_event *fast_path_evt;
> struct Scsi_Host *shost = cmd->device->host;
> @@ -2388,39 +2387,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba,
> struct lpfc_iocbq *pIocbIn,
> }
>
The code just above this area should be moved into the lpfc_change_queue_depth routine.
> /*
> - * Check for queue full. If the lun is reporting queue full,
> then
> - * back off the lun queue depth to prevent target overloads.
> - */
> - if (result == SAM_STAT_TASK_SET_FULL && pnode &&
> - NLP_CHK_NODE_ACT(pnode)) {
> - pnode->last_q_full_time = jiffies;
> -
> - shost_for_each_device(tmp_sdev, shost) {
> - if (tmp_sdev->id != scsi_id)
> - continue;
> - depth = scsi_track_queue_full(tmp_sdev,
> - tmp_sdev->queue_depth - 1);
> - }
> - /*
> - * The queue depth cannot be lowered any more.
> - * Modify the returned error code to store
> - * the final depth value set by
> - * scsi_track_queue_full.
> - */
> - if (depth == -1)
> - depth = shost->cmd_per_lun;
> -
> - if (depth) {
> - lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
> - "0711 detected queue full - lun queue "
> - "depth adjusted to %d.\n", depth);
> - lpfc_send_sdev_queuedepth_change_event(phba, vport,
> - pnode, 0xFFFFFFFF,
> - depth+1, depth);
> - }
> - }
> -
> - /*
> * If there is a thread waiting for command completion
> * wake up the thread.
> */
> @@ -3551,6 +3517,45 @@ lpfc_slave_configure(struct scsi_device *sdev)
> return 0;
> }
>
> +static int lpfc_change_queue_depth(struct scsi_device *sdev, int
> queue_depth,
> + int reason)
> +{
> + struct Scsi_Host *shost = sdev->host;
> + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
> + struct lpfc_hba *phba = vport->phba;
> + struct lpfc_rport_data *rdata = sdev->hostdata;
> + struct lpfc_nodelist *pnode = rdata->pnode;
> + int depth;
> +
> + if (reason != SCSI_QDEPTH_QFULL)
> + return -EOPNOTSUPP;
This should handle qfull(ramp up) and ramp down.
> +
> + if (!pnode || !NLP_CHK_NODE_ACT(pnode))
> + return -EINVAL;
> +
> + pnode->last_q_full_time = jiffies;
> +
> + depth = scsi_track_queue_full(sdev, queue_depth);
> + /*
> + * The queue depth cannot be lowered any more.
> + * Modify the returned error code to store
> + * the final depth value set by
> + * scsi_track_queue_full.
> + */
> + if (depth == -1)
> + depth = shost->cmd_per_lun;
> +
> + if (depth) {
> + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
> + "0711 detected queue full - lun queue "
> + "depth adjusted to %d.\n", depth);
> + lpfc_send_sdev_queuedepth_change_event(phba, vport,
> + pnode, 0xFFFFFFFF,
> + depth + 1, depth);
> + }
> + return sdev->queue_depth;
> +}
> +
> /**
> * lpfc_slave_destroy - slave_destroy entry point of SHT data
> structure
> * @sdev: Pointer to scsi_device.
> @@ -3574,6 +3579,7 @@ struct scsi_host_template lpfc_template = {
> .eh_device_reset_handler = lpfc_device_reset_handler,
> .eh_target_reset_handler = lpfc_target_reset_handler,
> .eh_bus_reset_handler = lpfc_bus_reset_handler,
> + .change_queue_depth = lpfc_change_queue_depth,
> .slave_alloc = lpfc_slave_alloc,
> .slave_configure = lpfc_slave_configure,
> .slave_destroy = lpfc_slave_destroy,
> @@ -3596,6 +3602,7 @@ struct scsi_host_template lpfc_vport_template = {
> .eh_device_reset_handler = lpfc_device_reset_handler,
> .eh_target_reset_handler = lpfc_target_reset_handler,
> .eh_bus_reset_handler = lpfc_bus_reset_handler,
> + .change_queue_depth = lpfc_change_queue_depth,
> .slave_alloc = lpfc_slave_alloc,
> .slave_configure = lpfc_slave_configure,
> .slave_destroy = lpfc_slave_destroy,
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c
> b/drivers/scsi/qla2xxx/qla_isr.c
> index 74fa6f9..66fda3a 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -836,20 +836,6 @@ qla2x00_adjust_sdev_qdepth_up(struct scsi_device
> *sdev, void *data)
> sdev->queue_depth));
> }
>
> -static void
> -qla2x00_adjust_sdev_qdepth_down(struct scsi_device *sdev, void *data)
> -{
> - fc_port_t *fcport = data;
> -
> - if (!scsi_track_queue_full(sdev, sdev->queue_depth - 1))
> - return;
> -
> - DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
> - "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
> - fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
> - sdev->queue_depth));
> -}
> -
> static inline void
> qla2x00_ramp_up_queue_depth(scsi_qla_host_t *vha, struct req_que *req,
> srb_t *sp)
> @@ -1176,13 +1162,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha,
> struct rsp_que *rsp, void *pkt)
> "scsi(%ld): QUEUE FULL status detected "
> "0x%x-0x%x.\n", vha->host_no, comp_status,
> scsi_status));
> -
> - /* Adjust queue depth for all luns on the port. */
> - if (!ql2xqfulltracking)
> - break;
> - fcport->last_queue_full = jiffies;
> - starget_for_each_device(cp->device->sdev_target,
> - fcport, qla2x00_adjust_sdev_qdepth_down);
> break;
> }
> if (lscsi_status != SS_CHECK_CONDITION)
> @@ -1233,17 +1212,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha,
> struct rsp_que *rsp, void *pkt)
> "scsi(%ld): QUEUE FULL status detected "
> "0x%x-0x%x.\n", vha->host_no, comp_status,
> scsi_status));
> -
> - /*
> - * Adjust queue depth for all luns on the
> - * port.
> - */
> - if (!ql2xqfulltracking)
> - break;
> - fcport->last_queue_full = jiffies;
> - starget_for_each_device(
> - cp->device->sdev_target, fcport,
> - qla2x00_adjust_sdev_qdepth_down);
> break;
> }
> if (lscsi_status != SS_CHECK_CONDITION)
> diff --git a/drivers/scsi/qla2xxx/qla_os.c
> b/drivers/scsi/qla2xxx/qla_os.c
> index c05c460..9652aac 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -1222,12 +1222,36 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
> sdev->hostdata = NULL;
> }
>
> +static void qla2x00_handle_queue_full(struct scsi_device *sdev, int
> qdepth)
> +{
> + fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
> +
> + fcport->last_queue_full = jiffies;
> +
> + if (!scsi_track_queue_full(sdev, qdepth))
> + return;
> +
> + DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
> + "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
> + fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
> + sdev->queue_depth));
> +}
> +
> static int
> qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int
> reason)
> {
> - if (reason != SCSI_QDEPTH_DEFAULT)
> - return -EOPNOTSUPP;
> - scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
> + switch (reason) {
> + case SCSI_QDEPTH_DEFAULT:
> + scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
> qdepth);
> + break;
> + case SCSI_QDEPTH_QFULL:
> + if (!ql2xqfulltracking)
> + qla2x00_handle_queue_full(sdev, qdepth);
> + break;
> + default:
> + return EOPNOTSUPP;
> + }
> +
> return sdev->queue_depth;
> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 29+ messages in thread
* RE: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
2009-09-04 13:47 ` Alex.Iannicelli
@ 2009-09-04 21:43 ` Vasu Dev
2009-09-11 16:18 ` Mike Christie
2009-09-11 16:54 ` Mike Christie
0 siblings, 2 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-04 21:43 UTC (permalink / raw)
To: Alex.Iannicelli, andrew.vasquez, James.Bottomley
Cc: vasu.dev, linux-scsi, James.Smart, michaelc, robert.w.love,
christof.schmitt
On Fri, 2009-09-04 at 06:47 -0700, Alex.Iannicelli@Emulex.Com wrote:
> It looks like you moved the ramp up functionality into the scsi layer,
> but did not move the ramp up code from the lpfc driver in the
Correct.
> lpfc_scsi_cmd_iocb_cmpl routine (just above the code that was removed
> for the ramp down in this patch) to the new lpfc_change_queue_depth
> routine. I think that this new routine should handle both ramp up and
> ramp down but you have it only handling the ramp down case.
>
I agree all FC HBA should handle both ramp down and up as per added new
change_queue_depth interface by this series. I did this for libfc/fcoe
and Chrirstof did this for zfcp driver but lpfc & qla2xxx got only ramp
down changes from Mike, now that Mike is busy with other stuff I don't
know how to complete them in this series since I don't understand lpfc
and qla2xxx enough and neither I have way to test changes to these
drivers.
So I'm going to update this series to have just libfc and zfcp driver
changes for now and lpfc and qla2xxx can be updated later by someone
familiar lpfc and qla2xxx, their ramp down changes can be collect from
this series post.
Thanks
Vasu
> -Alex
>
> > -----Original Message-----
> > From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> > owner@vger.kernel.org] On Behalf Of Vasu Dev
> > Sent: Thursday, September 03, 2009 6:23 PM
> > To: James Bottomley; linux-scsi@vger.kernel.org
> > Cc: Andrew Vasquez; Smart, James; Mike Christie; Robert Love; Christof
> > Schmitt
> > Subject: [PATCH 04/10] drivers: convert fc drivers calling
> > scsi_track_queue_full
> >
> > From: Mike Christie <michaelc@cs.wisc.edu>
> >
> > This converts the fc drivers that were using scsi_track_queue_full
> > to track the queue full from the change_queue_depth callback.
> >
> > I have not yet tested the qla2xxx or lpfc parts.
> >
> > Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> >
> > --
> > Adds check to ignore SCSI_QDEPTH_QFULL in case the
> > ql2xqfulltracking is not set.
> > Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> > ---
> >
> > drivers/scsi/libfc/fc_fcp.c | 26 +++++---------
> > drivers/scsi/lpfc/lpfc_scsi.c | 75 ++++++++++++++++++++++----------
> > --------
> > drivers/scsi/qla2xxx/qla_isr.c | 32 -----------------
> > drivers/scsi/qla2xxx/qla_os.c | 30 ++++++++++++++--
> > 4 files changed, 77 insertions(+), 86 deletions(-)
> >
> > diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
> > index 20b88cd..d919c2a 100644
> > --- a/drivers/scsi/libfc/fc_fcp.c
> > +++ b/drivers/scsi/libfc/fc_fcp.c
> > @@ -1814,21 +1814,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
> > sc_cmd->result = DID_OK << 16;
> > if (fsp->scsi_resid)
> > CMD_RESID_LEN(sc_cmd) = fsp->scsi_resid;
> > - } else if (fsp->cdb_status == QUEUE_FULL) {
> > - struct scsi_device *tmp_sdev;
> > - struct scsi_device *sdev = sc_cmd->device;
> > -
> > - shost_for_each_device(tmp_sdev, sdev->host) {
> > - if (tmp_sdev->id != sdev->id)
> > - continue;
> > -
> > - if (tmp_sdev->queue_depth > 1) {
> > - scsi_track_queue_full(tmp_sdev,
> > - tmp_sdev->
> > - queue_depth - 1);
> > - }
> > - }
> > - sc_cmd->result = (DID_OK << 16) | fsp->cdb_status;
> > } else {
> > /*
> > * transport level I/O was ok but scsi
> > @@ -2064,9 +2049,16 @@ EXPORT_SYMBOL(fc_slave_alloc);
> >
> > int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int
> > reason)
> > {
> > - if (reason != SCSI_QDEPTH_DEFAULT)
> > + switch (reason) {
> > + case SCSI_QDEPTH_DEFAULT:
> > + scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
> > qdepth);
> > + break;
> > + case SCSI_QDEPTH_QFULL:
> > + scsi_track_queue_full(sdev, qdepth);
> > + break;
> > + default:
> > return -EOPNOTSUPP;
> > - scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
> > + }
> > return sdev->queue_depth;
> > }
> > EXPORT_SYMBOL(fc_change_queue_depth);
> > diff --git a/drivers/scsi/lpfc/lpfc_scsi.c
> > b/drivers/scsi/lpfc/lpfc_scsi.c
> > index 61d0897..2d39d84 100644
> > --- a/drivers/scsi/lpfc/lpfc_scsi.c
> > +++ b/drivers/scsi/lpfc/lpfc_scsi.c
> > @@ -2189,7 +2189,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba,
> > struct lpfc_iocbq *pIocbIn,
> > struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
> > int result;
> > struct scsi_device *tmp_sdev;
> > - int depth = 0;
> > unsigned long flags;
> > struct lpfc_fast_path_event *fast_path_evt;
> > struct Scsi_Host *shost = cmd->device->host;
> > @@ -2388,39 +2387,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba,
> > struct lpfc_iocbq *pIocbIn,
> > }
> >
>
> The code just above this area should be moved into the lpfc_change_queue_depth routine.
>
> > /*
> > - * Check for queue full. If the lun is reporting queue full,
> > then
> > - * back off the lun queue depth to prevent target overloads.
> > - */
> > - if (result == SAM_STAT_TASK_SET_FULL && pnode &&
> > - NLP_CHK_NODE_ACT(pnode)) {
> > - pnode->last_q_full_time = jiffies;
> > -
> > - shost_for_each_device(tmp_sdev, shost) {
> > - if (tmp_sdev->id != scsi_id)
> > - continue;
> > - depth = scsi_track_queue_full(tmp_sdev,
> > - tmp_sdev->queue_depth - 1);
> > - }
> > - /*
> > - * The queue depth cannot be lowered any more.
> > - * Modify the returned error code to store
> > - * the final depth value set by
> > - * scsi_track_queue_full.
> > - */
> > - if (depth == -1)
> > - depth = shost->cmd_per_lun;
> > -
> > - if (depth) {
> > - lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
> > - "0711 detected queue full - lun queue "
> > - "depth adjusted to %d.\n", depth);
> > - lpfc_send_sdev_queuedepth_change_event(phba, vport,
> > - pnode, 0xFFFFFFFF,
> > - depth+1, depth);
> > - }
> > - }
> > -
> > - /*
> > * If there is a thread waiting for command completion
> > * wake up the thread.
> > */
> > @@ -3551,6 +3517,45 @@ lpfc_slave_configure(struct scsi_device *sdev)
> > return 0;
> > }
> >
> > +static int lpfc_change_queue_depth(struct scsi_device *sdev, int
> > queue_depth,
> > + int reason)
> > +{
> > + struct Scsi_Host *shost = sdev->host;
> > + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
> > + struct lpfc_hba *phba = vport->phba;
> > + struct lpfc_rport_data *rdata = sdev->hostdata;
> > + struct lpfc_nodelist *pnode = rdata->pnode;
> > + int depth;
> > +
> > + if (reason != SCSI_QDEPTH_QFULL)
> > + return -EOPNOTSUPP;
>
> This should handle qfull(ramp up) and ramp down.
>
> > +
> > + if (!pnode || !NLP_CHK_NODE_ACT(pnode))
> > + return -EINVAL;
> > +
> > + pnode->last_q_full_time = jiffies;
> > +
> > + depth = scsi_track_queue_full(sdev, queue_depth);
> > + /*
> > + * The queue depth cannot be lowered any more.
> > + * Modify the returned error code to store
> > + * the final depth value set by
> > + * scsi_track_queue_full.
> > + */
> > + if (depth == -1)
> > + depth = shost->cmd_per_lun;
> > +
> > + if (depth) {
> > + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
> > + "0711 detected queue full - lun queue "
> > + "depth adjusted to %d.\n", depth);
> > + lpfc_send_sdev_queuedepth_change_event(phba, vport,
> > + pnode, 0xFFFFFFFF,
> > + depth + 1, depth);
> > + }
> > + return sdev->queue_depth;
> > +}
> > +
> > /**
> > * lpfc_slave_destroy - slave_destroy entry point of SHT data
> > structure
> > * @sdev: Pointer to scsi_device.
> > @@ -3574,6 +3579,7 @@ struct scsi_host_template lpfc_template = {
> > .eh_device_reset_handler = lpfc_device_reset_handler,
> > .eh_target_reset_handler = lpfc_target_reset_handler,
> > .eh_bus_reset_handler = lpfc_bus_reset_handler,
> > + .change_queue_depth = lpfc_change_queue_depth,
> > .slave_alloc = lpfc_slave_alloc,
> > .slave_configure = lpfc_slave_configure,
> > .slave_destroy = lpfc_slave_destroy,
> > @@ -3596,6 +3602,7 @@ struct scsi_host_template lpfc_vport_template = {
> > .eh_device_reset_handler = lpfc_device_reset_handler,
> > .eh_target_reset_handler = lpfc_target_reset_handler,
> > .eh_bus_reset_handler = lpfc_bus_reset_handler,
> > + .change_queue_depth = lpfc_change_queue_depth,
> > .slave_alloc = lpfc_slave_alloc,
> > .slave_configure = lpfc_slave_configure,
> > .slave_destroy = lpfc_slave_destroy,
> > diff --git a/drivers/scsi/qla2xxx/qla_isr.c
> > b/drivers/scsi/qla2xxx/qla_isr.c
> > index 74fa6f9..66fda3a 100644
> > --- a/drivers/scsi/qla2xxx/qla_isr.c
> > +++ b/drivers/scsi/qla2xxx/qla_isr.c
> > @@ -836,20 +836,6 @@ qla2x00_adjust_sdev_qdepth_up(struct scsi_device
> > *sdev, void *data)
> > sdev->queue_depth));
> > }
> >
> > -static void
> > -qla2x00_adjust_sdev_qdepth_down(struct scsi_device *sdev, void *data)
> > -{
> > - fc_port_t *fcport = data;
> > -
> > - if (!scsi_track_queue_full(sdev, sdev->queue_depth - 1))
> > - return;
> > -
> > - DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
> > - "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
> > - fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
> > - sdev->queue_depth));
> > -}
> > -
> > static inline void
> > qla2x00_ramp_up_queue_depth(scsi_qla_host_t *vha, struct req_que *req,
> > srb_t *sp)
> > @@ -1176,13 +1162,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha,
> > struct rsp_que *rsp, void *pkt)
> > "scsi(%ld): QUEUE FULL status detected "
> > "0x%x-0x%x.\n", vha->host_no, comp_status,
> > scsi_status));
> > -
> > - /* Adjust queue depth for all luns on the port. */
> > - if (!ql2xqfulltracking)
> > - break;
> > - fcport->last_queue_full = jiffies;
> > - starget_for_each_device(cp->device->sdev_target,
> > - fcport, qla2x00_adjust_sdev_qdepth_down);
> > break;
> > }
> > if (lscsi_status != SS_CHECK_CONDITION)
> > @@ -1233,17 +1212,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha,
> > struct rsp_que *rsp, void *pkt)
> > "scsi(%ld): QUEUE FULL status detected "
> > "0x%x-0x%x.\n", vha->host_no, comp_status,
> > scsi_status));
> > -
> > - /*
> > - * Adjust queue depth for all luns on the
> > - * port.
> > - */
> > - if (!ql2xqfulltracking)
> > - break;
> > - fcport->last_queue_full = jiffies;
> > - starget_for_each_device(
> > - cp->device->sdev_target, fcport,
> > - qla2x00_adjust_sdev_qdepth_down);
> > break;
> > }
> > if (lscsi_status != SS_CHECK_CONDITION)
> > diff --git a/drivers/scsi/qla2xxx/qla_os.c
> > b/drivers/scsi/qla2xxx/qla_os.c
> > index c05c460..9652aac 100644
> > --- a/drivers/scsi/qla2xxx/qla_os.c
> > +++ b/drivers/scsi/qla2xxx/qla_os.c
> > @@ -1222,12 +1222,36 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
> > sdev->hostdata = NULL;
> > }
> >
> > +static void qla2x00_handle_queue_full(struct scsi_device *sdev, int
> > qdepth)
> > +{
> > + fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
> > +
> > + fcport->last_queue_full = jiffies;
> > +
> > + if (!scsi_track_queue_full(sdev, qdepth))
> > + return;
> > +
> > + DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
> > + "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
> > + fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
> > + sdev->queue_depth));
> > +}
> > +
> > static int
> > qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int
> > reason)
> > {
> > - if (reason != SCSI_QDEPTH_DEFAULT)
> > - return -EOPNOTSUPP;
> > - scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
> > + switch (reason) {
> > + case SCSI_QDEPTH_DEFAULT:
> > + scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
> > qdepth);
> > + break;
> > + case SCSI_QDEPTH_QFULL:
> > + if (!ql2xqfulltracking)
> > + qla2x00_handle_queue_full(sdev, qdepth);
> > + break;
> > + default:
> > + return EOPNOTSUPP;
> > + }
> > +
> > return sdev->queue_depth;
> > }
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-scsi"
> > in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> NrybXǧv^){.n+{"{ay\x1dʇڙ,j\afhz\x1ew\fj:+vwjm\azZ+ݢj"!
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2] drivers: convert libfc calling scsi_track_queue_full
2009-09-03 22:22 ` [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full Vasu Dev
2009-09-04 13:47 ` Alex.Iannicelli
@ 2009-09-07 20:44 ` Vasu Dev
1 sibling, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-07 20:44 UTC (permalink / raw)
To: linux-scsi
From: Mike Christie <michaelc@cs.wisc.edu>
This converts the libfc using scsi_track_queue_full to
track the queue full from the change_queue_depth callback.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/libfc/fc_fcp.c | 26 +++++++++-----------------
1 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index d748e03..6c189be 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1814,21 +1814,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
sc_cmd->result = DID_OK << 16;
if (fsp->scsi_resid)
CMD_RESID_LEN(sc_cmd) = fsp->scsi_resid;
- } else if (fsp->cdb_status == QUEUE_FULL) {
- struct scsi_device *tmp_sdev;
- struct scsi_device *sdev = sc_cmd->device;
-
- shost_for_each_device(tmp_sdev, sdev->host) {
- if (tmp_sdev->id != sdev->id)
- continue;
-
- if (tmp_sdev->queue_depth > 1) {
- scsi_track_queue_full(tmp_sdev,
- tmp_sdev->
- queue_depth - 1);
- }
- }
- sc_cmd->result = (DID_OK << 16) | fsp->cdb_status;
} else {
/*
* transport level I/O was ok but scsi
@@ -2064,9 +2049,16 @@ EXPORT_SYMBOL(fc_slave_alloc);
int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
- if (reason != SCSI_QDEPTH_DEFAULT)
+ switch (reason) {
+ case SCSI_QDEPTH_DEFAULT:
+ scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+ break;
+ case SCSI_QDEPTH_QFULL:
+ scsi_track_queue_full(sdev, qdepth);
+ break;
+ default:
return -EOPNOTSUPP;
- scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+ }
return sdev->queue_depth;
}
EXPORT_SYMBOL(fc_change_queue_depth);
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 08/10] fcoe, libfc: fix an libfc issue with queue ramp down in libfc
2009-09-03 22:23 ` [PATCH 08/10] fcoe, libfc: fix an libfc issue with queue ramp down in libfc Vasu Dev
@ 2009-09-10 22:15 ` Robert Love
0 siblings, 0 replies; 29+ messages in thread
From: Robert Love @ 2009-09-10 22:15 UTC (permalink / raw)
To: Dev, Vasu
Cc: James Bottomley, linux-scsi@vger.kernel.org, Andrew Vasquez,
James Smart, Mike Christie, Christof Schmitt
On Thu, 2009-09-03 at 15:23 -0700, Dev, Vasu wrote:
> The cmd_per_lun value is used by scsi-ml as fall back lowest
> queue_depth value but in case of libfc cmd_per_lun is set to
> same value as max queue_depth = 32.
>
> So this patch reduces cmd_per_lun value to 3 and configures
> each lun with default max queue_depth 32 in fc_slave_alloc.
>
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Acked-by: Robert Love <robert.w.love@intel.com>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 09/10] libfc: adds queue_depth ramp up to libfc
2009-09-03 22:23 ` [PATCH 09/10] libfc: adds queue_depth ramp up to libfc Vasu Dev
@ 2009-09-10 22:18 ` Robert Love
0 siblings, 0 replies; 29+ messages in thread
From: Robert Love @ 2009-09-10 22:18 UTC (permalink / raw)
To: Dev, Vasu
Cc: James Bottomley, linux-scsi@vger.kernel.org, Andrew Vasquez,
James Smart, Mike Christie, Christof Schmitt
On Thu, 2009-09-03 at 15:23 -0700, Dev, Vasu wrote:
> Increases queue_depth by one on fc_change_queue_depth call back
> with reason SCSI_QDEPTH_RAMP_UP.
>
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Acked-by: Robert Love <robert.w.love@intel.com>
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 03/10 v2] drivers: convert drivers setting the change_queue_depth callback
2009-09-03 22:22 ` [PATCH 03/10] drivers: convert drivers setting the change_queue_depth callback Vasu Dev
@ 2009-09-10 22:22 ` Vasu Dev
0 siblings, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-10 22:22 UTC (permalink / raw)
To: linux-scsi
From: Mike Christie <michaelc@cs.wisc.edu>
This is a simple port of the drivers setting a change_queue_depth
callback but were not tracking queue fulls. In the patch I just have
these LLDs adjust the queue depth if the user was requesting it.
Patch is only compile tested.
-v2
Also converted pmcraid_change_queue_depth and then verified
all modules compile using "make allmodconfig" for any new build
warnings on X86_64.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/ata/libata-scsi.c | 7 ++++++-
drivers/ata/sata_nv.c | 2 +-
drivers/message/fusion/mptscsih.c | 9 +++++++--
drivers/message/fusion/mptscsih.h | 3 ++-
drivers/s390/scsi/zfcp_scsi.c | 5 ++++-
drivers/scsi/3w-9xxx.c | 5 ++++-
drivers/scsi/3w-xxxx.c | 5 ++++-
drivers/scsi/53c700.c | 5 ++++-
drivers/scsi/aacraid/linit.c | 6 +++++-
drivers/scsi/arcmsr/arcmsr_hba.c | 5 ++++-
drivers/scsi/hptiop.c | 5 ++++-
drivers/scsi/ibmvscsi/ibmvfc.c | 7 ++++++-
drivers/scsi/ibmvscsi/ibmvscsi.c | 7 ++++++-
drivers/scsi/ipr.c | 7 ++++++-
drivers/scsi/libfc/fc_fcp.c | 4 +++-
drivers/scsi/libiscsi.c | 4 +++-
drivers/scsi/libsas/sas_scsi_host.c | 6 +++++-
drivers/scsi/megaraid/megaraid_mbox.c | 7 ++++++-
drivers/scsi/mpt2sas/mpt2sas_scsih.c | 10 +++++++---
drivers/scsi/pmcraid.c | 7 ++++++-
drivers/scsi/qla2xxx/qla_os.c | 6 ++++--
include/linux/libata.h | 2 +-
include/scsi/libfc.h | 2 +-
include/scsi/libiscsi.h | 3 ++-
include/scsi/libsas.h | 3 ++-
25 files changed, 103 insertions(+), 29 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index d0dfeef..050fae6 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1212,6 +1212,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
* ata_scsi_change_queue_depth - SCSI callback for queue depth config
* @sdev: SCSI device to configure queue depth for
* @queue_depth: new queue depth
+ * @reason: calling context
*
* This is libata standard hostt->change_queue_depth callback.
* SCSI will call into this callback when user tries to set queue
@@ -1223,12 +1224,16 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
* RETURNS:
* Newly configured queue depth.
*/
-int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+ int reason)
{
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *dev;
unsigned long flags;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (queue_depth < 1 || queue_depth == sdev->queue_depth)
return sdev->queue_depth;
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 86a4058..9bb4afb 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)
ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
if (strncmp(model_num, "Maxtor", 6) == 0) {
- ata_scsi_change_queue_depth(sdev, 1);
+ ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_DEFAULT);
ata_dev_printk(dev, KERN_NOTICE,
"Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth);
}
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index c295786..e132c17 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2275,11 +2275,12 @@ mptscsih_slave_destroy(struct scsi_device *sdev)
* mptscsih_change_queue_depth - This function will set a devices queue depth
* @sdev: per scsi_device pointer
* @qdepth: requested queue depth
+ * @reason: calling context
*
* Adding support for new 'change_queue_depth' api.
*/
int
-mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
+mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
MPT_SCSI_HOST *hd = shost_priv(sdev->host);
VirtTarget *vtarget;
@@ -2291,6 +2292,9 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
starget = scsi_target(sdev);
vtarget = starget->hostdata;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (ioc->bus_type == SPI) {
if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES))
max_depth = 1;
@@ -2357,7 +2361,8 @@ mptscsih_slave_configure(struct scsi_device *sdev)
ioc->name, vtarget->negoFlags, vtarget->maxOffset,
vtarget->minSyncFactor));
- mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH);
+ mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH,
+ SCSI_QDEPTH_DEFAULT);
dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"tagged %d, simple %d, ordered %d\n",
ioc->name,sdev->tagged_supported, sdev->simple_tags,
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index e0b33e0..45a5ff3 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -128,7 +128,8 @@ extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_F
extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
-extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
+extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason);
extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
extern struct device_attribute *mptscsih_host_attrs[];
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 3ff726a..c46e04c 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -29,8 +29,11 @@ char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu)
return fcp_sns_info_ptr;
}
-static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth)
+static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
return sdev->queue_depth;
}
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 36c21b1..f7d52d8 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -186,8 +186,11 @@ static ssize_t twa_show_stats(struct device *dev,
} /* End twa_show_stats() */
/* This function will set a devices queue depth */
-static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
if (queue_depth > TW_Q_LENGTH-2)
queue_depth = TW_Q_LENGTH-2;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index faa0fcf..927f5ce 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -521,8 +521,11 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,
} /* End tw_show_stats() */
/* This function will set a devices queue depth */
-static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
if (queue_depth > TW_Q_LENGTH-2)
queue_depth = TW_Q_LENGTH-2;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index f5a9add..a5a493d 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -2082,8 +2082,11 @@ NCR_700_slave_destroy(struct scsi_device *SDp)
}
static int
-NCR_700_change_queue_depth(struct scsi_device *SDp, int depth)
+NCR_700_change_queue_depth(struct scsi_device *SDp, int depth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (depth > NCR_700_MAX_TAGS)
depth = NCR_700_MAX_TAGS;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 9b97c3e..e9373a2 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -472,8 +472,12 @@ static int aac_slave_configure(struct scsi_device *sdev)
* total capacity and the queue depth supported by the target device.
*/
-static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
+static int aac_change_queue_depth(struct scsi_device *sdev, int depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
(sdev_channel(sdev) == CONTAINER_CHANNEL)) {
struct scsi_device * dev;
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 80aac01..47d5d19 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -98,8 +98,11 @@ static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);
static const char *arcmsr_info(struct Scsi_Host *);
static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev,
- int queue_depth)
+ int queue_depth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
queue_depth = ARCMSR_MAX_CMD_PERLUN;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index c596ab5..19620e9 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -847,10 +847,13 @@ static int hptiop_reset(struct scsi_cmnd *scp)
}
static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev,
- int queue_depth)
+ int queue_depth, int reason)
{
struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (queue_depth > hba->max_requests)
queue_depth = hba->max_requests;
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index bb2c696..07e2e35 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -2478,12 +2478,17 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
* ibmvfc_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct
* @qdepth: depth to set
+ * @reason: calling context
*
* Return value:
* actual depth set
**/
-static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (qdepth > IBMVFC_MAX_CMDS_PER_LUN)
qdepth = IBMVFC_MAX_CMDS_PER_LUN;
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 9928704..15fa8c7 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1638,12 +1638,17 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev)
* ibmvscsi_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct
* @qdepth: depth to set
+ * @reason: calling context
*
* Return value:
* actual depth set
**/
-static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN)
qdepth = IBMVSCSI_MAX_CMDS_PER_LUN;
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 5f04550..d40d5c7 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3367,16 +3367,21 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) { return 0; };
* ipr_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct
* @qdepth: depth to set
+ * @reason: calling context
*
* Return value:
* actual depth set
**/
-static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason)
{
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
struct ipr_resource_entry *res;
unsigned long lock_flags = 0;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
res = (struct ipr_resource_entry *)sdev->hostdata;
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 59a4408..d748e03 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2062,8 +2062,10 @@ int fc_slave_alloc(struct scsi_device *sdev)
}
EXPORT_SYMBOL(fc_slave_alloc);
-int fc_change_queue_depth(struct scsi_device *sdev, int qdepth)
+int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
return sdev->queue_depth;
}
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 8dc73c4..e3879e6 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1643,8 +1643,10 @@ fault:
}
EXPORT_SYMBOL_GPL(iscsi_queuecommand);
-int iscsi_change_queue_depth(struct scsi_device *sdev, int depth)
+int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
return sdev->queue_depth;
}
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 1c558d3..14b1319 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -820,10 +820,14 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)
ata_port_disable(dev->sata_dev.ap);
}
-int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth)
+int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth,
+ int reason)
{
int res = min(new_depth, SAS_MAX_QD);
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (scsi_dev->tagged_supported)
scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev),
res);
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 234f0b7..fd181c2 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -335,12 +335,17 @@ static struct device_attribute *megaraid_sdev_attrs[] = {
* megaraid_change_queue_depth - Change the device's queue depth
* @sdev: scsi device struct
* @qdepth: depth to set
+ * @reason: calling context
*
* Return value:
* actual depth set
*/
-static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth)
+static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (qdepth > MBOX_MAX_SCSI_CMDS)
qdepth = MBOX_MAX_SCSI_CMDS;
scsi_adjust_queue_depth(sdev, 0, qdepth);
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 774b345..c6f4cee 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1084,16 +1084,20 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
* _scsih_change_queue_depth - setting device queue depth
* @sdev: scsi device struct
* @qdepth: requested queue depth
+ * @reason: calling context
*
* Returns queue depth.
*/
static int
-_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
+_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
struct Scsi_Host *shost = sdev->host;
int max_depth;
int tag_type;
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
max_depth = shost->can_queue;
if (!sdev->tagged_supported)
max_depth = 1;
@@ -1529,7 +1533,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
r_level, raid_device->handle,
(unsigned long long)raid_device->wwid,
raid_device->num_pds, ds);
- _scsih_change_queue_depth(sdev, qdepth);
+ _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT);
return 0;
}
@@ -1575,7 +1579,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
_scsih_display_sata_capabilities(ioc, sas_device, sdev);
}
- _scsih_change_queue_depth(sdev, qdepth);
+ _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT);
if (ssp_target)
sas_read_port_mode_page(sdev);
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 4302f06..2ae3fce 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -277,12 +277,17 @@ static void pmcraid_slave_destroy(struct scsi_device *scsi_dev)
* pmcraid_change_queue_depth - Change the device's queue depth
* @scsi_dev: scsi device struct
* @depth: depth to set
+ * @reason: calling context
*
* Return value
* actual depth set
*/
-static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth)
+static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth,
+ int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
+
if (depth > PMCRAID_MAX_CMD_PER_LUN)
depth = PMCRAID_MAX_CMD_PER_LUN;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 64ff147..16801ed 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -138,7 +138,7 @@ static int qla2xxx_eh_target_reset(struct scsi_cmnd *);
static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
-static int qla2x00_change_queue_depth(struct scsi_device *, int);
+static int qla2x00_change_queue_depth(struct scsi_device *, int, int);
static int qla2x00_change_queue_type(struct scsi_device *, int);
struct scsi_host_template qla2xxx_driver_template = {
@@ -1235,8 +1235,10 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
}
static int
-qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth)
+qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
+ if (reason != SCSI_QDEPTH_DEFAULT)
+ return -EOPNOTSUPP;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
return sdev->queue_depth;
}
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e5b6e33..a4744c8 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1010,7 +1010,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
extern int ata_scsi_slave_config(struct scsi_device *sdev);
extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
- int queue_depth);
+ int queue_depth, int reason);
extern struct ata_device *ata_dev_pair(struct ata_device *adev);
extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 65dc9aa..9874ea7 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -919,7 +919,7 @@ int fc_slave_alloc(struct scsi_device *sdev);
/*
* Adjust the queue depth.
*/
-int fc_change_queue_depth(struct scsi_device *sdev, int qdepth);
+int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason);
/*
* Change the tag type.
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 887e57e..d4142de 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -332,7 +332,8 @@ struct iscsi_host {
/*
* scsi host template
*/
-extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth);
+extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth,
+ int reason);
extern int iscsi_eh_abort(struct scsi_cmnd *sc);
extern int iscsi_eh_target_reset(struct scsi_cmnd *sc);
extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index e78d3b6..9eaa3f0 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -634,7 +634,8 @@ extern int sas_target_alloc(struct scsi_target *);
extern int sas_slave_alloc(struct scsi_device *);
extern int sas_slave_configure(struct scsi_device *);
extern void sas_slave_destroy(struct scsi_device *);
-extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
+extern int sas_change_queue_depth(struct scsi_device *, int new_depth,
+ int reason);
extern int sas_change_queue_type(struct scsi_device *, int qt);
extern int sas_bios_param(struct scsi_device *,
struct block_device *,
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
2009-09-04 21:43 ` Vasu Dev
@ 2009-09-11 16:18 ` Mike Christie
2009-09-11 23:25 ` Vasu Dev
2009-09-11 16:54 ` Mike Christie
1 sibling, 1 reply; 29+ messages in thread
From: Mike Christie @ 2009-09-11 16:18 UTC (permalink / raw)
To: Vasu Dev
Cc: Alex.Iannicelli, andrew.vasquez, James.Bottomley, vasu.dev,
linux-scsi, James.Smart, robert.w.love, christof.schmitt
On 09/04/2009 04:43 PM, Vasu Dev wrote:
> On Fri, 2009-09-04 at 06:47 -0700, Alex.Iannicelli@Emulex.Com wrote:
>> It looks like you moved the ramp up functionality into the scsi layer,
>> but did not move the ramp up code from the lpfc driver in the
>
> Correct.
>
>> lpfc_scsi_cmd_iocb_cmpl routine (just above the code that was removed
>> for the ramp down in this patch) to the new lpfc_change_queue_depth
>> routine. I think that this new routine should handle both ramp up and
>> ramp down but you have it only handling the ramp down case.
>>
>
> I agree all FC HBA should handle both ramp down and up as per added new
> change_queue_depth interface by this series. I did this for libfc/fcoe
> and Chrirstof did this for zfcp driver but lpfc& qla2xxx got only ramp
> down changes from Mike, now that Mike is busy with other stuff I don't
> know how to complete them in this series since I don't understand lpfc
> and qla2xxx enough and neither I have way to test changes to these
> drivers.
>
> So I'm going to update this series to have just libfc and zfcp driver
> changes for now and lpfc and qla2xxx can be updated later by someone
> familiar lpfc and qla2xxx, their ramp down changes can be collect from
> this series post.
>
I think it is fine not to convert a driver immediately and let the
driver maintainer handle it. I normally like to take a stab at it to try
and give the driver maintainer some more info on the how I think it
should work.
I think at the very least you want to make sure your code will work for
other drivers, so sometimes doing a pseudo patch is useful for another
reason.
For the case of lpfc and rampup I think we need a little more code. It
looks like lpfc will ramp down queues if it gets a reject on its port
(when we get a IOSTAT_LOCAL_REJECT we call lpfc_rampdown_queue_depth).
When it then tries to ramp up, it also takes that rampdown event into
account. The common code being added by Vasu, only tracks rampdown
events from QUEUE_FULLs.
You probably want to make a common fc class function which loops over
vports and will ramp down queues. The fc LLD can then call this and that
common fc function can make sure the common rampdown tracking is done so
later on the ramp up code can take that into account.
Reviewing lpfc also brings up the question of why it was not doing the
ramp up in the main IO path. It looks like it is done in a worker
thread. The ramp down for a QUEUE_FULL is probably done in the main IO
path because we are already getting errors and we want to prevent new
ones. But for the ramp up, did Emulex experience performance hits when
ramping up in the main IO path?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 07/10] scsi: add common queue_depth ramp up code
2009-09-03 22:23 ` [PATCH 07/10] scsi: add common queue_depth ramp up code Vasu Dev
@ 2009-09-11 16:31 ` Mike Christie
2009-09-11 23:45 ` Vasu Dev
0 siblings, 1 reply; 29+ messages in thread
From: Mike Christie @ 2009-09-11 16:31 UTC (permalink / raw)
To: Vasu Dev
Cc: James Bottomley, linux-scsi, Andrew Vasquez, James Smart,
Robert Love, Christof Schmitt
On 09/03/2009 05:23 PM, Vasu Dev wrote:
> Adds scsi_handle_queue_ramp_up to ramp up queue_depth on
> successful completion of IO. The scsi_handle_queue_ramp_up
> will do ramp up on all luns of a target, just same as
> ramp down done on all luns on a target.
>
> However ramp up is skipped if lapsed time since either
> last queue ramp up or down is less than LLD specified
> queue_ramp_up_period.
>
> The ramp up is also skipped in case the change_queue_depth
> is not supported by LLD.
>
> Signed-off-by: Vasu Dev<vasu.dev@intel.com>
> ---
>
> drivers/scsi/scsi_error.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 files changed, 36 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 7d1b862..c820ee7 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -331,6 +331,40 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
> }
> }
>
> +static void scsi_handle_queue_ramp_up(struct scsi_device *sdev)
> +{
> + struct scsi_host_template *sht = sdev->host->hostt;
> + struct scsi_device *tmp_sdev;
> +
> + if (!sht->change_queue_depth)
> + return;
> +
> + if (time_before(jiffies,
> + sdev->last_queue_ramp_up + sdev->queue_ramp_up_period))
> + return;
> +
> + if (time_before(jiffies,
> + sdev->last_queue_full_time + sdev->queue_ramp_up_period))
> + return;
> +
> + /*
> + * Walk all devices of a target and do
> + * ramp up on them.
> + */
> + shost_for_each_device(tmp_sdev, sdev->host) {
> + if ((tmp_sdev->channel != sdev->channel) ||
> + (tmp_sdev->id != sdev->id))
> + continue;
I just noticed that while on the ramp down we just check the id, but why
on the ramp up do we check the channel and id?
Do we just want to adjust the devices on one specific target? If so is
starget_for_each_device() better to use?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
2009-09-04 21:43 ` Vasu Dev
2009-09-11 16:18 ` Mike Christie
@ 2009-09-11 16:54 ` Mike Christie
2009-09-11 20:00 ` Giridhar Malavali
1 sibling, 1 reply; 29+ messages in thread
From: Mike Christie @ 2009-09-11 16:54 UTC (permalink / raw)
To: Vasu Dev
Cc: Alex.Iannicelli, andrew.vasquez, James.Bottomley, vasu.dev,
linux-scsi, James.Smart, robert.w.love, christof.schmitt
[-- Attachment #1: Type: text/plain, Size: 850 bytes --]
On 09/04/2009 04:43 PM, Vasu Dev wrote:
> I agree all FC HBA should handle both ramp down and up as per added new
> change_queue_depth interface by this series. I did this for libfc/fcoe
> and Chrirstof did this for zfcp driver but lpfc& qla2xxx got only ramp
> down changes from Mike, now that Mike is busy with other stuff I don't
> know how to complete them in this series since I don't understand lpfc
> and qla2xxx enough and neither I have way to test changes to these
> drivers.
The qla2xxxx conversion seems a lot easier than lpfc (at least a lot
closer to what is being done in the common code Vasu added). I am
attaching a patch made over this patchset that converts it to use the
common ramp up code. I have only compile tested it.
Andrew, could you have your guys give it a spin? Did you guys test out
the rampdown/qfull handling?
[-- Attachment #2: 0001-qla2xxx-hook-qla2xxx-into-common-ramp-up-code.patch --]
[-- Type: text/plain, Size: 6473 bytes --]
From d8a94c82ce28837ce8a05349fc073b895813601d Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Fri, 11 Sep 2009 11:43:40 -0500
Subject: [PATCH 1/1] qla2xxx: hook qla2xxx into common ramp up code
This hooks qla2xxx into the common ramp up code.
This q depth behavior should be the same as before. The only
change should be that you use the common scsi device sysfs
interface to set the ramp up period instead of using the
qla2xxx mod param.
This patch was made over the rampdown/qfull handling patch.
It is only compile tested.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
drivers/scsi/qla2xxx/qla_def.h | 3 --
drivers/scsi/qla2xxx/qla_gbl.h | 2 -
drivers/scsi/qla2xxx/qla_isr.c | 59 ----------------------------------------
drivers/scsi/qla2xxx/qla_os.c | 39 +++++++++++++++++++-------
4 files changed, 29 insertions(+), 74 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index d8ce310..8ead66e 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1570,9 +1570,6 @@ typedef struct fc_port {
struct fc_rport *rport, *drport;
u32 supported_classes;
- unsigned long last_queue_full;
- unsigned long last_ramp_up;
-
uint16_t vp_idx;
} fc_port_t;
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 14e0562..0ca5c54 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -72,8 +72,6 @@ extern int ql2xloginretrycount;
extern int ql2xfdmienable;
extern int ql2xallocfwdump;
extern int ql2xextended_error_logging;
-extern int ql2xqfullrampup;
-extern int ql2xqfulltracking;
extern int ql2xiidmaenable;
extern int ql2xmaxqueues;
extern int ql2xmultique_tag;
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 8eceac8..d64bace 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -805,64 +805,6 @@ skip_rio:
qla2x00_alert_all_vps(rsp, mb);
}
-static void
-qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, void *data)
-{
- fc_port_t *fcport = data;
- struct scsi_qla_host *vha = fcport->vha;
- struct qla_hw_data *ha = vha->hw;
- struct req_que *req = NULL;
-
- if (!ql2xqfulltracking)
- return;
-
- req = vha->req;
- if (!req)
- return;
- if (req->max_q_depth <= sdev->queue_depth)
- return;
-
- if (sdev->ordered_tags)
- scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG,
- sdev->queue_depth + 1);
- else
- scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG,
- sdev->queue_depth + 1);
-
- fcport->last_ramp_up = jiffies;
-
- DEBUG2(qla_printk(KERN_INFO, ha,
- "scsi(%ld:%d:%d:%d): Queue depth adjusted-up to %d.\n",
- fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
- sdev->queue_depth));
-}
-
-static inline void
-qla2x00_ramp_up_queue_depth(scsi_qla_host_t *vha, struct req_que *req,
- srb_t *sp)
-{
- fc_port_t *fcport;
- struct scsi_device *sdev;
-
- if (!ql2xqfulltracking)
- return;
-
- sdev = sp->cmd->device;
- if (sdev->queue_depth >= req->max_q_depth)
- return;
-
- fcport = sp->fcport;
- if (time_before(jiffies,
- fcport->last_ramp_up + ql2xqfullrampup * HZ))
- return;
- if (time_before(jiffies,
- fcport->last_queue_full + ql2xqfullrampup * HZ))
- return;
-
- starget_for_each_device(sdev->sdev_target, fcport,
- qla2x00_adjust_sdev_qdepth_up);
-}
-
/**
* qla2x00_process_completed_request() - Process a Fast Post response.
* @ha: SCSI driver HA context
@@ -894,7 +836,6 @@ qla2x00_process_completed_request(struct scsi_qla_host *vha,
/* Save ISP completion status */
sp->cmd->result = DID_OK << 16;
- qla2x00_ramp_up_queue_depth(vha, req, sp);
qla2x00_sp_compl(ha, sp);
} else {
DEBUG2(printk("scsi(%ld) Req:%d: Invalid ISP SCSI completion"
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index b24c7cc..72c2821 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -78,7 +78,7 @@ module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(ql2xmaxqdepth,
"Maximum queue depth to report for target devices.");
-int ql2xqfulltracking = 1;
+static int ql2xqfulltracking = 1;
module_param(ql2xqfulltracking, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(ql2xqfulltracking,
"Controls whether the driver tracks queue full status "
@@ -86,13 +86,6 @@ MODULE_PARM_DESC(ql2xqfulltracking,
"depth. Default is 1, perform tracking. Set to 0 to "
"disable dynamic tracking and adjustment of queue depth.");
-int ql2xqfullrampup = 120;
-module_param(ql2xqfullrampup, int, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(ql2xqfullrampup,
- "Number of seconds to wait to begin to ramp-up the queue "
- "depth for a device after a queue-full condition has been "
- "detected. Default is 120 seconds.");
-
int ql2xiidmaenable=1;
module_param(ql2xiidmaenable, int, S_IRUGO|S_IRUSR);
MODULE_PARM_DESC(ql2xiidmaenable,
@@ -1238,8 +1231,6 @@ static void qla2x00_handle_queue_full(struct scsi_device *sdev, int qdepth)
{
fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
- fcport->last_queue_full = jiffies;
-
if (!scsi_track_queue_full(sdev, qdepth))
return;
@@ -1249,6 +1240,30 @@ static void qla2x00_handle_queue_full(struct scsi_device *sdev, int qdepth)
sdev->queue_depth));
}
+static void qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, int qdepth)
+{
+ fc_port_t *fcport = sdev->hostdata;
+ struct scsi_qla_host *vha = fcport->vha;
+ struct qla_hw_data *ha = vha->hw;
+ struct req_que *req = NULL;
+
+ req = vha->req;
+ if (!req)
+ return;
+ if (req->max_q_depth <= sdev->queue_depth || req->max_q_depth < qdepth)
+ return;
+
+ if (sdev->ordered_tags)
+ scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, qdepth);
+ else
+ scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, qdepth);
+
+ DEBUG2(qla_printk(KERN_INFO, ha,
+ "scsi(%ld:%d:%d:%d): Queue depth adjusted-up to %d.\n",
+ fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
+ sdev->queue_depth));
+}
+
static int
qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
{
@@ -1260,6 +1275,10 @@ qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
if (!ql2xqfulltracking)
qla2x00_handle_queue_full(sdev, qdepth);
break;
+ case SCSI_QDEPTH_RAMP_UP:
+ if (!ql2xqfulltracking)
+ qla2x00_adjust_sdev_qdepth_up(sdev, qdepth);
+ break;
default:
return EOPNOTSUPP;
}
--
1.6.2.2
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
2009-09-11 16:54 ` Mike Christie
@ 2009-09-11 20:00 ` Giridhar Malavali
0 siblings, 0 replies; 29+ messages in thread
From: Giridhar Malavali @ 2009-09-11 20:00 UTC (permalink / raw)
To: Mike Christie
Cc: Vasu Dev, Alex.Iannicelli@Emulex.Com, Andrew Vasquez,
James.Bottomley@HansenPartnership.com, vasu.dev@intel.com,
linux-scsi@vger.kernel.org, James.Smart@Emulex.Com,
robert.w.love@intel.com, christof.schmitt@de.ibm.com
Mike,
I am looking at the changes. Will get back to you.
-- Giridhar.M.B
On Sep 11, 2009, at 9:54 AM, Mike Christie wrote:
> On 09/04/2009 04:43 PM, Vasu Dev wrote:
>> I agree all FC HBA should handle both ramp down and up as per added
>> new
>> change_queue_depth interface by this series. I did this for libfc/
>> fcoe
>> and Chrirstof did this for zfcp driver but lpfc& qla2xxx got only
>> ramp
>> down changes from Mike, now that Mike is busy with other stuff I
>> don't
>> know how to complete them in this series since I don't understand
>> lpfc
>> and qla2xxx enough and neither I have way to test changes to these
>> drivers.
>
> The qla2xxxx conversion seems a lot easier than lpfc (at least a lot
> closer to what is being done in the common code Vasu added). I am
> attaching a patch made over this patchset that converts it to use the
> common ramp up code. I have only compile tested it.
>
> Andrew, could you have your guys give it a spin? Did you guys test out
> the rampdown/qfull handling?
> <0001-qla2xxx-hook-qla2xxx-into-common-ramp-up-code.patch>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
2009-09-11 16:18 ` Mike Christie
@ 2009-09-11 23:25 ` Vasu Dev
2009-09-14 17:09 ` Mike Christie
0 siblings, 1 reply; 29+ messages in thread
From: Vasu Dev @ 2009-09-11 23:25 UTC (permalink / raw)
To: Mike Christie
Cc: Alex.Iannicelli, andrew.vasquez, James.Bottomley, vasu.dev,
linux-scsi, James.Smart, robert.w.love, christof.schmitt
On Fri, 2009-09-11 at 11:18 -0500, Mike Christie wrote:
> On 09/04/2009 04:43 PM, Vasu Dev wrote:
> > On Fri, 2009-09-04 at 06:47 -0700, Alex.Iannicelli@Emulex.Com wrote:
> >> It looks like you moved the ramp up functionality into the scsi layer,
> >> but did not move the ramp up code from the lpfc driver in the
> >
> > Correct.
> >
> >> lpfc_scsi_cmd_iocb_cmpl routine (just above the code that was removed
> >> for the ramp down in this patch) to the new lpfc_change_queue_depth
> >> routine. I think that this new routine should handle both ramp up and
> >> ramp down but you have it only handling the ramp down case.
> >>
> >
> > I agree all FC HBA should handle both ramp down and up as per added new
> > change_queue_depth interface by this series. I did this for libfc/fcoe
> > and Chrirstof did this for zfcp driver but lpfc& qla2xxx got only ramp
> > down changes from Mike, now that Mike is busy with other stuff I don't
> > know how to complete them in this series since I don't understand lpfc
> > and qla2xxx enough and neither I have way to test changes to these
> > drivers.
> >
> > So I'm going to update this series to have just libfc and zfcp driver
> > changes for now and lpfc and qla2xxx can be updated later by someone
> > familiar lpfc and qla2xxx, their ramp down changes can be collect from
> > this series post.
> >
>
> I think it is fine not to convert a driver immediately and let the
> driver maintainer handle it. I normally like to take a stab at it to try
> and give the driver maintainer some more info on the how I think it
> should work.
>
> I think at the very least you want to make sure your code will work for
> other drivers, so sometimes doing a pseudo patch is useful for another
> reason.
>
I'll try to come up with a compile tested code for lpfc and you already
did that for qla2xx ramp up today. As you said "it is fine not to
convert a driver immediately", so I'll provide this separately and will
try to do it earliest possible.
Modified change_queue_depth interface changes by this series should be
sufficient to later do lpfc and qla2xx changes.
> For the case of lpfc and rampup I think we need a little more code. It
> looks like lpfc will ramp down queues if it gets a reject on its port
> (when we get a IOSTAT_LOCAL_REJECT we call lpfc_rampdown_queue_depth).
> When it then tries to ramp up, it also takes that rampdown event into
> account. The common code being added by Vasu, only tracks rampdown
> events from QUEUE_FULLs.
>
The qla2xx ramps down only on QUEUE_FULL beside added zfcp and lpfc
doing same only on QUEUE_FULL condition, but still a HBAs could call
their own change_queue_depth function for other conditions to ramp down
e.g. lpfc for IOSTAT_LOCAL_REJECT.
The lpfc and qla2xxx both are calling ramp up code only after specified
time interval since last ramp down/up on a successful IO completion, so
does the added code does the same with tunable time interval. I chose
least 120HZ from qla2xxx as default.
So added common code for ramp down/up is sufficient for majority of FC
HBAs and lpfc specific additional criteria should be limited to only
lpfc HBA code.
> You probably want to make a common fc class function which loops over
> vports and will ramp down queues. The fc LLD can then call this and that
> common fc function can make sure the common rampdown tracking is done so
> later on the ramp up code can take that into account.
>
The qdepth should be adjusted for all luns of a target and doing so via
scsi-ml struct is more common to all scsi transport classes. I think we
need to limit qdepth adjustment to only all luns of a target/vport at a
time as currently qla2xxx does and same is done by added common ramp up
code.
> Reviewing lpfc also brings up the question of why it was not doing the
> ramp up in the main IO path. It looks like it is done in a worker
> thread. The ramp down for a QUEUE_FULL is probably done in the main IO
> path because we are already getting errors and we want to prevent new
> ones. But for the ramp up, did Emulex experience performance hits when
> ramping up in the main IO path?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 07/10] scsi: add common queue_depth ramp up code
2009-09-11 16:31 ` Mike Christie
@ 2009-09-11 23:45 ` Vasu Dev
0 siblings, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-11 23:45 UTC (permalink / raw)
To: Mike Christie
Cc: Vasu Dev, James Bottomley, linux-scsi, Andrew Vasquez,
James Smart, Robert Love, Christof Schmitt
On Fri, 2009-09-11 at 11:31 -0500, Mike Christie wrote:
> > + /*
> > + * Walk all devices of a target and do
> > + * ramp up on them.
> > + */
> > + shost_for_each_device(tmp_sdev, sdev->host) {
> > + if ((tmp_sdev->channel != sdev->channel) ||
> > + (tmp_sdev->id != sdev->id))
> > + continue;
>
> I just noticed that while on the ramp down we just check the id, but
> why
> on the ramp up do we check the channel and id?
>
Currently qla2xxx does ramp down on all luns of a target using
starget_for_each_device, so I added check for channel also just as
starget_for_each_device does. The ramp down should be doing same, I'll
add channel check to ramp down code also.
> Do we just want to adjust the devices on one specific target? If so is
> starget_for_each_device() better to use?
I considered that but call back parameters in starget_for_each_device
were not compatible with required parameters to change_queue_depth call
back, later starget_for_each_device should be fixed to use it here also
and that would be another API change.
Thanks
Vasu
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 02/10 v2] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
2009-09-03 22:22 ` [PATCH 02/10] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
@ 2009-09-13 0:52 ` Vasu Dev
0 siblings, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-09-13 0:52 UTC (permalink / raw)
To: linux-scsi
From: Mike Christie <michaelc@cs.wisc.edu>
This has scsi-ml call the change_queue_depth functions when
we get a QUEUE_FULL. It will only change the queue depth if
change_queue_depth is set because the LLD may have to
modify some internal resources, so I thought this would
be the safest route.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
-v2
Limits change_queue_depth to only all luns of target by adding
channel check while iterating for all luns of Scsi_Host. This is
same as currently qla2xxx FC HBA does on QUEUE_FULL event.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
drivers/scsi/scsi_error.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 877204d..3eac11b 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -331,6 +331,28 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
}
}
+static void scsi_handle_queue_full(struct scsi_device *sdev)
+{
+ struct scsi_host_template *sht = sdev->host->hostt;
+ struct scsi_device *tmp_sdev;
+
+ if (!sht->change_queue_depth)
+ return;
+
+ shost_for_each_device(tmp_sdev, sdev->host) {
+ if ((tmp_sdev->channel != sdev->channel) ||
+ (tmp_sdev->id != sdev->id))
+ continue;
+ /*
+ * We do not know the number of commands that were at
+ * the device when we got the queue full so we start
+ * from the highest possible value and work our way down.
+ */
+ sht->change_queue_depth(tmp_sdev, tmp_sdev->queue_depth - 1,
+ SCSI_QDEPTH_QFULL);
+ }
+}
+
/**
* scsi_eh_completed_normally - Disposition a eh cmd on return from LLD.
* @scmd: SCSI cmd to examine.
@@ -387,8 +409,10 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
* let issuer deal with this, it could be just fine
*/
return SUCCESS;
- case BUSY:
case QUEUE_FULL:
+ scsi_handle_queue_full(scmd->device);
+ /* fall through */
+ case BUSY:
default:
return FAILED;
}
@@ -1384,6 +1408,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
*/
switch (status_byte(scmd->result)) {
case QUEUE_FULL:
+ scsi_handle_queue_full(scmd->device);
/*
* the case of trying to send too many commands to a
* tagged queueing device.
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
2009-09-11 23:25 ` Vasu Dev
@ 2009-09-14 17:09 ` Mike Christie
[not found] ` <4AAE78DD.9070808-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
0 siblings, 1 reply; 29+ messages in thread
From: Mike Christie @ 2009-09-14 17:09 UTC (permalink / raw)
To: Vasu Dev
Cc: Alex.Iannicelli, andrew.vasquez, James.Bottomley, vasu.dev,
linux-scsi, James.Smart, robert.w.love, christof.schmitt
Vasu Dev wrote:
> On Fri, 2009-09-11 at 11:18 -0500, Mike Christie wrote:
>> On 09/04/2009 04:43 PM, Vasu Dev wrote:
>>> On Fri, 2009-09-04 at 06:47 -0700, Alex.Iannicelli@Emulex.Com wrote:
>>>> It looks like you moved the ramp up functionality into the scsi layer,
>>>> but did not move the ramp up code from the lpfc driver in the
>>> Correct.
>>>
>>>> lpfc_scsi_cmd_iocb_cmpl routine (just above the code that was removed
>>>> for the ramp down in this patch) to the new lpfc_change_queue_depth
>>>> routine. I think that this new routine should handle both ramp up and
>>>> ramp down but you have it only handling the ramp down case.
>>>>
>>> I agree all FC HBA should handle both ramp down and up as per added new
>>> change_queue_depth interface by this series. I did this for libfc/fcoe
>>> and Chrirstof did this for zfcp driver but lpfc& qla2xxx got only ramp
>>> down changes from Mike, now that Mike is busy with other stuff I don't
>>> know how to complete them in this series since I don't understand lpfc
>>> and qla2xxx enough and neither I have way to test changes to these
>>> drivers.
>>>
>>> So I'm going to update this series to have just libfc and zfcp driver
>>> changes for now and lpfc and qla2xxx can be updated later by someone
>>> familiar lpfc and qla2xxx, their ramp down changes can be collect from
>>> this series post.
>>>
>> I think it is fine not to convert a driver immediately and let the
>> driver maintainer handle it. I normally like to take a stab at it to try
>> and give the driver maintainer some more info on the how I think it
>> should work.
>>
>> I think at the very least you want to make sure your code will work for
>> other drivers, so sometimes doing a pseudo patch is useful for another
>> reason.
>>
>
> I'll try to come up with a compile tested code for lpfc and you already
> did that for qla2xx ramp up today. As you said "it is fine not to
> convert a driver immediately", so I'll provide this separately and will
> try to do it earliest possible.
>
> Modified change_queue_depth interface changes by this series should be
> sufficient to later do lpfc and qla2xx changes.
>
>> For the case of lpfc and rampup I think we need a little more code. It
>> looks like lpfc will ramp down queues if it gets a reject on its port
>> (when we get a IOSTAT_LOCAL_REJECT we call lpfc_rampdown_queue_depth).
>> When it then tries to ramp up, it also takes that rampdown event into
>> account. The common code being added by Vasu, only tracks rampdown
>> events from QUEUE_FULLs.
>>
>
> The qla2xx ramps down only on QUEUE_FULL beside added zfcp and lpfc
> doing same only on QUEUE_FULL condition, but still a HBAs could call
> their own change_queue_depth function for other conditions to ramp down
> e.g. lpfc for IOSTAT_LOCAL_REJECT.
If they do this will they have to duplicate the rampdown/up time
tracking done by the common scsi_error code?
>
> The lpfc and qla2xxx both are calling ramp up code only after specified
> time interval since last ramp down/up on a successful IO completion, so
> does the added code does the same with tunable time interval. I chose
> least 120HZ from qla2xxx as default.
>
> So added common code for ramp down/up is sufficient for majority of FC
> HBAs and lpfc specific additional criteria should be limited to only
> lpfc HBA code.
Why should it only be limited to lpfc? Are you saying other drivers or
hw do not have something like a local reject or out of hba port
resources? Do you know this by just looking at the driver? A lot of
times lpfc will add something then other drivers (myself included) will
add it later when they have seen lpfc do it. Or are you saying you think
other drivers are going to want to handle the problem in a different way?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
[not found] ` <4AAE78DD.9070808-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
@ 2009-09-14 22:56 ` Vasu Dev
[not found] ` <1252968994.2231.16.camel-B2RhF0yJhE275v1z/vFq2g@public.gmane.org>
0 siblings, 1 reply; 29+ messages in thread
From: Vasu Dev @ 2009-09-14 22:56 UTC (permalink / raw)
To: Mike Christie
Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA,
James.Smart-iH1Dq9VlAzfQT0dZR+AlfA,
James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
christof.schmitt-tA70FqPdS9bQT0dZR+AlfA,
andrew.vasquez-h88ZbnxC6KDQT0dZR+AlfA,
Alex.Iannicelli-iH1Dq9VlAzfQT0dZR+AlfA,
devel-s9riP+hp16TNLxjTenLetw
On Mon, 2009-09-14 at 12:09 -0500, Mike Christie wrote:
> Vasu Dev wrote:
> > On Fri, 2009-09-11 at 11:18 -0500, Mike Christie wrote:
> >> On 09/04/2009 04:43 PM, Vasu Dev wrote:
> >>> On Fri, 2009-09-04 at 06:47 -0700, Alex.Iannicelli-iH1Dq9VlAzfQT0dZR+AlfA@public.gmane.org wrote:
> >>>> It looks like you moved the ramp up functionality into the scsi layer,
> >>>> but did not move the ramp up code from the lpfc driver in the
> >>> Correct.
> >>>
> >>>> lpfc_scsi_cmd_iocb_cmpl routine (just above the code that was removed
> >>>> for the ramp down in this patch) to the new lpfc_change_queue_depth
> >>>> routine. I think that this new routine should handle both ramp up and
> >>>> ramp down but you have it only handling the ramp down case.
> >>>>
> >>> I agree all FC HBA should handle both ramp down and up as per added new
> >>> change_queue_depth interface by this series. I did this for libfc/fcoe
> >>> and Chrirstof did this for zfcp driver but lpfc& qla2xxx got only ramp
> >>> down changes from Mike, now that Mike is busy with other stuff I don't
> >>> know how to complete them in this series since I don't understand lpfc
> >>> and qla2xxx enough and neither I have way to test changes to these
> >>> drivers.
> >>>
> >>> So I'm going to update this series to have just libfc and zfcp driver
> >>> changes for now and lpfc and qla2xxx can be updated later by someone
> >>> familiar lpfc and qla2xxx, their ramp down changes can be collect from
> >>> this series post.
> >>>
> >> I think it is fine not to convert a driver immediately and let the
> >> driver maintainer handle it. I normally like to take a stab at it to try
> >> and give the driver maintainer some more info on the how I think it
> >> should work.
> >>
> >> I think at the very least you want to make sure your code will work for
> >> other drivers, so sometimes doing a pseudo patch is useful for another
> >> reason.
> >>
> >
> > I'll try to come up with a compile tested code for lpfc and you already
> > did that for qla2xx ramp up today. As you said "it is fine not to
> > convert a driver immediately", so I'll provide this separately and will
> > try to do it earliest possible.
> >
> > Modified change_queue_depth interface changes by this series should be
> > sufficient to later do lpfc and qla2xx changes.
> >
> >> For the case of lpfc and rampup I think we need a little more code. It
> >> looks like lpfc will ramp down queues if it gets a reject on its port
> >> (when we get a IOSTAT_LOCAL_REJECT we call lpfc_rampdown_queue_depth).
> >> When it then tries to ramp up, it also takes that rampdown event into
> >> account. The common code being added by Vasu, only tracks rampdown
> >> events from QUEUE_FULLs.
> >>
> >
> > The qla2xx ramps down only on QUEUE_FULL beside added zfcp and lpfc
> > doing same only on QUEUE_FULL condition, but still a HBAs could call
> > their own change_queue_depth function for other conditions to ramp down
> > e.g. lpfc for IOSTAT_LOCAL_REJECT.
>
> If they do this will they have to duplicate the rampdown/up time
> tracking done by the common scsi_error code?
>
lpfc could still use same added common ramp up and ramp down code for
lpfc specific IOSTAT_LOCAL_REJECT condition. This would just require
exporting added scsi_handle_queue_full() and then have lpc call this for
IOSTAT_LOCAL_REJECT condition. The lpfc change_queue_depth handler could
make additional checks for IOSTAT_LOCAL_REJECT condition before final
qdepth adjustment which would get called by added common code. So I
don't see any duplicate code in that case while also limiting
IOSTAT_LOCAL_REJECT code to only lpfc.
> >
> > The lpfc and qla2xxx both are calling ramp up code only after specified
> > time interval since last ramp down/up on a successful IO completion, so
> > does the added code does the same with tunable time interval. I chose
> > least 120HZ from qla2xxx as default.
> >
> > So added common code for ramp down/up is sufficient for majority of FC
> > HBAs and lpfc specific additional criteria should be limited to only
> > lpfc HBA code.
>
> Why should it only be limited to lpfc? Are you saying other drivers or
> hw do not have something like a local reject or out of hba port
> resources? Do you know this by just looking at the driver? A lot of
> times lpfc will add something then other drivers (myself included) will
> add it later when they have seen lpfc do it. Or are you saying you think
> other drivers are going to want to handle the problem in a different way?
Yes, I think adjusting can_queue will be more helpful in case of
resource allocation failures instead queue_depth adjustment on all luns.
In case of rport is gone, no use of queue_depth ramp down on luns of
rport.
Regards
Vasu
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full
[not found] ` <1252968994.2231.16.camel-B2RhF0yJhE275v1z/vFq2g@public.gmane.org>
@ 2009-09-15 4:18 ` Mike Christie
0 siblings, 0 replies; 29+ messages in thread
From: Mike Christie @ 2009-09-15 4:18 UTC (permalink / raw)
To: Vasu Dev
Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA,
James.Smart-iH1Dq9VlAzfQT0dZR+AlfA,
James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk,
christof.schmitt-tA70FqPdS9bQT0dZR+AlfA,
andrew.vasquez-h88ZbnxC6KDQT0dZR+AlfA,
Alex.Iannicelli-iH1Dq9VlAzfQT0dZR+AlfA,
devel-s9riP+hp16TNLxjTenLetw
Vasu Dev wrote:
> On Mon, 2009-09-14 at 12:09 -0500, Mike Christie wrote:
>> Vasu Dev wrote:
>>> On Fri, 2009-09-11 at 11:18 -0500, Mike Christie wrote:
>>>> On 09/04/2009 04:43 PM, Vasu Dev wrote:
>>>>> On Fri, 2009-09-04 at 06:47 -0700, Alex.Iannicelli-iH1Dq9VlAzfQT0dZR+AlfA@public.gmane.org wrote:
>>>>>> It looks like you moved the ramp up functionality into the scsi layer,
>>>>>> but did not move the ramp up code from the lpfc driver in the
>>>>> Correct.
>>>>>
>>>>>> lpfc_scsi_cmd_iocb_cmpl routine (just above the code that was removed
>>>>>> for the ramp down in this patch) to the new lpfc_change_queue_depth
>>>>>> routine. I think that this new routine should handle both ramp up and
>>>>>> ramp down but you have it only handling the ramp down case.
>>>>>>
>>>>> I agree all FC HBA should handle both ramp down and up as per added new
>>>>> change_queue_depth interface by this series. I did this for libfc/fcoe
>>>>> and Chrirstof did this for zfcp driver but lpfc& qla2xxx got only ramp
>>>>> down changes from Mike, now that Mike is busy with other stuff I don't
>>>>> know how to complete them in this series since I don't understand lpfc
>>>>> and qla2xxx enough and neither I have way to test changes to these
>>>>> drivers.
>>>>>
>>>>> So I'm going to update this series to have just libfc and zfcp driver
>>>>> changes for now and lpfc and qla2xxx can be updated later by someone
>>>>> familiar lpfc and qla2xxx, their ramp down changes can be collect from
>>>>> this series post.
>>>>>
>>>> I think it is fine not to convert a driver immediately and let the
>>>> driver maintainer handle it. I normally like to take a stab at it to try
>>>> and give the driver maintainer some more info on the how I think it
>>>> should work.
>>>>
>>>> I think at the very least you want to make sure your code will work for
>>>> other drivers, so sometimes doing a pseudo patch is useful for another
>>>> reason.
>>>>
>>> I'll try to come up with a compile tested code for lpfc and you already
>>> did that for qla2xx ramp up today. As you said "it is fine not to
>>> convert a driver immediately", so I'll provide this separately and will
>>> try to do it earliest possible.
>>>
>>> Modified change_queue_depth interface changes by this series should be
>>> sufficient to later do lpfc and qla2xx changes.
>>>
>>>> For the case of lpfc and rampup I think we need a little more code. It
>>>> looks like lpfc will ramp down queues if it gets a reject on its port
>>>> (when we get a IOSTAT_LOCAL_REJECT we call lpfc_rampdown_queue_depth).
>>>> When it then tries to ramp up, it also takes that rampdown event into
>>>> account. The common code being added by Vasu, only tracks rampdown
>>>> events from QUEUE_FULLs.
>>>>
>>> The qla2xx ramps down only on QUEUE_FULL beside added zfcp and lpfc
>>> doing same only on QUEUE_FULL condition, but still a HBAs could call
>>> their own change_queue_depth function for other conditions to ramp down
>>> e.g. lpfc for IOSTAT_LOCAL_REJECT.
>> If they do this will they have to duplicate the rampdown/up time
>> tracking done by the common scsi_error code?
>>
>
> lpfc could still use same added common ramp up and ramp down code for
> lpfc specific IOSTAT_LOCAL_REJECT condition. This would just require
> exporting added scsi_handle_queue_full() and then have lpc call this for
> IOSTAT_LOCAL_REJECT condition. The lpfc change_queue_depth handler could
> make additional checks for IOSTAT_LOCAL_REJECT condition before final
> qdepth adjustment which would get called by added common code. So I
> don't see any duplicate code in that case while also limiting
> IOSTAT_LOCAL_REJECT code to only lpfc.
Works for me.
>
>>> The lpfc and qla2xxx both are calling ramp up code only after specified
>>> time interval since last ramp down/up on a successful IO completion, so
>>> does the added code does the same with tunable time interval. I chose
>>> least 120HZ from qla2xxx as default.
>>>
>>> So added common code for ramp down/up is sufficient for majority of FC
>>> HBAs and lpfc specific additional criteria should be limited to only
>>> lpfc HBA code.
>> Why should it only be limited to lpfc? Are you saying other drivers or
>> hw do not have something like a local reject or out of hba port
>> resources? Do you know this by just looking at the driver? A lot of
>> times lpfc will add something then other drivers (myself included) will
>> add it later when they have seen lpfc do it. Or are you saying you think
>> other drivers are going to want to handle the problem in a different way?
>
> Yes, I think adjusting can_queue will be more helpful in case of
> resource allocation failures instead queue_depth adjustment on all luns.
> In case of rport is gone, no use of queue_depth ramp down on luns of
> rport.
Works for me.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 00/10] handles queue_depth adjustments in scsi_error.c
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
` (9 preceding siblings ...)
2009-09-03 22:23 ` [PATCH 10/10] zfcp: Adapt change_queue_depth for queue full tracking Vasu Dev
@ 2009-10-13 21:59 ` James Bottomley
2009-10-15 23:09 ` Vasu Dev
10 siblings, 1 reply; 29+ messages in thread
From: James Bottomley @ 2009-10-13 21:59 UTC (permalink / raw)
To: Vasu Dev
Cc: linux-scsi, Andrew Vasquez, James Smart, Mike Christie,
Robert Love, Christof Schmitt
On Thu, 2009-09-03 at 15:22 -0700, Vasu Dev wrote:
> This patch series moves the QUEUE_FULL and then the ramp
> up code from drivers like qla2xxx and lpfc to scsi-ml.
> The change_queue_depth callback is used to allow the
> drivers to adjust the queue depth, so LLDs do not have
> to worry about parsing the sense, see some additional
> info on these changes in first RFC cover at:-
>
> http://www.spinics.net/lists/linux-scsi/msg35959.html
>
> I've tested this series with libfc/fcoe for queue_depth
> ramp down and up.
>
> This series is based on scsi-misc -rc7 and also cleanly
> applies & works on top recently submitted 64 fcoe patches
> series by Rob "[PATCH 00/64] libfc, libfcoe and fcoe
> updates for scsi-misc"
>
> I'm posting this series with Mike and Christof patches
> per this mail thread discussion
> http://marc.info/?l=linux-scsi&m=125196587107768&w=2
>
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
OK, so this patch series isn't bisectable. If I just apply 1 it won't
compile.
To get to bisectability it looks like patches 1,3,4 need combining. It
also looks like 5,6,7 are all really the same change, so could be
combined.
Could you repost with at least the bisectability fixed?
Thanks,
James
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 00/10] handles queue_depth adjustments in scsi_error.c
2009-10-13 21:59 ` [PATCH 00/10] handles queue_depth adjustments in scsi_error.c James Bottomley
@ 2009-10-15 23:09 ` Vasu Dev
0 siblings, 0 replies; 29+ messages in thread
From: Vasu Dev @ 2009-10-15 23:09 UTC (permalink / raw)
To: James Bottomley
Cc: Vasu Dev, linux-scsi, Andrew Vasquez, James Smart, Mike Christie,
Robert Love, Christof Schmitt
On Tue, 2009-10-13 at 16:59 -0500, James Bottomley wrote:
> OK, so this patch series isn't bisectable. If I just apply 1 it
> won't
> compile.
>
> To get to bisectability it looks like patches 1,3,4 need combining. It
Only 4 needs to be combined with 1 due to change_queue_depth() func
params change in 1 and all impacted drivers by this change are modified
later in patch 4 breaking patch 1. The patch 3 depended on 2, so 3
cannot be merged w/o 2, so I'll leave them as-is.
> also looks like 5,6,7 are all really the same change, so could be
> combined.
>
Yes can be since all for added common ramp up code. I kept existing code
changes separate in 5 and 6 to help in review. I'm combining them as
well.
Also adding one more related change as max_queue_depth field per sdev to
track max qdepth per sdev, so that ramp up won't exceed max_queue_depth
which could be modified via sysfs to limit qdepth on a sdev.
> Could you repost with at least the bisectability fixed?
>
I'm posting revised series with each bisectable patch on scsi-misc
current top commit:-
commit bfa27150c1ba70e2cb2d3b738025ec4803f4101e
Author: Jing Huang <huangj@brocade.com>
Date: Fri Sep 25 12:29:54 2009 -0700
[SCSI] bfa: fixed checkpatch errors for bfad files
Thanks
Vasu
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2009-10-15 23:10 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-03 22:22 [PATCH 00/10] handles queue_depth adjustments in scsi_error.c Vasu Dev
2009-09-03 22:22 ` [PATCH 01/10] scsi-ml: modify change_queue_depth to take in reason why it is being called Vasu Dev
2009-09-03 22:22 ` [PATCH 02/10] scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL Vasu Dev
2009-09-13 0:52 ` [PATCH 02/10 v2] " Vasu Dev
2009-09-03 22:22 ` [PATCH 03/10] drivers: convert drivers setting the change_queue_depth callback Vasu Dev
2009-09-10 22:22 ` [PATCH 03/10 v2] " Vasu Dev
2009-09-03 22:22 ` [PATCH 04/10] drivers: convert fc drivers calling scsi_track_queue_full Vasu Dev
2009-09-04 13:47 ` Alex.Iannicelli
2009-09-04 21:43 ` Vasu Dev
2009-09-11 16:18 ` Mike Christie
2009-09-11 23:25 ` Vasu Dev
2009-09-14 17:09 ` Mike Christie
[not found] ` <4AAE78DD.9070808-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2009-09-14 22:56 ` Vasu Dev
[not found] ` <1252968994.2231.16.camel-B2RhF0yJhE275v1z/vFq2g@public.gmane.org>
2009-09-15 4:18 ` Mike Christie
2009-09-11 16:54 ` Mike Christie
2009-09-11 20:00 ` Giridhar Malavali
2009-09-07 20:44 ` [PATCH v2] drivers: convert libfc " Vasu Dev
2009-09-03 22:22 ` [PATCH 05/10] scsi: updates sdev to add queue_depth ramp up code Vasu Dev
2009-09-03 22:22 ` [PATCH 06/10] scsi: adds sdev->queue_ramp_up_period to sysfs Vasu Dev
2009-09-03 22:23 ` [PATCH 07/10] scsi: add common queue_depth ramp up code Vasu Dev
2009-09-11 16:31 ` Mike Christie
2009-09-11 23:45 ` Vasu Dev
2009-09-03 22:23 ` [PATCH 08/10] fcoe, libfc: fix an libfc issue with queue ramp down in libfc Vasu Dev
2009-09-10 22:15 ` Robert Love
2009-09-03 22:23 ` [PATCH 09/10] libfc: adds queue_depth ramp up to libfc Vasu Dev
2009-09-10 22:18 ` Robert Love
2009-09-03 22:23 ` [PATCH 10/10] zfcp: Adapt change_queue_depth for queue full tracking Vasu Dev
2009-10-13 21:59 ` [PATCH 00/10] handles queue_depth adjustments in scsi_error.c James Bottomley
2009-10-15 23:09 ` Vasu Dev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).