Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Hiral Patel and committed by
James Bottomley
fc85799e d0385d92

+34 -18
+3
drivers/scsi/fnic/fnic.h
··· 43 43 #define DFX DRV_NAME "%d: " 44 44 45 45 #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 */ 46 48 #define FNIC_MAX_IO_REQ 2048 /* scsi_cmnd tag map entries */ 47 49 #define FNIC_IO_LOCKS 64 /* IO locks: power of 2 */ 48 50 #define FNIC_DFLT_QUEUE_DEPTH 32 ··· 225 223 char name[IFNAMSIZ]; 226 224 struct timer_list notify_timer; /* used for MSI interrupts */ 227 225 226 + unsigned int fnic_max_tag_id; 228 227 unsigned int err_intr_offset; 229 228 unsigned int link_intr_offset; 230 229
+21 -8
drivers/scsi/fnic/fnic_main.c
··· 74 74 MODULE_PARM_DESC(fnic_trace_max_pages, "Total allocated memory pages " 75 75 "for fnic trace buffer"); 76 76 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 + 77 81 static struct libfc_function_template fnic_transport_template = { 78 82 .frame_send = fnic_send, 79 83 .lport_set_port_id = fnic_set_port_id, ··· 95 91 if (!rport || fc_remote_port_chkready(rport)) 96 92 return -ENXIO; 97 93 98 - scsi_activate_tcq(sdev, FNIC_DFLT_QUEUE_DEPTH); 94 + scsi_activate_tcq(sdev, fnic_max_qdepth); 99 95 return 0; 100 96 } 101 97 ··· 556 552 557 553 host->transportt = fnic_fc_transport; 558 554 559 - err = scsi_init_shared_tag_map(host, FNIC_MAX_IO_REQ); 560 - if (err) { 561 - shost_printk(KERN_ERR, fnic->lport->host, 562 - "Unable to alloc shared tag map\n"); 563 - goto err_out_free_hba; 564 - } 565 - 566 555 /* Setup PCI resources */ 567 556 pci_set_drvdata(pdev, fnic); 568 557 ··· 668 671 "aborting.\n"); 669 672 goto err_out_dev_close; 670 673 } 674 + 675 + /* Configure Maximum Outstanding IO reqs*/ 676 + if (fnic->config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD) { 677 + host->can_queue = min_t(u32, FNIC_MAX_IO_REQ, 678 + max_t(u32, FNIC_MIN_IO_REQ, 679 + fnic->config.io_throttle_count)); 680 + } 681 + fnic->fnic_max_tag_id = host->can_queue; 682 + 683 + err = scsi_init_shared_tag_map(host, fnic->fnic_max_tag_id); 684 + if (err) { 685 + shost_printk(KERN_ERR, fnic->lport->host, 686 + "Unable to alloc shared tag map\n"); 687 + goto err_out_dev_close; 688 + } 689 + 671 690 host->max_lun = fnic->config.luns_per_tgt; 672 691 host->max_id = FNIC_MAX_FCP_TARGET; 673 692 host->max_cmd_len = FCOE_MAX_CMD_LEN;
+8 -8
drivers/scsi/fnic/fnic_scsi.c
··· 736 736 fcpio_tag_id_dec(&tag, &id); 737 737 icmnd_cmpl = &desc->u.icmnd_cmpl; 738 738 739 - if (id >= FNIC_MAX_IO_REQ) { 739 + if (id >= fnic->fnic_max_tag_id) { 740 740 shost_printk(KERN_ERR, fnic->lport->host, 741 741 "Tag out of range tag %x hdr status = %s\n", 742 742 id, fnic_fcpio_status_to_str(hdr_status)); ··· 913 913 fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag); 914 914 fcpio_tag_id_dec(&tag, &id); 915 915 916 - if ((id & FNIC_TAG_MASK) >= FNIC_MAX_IO_REQ) { 916 + if ((id & FNIC_TAG_MASK) >= fnic->fnic_max_tag_id) { 917 917 shost_printk(KERN_ERR, fnic->lport->host, 918 918 "Tag out of range tag %x hdr status = %s\n", 919 919 id, fnic_fcpio_status_to_str(hdr_status)); ··· 1127 1127 spinlock_t *io_lock; 1128 1128 unsigned long start_time = 0; 1129 1129 1130 - for (i = 0; i < FNIC_MAX_IO_REQ; i++) { 1130 + for (i = 0; i < fnic->fnic_max_tag_id; i++) { 1131 1131 if (i == exclude_id) 1132 1132 continue; 1133 1133 ··· 1210 1210 fcpio_tag_id_dec(&desc->hdr.tag, &id); 1211 1211 id &= FNIC_TAG_MASK; 1212 1212 1213 - if (id >= FNIC_MAX_IO_REQ) 1213 + if (id >= fnic->fnic_max_tag_id) 1214 1214 return; 1215 1215 1216 1216 sc = scsi_host_find_tag(fnic->lport->host, id); ··· 1314 1314 if (fnic->in_remove) 1315 1315 return; 1316 1316 1317 - for (tag = 0; tag < FNIC_MAX_IO_REQ; tag++) { 1317 + for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) { 1318 1318 abt_tag = tag; 1319 1319 io_lock = fnic_io_lock_tag(fnic, tag); 1320 1320 spin_lock_irqsave(io_lock, flags); ··· 1448 1448 if (fnic->in_remove) 1449 1449 return; 1450 1450 1451 - for (tag = 0; tag < FNIC_MAX_IO_REQ; tag++) { 1451 + for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) { 1452 1452 abt_tag = tag; 1453 1453 io_lock = fnic_io_lock_tag(fnic, tag); 1454 1454 spin_lock_irqsave(io_lock, flags); ··· 1781 1781 DECLARE_COMPLETION_ONSTACK(tm_done); 1782 1782 enum fnic_ioreq_state old_ioreq_state; 1783 1783 1784 - for (tag = 0; tag < FNIC_MAX_IO_REQ; tag++) { 1784 + for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) { 1785 1785 io_lock = fnic_io_lock_tag(fnic, tag); 1786 1786 spin_lock_irqsave(io_lock, flags); 1787 1787 sc = scsi_host_find_tag(fnic->lport->host, tag); ··· 2404 2404 lun_dev = lr_sc->device; 2405 2405 2406 2406 /* 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++) { 2408 2408 sc = scsi_host_find_tag(fnic->lport->host, tag); 2409 2409 /* 2410 2410 * ignore this lun reset cmd or cmds that do not belong to
+2 -2
drivers/scsi/fnic/vnic_scsi.h
··· 54 54 #define VNIC_FNIC_PLOGI_TIMEOUT_MIN 1000 55 55 #define VNIC_FNIC_PLOGI_TIMEOUT_MAX 255000 56 56 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 59 59 60 60 #define VNIC_FNIC_LINK_DOWN_TIMEOUT_MIN 0 61 61 #define VNIC_FNIC_LINK_DOWN_TIMEOUT_MAX 240000