Commit 95e38aa0 authored by Doug Ledford's avatar Doug Ledford

[PATCH] qla1280 TCQ update

qla1280.h:
  Update device template
qla1280.c:
  Update to use slave_attach for setting queue depth
parent 7ec7888b
......@@ -70,17 +70,21 @@ static unsigned char target2alpa[] = {
static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd);
static void fcal_select_queue_depths(struct Scsi_Host *host, Scsi_Device *devlist)
int fcal_slave_attach(Scsi_Device *device)
{
Scsi_Device *device;
int depth_to_use;
for (device = devlist; device; device = device->next) {
if (device->host != host) continue;
if (device->tagged_supported)
device->queue_depth = /* 254 */ 8;
depth_to_use = /* 254 */ 8;
else
device->queue_depth = 2;
}
depth_to_use = 2;
scsi_adjust_queue_depth(device,
(device->tagged_supported ?
MSG_SIMPLE_TAG : 0),
depth_to_use);
return 0;
}
/* Detect all FC Arbitrated Loops attached to the machine.
......@@ -165,7 +169,6 @@ int __init fcal_detect(Scsi_Host_Template *tpnt)
#ifdef __sparc_v9__
host->unchecked_isa_dma = 1;
#endif
host->select_queue_depths = fcal_select_queue_depths;
fc->channels = 1;
fc->targets = 127;
......
......@@ -23,6 +23,7 @@ struct fcal {
int fcal_detect(Scsi_Host_Template *);
int fcal_release(struct Scsi_Host *);
int fcal_proc_info (char *, char **, off_t, int, int, int);
int fcal_slave_attach(Scsi_Device *);
#define FCAL { \
name: "Fibre Channel Arbitrated Loop",\
......@@ -30,6 +31,7 @@ int fcal_proc_info (char *, char **, off_t, int, int, int);
release: fcal_release, \
proc_info: fcal_proc_info, \
queuecommand: fcp_scsi_queuecommand, \
slave_attach: fcal_slave_attach, \
can_queue: FCAL_CAN_QUEUE, \
this_id: -1, \
sg_tablesize: 1, \
......
......@@ -378,8 +378,6 @@ static Scsi_Host_Template *the_template = NULL;
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f))
static void ncr53c8xx_select_queue_depths(
struct Scsi_Host *host, struct scsi_device *devlist);
static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
static void ncr53c8xx_timeout(unsigned long np);
......@@ -3710,7 +3708,6 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
instance->dma_channel = 0;
instance->cmd_per_lun = MAX_TAGS;
instance->can_queue = (MAX_START-4);
instance->select_queue_depths = ncr53c8xx_select_queue_depths;
scsi_set_pci_device(instance, device->pdev);
#ifdef SCSI_NCR_INTEGRITY_CHECKING
......@@ -8500,18 +8497,13 @@ static void __init ncr_getclock (ncb_p np, int mult)
** Linux select queue depths function
*/
static void ncr53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_device *devlist)
int ncr53c8xx_slave_attach(Scsi_Device *device)
{
struct scsi_device *device;
for (device = devlist; device; device = device->next) {
struct Scsi_Host *host = device->host;
ncb_p np;
tcb_p tp;
lcb_p lp;
int numtags;
if (device->host != host)
continue;
int numtags, depth_to_use;
np = ((struct host_data *) host->hostdata)->ncb;
tp = &np->target[device->id];
......@@ -8528,11 +8520,16 @@ static void ncr53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_de
numtags = tp->usrtags;
if (!device->tagged_supported)
numtags = 1;
device->queue_depth = numtags;
if (device->queue_depth < 2)
device->queue_depth = 2;
if (device->queue_depth > MAX_TAGS)
device->queue_depth = MAX_TAGS;
depth_to_use = numtags;
if (depth_to_use < 2)
depth_to_use = 2;
if (depth_to_use > MAX_TAGS)
depth_to_use = MAX_TAGS;
scsi_adjust_queue_depth(device,
(device->tagged_supported ?
MSG_SIMPLE_TAG : 0),
depth_to_use);
/*
** Since the queue depth is not tunable under Linux,
......@@ -8541,15 +8538,16 @@ static void ncr53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_de
*/
if (lp) {
lp->numtags = lp->maxtags = numtags;
lp->scdev_depth = device->queue_depth;
lp->scdev_depth = depth_to_use;
}
ncr_setup_tags (np, device->id, device->lun);
#ifdef DEBUG_NCR53C8XX
printk("ncr53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
np->unit, device->id, device->lun, device->queue_depth);
printk("ncr53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
np->unit, device->id, device->lun, depth_to_use);
#endif
}
return 0;
}
/*
......
......@@ -59,6 +59,7 @@ int ncr53c8xx_detect(Scsi_Host_Template *tpnt);
const char *ncr53c8xx_info(struct Scsi_Host *host);
int ncr53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int ncr53c8xx_reset(Scsi_Cmnd *, unsigned int);
int ncr53c8xx_slave_attach(Scsi_Device *);
#ifdef MODULE
int ncr53c8xx_release(struct Scsi_Host *);
......@@ -74,6 +75,7 @@ int ncr53c8xx_release(struct Scsi_Host *);
release: ncr53c8xx_release, \
info: ncr53c8xx_info, \
queuecommand: ncr53c8xx_queue_command,\
slave_attach: ncr53c8xx_slave_attach, \
abort: ncr53c8xx_abort, \
reset: ncr53c8xx_reset, \
bios_param: scsicam_bios_param, \
......
......@@ -71,17 +71,21 @@ static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt)
up(&fc_sem);
}
static void pluto_select_queue_depths(struct Scsi_Host *host, Scsi_Device *devlist)
int pluto_slave_attach(Scsi_Device *device)
{
Scsi_Device *device;
int depth_to_use;
for (device = devlist; device; device = device->next) {
if (device->host != host) continue;
if (device->tagged_supported)
device->queue_depth = /* 254 */ 8;
depth_to_use = /* 254 */ 8;
else
device->queue_depth = 2;
}
depth_to_use = 2;
scsi_adjust_queue_depth(device,
(device->tagged_supported ?
MSG_SIMPLE_TAG : 0),
depth_to_use);
return 0;
}
/* Detect all SSAs attached to the machine.
......@@ -241,7 +245,6 @@ int __init pluto_detect(Scsi_Host_Template *tpnt)
host->unchecked_isa_dma = 1;
#endif
host->select_queue_depths = pluto_select_queue_depths;
fc->channels = inq->channels + 1;
fc->targets = inq->targets;
......
......@@ -41,6 +41,7 @@ struct pluto_inquiry {
int pluto_detect(Scsi_Host_Template *);
int pluto_release(struct Scsi_Host *);
const char * pluto_info(struct Scsi_Host *);
int pluto_slave_attach(Scsi_Device *);
#define PLUTO { \
name: "Sparc Storage Array 100/200", \
......@@ -48,6 +49,7 @@ const char * pluto_info(struct Scsi_Host *);
release: pluto_release, \
info: pluto_info, \
queuecommand: fcp_scsi_queuecommand, \
slave_attach: pluto_slave_attach, \
can_queue: PLUTO_CAN_QUEUE, \
this_id: -1, \
sg_tablesize: 1, \
......
......@@ -382,8 +382,7 @@ static void qla1280_done(struct scsi_qla_host *, srb_t **, srb_t **);
static void qla1280_next(struct scsi_qla_host *, scsi_lu_t *, int);
static void qla1280_putq_t(scsi_lu_t *, srb_t *);
static void qla1280_done_q_put(srb_t *, srb_t **, srb_t **);
static void qla1280_device_queue_depth(struct scsi_qla_host *, Scsi_Device *);
static void qla1280_select_queue_depth(struct Scsi_Host *, Scsi_Device *);
static int qla1280_slave_attach(Scsi_Device *);
#if STOP_ON_ERROR
static void qla1280_panic(char *, struct Scsi_Host *host);
#endif
......@@ -840,7 +839,6 @@ qla1280_do_device_init(struct pci_dev *pdev,
host->can_queue = 0xfffff; /* unlimited */
host->cmd_per_lun = 1;
host->select_queue_depths = qla1280_select_queue_depth;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,18)
host->base = (unsigned char *)ha->mmpbase;
#else
......@@ -1796,7 +1794,7 @@ qla1280_do_dpc(void *p)
}
/**************************************************************************
* qla1280_device_queue_depth
* qla1280_slave_attach
*
* Description:
* Determines the queue depth for a given device. There are two ways
......@@ -1806,51 +1804,28 @@ qla1280_do_dpc(void *p)
* as the default queue depth. Otherwise, we use either 4 or 8 as the
* default queue depth (dependent on the number of hardware SCBs).
**************************************************************************/
static void
qla1280_device_queue_depth(struct scsi_qla_host *p, Scsi_Device * device)
static int
qla1280_slave_attach(Scsi_Device * device)
{
int default_depth = 3;
struct scsi_qla_host *p = (struct scsi_qla_host *)device->host->hostdata;
int bus = device->channel;
int target = device->id;
device->queue_depth = default_depth;
if (qla1280_check_for_dead_scsi_bus(p, bus))
return 1;
if (device->tagged_supported &&
(p->bus_settings[bus].qtag_enables & (BIT_0 << target))) {
device->tagged_queue = 1;
device->current_tag = 0;
device->queue_depth = p->bus_settings[bus].hiwat;
scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
p->bus_settings[bus].hiwat);
/* device->queue_depth = 20; */
printk(KERN_INFO "scsi(%li:%d:%d:%d): Enabled tagged queuing, "
"queue depth %d.\n", p->host_no, device->channel,
device->id, device->lun, device->queue_depth);
} else {
scsi_adjust_queue_depth(device, 0 /* TCQ off */, 3);
}
qla12160_get_target_parameters(p, bus, target, device->lun);
}
/**************************************************************************
* qla1280_select_queue_depth
*
* Sets the queue depth for each SCSI device hanging off the input
* host adapter. We use a queue depth of 2 for devices that do not
* support tagged queueing.
**************************************************************************/
static void
qla1280_select_queue_depth(struct Scsi_Host *host, Scsi_Device * scsi_devs)
{
Scsi_Device *device;
struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
ENTER("qla1280_select_queue_depth");
for (device = scsi_devs; device != NULL; device = device->next) {
if (device->host == host)
qla1280_device_queue_depth (ha, device);
}
if (scsi_devs)
qla1280_check_for_dead_scsi_bus(ha, scsi_devs->channel);
LEAVE("qla1280_select_queue_depth");
return 0;
}
/*
......
......@@ -1314,6 +1314,7 @@ int qla1280_queuecommand(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
int qla1280_abort(Scsi_Cmnd *);
int qla1280_reset(Scsi_Cmnd *, unsigned int);
int qla1280_biosparam(Disk *, struct block_device *, int[]);
static int qla1280_slave_attach(Scsi_Device *);
void qla1280_intr_handler(int, void *, struct pt_regs *);
void qla1280_setup(char *s, int *dummy);
......@@ -1342,7 +1343,7 @@ void qla1280_setup(char *s, int *dummy);
/* use_new_eh_code: 0, */ \
abort: qla1280_abort, \
reset: qla1280_reset, \
slave_attach: NULL, \
slave_attach: qla1280_slave_attach, \
bios_param: qla1280_biosparam, \
can_queue: 255, /* max simultaneous cmds */\
this_id: -1, /* scsi id of host adapter */\
......
......@@ -1341,8 +1341,6 @@ MODULE_PARM(sym53c8xx, "s");
#define SetScsiAbortResult(cmd) SetScsiResult(cmd, DID_ABORT, 0xff)
#endif
static void sym53c8xx_select_queue_depths(
struct Scsi_Host *host, struct scsi_device *devlist);
static void sym53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
static void sym53c8xx_timeout(unsigned long np);
......@@ -5923,8 +5921,6 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
#endif
#endif
instance->select_queue_depths = sym53c8xx_select_queue_depths;
NCR_UNLOCK_NCB(np, flags);
/*
......@@ -13545,18 +13541,13 @@ static int device_queue_depth(ncb_p np, int target, int lun)
return DEF_DEPTH;
}
static void sym53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_device *devlist)
int sym53c8xx_slave_attach(Scsi_Device *device)
{
struct scsi_device *device;
for (device = devlist; device; device = device->next) {
struct Scsi_Host *host = device->host;
ncb_p np;
tcb_p tp;
lcb_p lp;
int numtags;
if (device->host != host)
continue;
int numtags, depth_to_use;
np = ((struct host_data *) host->hostdata)->ncb;
tp = &np->target[device->id];
......@@ -13573,11 +13564,16 @@ static void sym53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_de
numtags = tp->usrtags;
if (!device->tagged_supported)
numtags = 1;
device->queue_depth = numtags;
if (device->queue_depth < 2)
device->queue_depth = 2;
if (device->queue_depth > MAX_TAGS)
device->queue_depth = MAX_TAGS;
depth_to_use = numtags;
if (depth_to_use < 2)
depth_to_use = 2;
if (depth_to_use > MAX_TAGS)
depth_to_use = MAX_TAGS;
scsi_adjust_queue_depth(device,
(device->tagged_supported ?
MSG_SIMPLE_TAG : 0),
depth_to_use);
/*
** Since the queue depth is not tunable under Linux,
......@@ -13586,15 +13582,16 @@ static void sym53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_de
*/
if (lp) {
lp->numtags = lp->maxtags = numtags;
lp->scdev_depth = device->queue_depth;
lp->scdev_depth = depth_to_use;
}
ncr_setup_tags (np, device->id, device->lun);
#ifdef DEBUG_SYM53C8XX
printk("sym53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
np->unit, device->id, device->lun, device->queue_depth);
printk("sym53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
np->unit, device->id, device->lun, depth_to_use);
#endif
}
return 0;
}
/*
......
......@@ -74,6 +74,7 @@ int sym53c8xx_detect(Scsi_Host_Template *tpnt);
const char *sym53c8xx_info(struct Scsi_Host *host);
int sym53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int sym53c8xx_reset(Scsi_Cmnd *, unsigned int);
int sym53c8xx_slave_attach(Scsi_Device *);
#ifdef MODULE
int sym53c8xx_release(struct Scsi_Host *);
......@@ -89,6 +90,7 @@ int sym53c8xx_release(struct Scsi_Host *);
release: sym53c8xx_release, \
info: sym53c8xx_info, \
queuecommand: sym53c8xx_queue_command,\
slave_attach: sym53c8xx_slave_attach, \
abort: sym53c8xx_abort, \
reset: sym53c8xx_reset, \
bios_param: scsicam_bios_param, \
......
......@@ -89,6 +89,8 @@ int sym53c8xx_eh_device_reset_handler(Scsi_Cmnd *);
int sym53c8xx_eh_bus_reset_handler(Scsi_Cmnd *);
int sym53c8xx_eh_host_reset_handler(Scsi_Cmnd *);
int sym53c8xx_slave_attach(Scsi_Device *);
#ifdef MODULE
int sym53c8xx_release(struct Scsi_Host *);
#else
......@@ -109,6 +111,7 @@ int sym53c8xx_release(struct Scsi_Host *);
release: sym53c8xx_release, \
info: sym53c8xx_info, \
queuecommand: sym53c8xx_queue_command, \
slave_attach: sym53c8xx_slave_attach, \
eh_abort_handler: sym53c8xx_eh_abort_handler, \
eh_device_reset_handler:sym53c8xx_eh_device_reset_handler, \
eh_bus_reset_handler: sym53c8xx_eh_bus_reset_handler, \
......
......@@ -1327,20 +1327,14 @@ static int device_queue_depth(hcb_p np, int target, int lun)
/*
* Linux entry point for device queue sizing.
*/
static void
sym53c8xx_select_queue_depths(struct Scsi_Host *host,
struct scsi_device *devlist)
int
sym53c8xx_slave_attach(Scsi_Device *device)
{
struct scsi_device *device;
for (device = devlist; device; device = device->next) {
struct Scsi_Host *host = device->host;
hcb_p np;
tcb_p tp;
lcb_p lp;
int reqtags;
if (device->host != host)
continue;
int reqtags, depth_to_use;
np = ((struct host_data *) host->hostdata)->ncb;
tp = &np->target[device->id];
......@@ -1356,10 +1350,8 @@ sym53c8xx_select_queue_depths(struct Scsi_Host *host,
* If it fail, we may well be in the sh*t. :)
*/
lp = sym_alloc_lcb(np, device->id, device->lun);
if (!lp) {
device->queue_depth = 1;
continue;
}
if (!lp)
return -ENOMEM;
/*
* Get user flags.
......@@ -1380,13 +1372,18 @@ sym53c8xx_select_queue_depths(struct Scsi_Host *host,
#if 1 /* Avoid to locally queue commands for no good reasons */
if (reqtags > SYM_CONF_MAX_TAG)
reqtags = SYM_CONF_MAX_TAG;
device->queue_depth = reqtags ? reqtags : 2;
depth_to_use = (reqtags ? reqtags : 2);
#else
device->queue_depth = reqtags ? SYM_CONF_MAX_TAG : 2;
depth_to_use = (reqtags ? SYM_CONF_MAX_TAG : 2);
#endif
lp->s.scdev_depth = device->queue_depth;
scsi_adjust_queue_depth(device,
(device->tagged_supported ?
MSG_SIMPLE_TAG : 0),
depth_to_use);
lp->s.scdev_depth = depth_to_use;
sym_tune_dev_queuing(np, device->id, device->lun, reqtags);
}
return 0;
}
/*
......@@ -2132,7 +2129,6 @@ sym_attach (Scsi_Host_Template *tpnt, int unit, sym_device *dev)
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
instance->max_cmd_len = 16;
#endif
instance->select_queue_depths = sym53c8xx_select_queue_depths;
instance->highmem_io = 1;
SYM_UNLOCK_HCB(np, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment