aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_isr.c
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2006-10-13 12:33:39 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-10-25 18:13:08 -0400
commitdf7baa506c2db1c2d12abd6f05c43f911da55a2e (patch)
tree0914b8f01b031312246fc7ddbadb358f3bdff667 /drivers/scsi/qla2xxx/qla_isr.c
parent18c6c12759813c988bb05796d1b3352e98ae77de (diff)
[SCSI] qla2xxx: Correct QUEUE_FULL handling.
- Drop queue-depths across all luns for a given fcport during TASK_SET_FULL statuses. - Ramp-up I/Os after throttling. - Consolidate completion-status handling of CS_QUEUE_FULL with CS_COMPLETE as ISP24xx firmware no longer reports CS_QUEUE_FULL. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_isr.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c91
1 files changed, 80 insertions, 11 deletions
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 626c7178a434..d3b6df4d55c8 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -6,6 +6,8 @@
6 */ 6 */
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9#include <scsi/scsi_tcq.h>
10
9static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t); 11static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
10static void qla2x00_async_event(scsi_qla_host_t *, uint16_t *); 12static void qla2x00_async_event(scsi_qla_host_t *, uint16_t *);
11static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t); 13static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t);
@@ -593,6 +595,67 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
593 } 595 }
594} 596}
595 597
598static void
599qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, void *data)
600{
601 fc_port_t *fcport = data;
602
603 if (fcport->ha->max_q_depth <= sdev->queue_depth)
604 return;
605
606 if (sdev->ordered_tags)
607 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG,
608 sdev->queue_depth + 1);
609 else
610 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG,
611 sdev->queue_depth + 1);
612
613 fcport->last_ramp_up = jiffies;
614
615 DEBUG2(qla_printk(KERN_INFO, fcport->ha,
616 "scsi(%ld:%d:%d:%d): Queue depth adjusted-up to %d.\n",
617 fcport->ha->host_no, sdev->channel, sdev->id, sdev->lun,
618 sdev->queue_depth));
619}
620
621static void
622qla2x00_adjust_sdev_qdepth_down(struct scsi_device *sdev, void *data)
623{
624 fc_port_t *fcport = data;
625
626 if (!scsi_track_queue_full(sdev, sdev->queue_depth - 1))
627 return;
628
629 DEBUG2(qla_printk(KERN_INFO, fcport->ha,
630 "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
631 fcport->ha->host_no, sdev->channel, sdev->id, sdev->lun,
632 sdev->queue_depth));
633}
634
635static inline void
636qla2x00_ramp_up_queue_depth(scsi_qla_host_t *ha, srb_t *sp)
637{
638 fc_port_t *fcport;
639 struct scsi_device *sdev;
640
641 sdev = sp->cmd->device;
642 if (sdev->queue_depth >= ha->max_q_depth)
643 return;
644
645 fcport = sp->fcport;
646 if (time_before(jiffies,
647 fcport->last_ramp_up + ql2xqfullrampup * HZ))
648 return;
649 if (time_before(jiffies,
650 fcport->last_queue_full + ql2xqfullrampup * HZ))
651 return;
652
653 spin_unlock_irq(&ha->hardware_lock);
654 starget_for_each_device(sdev->sdev_target, fcport,
655 qla2x00_adjust_sdev_qdepth_up);
656 spin_lock_irq(&ha->hardware_lock);
657}
658
596/** 659/**
597 * qla2x00_process_completed_request() - Process a Fast Post response. 660 * qla2x00_process_completed_request() - Process a Fast Post response.
598 * @ha: SCSI driver HA context 661 * @ha: SCSI driver HA context
@@ -624,6 +687,8 @@ qla2x00_process_completed_request(struct scsi_qla_host *ha, uint32_t index)
624 687
625 /* Save ISP completion status */ 688 /* Save ISP completion status */
626 sp->cmd->result = DID_OK << 16; 689 sp->cmd->result = DID_OK << 16;
690
691 qla2x00_ramp_up_queue_depth(ha, sp);
627 qla2x00_sp_compl(ha, sp); 692 qla2x00_sp_compl(ha, sp);
628 } else { 693 } else {
629 DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n", 694 DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n",
@@ -823,6 +888,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
823 */ 888 */
824 switch (comp_status) { 889 switch (comp_status) {
825 case CS_COMPLETE: 890 case CS_COMPLETE:
891 case CS_QUEUE_FULL:
826 if (scsi_status == 0) { 892 if (scsi_status == 0) {
827 cp->result = DID_OK << 16; 893 cp->result = DID_OK << 16;
828 break; 894 break;
@@ -849,6 +915,20 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
849 } 915 }
850 cp->result = DID_OK << 16 | lscsi_status; 916 cp->result = DID_OK << 16 | lscsi_status;
851 917
918 if (lscsi_status == SAM_STAT_TASK_SET_FULL) {
919 DEBUG2(printk(KERN_INFO
920 "scsi(%ld): QUEUE FULL status detected "
921 "0x%x-0x%x.\n", ha->host_no, comp_status,
922 scsi_status));
923
924 /* Adjust queue depth for all luns on the port. */
925 fcport->last_queue_full = jiffies;
926 spin_unlock_irq(&ha->hardware_lock);
927 starget_for_each_device(cp->device->sdev_target,
928 fcport, qla2x00_adjust_sdev_qdepth_down);
929 spin_lock_irq(&ha->hardware_lock);
930 break;
931 }
852 if (lscsi_status != SS_CHECK_CONDITION) 932 if (lscsi_status != SS_CHECK_CONDITION)
853 break; 933 break;
854 934
@@ -1066,17 +1146,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1066 qla2x00_mark_device_lost(ha, fcport, 1, 1); 1146 qla2x00_mark_device_lost(ha, fcport, 1, 1);
1067 break; 1147 break;
1068 1148
1069 case CS_QUEUE_FULL:
1070 DEBUG2(printk(KERN_INFO
1071 "scsi(%ld): QUEUE FULL status detected 0x%x-0x%x.\n",
1072 ha->host_no, comp_status, scsi_status));
1073
1074 /* SCSI Mid-Layer handles device queue full */
1075
1076 cp->result = DID_OK << 16 | lscsi_status;
1077
1078 break;
1079
1080 default: 1149 default:
1081 DEBUG3(printk("scsi(%ld): Error detected (unknown status) " 1150 DEBUG3(printk("scsi(%ld): Error detected (unknown status) "
1082 "0x%x-0x%x.\n", ha->host_no, comp_status, scsi_status)); 1151 "0x%x-0x%x.\n", ha->host_no, comp_status, scsi_status));