aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid C Somayajulu <david.somayajulu@qlogic.com>2007-07-09 15:44:36 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-14 20:11:38 -0400
commit6ea7e33ee1b74de9b60327fec1a0cd39afac3983 (patch)
treed8fe46883214d3dbed30f19d758f027477852fde /drivers
parent0c2cc4337968f7aab91a91b8d5889982e3a3bd0d (diff)
[SCSI] qla4xxx: Fix underrun/overrun conditions
On Wed, 2007-06-06 at 11:55 -0700, David C Somayajulu wrote: This patch fixes the code handling underrun and overrun conditions. Also fixed coding style as per Mike Christie's advice. Signed-off-by: David Somayajulu <david.somayajulu@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/qla4xxx/ql4_isr.c57
-rw-r--r--drivers/scsi/qla4xxx/ql4_version.h2
2 files changed, 33 insertions, 26 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index b47bd85f114d..4a154beb0d39 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -93,9 +93,29 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
93 break; 93 break;
94 } 94 }
95 95
96 if (sts_entry->iscsiFlags & 96 if (sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_OVER) {
97 (ISCSI_FLAG_RESIDUAL_OVER|ISCSI_FLAG_RESIDUAL_UNDER)) 97 cmd->result = DID_ERROR << 16;
98 break;
99 }
100
101 if (sts_entry->iscsiFlags &ISCSI_FLAG_RESIDUAL_UNDER) {
98 scsi_set_resid(cmd, residual); 102 scsi_set_resid(cmd, residual);
103 if (!scsi_status && ((scsi_bufflen(cmd) - residual) <
104 cmd->underflow)) {
105
106 cmd->result = DID_ERROR << 16;
107
108 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: "
109 "Mid-layer Data underrun0, "
110 "xferlen = 0x%x, "
111 "residual = 0x%x\n", ha->host_no,
112 cmd->device->channel,
113 cmd->device->id,
114 cmd->device->lun, __func__,
115 scsi_bufflen(cmd), residual));
116 break;
117 }
118 }
99 119
100 cmd->result = DID_OK << 16 | scsi_status; 120 cmd->result = DID_OK << 16 | scsi_status;
101 121
@@ -164,7 +184,8 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
164 184
165 case SCS_DATA_UNDERRUN: 185 case SCS_DATA_UNDERRUN:
166 case SCS_DATA_OVERRUN: 186 case SCS_DATA_OVERRUN:
167 if (sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_OVER) { 187 if ((sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_OVER) ||
188 (sts_entry->completionStatus == SCS_DATA_OVERRUN)) {
168 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: " "Data overrun, " 189 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: " "Data overrun, "
169 "residual = 0x%x\n", ha->host_no, 190 "residual = 0x%x\n", ha->host_no,
170 cmd->device->channel, cmd->device->id, 191 cmd->device->channel, cmd->device->id,
@@ -174,21 +195,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
174 break; 195 break;
175 } 196 }
176 197
177 if ((sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_UNDER) == 0) { 198 scsi_set_resid(cmd, residual);
178 /*
179 * Firmware detected a SCSI transport underrun
180 * condition
181 */
182 scsi_set_resid(cmd, residual);
183 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: UNDERRUN status "
184 "detected, xferlen = 0x%x, residual = "
185 "0x%x\n",
186 ha->host_no, cmd->device->channel,
187 cmd->device->id,
188 cmd->device->lun, __func__,
189 scsi_bufflen(cmd),
190 residual));
191 }
192 199
193 /* 200 /*
194 * If there is scsi_status, it takes precedense over 201 * If there is scsi_status, it takes precedense over
@@ -245,13 +252,13 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
245 * will return DID_ERROR. 252 * will return DID_ERROR.
246 */ 253 */
247 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: " 254 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: "
248 "Mid-layer Data underrun, " 255 "Mid-layer Data underrun1, "
249 "xferlen = 0x%x, " 256 "xferlen = 0x%x, "
250 "residual = 0x%x\n", ha->host_no, 257 "residual = 0x%x\n", ha->host_no,
251 cmd->device->channel, 258 cmd->device->channel,
252 cmd->device->id, 259 cmd->device->id,
253 cmd->device->lun, __func__, 260 cmd->device->lun, __func__,
254 scsi_bufflen(cmd), residual)); 261 scsi_bufflen(cmd), residual));
255 262
256 cmd->result = DID_ERROR << 16; 263 cmd->result = DID_ERROR << 16;
257 } else { 264 } else {
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
index 2149069689bd..ab984cb89cea 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,5 +5,5 @@
5 * See LICENSE.qla4xxx for copyright and licensing details. 5 * See LICENSE.qla4xxx for copyright and licensing details.
6 */ 6 */
7 7
8#define QLA4XXX_DRIVER_VERSION "5.01.00-k7" 8#define QLA4XXX_DRIVER_VERSION "5.01.00-k8"
9 9