From: <vl...@us...> - 2006-10-20 18:30:02
|
Revision: 11 http://svn.sourceforge.net/scst/?rev=11&view=rev Author: vlnb Date: 2006-10-20 11:29:55 -0700 (Fri, 20 Oct 2006) Log Message: ----------- Debugging cleanups Modified Paths: -------------- trunk/qla2x00t/qla2x00-target/qla2x00t.c Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-10-20 18:18:46 UTC (rev 10) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-10-20 18:29:55 UTC (rev 11) @@ -772,10 +772,10 @@ prm.residual = le32_to_cpu(prm.cmd->atio.data_length) - prm.bufflen; if (prm.residual > 0) { - TRACE_MGMT_DBG("Residual underflow: %d", prm.residual); + TRACE_DBG("Residual underflow: %d", prm.residual); prm.rq_result |= SS_RESIDUAL_UNDER; } else if (prm.residual < 0) { - TRACE_MGMT_DBG("Residual overflow: %d", prm.residual); + TRACE_DBG("Residual overflow: %d", prm.residual); prm.rq_result |= SS_RESIDUAL_OVER; prm.residual = -prm.residual; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-11-02 18:38:57
|
Revision: 25 http://svn.sourceforge.net/scst/?rev=25&view=rev Author: vlnb Date: 2006-11-02 04:08:28 -0800 (Thu, 02 Nov 2006) Log Message: ----------- Minor cleanup Modified Paths: -------------- trunk/qla2x00t/qla2x00-target/qla2x00t.c Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 12:03:39 UTC (rev 24) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 12:08:28 UTC (rev 25) @@ -77,10 +77,6 @@ # endif #endif -#if defined(DEBUG) || defined(TRACING) -unsigned long trace_flag = SCST_DEFAULT_QLA_LOG_FLAGS; -#endif - static int q2t_target_detect(struct scst_tgt_template *templ); static int q2t_target_release(struct scst_tgt *scst_tgt); static int q2t_xmit_response(struct scst_cmd *scst_cmd); @@ -104,6 +100,10 @@ * Global Variables */ +#if defined(DEBUG) || defined(TRACING) +unsigned long trace_flag = SCST_DEFAULT_QLA_LOG_FLAGS; +#endif + struct scst_tgt_template tgt_template = { name:"qla2x00tgt", sg_tablesize:0, @@ -123,8 +123,8 @@ task_mgmt_fn_done:q2t_task_mgmt_fn_done, }; +kmem_cache_t *q2t_cmd_cachep = NULL; static struct qla2x_tgt_target tgt_data; -kmem_cache_t *q2t_cmd_cachep = NULL; /* * Functions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2006-11-02 18:40:13
|
Revision: 20 http://svn.sourceforge.net/scst/?rev=20&view=rev Author: vlnb Date: 2006-11-02 02:43:12 -0800 (Thu, 02 Nov 2006) Log Message: ----------- The first attempt to fix the "Unable to find wwn login for loop id 2, using loop id instead" problem Modified Paths: -------------- trunk/qla2x00t/qla2x00-target/qla2x00t.c Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-10-27 10:43:58 UTC (rev 19) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2006-11-02 10:43:12 UTC (rev 20) @@ -112,7 +112,8 @@ static void q2t_ctio_completion(scsi_qla_host_t *ha, uint32_t handle); static void q2t_host_action(scsi_qla_host_t *ha, qla2x_tgt_host_action_t action); -static void q2x_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd); +static void q2t_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd, + atio_entry_t *atio); /* * Global Variables @@ -710,7 +711,7 @@ prm.cmd->state = Q2T_STATE_ABORTED; - q2x_send_term_exchange(ha, prm.cmd); + q2t_send_term_exchange(ha, prm.cmd, &prm.cmd->atio); /* !! At this point cmd could be already freed !! */ goto out; } @@ -895,10 +896,10 @@ return res; } -static void q2x_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd) +static void q2t_send_term_exchange(scsi_qla_host_t *ha, struct q2t_cmd *cmd, + atio_entry_t *atio) { ctio_ret_entry_t *ctio; - atio_entry_t *atio = &cmd->atio; unsigned long flags; int do_tgt_cmd_done = 0; @@ -925,15 +926,19 @@ ctio->entry_type = CTIO_RET_TYPE; ctio->entry_count = 1; - ctio->handle = q2t_make_handle(ha); - if (ctio->handle != Q2T_NULL_HANDLE) { - ha->cmds[ctio->handle] = cmd; - ctio->handle |= CTIO_COMPLETION_HANDLE_MARK; - } else { - ctio->handle = Q2T_SKIP_HANDLE | CTIO_COMPLETION_HANDLE_MARK; - do_tgt_cmd_done = 1; - } + if (cmd != NULL) { + ctio->handle = q2t_make_handle(ha); + if (ctio->handle != Q2T_NULL_HANDLE) { + ha->cmds[ctio->handle] = cmd; + } else { + ctio->handle = Q2T_SKIP_HANDLE; + do_tgt_cmd_done = 1; + } + } else + ctio->handle = Q2T_SKIP_HANDLE; + ctio->handle |= CTIO_COMPLETION_HANDLE_MARK; + SET_TARGET_ID(ha, ctio->target, GET_TARGET_ID(ha, atio)); ctio->exchange_id = atio->exchange_id; @@ -1274,7 +1279,6 @@ return; } - static char *q2t_make_name(scsi_qla_host_t *ha, int loop_id) #ifdef FC_SCST_WWN_AUTH { @@ -1303,11 +1307,19 @@ } if (wwn_found == 0) { - PRINT_ERROR("qla2x00tgt(%ld): Unable to find wwn login for " +#if 0 + PRINT_ERROR("qla2x00tgt(%ld): Unable to find wwn login for " "loop id %d, using loop id instead", ha->instance, loop_id); - snprintf(wwn_str, 2*WWN_SIZE, "%d", loop_id); + snprintf(wwn_str, 2*WWN_SIZE, "%d", loop_id); +#else + TRACE_DBG("qla2x00tgt(%ld): Unable to find wwn login for " + "loop id %d", ha->instance, loop_id); + kfree(wwn_str); + wwn_str = NULL; +#endif } + out: return wwn_str; } @@ -1386,8 +1398,10 @@ /* register session (remote initiator) */ { char *name = q2t_make_name(ha, loop_id); - if (name == NULL) + if (name == NULL) { + res = -ESRCH; goto out_free_sess; + } sess->scst_sess = scst_register_session( tgt->scst_tgt, 1, name, sess, q2t_alloc_session_done); @@ -1733,6 +1747,7 @@ switch (pkt->entry_type) { case ACCEPT_TGT_IO_TYPE: if (ha->flags.enable_target_mode && ha->tgt != NULL) { + int rc; atio = (atio_entry_t *)pkt; TRACE_DBG("ACCEPT_TGT_IO instance %ld status %04x " "lun %04x read/write %d data_length %08x " @@ -1752,12 +1767,17 @@ } TRACE_BUFF_FLAG(TRACE_SCSI, "CDB", atio->cdb, sizeof(atio->cdb)); - if (q2t_send_cmd_to_scst(ha, atio) != 0) { - PRINT_INFO("qla2x00tgt(%ld): Unable to send " - "the command to SCSI target " - "mid-level, sending BUSY status", - ha->instance); - q2t_send_busy(ha, atio); + rc = q2t_send_cmd_to_scst(ha, atio); + if (unlikely(rc != 0)) { + if (rc == -ESRCH) { + q2t_send_term_exchange(ha, NULL, atio); + } else { + PRINT_INFO("qla2x00tgt(%ld): Unable to " + "send the command to SCSI target " + "mid-level, sending BUSY status", + ha->instance); + q2t_send_busy(ha, atio); + } } } else { PRINT_ERROR("qla2x00tgt(%ld): ATIO, but target mode " This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-02-19 10:47:26
|
Revision: 88 http://svn.sourceforge.net/scst/?rev=88&view=rev Author: vlnb Date: 2007-02-19 02:46:53 -0800 (Mon, 19 Feb 2007) Log Message: ----------- Minor fix for ABORTed on SIRQ commands Modified Paths: -------------- trunk/qla2x00t/qla2x00-target/qla2x00t.c Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-02-16 11:11:18 UTC (rev 87) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-02-19 10:46:53 UTC (rev 88) @@ -924,7 +924,7 @@ if (!ha_locked) spin_unlock_irqrestore(&ha->hardware_lock, flags); - if (do_tgt_cmd_done) { + if (do_tgt_cmd_done && !in_interrupt()) { msleep(250); scst_tgt_cmd_done(cmd->scst_cmd); /* !! At this point cmd could be already freed !! */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-02-19 12:56:03
|
Revision: 89 http://svn.sourceforge.net/scst/?rev=89&view=rev Author: vlnb Date: 2007-02-19 04:55:54 -0800 (Mon, 19 Feb 2007) Log Message: ----------- Oops, the previous commit was wrong. Fix it. Modified Paths: -------------- trunk/qla2x00t/qla2x00-target/qla2x00t.c Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-02-19 10:46:53 UTC (rev 88) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-02-19 12:55:54 UTC (rev 89) @@ -924,8 +924,9 @@ if (!ha_locked) spin_unlock_irqrestore(&ha->hardware_lock, flags); - if (do_tgt_cmd_done && !in_interrupt()) { - msleep(250); + if (do_tgt_cmd_done) { + if (!in_interrupt()) + msleep(250); scst_tgt_cmd_done(cmd->scst_cmd); /* !! At this point cmd could be already freed !! */ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-12-11 10:51:14
|
Revision: 231 http://scst.svn.sourceforge.net/scst/?rev=231&view=rev Author: vlnb Date: 2007-12-11 02:51:08 -0800 (Tue, 11 Dec 2007) Log Message: ----------- Fixed possible crash if tgt module rmmod'ed under load Modified Paths: -------------- trunk/qla2x00t/qla2x00-target/qla2x00t.c Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-12-10 12:09:07 UTC (rev 230) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-12-11 10:51:08 UTC (rev 231) @@ -66,8 +66,6 @@ static void q2t_task_mgmt_fn_done(struct scst_mgmt_cmd *mcmd); /* Predefs for callbacks handed to qla2xxx(target) */ -static void q2t_host_action(scsi_qla_host_t *ha, - qla2x_tgt_host_action_t action); static void q2t_response_pkt(scsi_qla_host_t *ha, sts_entry_t *pkt); static void q2t_async_event(uint16_t code, scsi_qla_host_t *ha, uint16_t *mailbox); @@ -396,8 +394,11 @@ "sess_count=%d", tgt, list_empty(&tgt->sess_list), tgt->sess_count); + /* The lock is needed, because we still can get an incoming packet */ + spin_lock_irqsave(&ha->hardware_lock, flags); scst_tgt_set_tgt_priv(scst_tgt, NULL); ha->tgt = NULL; + spin_unlock_irqrestore(&ha->hardware_lock, flags); kfree(tgt); @@ -1734,6 +1735,12 @@ atio_entry_t *atio; TRACE_ENTRY(); + + 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)); @@ -1922,7 +1929,7 @@ sBUG_ON(ha == NULL); - if (ha->tgt == NULL) { + if (unlikely(ha->tgt == NULL)) { TRACE(TRACE_DEBUG|TRACE_MGMT, "ASYNC EVENT %#x, but no tgt. ha %p tgt_flag %d", code, ha, ha->flags.enable_target_mode); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2007-07-18 08:50:51
|
Revision: 151 http://svn.sourceforge.net/scst/?rev=151&view=rev Author: vlnb Date: 2007-07-18 01:50:50 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Update for 64-bit tags Modified Paths: -------------- trunk/qla2x00t/qla2x00-target/qla2x00t.c Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-07-18 08:41:44 UTC (rev 150) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-07-18 08:50:50 UTC (rev 151) @@ -689,7 +689,7 @@ uint16_t full_req_cnt; TRACE_ENTRY(); - TRACE(TRACE_SCSI, "tag=%d", scst_cmd_get_tag(scst_cmd)); + TRACE(TRACE_SCSI, "tag=%Ld", scst_cmd_get_tag(scst_cmd)); prm.cmd = (struct q2t_cmd *)scst_cmd_get_tgt_priv(scst_cmd); sess = (struct q2t_sess *) @@ -699,7 +699,7 @@ scsi_qla_host_t *ha = sess->tgt->ha; TRACE(TRACE_MGMT, "qla2x00tgt(%ld): terminating exchange " - "for aborted scst_cmd=%p (tag=%d)", + "for aborted scst_cmd=%p (tag=%Ld)", ha->instance, scst_cmd, scst_cmd_get_tag(scst_cmd)); prm.cmd->state = Q2T_STATE_ABORTED; @@ -835,7 +835,7 @@ struct q2t_prm prm = { 0 }; TRACE_ENTRY(); - TRACE(TRACE_SCSI, "tag=%d", scst_cmd_get_tag(scst_cmd)); + TRACE(TRACE_SCSI, "tag=%Ld", scst_cmd_get_tag(scst_cmd)); prm.cmd = (struct q2t_cmd *)scst_cmd_get_tgt_priv(scst_cmd); sess = (struct q2t_sess *) @@ -969,7 +969,7 @@ struct q2t_cmd *cmd = (struct q2t_cmd *)scst_cmd_get_tgt_priv(scst_cmd); TRACE_ENTRY(); - TRACE(TRACE_SCSI, "END Command tag %d", scst_cmd_get_tag(scst_cmd)); + TRACE(TRACE_SCSI, "END Command tag %Ld", scst_cmd_get_tag(scst_cmd)); scst_cmd_set_tgt_priv(scst_cmd, NULL); @@ -1258,7 +1258,7 @@ #endif TRACE_DBG("Context %x", context); - TRACE(TRACE_SCSI, "START Command (tag %d)", scst_cmd_get_tag(cmd->scst_cmd)); + TRACE(TRACE_SCSI, "START Command (tag %Ld)", scst_cmd_get_tag(cmd->scst_cmd)); scst_cmd_init_done(cmd->scst_cmd, context); out: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |