From eb2a55ef21d20783d9f77ac8d4184529d0319f11 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 12 Dec 2007 16:06:47 +0000 Subject: [PATCH] - Fixed incorrect residual on internal BUSY replies - Cleanups and ChangeLog updates git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@232 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla2x00-target/ChangeLog | 12 ++++++------ qla2x00t/qla2x00-target/qla2x00t.c | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/qla2x00t/qla2x00-target/ChangeLog b/qla2x00t/qla2x00-target/ChangeLog index 68b4b8aed..f961ae170 100644 --- a/qla2x00t/qla2x00-target/ChangeLog +++ b/qla2x00t/qla2x00-target/ChangeLog @@ -3,7 +3,7 @@ Summary of changes between versions 0.9.5 and 0.9.6 - Support for per-target default security groups added. - - Update to work on the latest kernel (2.6.22.x). + - Updateed to work on 2.6.22.x kernels. - Updated to work with SCST 0.9.6. @@ -38,18 +38,21 @@ Patch vs: qla2xxx v8.01.03-k (in kernels 2.6.15.x+, including 2.6.16-prex) - Minor cleanups and fixes + Summary of changes between versions 0.9.3.7 and 0.9.3.8 ------------------------------------------------------- Patch vs: qla2xxx v8.01.03-k (in kernels 2.6.15.x+, including 2.6.16-prex) - Minor cleanups + Summary of changes between versions 0.9.3.6 and 0.9.3.7 ------------------------------------------------------- Patch vs: qla2xxx v8.01.03-k (in kernels 2.6.15.x+, including 2.6.16-prex) - Fix null pointer dereference in do_ctio_complete (thanks to Calvin Morrow) + Summary of changes between versions 0.9.3.5 and 0.9.3.6 ------------------------------------------------------- Patch vs: qla2xxx v8.01.03-k (in kernels 2.6.15.x+, including 2.6.16-prex) @@ -60,6 +63,7 @@ Patch vs: qla2xxx v8.01.03-k (in kernels 2.6.15.x+, including 2.6.16-prex) - Fixed possible race during initial enabling of Target Mode (thanks to Mark Buechler for finding) + Summary of changes between versions 0.9.3.4 and 0.9.3.5 ------------------------------------------------------- @@ -78,6 +82,7 @@ away w/out telling us (pointed out by Vladislav Bolkhovitin) - Some minor debugging changes + Summary of changes between versions 0.9.3.2 of old driver and 0.9.3.4 --------------------------------------------------------------------- @@ -91,8 +96,3 @@ having one for each driver type. - Target mode can be enabled via a sysfs interface on a per card basis. Under the appropriate scsi_host there is now an entry target_mode_enabled, which can read and written. - -NOTES: - -The initiator's req_pkt function has never updated the request queue pointers. -So the implementation for continuation packets, has never worked correctly. diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 0a2d2fc75..8f16029ec 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -928,6 +928,11 @@ static void q2t_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd, SET_TARGET_ID(ha, ctio->target, GET_TARGET_ID(ha, atio)); ctio->exchange_id = atio->exchange_id; + /* Most likely, it isn't needed */ + ctio->residual = atio->data_length; + if (ctio->residual != 0) + ctio->scsi_status |= SS_RESIDUAL_UNDER; + ctio->flags = __constant_cpu_to_le16(OF_FAST_POST | OF_TERM_EXCH | OF_NO_DATA | OF_SS_MODE_1); ctio->flags |= __constant_cpu_to_le16(OF_INC_RC); @@ -1168,6 +1173,9 @@ static void q2t_send_busy(scsi_qla_host_t *ha, atio_entry_t *atio) ctio->entry_count = 1; ctio->handle = Q2T_BUSY_HANDLE | CTIO_COMPLETION_HANDLE_MARK; ctio->scsi_status = __constant_cpu_to_le16(BUSY << 1); + ctio->residual = atio->data_length; + if (ctio->residual != 0) + ctio->scsi_status |= SS_RESIDUAL_UNDER; /* Set IDs */ SET_TARGET_ID(ha, ctio->target, GET_TARGET_ID(ha, atio)); @@ -1736,18 +1744,16 @@ static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt) TRACE_ENTRY(); + TRACE(TRACE_SCSI, "pkt %p: T %02x C %02x S %02x handle %#x", + pkt, pkt->entry_type, pkt->entry_count, pkt->entry_status, + pkt->handle); + if (unlikely(ha->tgt == NULL)) { TRACE_DBG("response pkt, but no tgt. ha %p tgt_flag %d", ha, ha->flags.enable_target_mode); goto out; } - sBUG_ON((ha == NULL) || (pkt == NULL)); - - TRACE(TRACE_SCSI, "pkt %p: T %02x C %02x S %02x handle %#x", - pkt, pkt->entry_type, pkt->entry_count, pkt->entry_status, - pkt->handle); - if (pkt->entry_status != 0) { PRINT_ERROR("qla2x00tgt(%ld): Received response packet %x " "with error status %x", ha->instance, pkt->entry_type,