aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_os.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c107
1 files changed, 101 insertions, 6 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 53efffce13a2..da86d3828c1d 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -111,8 +111,7 @@ MODULE_PARM_DESC(ql2xfdmienable,
111 "Enables FDMI registrations. " 111 "Enables FDMI registrations. "
112 "0 - no FDMI. Default is 1 - perform FDMI."); 112 "0 - no FDMI. Default is 1 - perform FDMI.");
113 113
114#define MAX_Q_DEPTH 32 114int ql2xmaxqdepth = MAX_Q_DEPTH;
115static int ql2xmaxqdepth = MAX_Q_DEPTH;
116module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR); 115module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR);
117MODULE_PARM_DESC(ql2xmaxqdepth, 116MODULE_PARM_DESC(ql2xmaxqdepth,
118 "Maximum queue depth to set for each LUN. " 117 "Maximum queue depth to set for each LUN. "
@@ -720,8 +719,10 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
720 } 719 }
721 720
722 sp = qla2x00_get_sp(base_vha, fcport, GFP_ATOMIC); 721 sp = qla2x00_get_sp(base_vha, fcport, GFP_ATOMIC);
723 if (!sp) 722 if (!sp) {
723 set_bit(HOST_RAMP_DOWN_QUEUE_DEPTH, &vha->dpc_flags);
724 goto qc24_host_busy; 724 goto qc24_host_busy;
725 }
725 726
726 sp->u.scmd.cmd = cmd; 727 sp->u.scmd.cmd = cmd;
727 sp->type = SRB_SCSI_CMD; 728 sp->type = SRB_SCSI_CMD;
@@ -734,6 +735,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
734 if (rval != QLA_SUCCESS) { 735 if (rval != QLA_SUCCESS) {
735 ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3013, 736 ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3013,
736 "Start scsi failed rval=%d for cmd=%p.\n", rval, cmd); 737 "Start scsi failed rval=%d for cmd=%p.\n", rval, cmd);
738 set_bit(HOST_RAMP_DOWN_QUEUE_DEPTH, &vha->dpc_flags);
737 goto qc24_host_busy_free_sp; 739 goto qc24_host_busy_free_sp;
738 } 740 }
739 741
@@ -1458,6 +1460,81 @@ qla2x00_change_queue_type(struct scsi_device *sdev, int tag_type)
1458 return tag_type; 1460 return tag_type;
1459} 1461}
1460 1462
1463static void
1464qla2x00_host_ramp_down_queuedepth(scsi_qla_host_t *vha)
1465{
1466 scsi_qla_host_t *vp;
1467 struct Scsi_Host *shost;
1468 struct scsi_device *sdev;
1469 struct qla_hw_data *ha = vha->hw;
1470 unsigned long flags;
1471
1472 ha->host_last_rampdown_time = jiffies;
1473
1474 if (ha->cfg_lun_q_depth <= vha->host->cmd_per_lun)
1475 return;
1476
1477 if ((ha->cfg_lun_q_depth / 2) < vha->host->cmd_per_lun)
1478 ha->cfg_lun_q_depth = vha->host->cmd_per_lun;
1479 else
1480 ha->cfg_lun_q_depth = ha->cfg_lun_q_depth / 2;
1481
1482 /*
1483 * Geometrically ramp down the queue depth for all devices on this
1484 * adapter
1485 */
1486 spin_lock_irqsave(&ha->vport_slock, flags);
1487 list_for_each_entry(vp, &ha->vp_list, list) {
1488 shost = vp->host;
1489 shost_for_each_device(sdev, shost) {
1490 if (sdev->queue_depth > shost->cmd_per_lun) {
1491 if (sdev->queue_depth < ha->cfg_lun_q_depth)
1492 continue;
1493 ql_log(ql_log_warn, vp, 0x3031,
1494 "%ld:%d:%d: Ramping down queue depth to %d",
1495 vp->host_no, sdev->id, sdev->lun,
1496 ha->cfg_lun_q_depth);
1497 qla2x00_change_queue_depth(sdev,
1498 ha->cfg_lun_q_depth, SCSI_QDEPTH_DEFAULT);
1499 }
1500 }
1501 }
1502 spin_unlock_irqrestore(&ha->vport_slock, flags);
1503
1504 return;
1505}
1506
1507static void
1508qla2x00_host_ramp_up_queuedepth(scsi_qla_host_t *vha)
1509{
1510 scsi_qla_host_t *vp;
1511 struct Scsi_Host *shost;
1512 struct scsi_device *sdev;
1513 struct qla_hw_data *ha = vha->hw;
1514 unsigned long flags;
1515
1516 ha->host_last_rampup_time = jiffies;
1517 ha->cfg_lun_q_depth++;
1518
1519 /*
1520 * Linearly ramp up the queue depth for all devices on this
1521 * adapter
1522 */
1523 spin_lock_irqsave(&ha->vport_slock, flags);
1524 list_for_each_entry(vp, &ha->vp_list, list) {
1525 shost = vp->host;
1526 shost_for_each_device(sdev, shost) {
1527 if (sdev->queue_depth > ha->cfg_lun_q_depth)
1528 continue;
1529 qla2x00_change_queue_depth(sdev, ha->cfg_lun_q_depth,
1530 SCSI_QDEPTH_RAMP_UP);
1531 }
1532 }
1533 spin_unlock_irqrestore(&ha->vport_slock, flags);
1534
1535 return;
1536}
1537
1461/** 1538/**
1462 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method. 1539 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1463 * @ha: HA context 1540 * @ha: HA context
@@ -2235,6 +2312,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2235 ha->init_cb_size = sizeof(init_cb_t); 2312 ha->init_cb_size = sizeof(init_cb_t);
2236 ha->link_data_rate = PORT_SPEED_UNKNOWN; 2313 ha->link_data_rate = PORT_SPEED_UNKNOWN;
2237 ha->optrom_size = OPTROM_SIZE_2300; 2314 ha->optrom_size = OPTROM_SIZE_2300;
2315 ha->cfg_lun_q_depth = ql2xmaxqdepth;
2238 2316
2239 /* Assign ISP specific operations. */ 2317 /* Assign ISP specific operations. */
2240 if (IS_QLA2100(ha)) { 2318 if (IS_QLA2100(ha)) {
@@ -4610,6 +4688,18 @@ qla2x00_do_dpc(void *data)
4610 qla2xxx_flash_npiv_conf(base_vha); 4688 qla2xxx_flash_npiv_conf(base_vha);
4611 } 4689 }
4612 4690
4691 if (test_and_clear_bit(HOST_RAMP_DOWN_QUEUE_DEPTH,
4692 &base_vha->dpc_flags)) {
4693 /* Prevents simultaneous ramp up and down */
4694 clear_bit(HOST_RAMP_UP_QUEUE_DEPTH,
4695 &base_vha->dpc_flags);
4696 qla2x00_host_ramp_down_queuedepth(base_vha);
4697 }
4698
4699 if (test_and_clear_bit(HOST_RAMP_UP_QUEUE_DEPTH,
4700 &base_vha->dpc_flags))
4701 qla2x00_host_ramp_up_queuedepth(base_vha);
4702
4613 if (!ha->interrupts_on) 4703 if (!ha->interrupts_on)
4614 ha->isp_ops->enable_intrs(ha); 4704 ha->isp_ops->enable_intrs(ha);
4615 4705
@@ -4807,7 +4897,9 @@ qla2x00_timer(scsi_qla_host_t *vha)
4807 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || 4897 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) ||
4808 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || 4898 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) ||
4809 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || 4899 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) ||
4810 test_bit(RELOGIN_NEEDED, &vha->dpc_flags))) { 4900 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) ||
4901 test_bit(HOST_RAMP_DOWN_QUEUE_DEPTH, &vha->dpc_flags) ||
4902 test_bit(HOST_RAMP_UP_QUEUE_DEPTH, &vha->dpc_flags))) {
4811 ql_dbg(ql_dbg_timer, vha, 0x600b, 4903 ql_dbg(ql_dbg_timer, vha, 0x600b,
4812 "isp_abort_needed=%d loop_resync_needed=%d " 4904 "isp_abort_needed=%d loop_resync_needed=%d "
4813 "fcport_update_needed=%d start_dpc=%d " 4905 "fcport_update_needed=%d start_dpc=%d "
@@ -4820,12 +4912,15 @@ qla2x00_timer(scsi_qla_host_t *vha)
4820 ql_dbg(ql_dbg_timer, vha, 0x600c, 4912 ql_dbg(ql_dbg_timer, vha, 0x600c,
4821 "beacon_blink_needed=%d isp_unrecoverable=%d " 4913 "beacon_blink_needed=%d isp_unrecoverable=%d "
4822 "fcoe_ctx_reset_needed=%d vp_dpc_needed=%d " 4914 "fcoe_ctx_reset_needed=%d vp_dpc_needed=%d "
4823 "relogin_needed=%d.\n", 4915 "relogin_needed=%d, host_ramp_down_needed=%d "
4916 "host_ramp_up_needed=%d.\n",
4824 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), 4917 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags),
4825 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), 4918 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags),
4826 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), 4919 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags),
4827 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), 4920 test_bit(VP_DPC_NEEDED, &vha->dpc_flags),
4828 test_bit(RELOGIN_NEEDED, &vha->dpc_flags)); 4921 test_bit(RELOGIN_NEEDED, &vha->dpc_flags),
4922 test_bit(HOST_RAMP_UP_QUEUE_DEPTH, &vha->dpc_flags),
4923 test_bit(HOST_RAMP_DOWN_QUEUE_DEPTH, &vha->dpc_flags));
4829 qla2xxx_wake_dpc(vha); 4924 qla2xxx_wake_dpc(vha);
4830 } 4925 }
4831 4926