From: <vl...@us...> - 2007-11-02 19:21:03
|
Revision: 217 http://scst.svn.sourceforge.net/scst/?rev=217&view=rev Author: vlnb Date: 2007-11-02 12:20:59 -0700 (Fri, 02 Nov 2007) Log Message: ----------- Minor pass-through related fixes and logging improvelemnts Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2007-11-02 11:02:50 UTC (rev 216) +++ trunk/scst/src/scst_lib.c 2007-11-02 19:20:59 UTC (rev 217) @@ -1696,10 +1696,10 @@ #ifdef EXTRACHECKS if (unlikely((info_p->transfer_len == 0) && - (info_p->direction != SCST_DATA_NONE)) && - !(info_p->flags & SCST_UNKNOWN_LENGTH)) { - PRINT_ERROR("transfer_len 0, direction %d change on %d", - info_p->direction, SCST_DATA_NONE); + (info_p->direction != SCST_DATA_NONE) && + ((info_p->flags & SCST_UNKNOWN_LENGTH) == 0))) { + PRINT_ERROR("transfer_len 0, direction %d, flags %x, changing " + "direction on NONE", info_p->direction, info_p->flags); info_p->direction = SCST_DATA_NONE; } #endif Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2007-11-02 11:02:50 UTC (rev 216) +++ trunk/scst/src/scst_main.c 2007-11-02 19:20:59 UTC (rev 217) @@ -1369,6 +1369,77 @@ .remove = scst_remove, }; +static void __init scst_print_config(void) +{ + char buf[128]; + int i, j; + + i = snprintf(buf, sizeof(buf), "Enabled features: "); + j = i; + +#ifdef STRICT_SERIALIZING + i += snprintf(&buf[i], sizeof(buf) - i, "Strict serializing"); +#endif + +#ifdef EXTRACHECKS + i += snprintf(&buf[i], sizeof(buf) - i, "%sEXTRACHECKS", + (j == i) ? "" : ", "); +#endif + +#ifdef TRACING + i += snprintf(&buf[i], sizeof(buf) - i, "%sTRACING", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG_TM + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_TM", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG_RETRY + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_RETRY", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG_OOM + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_OOM", + (j == i) ? "" : ", "); +#endif + +#ifdef DEBUG_SN + i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_SN", + (j == i) ? "" : ", "); +#endif + +#ifdef USE_EXPECTED_VALUES + i += snprintf(&buf[i], sizeof(buf) - i, "%sUSE_EXPECTED_VALUES", + (j == i) ? "" : ", "); +#endif + +#ifdef ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ + i += snprintf(&buf[i], sizeof(buf) - i, "%sALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ", + (j == i) ? "" : ", "); +#endif + +#ifdef SCST_STRICT_SECURITY + i += snprintf(&buf[i], sizeof(buf) - i, "%sSCST_STRICT_SECURITY", + (j == i) ? "" : ", "); +#endif + +#ifdef SCST_HIGHMEM + i += snprintf(&buf[i], sizeof(buf) - i, "%sSCST_HIGHMEM", + (j == i) ? "" : ", "); +#endif + + if (j != i) + PRINT_INFO("%s", buf); +} + static int __init init_scst(void) { int res = 0, i; @@ -1501,6 +1572,8 @@ PRINT_INFO("SCST version %s loaded successfully (max mem for " "commands %ld Mb)", SCST_VERSION_STRING, scst_max_cmd_mem >> 20); + scst_print_config(); + out: TRACE_EXIT_RES(res); return res; Modified: trunk/scst/src/scst_proc.c =================================================================== --- trunk/scst/src/scst_proc.c 2007-11-02 11:02:50 UTC (rev 216) +++ trunk/scst/src/scst_proc.c 2007-11-02 19:20:59 UTC (rev 217) @@ -1638,6 +1638,22 @@ seq_printf(seq, "DEBUG_SN\n"); #endif +#ifdef USE_EXPECTED_VALUES + seq_printf(seq, "USE_EXPECTED_VALUES\n"); +#endif + +#ifdef ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ + seq_printf(seq, "ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ\n"); +#endif + +#ifdef SCST_STRICT_SECURITY + seq_printf(seq, "SCST_STRICT_SECURITY\n"); +#endif + +#ifdef SCST_HIGHMEM + seq_printf(seq, "SCST_HIGHMEM\n"); +#endif + TRACE_EXIT(); return 0; } Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-11-02 11:02:50 UTC (rev 216) +++ trunk/scst/src/scst_targ.c 2007-11-02 19:20:59 UTC (rev 217) @@ -356,12 +356,13 @@ if (scst_cmd_is_expected_set(cmd)) { /* * Command data length can't be easily - * determined from the CDB. Get it from + * determined from the CDB. ToDo, that should + * be fixed. Until it's fixed, get it from * the supplied expected value, but - * limit it to some reasonable value (50MB). + * limit it to some reasonable value (15MB). */ cmd->bufflen = min(cmd->expected_transfer_len, - 50*1024*1024); + 15*1024*1024); } else cmd->bufflen = 0; } else @@ -428,24 +429,18 @@ goto out_error; } + if (unlikely(state == SCST_CMD_STATE_XMIT_RESP)) + goto set_res; + #ifdef EXTRACHECKS - if ((state != SCST_CMD_STATE_XMIT_RESP) && - (((cmd->data_direction == SCST_DATA_UNKNOWN) && - (state != SCST_CMD_STATE_DEV_PARSE)) || - ((cmd->bufflen != 0) && - (cmd->data_direction == SCST_DATA_NONE) && - (cmd->status == 0)) || - ((cmd->bufflen == 0) && - (cmd->data_direction != SCST_DATA_NONE)) || - ((cmd->bufflen != 0) && (cmd->sg == NULL) && - (state > SCST_CMD_STATE_PREPARE_SPACE)))) - { + if ((cmd->bufflen != 0) && + ((cmd->data_direction == SCST_DATA_NONE) || + ((cmd->sg == NULL) && (state > SCST_CMD_STATE_PREPARE_SPACE)))) { PRINT_ERROR("Dev handler %s parse() returned " - "invalid cmd data_direction %d, " - "bufflen %d or state %d (opcode 0x%x)", - dev->handler->name, - cmd->data_direction, cmd->bufflen, - state, cmd->cdb[0]); + "invalid cmd data_direction %d, bufflen %d, state %d " + "or sg %p (opcode 0x%x)", dev->handler->name, + cmd->data_direction, cmd->bufflen, state, cmd->sg, + cmd->cdb[0]); goto out_error; } #endif @@ -478,7 +473,8 @@ if (unlikely(cmd->bufflen != cmd->expected_transfer_len)) { PRINT_INFO("Warning: expected transfer length %d for " "opcode 0x%02x (handler %s, target %s) doesn't " - "match decoded value %d. Faulty initiator?", + "match decoded value %d. Faulty initiator or " + "scst_scsi_op_table should be updated?", cmd->expected_transfer_len, cmd->cdb[0], dev->handler->name, cmd->tgtt->name, cmd->bufflen); @@ -486,6 +482,16 @@ #endif } + if ((cmd->data_direction == SCST_DATA_UNKNOWN) || + ((cmd->bufflen == 0) && (cmd->data_direction != SCST_DATA_NONE))) { + PRINT_ERROR("Wrong data direction (%d) or/and buffer " + "length (%d). Opcode 0x%x, handler %s, target %s", + cmd->data_direction, cmd->bufflen, cmd->cdb[0], + dev->handler->name, cmd->tgtt->name); + goto out_error; + } + +set_res: switch (state) { case SCST_CMD_STATE_PREPARE_SPACE: case SCST_CMD_STATE_DEV_PARSE: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |