Skip to content

Commit 1304953

Browse files
Joseph HandzikJens Axboe
authored andcommitted
cciss: Adds simple mode functionality
Signed-off-by: Joseph Handzik <joseph.t.handzik@beardog.cce.hp.com> Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent 322a8b0 commit 1304953

3 files changed

Lines changed: 56 additions & 11 deletions

File tree

‎Documentation/blockdev/cciss.txt‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ The device naming scheme is:
7878
/dev/cciss/c1d1p2 Controller 1, disk 1, partition 2
7979
/dev/cciss/c1d1p3 Controller 1, disk 1, partition 3
8080

81+
CCISS simple mode support
82+
-------------------------
83+
84+
The "cciss_simple_mode=1" boot parameter may be used to prevent the driver
85+
from putting the controller into "performant" mode. The difference is that
86+
with simple mode, each command completion requires an interrupt, while with
87+
"performant mode" (the default, and ordinarily better performing) it is
88+
possible to have multiple command completions indicated by a single
89+
interrupt.
90+
8191
SCSI tape drive and medium changer support
8292
------------------------------------------
8393

‎drivers/block/cciss.c‎

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ static int cciss_tape_cmds = 6;
6868
module_param(cciss_tape_cmds, int, 0644);
6969
MODULE_PARM_DESC(cciss_tape_cmds,
7070
"number of commands to allocate for tape devices (default: 6)");
71+
static int cciss_simple_mode;
72+
module_param(cciss_simple_mode, int, S_IRUGO|S_IWUSR);
73+
MODULE_PARM_DESC(cciss_simple_mode,
74+
"Use 'simple mode' rather than 'performant mode'");
7175

7276
static DEFINE_MUTEX(cciss_mutex);
7377
static struct proc_dir_entry *proc_cciss;
@@ -176,6 +180,7 @@ static void cciss_geometry_inquiry(ctlr_info_t *h, int logvol,
176180
unsigned int block_size, InquiryData_struct *inq_buff,
177181
drive_info_struct *drv);
178182
static void __devinit cciss_interrupt_mode(ctlr_info_t *);
183+
static int __devinit cciss_enter_simple_mode(struct ctlr_info *h);
179184
static void start_io(ctlr_info_t *h);
180185
static int sendcmd_withirq(ctlr_info_t *h, __u8 cmd, void *buff, size_t size,
181186
__u8 page_code, unsigned char scsi3addr[],
@@ -388,7 +393,7 @@ static void cciss_seq_show_header(struct seq_file *seq)
388393
h->product_name,
389394
(unsigned long)h->board_id,
390395
h->firm_ver[0], h->firm_ver[1], h->firm_ver[2],
391-
h->firm_ver[3], (unsigned int)h->intr[PERF_MODE_INT],
396+
h->firm_ver[3], (unsigned int)h->intr[h->intr_mode],
392397
h->num_luns,
393398
h->Qdepth, h->commands_outstanding,
394399
h->maxQsinceinit, h->max_outstanding, h->maxSG);
@@ -3984,6 +3989,9 @@ static void __devinit cciss_put_controller_into_performant_mode(ctlr_info_t *h)
39843989
{
39853990
__u32 trans_support;
39863991

3992+
if (cciss_simple_mode)
3993+
return;
3994+
39873995
dev_dbg(&h->pdev->dev, "Trying to put board into Performant mode\n");
39883996
/* Attempt to put controller into performant mode if supported */
39893997
/* Does board support performant mode? */
@@ -4081,7 +4089,7 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *h)
40814089
default_int_mode:
40824090
#endif /* CONFIG_PCI_MSI */
40834091
/* if we get here we're going to use the default interrupt mode */
4084-
h->intr[PERF_MODE_INT] = h->pdev->irq;
4092+
h->intr[h->intr_mode] = h->pdev->irq;
40854093
return;
40864094
}
40874095

@@ -4341,6 +4349,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
43414349
}
43424350
cciss_enable_scsi_prefetch(h);
43434351
cciss_p600_dma_prefetch_quirk(h);
4352+
err = cciss_enter_simple_mode(h);
4353+
if (err)
4354+
goto err_out_free_res;
43444355
cciss_put_controller_into_performant_mode(h);
43454356
return 0;
43464357

@@ -4843,20 +4854,20 @@ static int cciss_request_irq(ctlr_info_t *h,
48434854
irqreturn_t (*intxhandler)(int, void *))
48444855
{
48454856
if (h->msix_vector || h->msi_vector) {
4846-
if (!request_irq(h->intr[PERF_MODE_INT], msixhandler,
4857+
if (!request_irq(h->intr[h->intr_mode], msixhandler,
48474858
IRQF_DISABLED, h->devname, h))
48484859
return 0;
48494860
dev_err(&h->pdev->dev, "Unable to get msi irq %d"
4850-
" for %s\n", h->intr[PERF_MODE_INT],
4861+
" for %s\n", h->intr[h->intr_mode],
48514862
h->devname);
48524863
return -1;
48534864
}
48544865

4855-
if (!request_irq(h->intr[PERF_MODE_INT], intxhandler,
4866+
if (!request_irq(h->intr[h->intr_mode], intxhandler,
48564867
IRQF_DISABLED, h->devname, h))
48574868
return 0;
48584869
dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n",
4859-
h->intr[PERF_MODE_INT], h->devname);
4870+
h->intr[h->intr_mode], h->devname);
48604871
return -1;
48614872
}
48624873

@@ -4887,7 +4898,7 @@ static void cciss_undo_allocations_after_kdump_soft_reset(ctlr_info_t *h)
48874898
{
48884899
int ctlr = h->ctlr;
48894900

4890-
free_irq(h->intr[PERF_MODE_INT], h);
4901+
free_irq(h->intr[h->intr_mode], h);
48914902
#ifdef CONFIG_PCI_MSI
48924903
if (h->msix_vector)
48934904
pci_disable_msix(h->pdev);
@@ -4953,6 +4964,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
49534964
h = hba[i];
49544965
h->pdev = pdev;
49554966
h->busy_initializing = 1;
4967+
h->intr_mode = cciss_simple_mode ? SIMPLE_MODE_INT : PERF_MODE_INT;
49564968
INIT_LIST_HEAD(&h->cmpQ);
49574969
INIT_LIST_HEAD(&h->reqQ);
49584970
mutex_init(&h->busy_shutting_down);
@@ -5009,7 +5021,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
50095021

50105022
dev_info(&h->pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n",
50115023
h->devname, pdev->device, pci_name(pdev),
5012-
h->intr[PERF_MODE_INT], dac ? "" : " not");
5024+
h->intr[h->intr_mode], dac ? "" : " not");
50135025

50145026
if (cciss_allocate_cmd_pool(h))
50155027
goto clean4;
@@ -5056,7 +5068,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
50565068
spin_lock_irqsave(&h->lock, flags);
50575069
h->access.set_intr_mask(h, CCISS_INTR_OFF);
50585070
spin_unlock_irqrestore(&h->lock, flags);
5059-
free_irq(h->intr[PERF_MODE_INT], h);
5071+
free_irq(h->intr[h->intr_mode], h);
50605072
rc = cciss_request_irq(h, cciss_msix_discard_completions,
50615073
cciss_intx_discard_completions);
50625074
if (rc) {
@@ -5133,7 +5145,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
51335145
cciss_free_cmd_pool(h);
51345146
cciss_free_scatterlists(h);
51355147
cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds);
5136-
free_irq(h->intr[PERF_MODE_INT], h);
5148+
free_irq(h->intr[h->intr_mode], h);
51375149
clean2:
51385150
unregister_blkdev(h->major, h->devname);
51395151
clean1:
@@ -5172,9 +5184,31 @@ static void cciss_shutdown(struct pci_dev *pdev)
51725184
if (return_code != IO_OK)
51735185
dev_warn(&h->pdev->dev, "Error flushing cache\n");
51745186
h->access.set_intr_mask(h, CCISS_INTR_OFF);
5175-
free_irq(h->intr[PERF_MODE_INT], h);
5187+
free_irq(h->intr[h->intr_mode], h);
51765188
}
51775189

5190+
static int __devinit cciss_enter_simple_mode(struct ctlr_info *h)
5191+
{
5192+
u32 trans_support;
5193+
5194+
trans_support = readl(&(h->cfgtable->TransportSupport));
5195+
if (!(trans_support & SIMPLE_MODE))
5196+
return -ENOTSUPP;
5197+
5198+
h->max_commands = readl(&(h->cfgtable->CmdsOutMax));
5199+
writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest));
5200+
writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
5201+
cciss_wait_for_mode_change_ack(h);
5202+
print_cfg_table(h);
5203+
if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) {
5204+
dev_warn(&h->pdev->dev, "unable to get board into simple mode\n");
5205+
return -ENODEV;
5206+
}
5207+
h->transMethod = CFGTBL_Trans_Simple;
5208+
return 0;
5209+
}
5210+
5211+
51785212
static void __devexit cciss_remove_one(struct pci_dev *pdev)
51795213
{
51805214
ctlr_info_t *h;

‎drivers/block/cciss.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ struct ctlr_info
9292
unsigned int intr[4];
9393
unsigned int msix_vector;
9494
unsigned int msi_vector;
95+
int intr_mode;
9596
int cciss_max_sectors;
9697
BYTE cciss_read;
9798
BYTE cciss_write;

0 commit comments

Comments
 (0)