Skip to content

Commit fc85799

Browse files
Hiral PatelJames Bottomley
authored andcommitted
[SCSI] fnic: fnic Driver Tuneables Exposed through CLI
Introduced module params to provide dynamic way of configuring queue depth. Added support to get max io throttle count through UCSM to configure maximum outstanding IOs supported by fnic and push that value to scsi mid-layer. Supported IO throttle values: UCSM IO THROTTLE VALUE FNIC MAX OUTSTANDING IOS ------------------------------------------------------ 16 (Default) 2048 <= 256 256 > 256 <ucsm value> Signed-off-by: Hiral Patel <hiralpat@cisco.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent d0385d9 commit fc85799

File tree

4 files changed

+34
-18
lines changed

4 files changed

+34
-18
lines changed

drivers/scsi/fnic/fnic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#define DFX DRV_NAME "%d: "
4444

4545
#define DESC_CLEAN_LOW_WATERMARK 8
46+
#define FNIC_UCSM_DFLT_THROTTLE_CNT_BLD 16 /* UCSM default throttle count */
47+
#define FNIC_MIN_IO_REQ 256 /* Min IO throttle count */
4648
#define FNIC_MAX_IO_REQ 2048 /* scsi_cmnd tag map entries */
4749
#define FNIC_IO_LOCKS 64 /* IO locks: power of 2 */
4850
#define FNIC_DFLT_QUEUE_DEPTH 32
@@ -223,6 +225,7 @@ struct fnic {
223225
char name[IFNAMSIZ];
224226
struct timer_list notify_timer; /* used for MSI interrupts */
225227

228+
unsigned int fnic_max_tag_id;
226229
unsigned int err_intr_offset;
227230
unsigned int link_intr_offset;
228231

drivers/scsi/fnic/fnic_main.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ module_param(fnic_trace_max_pages, uint, S_IRUGO|S_IWUSR);
7474
MODULE_PARM_DESC(fnic_trace_max_pages, "Total allocated memory pages "
7575
"for fnic trace buffer");
7676

77+
static unsigned int fnic_max_qdepth = FNIC_DFLT_QUEUE_DEPTH;
78+
module_param(fnic_max_qdepth, uint, S_IRUGO|S_IWUSR);
79+
MODULE_PARM_DESC(fnic_max_qdepth, "Queue depth to report for each LUN");
80+
7781
static struct libfc_function_template fnic_transport_template = {
7882
.frame_send = fnic_send,
7983
.lport_set_port_id = fnic_set_port_id,
@@ -91,7 +95,7 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
9195
if (!rport || fc_remote_port_chkready(rport))
9296
return -ENXIO;
9397

94-
scsi_activate_tcq(sdev, FNIC_DFLT_QUEUE_DEPTH);
98+
scsi_activate_tcq(sdev, fnic_max_qdepth);
9599
return 0;
96100
}
97101

@@ -552,13 +556,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
552556

553557
host->transportt = fnic_fc_transport;
554558

555-
err = scsi_init_shared_tag_map(host, FNIC_MAX_IO_REQ);
556-
if (err) {
557-
shost_printk(KERN_ERR, fnic->lport->host,
558-
"Unable to alloc shared tag map\n");
559-
goto err_out_free_hba;
560-
}
561-
562559
/* Setup PCI resources */
563560
pci_set_drvdata(pdev, fnic);
564561

@@ -671,6 +668,22 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
671668
"aborting.\n");
672669
goto err_out_dev_close;
673670
}
671+
672+
/* Configure Maximum Outstanding IO reqs*/
673+
if (fnic->config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD) {
674+
host->can_queue = min_t(u32, FNIC_MAX_IO_REQ,
675+
max_t(u32, FNIC_MIN_IO_REQ,
676+
fnic->config.io_throttle_count));
677+
}
678+
fnic->fnic_max_tag_id = host->can_queue;
679+
680+
err = scsi_init_shared_tag_map(host, fnic->fnic_max_tag_id);
681+
if (err) {
682+
shost_printk(KERN_ERR, fnic->lport->host,
683+
"Unable to alloc shared tag map\n");
684+
goto err_out_dev_close;
685+
}
686+
674687
host->max_lun = fnic->config.luns_per_tgt;
675688
host->max_id = FNIC_MAX_FCP_TARGET;
676689
host->max_cmd_len = FCOE_MAX_CMD_LEN;

drivers/scsi/fnic/fnic_scsi.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
736736
fcpio_tag_id_dec(&tag, &id);
737737
icmnd_cmpl = &desc->u.icmnd_cmpl;
738738

739-
if (id >= FNIC_MAX_IO_REQ) {
739+
if (id >= fnic->fnic_max_tag_id) {
740740
shost_printk(KERN_ERR, fnic->lport->host,
741741
"Tag out of range tag %x hdr status = %s\n",
742742
id, fnic_fcpio_status_to_str(hdr_status));
@@ -913,7 +913,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
913913
fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag);
914914
fcpio_tag_id_dec(&tag, &id);
915915

916-
if ((id & FNIC_TAG_MASK) >= FNIC_MAX_IO_REQ) {
916+
if ((id & FNIC_TAG_MASK) >= fnic->fnic_max_tag_id) {
917917
shost_printk(KERN_ERR, fnic->lport->host,
918918
"Tag out of range tag %x hdr status = %s\n",
919919
id, fnic_fcpio_status_to_str(hdr_status));
@@ -1127,7 +1127,7 @@ static void fnic_cleanup_io(struct fnic *fnic, int exclude_id)
11271127
spinlock_t *io_lock;
11281128
unsigned long start_time = 0;
11291129

1130-
for (i = 0; i < FNIC_MAX_IO_REQ; i++) {
1130+
for (i = 0; i < fnic->fnic_max_tag_id; i++) {
11311131
if (i == exclude_id)
11321132
continue;
11331133

@@ -1210,7 +1210,7 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
12101210
fcpio_tag_id_dec(&desc->hdr.tag, &id);
12111211
id &= FNIC_TAG_MASK;
12121212

1213-
if (id >= FNIC_MAX_IO_REQ)
1213+
if (id >= fnic->fnic_max_tag_id)
12141214
return;
12151215

12161216
sc = scsi_host_find_tag(fnic->lport->host, id);
@@ -1314,7 +1314,7 @@ static void fnic_rport_exch_reset(struct fnic *fnic, u32 port_id)
13141314
if (fnic->in_remove)
13151315
return;
13161316

1317-
for (tag = 0; tag < FNIC_MAX_IO_REQ; tag++) {
1317+
for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) {
13181318
abt_tag = tag;
13191319
io_lock = fnic_io_lock_tag(fnic, tag);
13201320
spin_lock_irqsave(io_lock, flags);
@@ -1448,7 +1448,7 @@ void fnic_terminate_rport_io(struct fc_rport *rport)
14481448
if (fnic->in_remove)
14491449
return;
14501450

1451-
for (tag = 0; tag < FNIC_MAX_IO_REQ; tag++) {
1451+
for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) {
14521452
abt_tag = tag;
14531453
io_lock = fnic_io_lock_tag(fnic, tag);
14541454
spin_lock_irqsave(io_lock, flags);
@@ -1781,7 +1781,7 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,
17811781
DECLARE_COMPLETION_ONSTACK(tm_done);
17821782
enum fnic_ioreq_state old_ioreq_state;
17831783

1784-
for (tag = 0; tag < FNIC_MAX_IO_REQ; tag++) {
1784+
for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) {
17851785
io_lock = fnic_io_lock_tag(fnic, tag);
17861786
spin_lock_irqsave(io_lock, flags);
17871787
sc = scsi_host_find_tag(fnic->lport->host, tag);
@@ -2404,7 +2404,7 @@ int fnic_is_abts_pending(struct fnic *fnic, struct scsi_cmnd *lr_sc)
24042404
lun_dev = lr_sc->device;
24052405

24062406
/* walk again to check, if IOs are still pending in fw */
2407-
for (tag = 0; tag < FNIC_MAX_IO_REQ; tag++) {
2407+
for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) {
24082408
sc = scsi_host_find_tag(fnic->lport->host, tag);
24092409
/*
24102410
* ignore this lun reset cmd or cmds that do not belong to

drivers/scsi/fnic/vnic_scsi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
#define VNIC_FNIC_PLOGI_TIMEOUT_MIN 1000
5555
#define VNIC_FNIC_PLOGI_TIMEOUT_MAX 255000
5656

57-
#define VNIC_FNIC_IO_THROTTLE_COUNT_MIN 256
58-
#define VNIC_FNIC_IO_THROTTLE_COUNT_MAX 4096
57+
#define VNIC_FNIC_IO_THROTTLE_COUNT_MIN 1
58+
#define VNIC_FNIC_IO_THROTTLE_COUNT_MAX 2048
5959

6060
#define VNIC_FNIC_LINK_DOWN_TIMEOUT_MIN 0
6161
#define VNIC_FNIC_LINK_DOWN_TIMEOUT_MAX 240000

0 commit comments

Comments
 (0)