aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/fnic/fnic.h3
-rw-r--r--drivers/scsi/fnic/fnic_main.c29
-rw-r--r--drivers/scsi/fnic/fnic_scsi.c16
-rw-r--r--drivers/scsi/fnic/vnic_scsi.h4
4 files changed, 34 insertions, 18 deletions
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index d276aaf84f18..e4dd3d7cd236 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -43,6 +43,8 @@
43#define DFX DRV_NAME "%d: " 43#define DFX DRV_NAME "%d: "
44 44
45#define DESC_CLEAN_LOW_WATERMARK 8 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#define FNIC_MAX_IO_REQ 2048 /* scsi_cmnd tag map entries */ 48#define FNIC_MAX_IO_REQ 2048 /* scsi_cmnd tag map entries */
47#define FNIC_IO_LOCKS 64 /* IO locks: power of 2 */ 49#define FNIC_IO_LOCKS 64 /* IO locks: power of 2 */
48#define FNIC_DFLT_QUEUE_DEPTH 32 50#define FNIC_DFLT_QUEUE_DEPTH 32
@@ -223,6 +225,7 @@ struct fnic {
223 char name[IFNAMSIZ]; 225 char name[IFNAMSIZ];
224 struct timer_list notify_timer; /* used for MSI interrupts */ 226 struct timer_list notify_timer; /* used for MSI interrupts */
225 227
228 unsigned int fnic_max_tag_id;
226 unsigned int err_intr_offset; 229 unsigned int err_intr_offset;
227 unsigned int link_intr_offset; 230 unsigned int link_intr_offset;
228 231
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 835a9cdbac8b..bbf81ea3a252 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -74,6 +74,10 @@ module_param(fnic_trace_max_pages, uint, S_IRUGO|S_IWUSR);
74MODULE_PARM_DESC(fnic_trace_max_pages, "Total allocated memory pages " 74MODULE_PARM_DESC(fnic_trace_max_pages, "Total allocated memory pages "
75 "for fnic trace buffer"); 75 "for fnic trace buffer");
76 76
77static unsigned int fnic_max_qdepth = FNIC_DFLT_QUEUE_DEPTH;
78module_param(fnic_max_qdepth, uint, S_IRUGO|S_IWUSR);
79MODULE_PARM_DESC(fnic_max_qdepth, "Queue depth to report for each LUN");
80
77static struct libfc_function_template fnic_transport_template = { 81static struct libfc_function_template fnic_transport_template = {
78 .frame_send = fnic_send, 82 .frame_send = fnic_send,
79 .lport_set_port_id = fnic_set_port_id, 83 .lport_set_port_id = fnic_set_port_id,
@@ -91,7 +95,7 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
91 if (!rport || fc_remote_port_chkready(rport)) 95 if (!rport || fc_remote_port_chkready(rport))
92 return -ENXIO; 96 return -ENXIO;
93 97
94 scsi_activate_tcq(sdev, FNIC_DFLT_QUEUE_DEPTH); 98 scsi_activate_tcq(sdev, fnic_max_qdepth);
95 return 0; 99 return 0;
96} 100}
97 101
@@ -552,13 +556,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
552 556
553 host->transportt = fnic_fc_transport; 557 host->transportt = fnic_fc_transport;
554 558
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
562 /* Setup PCI resources */ 559 /* Setup PCI resources */
563 pci_set_drvdata(pdev, fnic); 560 pci_set_drvdata(pdev, fnic);
564 561
@@ -671,6 +668,22 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
671 "aborting.\n"); 668 "aborting.\n");
672 goto err_out_dev_close; 669 goto err_out_dev_close;
673 } 670 }
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
674 host->max_lun = fnic->config.luns_per_tgt; 687 host->max_lun = fnic->config.luns_per_tgt;
675 host->max_id = FNIC_MAX_FCP_TARGET; 688 host->max_id = FNIC_MAX_FCP_TARGET;
676 host->max_cmd_len = FCOE_MAX_CMD_LEN; 689 host->max_cmd_len = FCOE_MAX_CMD_LEN;
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index a876084ee12f..d014aae19134 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -736,7 +736,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
736 fcpio_tag_id_dec(&tag, &id); 736 fcpio_tag_id_dec(&tag, &id);
737 icmnd_cmpl = &desc->u.icmnd_cmpl; 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 shost_printk(KERN_ERR, fnic->lport->host, 740 shost_printk(KERN_ERR, fnic->lport->host,
741 "Tag out of range tag %x hdr status = %s\n", 741 "Tag out of range tag %x hdr status = %s\n",
742 id, fnic_fcpio_status_to_str(hdr_status)); 742 id, fnic_fcpio_status_to_str(hdr_status));
@@ -913,7 +913,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
913 fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag); 913 fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag);
914 fcpio_tag_id_dec(&tag, &id); 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 shost_printk(KERN_ERR, fnic->lport->host, 917 shost_printk(KERN_ERR, fnic->lport->host,
918 "Tag out of range tag %x hdr status = %s\n", 918 "Tag out of range tag %x hdr status = %s\n",
919 id, fnic_fcpio_status_to_str(hdr_status)); 919 id, fnic_fcpio_status_to_str(hdr_status));
@@ -1127,7 +1127,7 @@ static void fnic_cleanup_io(struct fnic *fnic, int exclude_id)
1127 spinlock_t *io_lock; 1127 spinlock_t *io_lock;
1128 unsigned long start_time = 0; 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 if (i == exclude_id) 1131 if (i == exclude_id)
1132 continue; 1132 continue;
1133 1133
@@ -1210,7 +1210,7 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
1210 fcpio_tag_id_dec(&desc->hdr.tag, &id); 1210 fcpio_tag_id_dec(&desc->hdr.tag, &id);
1211 id &= FNIC_TAG_MASK; 1211 id &= FNIC_TAG_MASK;
1212 1212
1213 if (id >= FNIC_MAX_IO_REQ) 1213 if (id >= fnic->fnic_max_tag_id)
1214 return; 1214 return;
1215 1215
1216 sc = scsi_host_find_tag(fnic->lport->host, id); 1216 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)
1314 if (fnic->in_remove) 1314 if (fnic->in_remove)
1315 return; 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 abt_tag = tag; 1318 abt_tag = tag;
1319 io_lock = fnic_io_lock_tag(fnic, tag); 1319 io_lock = fnic_io_lock_tag(fnic, tag);
1320 spin_lock_irqsave(io_lock, flags); 1320 spin_lock_irqsave(io_lock, flags);
@@ -1448,7 +1448,7 @@ void fnic_terminate_rport_io(struct fc_rport *rport)
1448 if (fnic->in_remove) 1448 if (fnic->in_remove)
1449 return; 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 abt_tag = tag; 1452 abt_tag = tag;
1453 io_lock = fnic_io_lock_tag(fnic, tag); 1453 io_lock = fnic_io_lock_tag(fnic, tag);
1454 spin_lock_irqsave(io_lock, flags); 1454 spin_lock_irqsave(io_lock, flags);
@@ -1781,7 +1781,7 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,
1781 DECLARE_COMPLETION_ONSTACK(tm_done); 1781 DECLARE_COMPLETION_ONSTACK(tm_done);
1782 enum fnic_ioreq_state old_ioreq_state; 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 io_lock = fnic_io_lock_tag(fnic, tag); 1785 io_lock = fnic_io_lock_tag(fnic, tag);
1786 spin_lock_irqsave(io_lock, flags); 1786 spin_lock_irqsave(io_lock, flags);
1787 sc = scsi_host_find_tag(fnic->lport->host, tag); 1787 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)
2404 lun_dev = lr_sc->device; 2404 lun_dev = lr_sc->device;
2405 2405
2406 /* walk again to check, if IOs are still pending in fw */ 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 sc = scsi_host_find_tag(fnic->lport->host, tag); 2408 sc = scsi_host_find_tag(fnic->lport->host, tag);
2409 /* 2409 /*
2410 * ignore this lun reset cmd or cmds that do not belong to 2410 * ignore this lun reset cmd or cmds that do not belong to
diff --git a/drivers/scsi/fnic/vnic_scsi.h b/drivers/scsi/fnic/vnic_scsi.h
index fbb55364e272..e343e1d0f801 100644
--- a/drivers/scsi/fnic/vnic_scsi.h
+++ b/drivers/scsi/fnic/vnic_scsi.h
@@ -54,8 +54,8 @@
54#define VNIC_FNIC_PLOGI_TIMEOUT_MIN 1000 54#define VNIC_FNIC_PLOGI_TIMEOUT_MIN 1000
55#define VNIC_FNIC_PLOGI_TIMEOUT_MAX 255000 55#define VNIC_FNIC_PLOGI_TIMEOUT_MAX 255000
56 56
57#define VNIC_FNIC_IO_THROTTLE_COUNT_MIN 256 57#define VNIC_FNIC_IO_THROTTLE_COUNT_MIN 1
58#define VNIC_FNIC_IO_THROTTLE_COUNT_MAX 4096 58#define VNIC_FNIC_IO_THROTTLE_COUNT_MAX 2048
59 59
60#define VNIC_FNIC_LINK_DOWN_TIMEOUT_MIN 0 60#define VNIC_FNIC_LINK_DOWN_TIMEOUT_MIN 0
61#define VNIC_FNIC_LINK_DOWN_TIMEOUT_MAX 240000 61#define VNIC_FNIC_LINK_DOWN_TIMEOUT_MAX 240000