Commit 9c19a7d0 authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[SCSI] libiscsi: rename iscsi_cmd_task to iscsi_task

This is the second part of the iscsi task merging, and
all it does it rename iscsi_cmd_task to iscsi_task and
mtask/ctask to just task.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 2747fdb2
...@@ -88,61 +88,61 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr) ...@@ -88,61 +88,61 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)
} }
EXPORT_SYMBOL_GPL(iscsi_update_cmdsn); EXPORT_SYMBOL_GPL(iscsi_update_cmdsn);
void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *ctask, void iscsi_prep_unsolicit_data_pdu(struct iscsi_task *task,
struct iscsi_data *hdr) struct iscsi_data *hdr)
{ {
struct iscsi_conn *conn = ctask->conn; struct iscsi_conn *conn = task->conn;
memset(hdr, 0, sizeof(struct iscsi_data)); memset(hdr, 0, sizeof(struct iscsi_data));
hdr->ttt = cpu_to_be32(ISCSI_RESERVED_TAG); hdr->ttt = cpu_to_be32(ISCSI_RESERVED_TAG);
hdr->datasn = cpu_to_be32(ctask->unsol_datasn); hdr->datasn = cpu_to_be32(task->unsol_datasn);
ctask->unsol_datasn++; task->unsol_datasn++;
hdr->opcode = ISCSI_OP_SCSI_DATA_OUT; hdr->opcode = ISCSI_OP_SCSI_DATA_OUT;
memcpy(hdr->lun, ctask->hdr->lun, sizeof(hdr->lun)); memcpy(hdr->lun, task->hdr->lun, sizeof(hdr->lun));
hdr->itt = ctask->hdr->itt; hdr->itt = task->hdr->itt;
hdr->exp_statsn = cpu_to_be32(conn->exp_statsn); hdr->exp_statsn = cpu_to_be32(conn->exp_statsn);
hdr->offset = cpu_to_be32(ctask->unsol_offset); hdr->offset = cpu_to_be32(task->unsol_offset);
if (ctask->unsol_count > conn->max_xmit_dlength) { if (task->unsol_count > conn->max_xmit_dlength) {
hton24(hdr->dlength, conn->max_xmit_dlength); hton24(hdr->dlength, conn->max_xmit_dlength);
ctask->data_count = conn->max_xmit_dlength; task->data_count = conn->max_xmit_dlength;
ctask->unsol_offset += ctask->data_count; task->unsol_offset += task->data_count;
hdr->flags = 0; hdr->flags = 0;
} else { } else {
hton24(hdr->dlength, ctask->unsol_count); hton24(hdr->dlength, task->unsol_count);
ctask->data_count = ctask->unsol_count; task->data_count = task->unsol_count;
hdr->flags = ISCSI_FLAG_CMD_FINAL; hdr->flags = ISCSI_FLAG_CMD_FINAL;
} }
} }
EXPORT_SYMBOL_GPL(iscsi_prep_unsolicit_data_pdu); EXPORT_SYMBOL_GPL(iscsi_prep_unsolicit_data_pdu);
static int iscsi_add_hdr(struct iscsi_cmd_task *ctask, unsigned len) static int iscsi_add_hdr(struct iscsi_task *task, unsigned len)
{ {
unsigned exp_len = ctask->hdr_len + len; unsigned exp_len = task->hdr_len + len;
if (exp_len > ctask->hdr_max) { if (exp_len > task->hdr_max) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
WARN_ON(len & (ISCSI_PAD_LEN - 1)); /* caller must pad the AHS */ WARN_ON(len & (ISCSI_PAD_LEN - 1)); /* caller must pad the AHS */
ctask->hdr_len = exp_len; task->hdr_len = exp_len;
return 0; return 0;
} }
/* /*
* make an extended cdb AHS * make an extended cdb AHS
*/ */
static int iscsi_prep_ecdb_ahs(struct iscsi_cmd_task *ctask) static int iscsi_prep_ecdb_ahs(struct iscsi_task *task)
{ {
struct scsi_cmnd *cmd = ctask->sc; struct scsi_cmnd *cmd = task->sc;
unsigned rlen, pad_len; unsigned rlen, pad_len;
unsigned short ahslength; unsigned short ahslength;
struct iscsi_ecdb_ahdr *ecdb_ahdr; struct iscsi_ecdb_ahdr *ecdb_ahdr;
int rc; int rc;
ecdb_ahdr = iscsi_next_hdr(ctask); ecdb_ahdr = iscsi_next_hdr(task);
rlen = cmd->cmd_len - ISCSI_CDB_SIZE; rlen = cmd->cmd_len - ISCSI_CDB_SIZE;
BUG_ON(rlen > sizeof(ecdb_ahdr->ecdb)); BUG_ON(rlen > sizeof(ecdb_ahdr->ecdb));
...@@ -150,7 +150,7 @@ static int iscsi_prep_ecdb_ahs(struct iscsi_cmd_task *ctask) ...@@ -150,7 +150,7 @@ static int iscsi_prep_ecdb_ahs(struct iscsi_cmd_task *ctask)
pad_len = iscsi_padding(rlen); pad_len = iscsi_padding(rlen);
rc = iscsi_add_hdr(ctask, sizeof(ecdb_ahdr->ahslength) + rc = iscsi_add_hdr(task, sizeof(ecdb_ahdr->ahslength) +
sizeof(ecdb_ahdr->ahstype) + ahslength + pad_len); sizeof(ecdb_ahdr->ahstype) + ahslength + pad_len);
if (rc) if (rc)
return rc; return rc;
...@@ -165,19 +165,19 @@ static int iscsi_prep_ecdb_ahs(struct iscsi_cmd_task *ctask) ...@@ -165,19 +165,19 @@ static int iscsi_prep_ecdb_ahs(struct iscsi_cmd_task *ctask)
debug_scsi("iscsi_prep_ecdb_ahs: varlen_cdb_len %d " debug_scsi("iscsi_prep_ecdb_ahs: varlen_cdb_len %d "
"rlen %d pad_len %d ahs_length %d iscsi_headers_size %u\n", "rlen %d pad_len %d ahs_length %d iscsi_headers_size %u\n",
cmd->cmd_len, rlen, pad_len, ahslength, ctask->hdr_len); cmd->cmd_len, rlen, pad_len, ahslength, task->hdr_len);
return 0; return 0;
} }
static int iscsi_prep_bidi_ahs(struct iscsi_cmd_task *ctask) static int iscsi_prep_bidi_ahs(struct iscsi_task *task)
{ {
struct scsi_cmnd *sc = ctask->sc; struct scsi_cmnd *sc = task->sc;
struct iscsi_rlength_ahdr *rlen_ahdr; struct iscsi_rlength_ahdr *rlen_ahdr;
int rc; int rc;
rlen_ahdr = iscsi_next_hdr(ctask); rlen_ahdr = iscsi_next_hdr(task);
rc = iscsi_add_hdr(ctask, sizeof(*rlen_ahdr)); rc = iscsi_add_hdr(task, sizeof(*rlen_ahdr));
if (rc) if (rc)
return rc; return rc;
...@@ -197,28 +197,28 @@ static int iscsi_prep_bidi_ahs(struct iscsi_cmd_task *ctask) ...@@ -197,28 +197,28 @@ static int iscsi_prep_bidi_ahs(struct iscsi_cmd_task *ctask)
/** /**
* iscsi_prep_scsi_cmd_pdu - prep iscsi scsi cmd pdu * iscsi_prep_scsi_cmd_pdu - prep iscsi scsi cmd pdu
* @ctask: iscsi task * @task: iscsi task
* *
* Prep basic iSCSI PDU fields for a scsi cmd pdu. The LLD should set * Prep basic iSCSI PDU fields for a scsi cmd pdu. The LLD should set
* fields like dlength or final based on how much data it sends * fields like dlength or final based on how much data it sends
*/ */
static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask) static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
{ {
struct iscsi_conn *conn = ctask->conn; struct iscsi_conn *conn = task->conn;
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct iscsi_cmd *hdr = ctask->hdr; struct iscsi_cmd *hdr = task->hdr;
struct scsi_cmnd *sc = ctask->sc; struct scsi_cmnd *sc = task->sc;
unsigned hdrlength, cmd_len; unsigned hdrlength, cmd_len;
int rc; int rc;
ctask->hdr_len = 0; task->hdr_len = 0;
rc = iscsi_add_hdr(ctask, sizeof(*hdr)); rc = iscsi_add_hdr(task, sizeof(*hdr));
if (rc) if (rc)
return rc; return rc;
hdr->opcode = ISCSI_OP_SCSI_CMD; hdr->opcode = ISCSI_OP_SCSI_CMD;
hdr->flags = ISCSI_ATTR_SIMPLE; hdr->flags = ISCSI_ATTR_SIMPLE;
int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun);
hdr->itt = build_itt(ctask->itt, session->age); hdr->itt = build_itt(task->itt, session->age);
hdr->cmdsn = cpu_to_be32(session->cmdsn); hdr->cmdsn = cpu_to_be32(session->cmdsn);
session->cmdsn++; session->cmdsn++;
hdr->exp_statsn = cpu_to_be32(conn->exp_statsn); hdr->exp_statsn = cpu_to_be32(conn->exp_statsn);
...@@ -226,17 +226,17 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask) ...@@ -226,17 +226,17 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
if (cmd_len < ISCSI_CDB_SIZE) if (cmd_len < ISCSI_CDB_SIZE)
memset(&hdr->cdb[cmd_len], 0, ISCSI_CDB_SIZE - cmd_len); memset(&hdr->cdb[cmd_len], 0, ISCSI_CDB_SIZE - cmd_len);
else if (cmd_len > ISCSI_CDB_SIZE) { else if (cmd_len > ISCSI_CDB_SIZE) {
rc = iscsi_prep_ecdb_ahs(ctask); rc = iscsi_prep_ecdb_ahs(task);
if (rc) if (rc)
return rc; return rc;
cmd_len = ISCSI_CDB_SIZE; cmd_len = ISCSI_CDB_SIZE;
} }
memcpy(hdr->cdb, sc->cmnd, cmd_len); memcpy(hdr->cdb, sc->cmnd, cmd_len);
ctask->imm_count = 0; task->imm_count = 0;
if (scsi_bidi_cmnd(sc)) { if (scsi_bidi_cmnd(sc)) {
hdr->flags |= ISCSI_FLAG_CMD_READ; hdr->flags |= ISCSI_FLAG_CMD_READ;
rc = iscsi_prep_bidi_ahs(ctask); rc = iscsi_prep_bidi_ahs(task);
if (rc) if (rc)
return rc; return rc;
} }
...@@ -258,28 +258,28 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask) ...@@ -258,28 +258,28 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
* *
* pad_count bytes to be sent as zero-padding * pad_count bytes to be sent as zero-padding
*/ */
ctask->unsol_count = 0; task->unsol_count = 0;
ctask->unsol_offset = 0; task->unsol_offset = 0;
ctask->unsol_datasn = 0; task->unsol_datasn = 0;
if (session->imm_data_en) { if (session->imm_data_en) {
if (out_len >= session->first_burst) if (out_len >= session->first_burst)
ctask->imm_count = min(session->first_burst, task->imm_count = min(session->first_burst,
conn->max_xmit_dlength); conn->max_xmit_dlength);
else else
ctask->imm_count = min(out_len, task->imm_count = min(out_len,
conn->max_xmit_dlength); conn->max_xmit_dlength);
hton24(hdr->dlength, ctask->imm_count); hton24(hdr->dlength, task->imm_count);
} else } else
zero_data(hdr->dlength); zero_data(hdr->dlength);
if (!session->initial_r2t_en) { if (!session->initial_r2t_en) {
ctask->unsol_count = min(session->first_burst, out_len) task->unsol_count = min(session->first_burst, out_len)
- ctask->imm_count; - task->imm_count;
ctask->unsol_offset = ctask->imm_count; task->unsol_offset = task->imm_count;
} }
if (!ctask->unsol_count) if (!task->unsol_count)
/* No unsolicit Data-Out's */ /* No unsolicit Data-Out's */
hdr->flags |= ISCSI_FLAG_CMD_FINAL; hdr->flags |= ISCSI_FLAG_CMD_FINAL;
} else { } else {
...@@ -292,7 +292,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask) ...@@ -292,7 +292,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
} }
/* calculate size of additional header segments (AHSs) */ /* calculate size of additional header segments (AHSs) */
hdrlength = ctask->hdr_len - sizeof(*hdr); hdrlength = task->hdr_len - sizeof(*hdr);
WARN_ON(hdrlength & (ISCSI_PAD_LEN-1)); WARN_ON(hdrlength & (ISCSI_PAD_LEN-1));
hdrlength /= ISCSI_PAD_LEN; hdrlength /= ISCSI_PAD_LEN;
...@@ -301,17 +301,17 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask) ...@@ -301,17 +301,17 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
hdr->hlength = hdrlength & 0xFF; hdr->hlength = hdrlength & 0xFF;
if (conn->session->tt->init_task && if (conn->session->tt->init_task &&
conn->session->tt->init_task(ctask)) conn->session->tt->init_task(task))
return -EIO; return -EIO;
ctask->state = ISCSI_TASK_RUNNING; task->state = ISCSI_TASK_RUNNING;
list_move_tail(&ctask->running, &conn->run_list); list_move_tail(&task->running, &conn->run_list);
conn->scsicmd_pdus_cnt++; conn->scsicmd_pdus_cnt++;
debug_scsi("iscsi prep [%s cid %d sc %p cdb 0x%x itt 0x%x len %d " debug_scsi("iscsi prep [%s cid %d sc %p cdb 0x%x itt 0x%x len %d "
"bidi_len %d cmdsn %d win %d]\n", scsi_bidi_cmnd(sc) ? "bidi_len %d cmdsn %d win %d]\n", scsi_bidi_cmnd(sc) ?
"bidirectional" : sc->sc_data_direction == DMA_TO_DEVICE ? "bidirectional" : sc->sc_data_direction == DMA_TO_DEVICE ?
"write" : "read", conn->id, sc, sc->cmnd[0], ctask->itt, "write" : "read", conn->id, sc, sc->cmnd[0], task->itt,
scsi_bufflen(sc), scsi_bufflen(sc),
scsi_bidi_cmnd(sc) ? scsi_in(sc)->length : 0, scsi_bidi_cmnd(sc) ? scsi_in(sc)->length : 0,
session->cmdsn, session->max_cmdsn - session->exp_cmdsn + 1); session->cmdsn, session->max_cmdsn - session->exp_cmdsn + 1);
...@@ -320,37 +320,37 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask) ...@@ -320,37 +320,37 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
/** /**
* iscsi_complete_command - finish a task * iscsi_complete_command - finish a task
* @ctask: iscsi cmd task * @task: iscsi cmd task
* *
* Must be called with session lock. * Must be called with session lock.
* This function returns the scsi command to scsi-ml or cleans * This function returns the scsi command to scsi-ml or cleans
* up mgmt tasks then returns the task to the pool. * up mgmt tasks then returns the task to the pool.
*/ */
static void iscsi_complete_command(struct iscsi_cmd_task *ctask) static void iscsi_complete_command(struct iscsi_task *task)
{ {
struct iscsi_conn *conn = ctask->conn; struct iscsi_conn *conn = task->conn;
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct scsi_cmnd *sc = ctask->sc; struct scsi_cmnd *sc = task->sc;
list_del_init(&ctask->running); list_del_init(&task->running);
ctask->state = ISCSI_TASK_COMPLETED; task->state = ISCSI_TASK_COMPLETED;
ctask->sc = NULL; task->sc = NULL;
if (conn->ctask == ctask) if (conn->task == task)
conn->ctask = NULL; conn->task = NULL;
/* /*
* login ctask is preallocated so do not free * login task is preallocated so do not free
*/ */
if (conn->login_ctask == ctask) if (conn->login_task == task)
return; return;
__kfifo_put(session->cmdpool.queue, (void*)&ctask, sizeof(void*)); __kfifo_put(session->cmdpool.queue, (void*)&task, sizeof(void*));
if (conn->ping_ctask == ctask) if (conn->ping_task == task)
conn->ping_ctask = NULL; conn->ping_task = NULL;
if (sc) { if (sc) {
ctask->sc = NULL; task->sc = NULL;
/* SCSI eh reuses commands to verify us */ /* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL; sc->SCp.ptr = NULL;
/* /*
...@@ -362,47 +362,47 @@ static void iscsi_complete_command(struct iscsi_cmd_task *ctask) ...@@ -362,47 +362,47 @@ static void iscsi_complete_command(struct iscsi_cmd_task *ctask)
} }
} }
static void __iscsi_get_ctask(struct iscsi_cmd_task *ctask) static void __iscsi_get_task(struct iscsi_task *task)
{ {
atomic_inc(&ctask->refcount); atomic_inc(&task->refcount);
} }
static void __iscsi_put_ctask(struct iscsi_cmd_task *ctask) static void __iscsi_put_task(struct iscsi_task *task)
{ {
if (atomic_dec_and_test(&ctask->refcount)) if (atomic_dec_and_test(&task->refcount))
iscsi_complete_command(ctask); iscsi_complete_command(task);
} }
void iscsi_put_ctask(struct iscsi_cmd_task *ctask) void iscsi_put_task(struct iscsi_task *task)
{ {
struct iscsi_session *session = ctask->conn->session; struct iscsi_session *session = task->conn->session;
spin_lock_bh(&session->lock); spin_lock_bh(&session->lock);
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
spin_unlock_bh(&session->lock); spin_unlock_bh(&session->lock);
} }
EXPORT_SYMBOL_GPL(iscsi_put_ctask); EXPORT_SYMBOL_GPL(iscsi_put_task);
/* /*
* session lock must be held * session lock must be held
*/ */
static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task,
int err) int err)
{ {
struct scsi_cmnd *sc; struct scsi_cmnd *sc;
sc = ctask->sc; sc = task->sc;
if (!sc) if (!sc)
return; return;
if (ctask->state == ISCSI_TASK_PENDING) if (task->state == ISCSI_TASK_PENDING)
/* /*
* cmd never made it to the xmit thread, so we should not count * cmd never made it to the xmit thread, so we should not count
* the cmd in the sequencing * the cmd in the sequencing
*/ */
conn->session->queued_cmdsn--; conn->session->queued_cmdsn--;
else else
conn->session->tt->cleanup_task(conn, ctask); conn->session->tt->cleanup_task(conn, task);
sc->result = err; sc->result = err;
...@@ -413,17 +413,17 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, ...@@ -413,17 +413,17 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
scsi_in(sc)->resid = scsi_in(sc)->length; scsi_in(sc)->resid = scsi_in(sc)->length;
} }
if (conn->ctask == ctask) if (conn->task == task)
conn->ctask = NULL; conn->task = NULL;
/* release ref from queuecommand */ /* release ref from queuecommand */
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
} }
static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, static int iscsi_prep_mgmt_task(struct iscsi_conn *conn,
struct iscsi_cmd_task *ctask) struct iscsi_task *task)
{ {
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct iscsi_hdr *hdr = (struct iscsi_hdr *)ctask->hdr; struct iscsi_hdr *hdr = (struct iscsi_hdr *)task->hdr;
struct iscsi_nopout *nop = (struct iscsi_nopout *)hdr; struct iscsi_nopout *nop = (struct iscsi_nopout *)hdr;
if (conn->session->state == ISCSI_STATE_LOGGING_OUT) if (conn->session->state == ISCSI_STATE_LOGGING_OUT)
...@@ -437,7 +437,7 @@ static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, ...@@ -437,7 +437,7 @@ static int iscsi_prep_mgmt_task(struct iscsi_conn *conn,
*/ */
nop->cmdsn = cpu_to_be32(session->cmdsn); nop->cmdsn = cpu_to_be32(session->cmdsn);
if (hdr->itt != RESERVED_ITT) { if (hdr->itt != RESERVED_ITT) {
hdr->itt = build_itt(ctask->itt, session->age); hdr->itt = build_itt(task->itt, session->age);
/* /*
* TODO: We always use immediate, so we never hit this. * TODO: We always use immediate, so we never hit this.
* If we start to send tmfs or nops as non-immediate then * If we start to send tmfs or nops as non-immediate then
...@@ -451,24 +451,24 @@ static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, ...@@ -451,24 +451,24 @@ static int iscsi_prep_mgmt_task(struct iscsi_conn *conn,
} }
if (session->tt->init_task) if (session->tt->init_task)
session->tt->init_task(ctask); session->tt->init_task(task);
if ((hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGOUT) if ((hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGOUT)
session->state = ISCSI_STATE_LOGGING_OUT; session->state = ISCSI_STATE_LOGGING_OUT;
list_move_tail(&ctask->running, &conn->mgmt_run_list); list_move_tail(&task->running, &conn->mgmt_run_list);
debug_scsi("mgmtpdu [op 0x%x hdr->itt 0x%x datalen %d]\n", debug_scsi("mgmtpdu [op 0x%x hdr->itt 0x%x datalen %d]\n",
hdr->opcode & ISCSI_OPCODE_MASK, hdr->itt, hdr->opcode & ISCSI_OPCODE_MASK, hdr->itt,
ctask->data_count); task->data_count);
return 0; return 0;
} }
static struct iscsi_cmd_task * static struct iscsi_task *
__iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
char *data, uint32_t data_size) char *data, uint32_t data_size)
{ {
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct iscsi_cmd_task *ctask; struct iscsi_task *task;
if (session->state == ISCSI_STATE_TERMINATE) if (session->state == ISCSI_STATE_TERMINATE)
return NULL; return NULL;
...@@ -481,18 +481,18 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ...@@ -481,18 +481,18 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
* Same task can be used. Same ITT must be used. * Same task can be used. Same ITT must be used.
* Note that login_task is preallocated at conn_create(). * Note that login_task is preallocated at conn_create().
*/ */
ctask = conn->login_ctask; task = conn->login_task;
else { else {
BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE);
BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED);
if (!__kfifo_get(session->cmdpool.queue, if (!__kfifo_get(session->cmdpool.queue,
(void*)&ctask, sizeof(void*))) (void*)&task, sizeof(void*)))
return NULL; return NULL;
if ((hdr->opcode == (ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE)) && if ((hdr->opcode == (ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE)) &&
hdr->ttt == RESERVED_ITT) { hdr->ttt == RESERVED_ITT) {
conn->ping_ctask = ctask; conn->ping_task = task;
conn->last_ping = jiffies; conn->last_ping = jiffies;
} }
} }
...@@ -501,33 +501,33 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ...@@ -501,33 +501,33 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
* released by the lld when it has transmitted the task for * released by the lld when it has transmitted the task for
* pdus we do not expect a response for. * pdus we do not expect a response for.
*/ */
atomic_set(&ctask->refcount, 1); atomic_set(&task->refcount, 1);
ctask->conn = conn; task->conn = conn;
ctask->sc = NULL; task->sc = NULL;
if (data_size) { if (data_size) {
memcpy(ctask->data, data, data_size); memcpy(task->data, data, data_size);
ctask->data_count = data_size; task->data_count = data_size;
} else } else
ctask->data_count = 0; task->data_count = 0;
memcpy(ctask->hdr, hdr, sizeof(struct iscsi_hdr)); memcpy(task->hdr, hdr, sizeof(struct iscsi_hdr));
INIT_LIST_HEAD(&ctask->running); INIT_LIST_HEAD(&task->running);
list_add_tail(&ctask->running, &conn->mgmtqueue); list_add_tail(&task->running, &conn->mgmtqueue);
if (session->tt->caps & CAP_DATA_PATH_OFFLOAD) { if (session->tt->caps & CAP_DATA_PATH_OFFLOAD) {
if (iscsi_prep_mgmt_task(conn, ctask)) { if (iscsi_prep_mgmt_task(conn, task)) {
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
return NULL; return NULL;
} }
if (session->tt->xmit_task(ctask)) if (session->tt->xmit_task(task))
ctask = NULL; task = NULL;
} else } else
scsi_queue_work(conn->session->host, &conn->xmitwork); scsi_queue_work(conn->session->host, &conn->xmitwork);
return ctask; return task;
} }
int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr,
...@@ -549,20 +549,20 @@ EXPORT_SYMBOL_GPL(iscsi_conn_send_pdu); ...@@ -549,20 +549,20 @@ EXPORT_SYMBOL_GPL(iscsi_conn_send_pdu);
* iscsi_cmd_rsp - SCSI Command Response processing * iscsi_cmd_rsp - SCSI Command Response processing
* @conn: iscsi connection * @conn: iscsi connection
* @hdr: iscsi header * @hdr: iscsi header
* @ctask: scsi command task * @task: scsi command task
* @data: cmd data buffer * @data: cmd data buffer
* @datalen: len of buffer * @datalen: len of buffer
* *
* iscsi_cmd_rsp sets up the scsi_cmnd fields based on the PDU and * iscsi_cmd_rsp sets up the scsi_cmnd fields based on the PDU and
* then completes the command and ctask. * then completes the command and task.
**/ **/
static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
struct iscsi_cmd_task *ctask, char *data, struct iscsi_task *task, char *data,
int datalen) int datalen)
{ {
struct iscsi_cmd_rsp *rhdr = (struct iscsi_cmd_rsp *)hdr; struct iscsi_cmd_rsp *rhdr = (struct iscsi_cmd_rsp *)hdr;
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct scsi_cmnd *sc = ctask->sc; struct scsi_cmnd *sc = task->sc;
iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr);
conn->exp_statsn = be32_to_cpu(rhdr->statsn) + 1; conn->exp_statsn = be32_to_cpu(rhdr->statsn) + 1;
...@@ -622,10 +622,10 @@ invalid_datalen: ...@@ -622,10 +622,10 @@ invalid_datalen:
} }
out: out:
debug_scsi("done [sc %lx res %d itt 0x%x]\n", debug_scsi("done [sc %lx res %d itt 0x%x]\n",
(long)sc, sc->result, ctask->itt); (long)sc, sc->result, task->itt);
conn->scsirsp_pdus_cnt++; conn->scsirsp_pdus_cnt++;
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
} }
static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
...@@ -650,9 +650,9 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) ...@@ -650,9 +650,9 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
{ {
struct iscsi_nopout hdr; struct iscsi_nopout hdr;
struct iscsi_cmd_task *ctask; struct iscsi_task *task;
if (!rhdr && conn->ping_ctask) if (!rhdr && conn->ping_task)
return; return;
memset(&hdr, 0, sizeof(struct iscsi_nopout)); memset(&hdr, 0, sizeof(struct iscsi_nopout));
...@@ -666,8 +666,8 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) ...@@ -666,8 +666,8 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
} else } else
hdr.ttt = RESERVED_ITT; hdr.ttt = RESERVED_ITT;
ctask = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0);
if (!ctask) if (!task)
iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n");
} }
...@@ -712,7 +712,7 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ...@@ -712,7 +712,7 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
{ {
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
int opcode = hdr->opcode & ISCSI_OPCODE_MASK, rc = 0; int opcode = hdr->opcode & ISCSI_OPCODE_MASK, rc = 0;
struct iscsi_cmd_task *ctask; struct iscsi_task *task;
uint32_t itt; uint32_t itt;
conn->last_recv = jiffies; conn->last_recv = jiffies;
...@@ -758,27 +758,27 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ...@@ -758,27 +758,27 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
goto out; goto out;
} }
ctask = session->cmds[itt]; task = session->cmds[itt];
switch(opcode) { switch(opcode) {
case ISCSI_OP_SCSI_CMD_RSP: case ISCSI_OP_SCSI_CMD_RSP:
if (!ctask->sc) { if (!task->sc) {
rc = ISCSI_ERR_NO_SCSI_CMD; rc = ISCSI_ERR_NO_SCSI_CMD;
break; break;
} }
BUG_ON((void*)ctask != ctask->sc->SCp.ptr); BUG_ON((void*)task != task->sc->SCp.ptr);
iscsi_scsi_cmd_rsp(conn, hdr, ctask, data, datalen); iscsi_scsi_cmd_rsp(conn, hdr, task, data, datalen);
break; break;
case ISCSI_OP_SCSI_DATA_IN: case ISCSI_OP_SCSI_DATA_IN:
if (!ctask->sc) { if (!task->sc) {
rc = ISCSI_ERR_NO_SCSI_CMD; rc = ISCSI_ERR_NO_SCSI_CMD;
break; break;
} }
BUG_ON((void*)ctask != ctask->sc->SCp.ptr); BUG_ON((void*)task != task->sc->SCp.ptr);
if (hdr->flags & ISCSI_FLAG_DATA_STATUS) { if (hdr->flags & ISCSI_FLAG_DATA_STATUS) {
conn->scsirsp_pdus_cnt++; conn->scsirsp_pdus_cnt++;
iscsi_update_cmdsn(session, iscsi_update_cmdsn(session,
(struct iscsi_nopin*) hdr); (struct iscsi_nopin*) hdr);
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
} }
break; break;
case ISCSI_OP_R2T: case ISCSI_OP_R2T:
...@@ -808,7 +808,7 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ...@@ -808,7 +808,7 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
} }
iscsi_tmf_rsp(conn, hdr); iscsi_tmf_rsp(conn, hdr);
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
break; break;
case ISCSI_OP_NOOP_IN: case ISCSI_OP_NOOP_IN:
iscsi_update_cmdsn(session, (struct iscsi_nopin*)hdr); iscsi_update_cmdsn(session, (struct iscsi_nopin*)hdr);
...@@ -818,13 +818,15 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ...@@ -818,13 +818,15 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
} }
conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;
if (conn->ping_ctask != ctask) if (conn->ping_task != task)
/* /*
* If this is not in response to one of our * If this is not in response to one of our
* nops then it must be from userspace. * nops then it must be from userspace.
*/ */
goto recv_pdu; goto recv_pdu;
__iscsi_put_ctask(ctask);
mod_timer(&conn->transport_timer, jiffies + conn->recv_timeout);
__iscsi_put_task(task);
break; break;
default: default:
rc = ISCSI_ERR_BAD_OPCODE; rc = ISCSI_ERR_BAD_OPCODE;
...@@ -836,7 +838,7 @@ out: ...@@ -836,7 +838,7 @@ out:
recv_pdu: recv_pdu:
if (iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen)) if (iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen))
rc = ISCSI_ERR_CONN_FAILED; rc = ISCSI_ERR_CONN_FAILED;
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
return rc; return rc;
} }
...@@ -855,7 +857,7 @@ EXPORT_SYMBOL_GPL(iscsi_complete_pdu); ...@@ -855,7 +857,7 @@ EXPORT_SYMBOL_GPL(iscsi_complete_pdu);
int iscsi_verify_itt(struct iscsi_conn *conn, itt_t itt) int iscsi_verify_itt(struct iscsi_conn *conn, itt_t itt)
{ {
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct iscsi_cmd_task *ctask; struct iscsi_task *task;
uint32_t i; uint32_t i;
if (itt == RESERVED_ITT) if (itt == RESERVED_ITT)
...@@ -878,11 +880,11 @@ int iscsi_verify_itt(struct iscsi_conn *conn, itt_t itt) ...@@ -878,11 +880,11 @@ int iscsi_verify_itt(struct iscsi_conn *conn, itt_t itt)
return ISCSI_ERR_BAD_ITT; return ISCSI_ERR_BAD_ITT;
} }
ctask = session->cmds[i]; task = session->cmds[i];
if (ctask->sc && ctask->sc->SCp.phase != session->age) { if (task->sc && task->sc->SCp.phase != session->age) {
iscsi_conn_printk(KERN_ERR, conn, iscsi_conn_printk(KERN_ERR, conn,
"iscsi: ctask's session age %d, " "iscsi: task's session age %d, "
"expected %d\n", ctask->sc->SCp.phase, "expected %d\n", task->sc->SCp.phase,
session->age); session->age);
return ISCSI_ERR_SESSION_FAILED; return ISCSI_ERR_SESSION_FAILED;
} }
...@@ -890,11 +892,11 @@ int iscsi_verify_itt(struct iscsi_conn *conn, itt_t itt) ...@@ -890,11 +892,11 @@ int iscsi_verify_itt(struct iscsi_conn *conn, itt_t itt)
} }
EXPORT_SYMBOL_GPL(iscsi_verify_itt); EXPORT_SYMBOL_GPL(iscsi_verify_itt);
struct iscsi_cmd_task * struct iscsi_task *
iscsi_itt_to_ctask(struct iscsi_conn *conn, itt_t itt) iscsi_itt_to_ctask(struct iscsi_conn *conn, itt_t itt)
{ {
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct iscsi_cmd_task *ctask; struct iscsi_task *task;
uint32_t i; uint32_t i;
if (iscsi_verify_itt(conn, itt)) if (iscsi_verify_itt(conn, itt))
...@@ -907,14 +909,14 @@ iscsi_itt_to_ctask(struct iscsi_conn *conn, itt_t itt) ...@@ -907,14 +909,14 @@ iscsi_itt_to_ctask(struct iscsi_conn *conn, itt_t itt)
if (i >= session->cmds_max) if (i >= session->cmds_max)
return NULL; return NULL;
ctask = session->cmds[i]; task = session->cmds[i];
if (!ctask->sc) if (!task->sc)
return NULL; return NULL;
if (ctask->sc->SCp.phase != session->age) if (task->sc->SCp.phase != session->age)
return NULL; return NULL;
return ctask; return task;
} }
EXPORT_SYMBOL_GPL(iscsi_itt_to_ctask); EXPORT_SYMBOL_GPL(iscsi_itt_to_ctask);
...@@ -955,38 +957,38 @@ static int iscsi_check_cmdsn_window_closed(struct iscsi_conn *conn) ...@@ -955,38 +957,38 @@ static int iscsi_check_cmdsn_window_closed(struct iscsi_conn *conn)
return 0; return 0;
} }
static int iscsi_xmit_ctask(struct iscsi_conn *conn) static int iscsi_xmit_task(struct iscsi_conn *conn)
{ {
struct iscsi_cmd_task *ctask = conn->ctask; struct iscsi_task *task = conn->task;
int rc; int rc;
__iscsi_get_ctask(ctask); __iscsi_get_task(task);
spin_unlock_bh(&conn->session->lock); spin_unlock_bh(&conn->session->lock);
rc = conn->session->tt->xmit_task(ctask); rc = conn->session->tt->xmit_task(task);
spin_lock_bh(&conn->session->lock); spin_lock_bh(&conn->session->lock);
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
if (!rc) if (!rc)
/* done with this ctask */ /* done with this task */
conn->ctask = NULL; conn->task = NULL;
return rc; return rc;
} }
/** /**
* iscsi_requeue_ctask - requeue ctask to run from session workqueue * iscsi_requeue_task - requeue task to run from session workqueue
* @ctask: ctask to requeue * @task: task to requeue
* *
* LLDs that need to run a ctask from the session workqueue should call * LLDs that need to run a task from the session workqueue should call
* this. The session lock must be held. This should only be called * this. The session lock must be held. This should only be called
* by software drivers. * by software drivers.
*/ */
void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask) void iscsi_requeue_task(struct iscsi_task *task)
{ {
struct iscsi_conn *conn = ctask->conn; struct iscsi_conn *conn = task->conn;
list_move_tail(&ctask->running, &conn->requeue); list_move_tail(&task->running, &conn->requeue);
scsi_queue_work(conn->session->host, &conn->xmitwork); scsi_queue_work(conn->session->host, &conn->xmitwork);
} }
EXPORT_SYMBOL_GPL(iscsi_requeue_ctask); EXPORT_SYMBOL_GPL(iscsi_requeue_task);
/** /**
* iscsi_data_xmit - xmit any command into the scheduled connection * iscsi_data_xmit - xmit any command into the scheduled connection
...@@ -1008,8 +1010,8 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) ...@@ -1008,8 +1010,8 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
return -ENODATA; return -ENODATA;
} }
if (conn->ctask) { if (conn->task) {
rc = iscsi_xmit_ctask(conn); rc = iscsi_xmit_task(conn);
if (rc) if (rc)
goto again; goto again;
} }
...@@ -1021,14 +1023,14 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) ...@@ -1021,14 +1023,14 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
*/ */
check_mgmt: check_mgmt:
while (!list_empty(&conn->mgmtqueue)) { while (!list_empty(&conn->mgmtqueue)) {
conn->ctask = list_entry(conn->mgmtqueue.next, conn->task = list_entry(conn->mgmtqueue.next,
struct iscsi_cmd_task, running); struct iscsi_task, running);
if (iscsi_prep_mgmt_task(conn, conn->ctask)) { if (iscsi_prep_mgmt_task(conn, conn->task)) {
__iscsi_put_ctask(conn->ctask); __iscsi_put_task(conn->task);
conn->ctask = NULL; conn->task = NULL;
continue; continue;
} }
rc = iscsi_xmit_ctask(conn); rc = iscsi_xmit_task(conn);
if (rc) if (rc)
goto again; goto again;
} }
...@@ -1038,21 +1040,21 @@ check_mgmt: ...@@ -1038,21 +1040,21 @@ check_mgmt:
if (conn->tmf_state == TMF_QUEUED) if (conn->tmf_state == TMF_QUEUED)
break; break;
conn->ctask = list_entry(conn->xmitqueue.next, conn->task = list_entry(conn->xmitqueue.next,
struct iscsi_cmd_task, running); struct iscsi_task, running);
if (conn->session->state == ISCSI_STATE_LOGGING_OUT) { if (conn->session->state == ISCSI_STATE_LOGGING_OUT) {
fail_command(conn, conn->ctask, DID_IMM_RETRY << 16); fail_command(conn, conn->task, DID_IMM_RETRY << 16);
continue; continue;
} }
if (iscsi_prep_scsi_cmd_pdu(conn->ctask)) { if (iscsi_prep_scsi_cmd_pdu(conn->task)) {
fail_command(conn, conn->ctask, DID_ABORT << 16); fail_command(conn, conn->task, DID_ABORT << 16);
continue; continue;
} }
rc = iscsi_xmit_ctask(conn); rc = iscsi_xmit_task(conn);
if (rc) if (rc)
goto again; goto again;
/* /*
* we could continuously get new ctask requests so * we could continuously get new task requests so
* we need to check the mgmt queue for nops that need to * we need to check the mgmt queue for nops that need to
* be sent to aviod starvation * be sent to aviod starvation
*/ */
...@@ -1070,11 +1072,11 @@ check_mgmt: ...@@ -1070,11 +1072,11 @@ check_mgmt:
if (conn->session->state == ISCSI_STATE_LOGGING_OUT) if (conn->session->state == ISCSI_STATE_LOGGING_OUT)
break; break;
conn->ctask = list_entry(conn->requeue.next, conn->task = list_entry(conn->requeue.next,
struct iscsi_cmd_task, running); struct iscsi_task, running);
conn->ctask->state = ISCSI_TASK_RUNNING; conn->task->state = ISCSI_TASK_RUNNING;
list_move_tail(conn->requeue.next, &conn->run_list); list_move_tail(conn->requeue.next, &conn->run_list);
rc = iscsi_xmit_ctask(conn); rc = iscsi_xmit_task(conn);
if (rc) if (rc)
goto again; goto again;
if (!list_empty(&conn->mgmtqueue)) if (!list_empty(&conn->mgmtqueue))
...@@ -1123,7 +1125,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) ...@@ -1123,7 +1125,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
int reason = 0; int reason = 0;
struct iscsi_session *session; struct iscsi_session *session;
struct iscsi_conn *conn; struct iscsi_conn *conn;
struct iscsi_cmd_task *ctask = NULL; struct iscsi_task *task = NULL;
sc->scsi_done = done; sc->scsi_done = done;
sc->result = 0; sc->result = 0;
...@@ -1191,31 +1193,31 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) ...@@ -1191,31 +1193,31 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
goto reject; goto reject;
} }
if (!__kfifo_get(session->cmdpool.queue, (void*)&ctask, if (!__kfifo_get(session->cmdpool.queue, (void*)&task,
sizeof(void*))) { sizeof(void*))) {
reason = FAILURE_OOM; reason = FAILURE_OOM;
goto reject; goto reject;
} }
sc->SCp.phase = session->age; sc->SCp.phase = session->age;
sc->SCp.ptr = (char *)ctask; sc->SCp.ptr = (char *)task;
atomic_set(&ctask->refcount, 1); atomic_set(&task->refcount, 1);
ctask->state = ISCSI_TASK_PENDING; task->state = ISCSI_TASK_PENDING;
ctask->conn = conn; task->conn = conn;
ctask->sc = sc; task->sc = sc;
INIT_LIST_HEAD(&ctask->running); INIT_LIST_HEAD(&task->running);
list_add_tail(&ctask->running, &conn->xmitqueue); list_add_tail(&task->running, &conn->xmitqueue);
if (session->tt->caps & CAP_DATA_PATH_OFFLOAD) { if (session->tt->caps & CAP_DATA_PATH_OFFLOAD) {
if (iscsi_prep_scsi_cmd_pdu(ctask)) { if (iscsi_prep_scsi_cmd_pdu(task)) {
sc->result = DID_ABORT << 16; sc->result = DID_ABORT << 16;
sc->scsi_done = NULL; sc->scsi_done = NULL;
iscsi_complete_command(ctask); iscsi_complete_command(task);
goto fault; goto fault;
} }
if (session->tt->xmit_task(ctask)) { if (session->tt->xmit_task(task)) {
sc->scsi_done = NULL; sc->scsi_done = NULL;
iscsi_complete_command(ctask); iscsi_complete_command(task);
reason = FAILURE_SESSION_NOT_READY; reason = FAILURE_SESSION_NOT_READY;
goto reject; goto reject;
} }
...@@ -1336,16 +1338,16 @@ static void iscsi_tmf_timedout(unsigned long data) ...@@ -1336,16 +1338,16 @@ static void iscsi_tmf_timedout(unsigned long data)
spin_unlock(&session->lock); spin_unlock(&session->lock);
} }
static int iscsi_exec_ctask_mgmt_fn(struct iscsi_conn *conn, static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn,
struct iscsi_tm *hdr, int age, struct iscsi_tm *hdr, int age,
int timeout) int timeout)
{ {
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct iscsi_cmd_task *ctask; struct iscsi_task *task;
ctask = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr, task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr,
NULL, 0); NULL, 0);
if (!ctask) { if (!task) {
spin_unlock_bh(&session->lock); spin_unlock_bh(&session->lock);
iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
spin_lock_bh(&session->lock); spin_lock_bh(&session->lock);
...@@ -1379,7 +1381,7 @@ static int iscsi_exec_ctask_mgmt_fn(struct iscsi_conn *conn, ...@@ -1379,7 +1381,7 @@ static int iscsi_exec_ctask_mgmt_fn(struct iscsi_conn *conn,
mutex_lock(&session->eh_mutex); mutex_lock(&session->eh_mutex);
spin_lock_bh(&session->lock); spin_lock_bh(&session->lock);
/* if the session drops it will clean up the ctask */ /* if the session drops it will clean up the task */
if (age != session->age || if (age != session->age ||
session->state != ISCSI_STATE_LOGGED_IN) session->state != ISCSI_STATE_LOGGED_IN)
return -ENOTCONN; return -ENOTCONN;
...@@ -1393,34 +1395,34 @@ static int iscsi_exec_ctask_mgmt_fn(struct iscsi_conn *conn, ...@@ -1393,34 +1395,34 @@ static int iscsi_exec_ctask_mgmt_fn(struct iscsi_conn *conn,
static void fail_all_commands(struct iscsi_conn *conn, unsigned lun, static void fail_all_commands(struct iscsi_conn *conn, unsigned lun,
int error) int error)
{ {
struct iscsi_cmd_task *ctask, *tmp; struct iscsi_task *task, *tmp;
if (conn->ctask && (conn->ctask->sc->device->lun == lun || lun == -1)) if (conn->task && (conn->task->sc->device->lun == lun || lun == -1))
conn->ctask = NULL; conn->task = NULL;
/* flush pending */ /* flush pending */
list_for_each_entry_safe(ctask, tmp, &conn->xmitqueue, running) { list_for_each_entry_safe(task, tmp, &conn->xmitqueue, running) {
if (lun == ctask->sc->device->lun || lun == -1) { if (lun == task->sc->device->lun || lun == -1) {
debug_scsi("failing pending sc %p itt 0x%x\n", debug_scsi("failing pending sc %p itt 0x%x\n",
ctask->sc, ctask->itt); task->sc, task->itt);
fail_command(conn, ctask, error << 16); fail_command(conn, task, error << 16);
} }
} }
list_for_each_entry_safe(ctask, tmp, &conn->requeue, running) { list_for_each_entry_safe(task, tmp, &conn->requeue, running) {
if (lun == ctask->sc->device->lun || lun == -1) { if (lun == task->sc->device->lun || lun == -1) {
debug_scsi("failing requeued sc %p itt 0x%x\n", debug_scsi("failing requeued sc %p itt 0x%x\n",
ctask->sc, ctask->itt); task->sc, task->itt);
fail_command(conn, ctask, error << 16); fail_command(conn, task, error << 16);
} }
} }
/* fail all other running */ /* fail all other running */
list_for_each_entry_safe(ctask, tmp, &conn->run_list, running) { list_for_each_entry_safe(task, tmp, &conn->run_list, running) {
if (lun == ctask->sc->device->lun || lun == -1) { if (lun == task->sc->device->lun || lun == -1) {
debug_scsi("failing in progress sc %p itt 0x%x\n", debug_scsi("failing in progress sc %p itt 0x%x\n",
ctask->sc, ctask->itt); task->sc, task->itt);
fail_command(conn, ctask, DID_BUS_BUSY << 16); fail_command(conn, task, DID_BUS_BUSY << 16);
} }
} }
} }
...@@ -1486,7 +1488,7 @@ static enum scsi_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *scmd) ...@@ -1486,7 +1488,7 @@ static enum scsi_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *scmd)
jiffies)) jiffies))
rc = EH_RESET_TIMER; rc = EH_RESET_TIMER;
/* if in the middle of checking the transport then give us more time */ /* if in the middle of checking the transport then give us more time */
if (conn->ping_ctask) if (conn->ping_task)
rc = EH_RESET_TIMER; rc = EH_RESET_TIMER;
done: done:
spin_unlock(&session->lock); spin_unlock(&session->lock);
...@@ -1510,7 +1512,7 @@ static void iscsi_check_transport_timeouts(unsigned long data) ...@@ -1510,7 +1512,7 @@ static void iscsi_check_transport_timeouts(unsigned long data)
recv_timeout *= HZ; recv_timeout *= HZ;
last_recv = conn->last_recv; last_recv = conn->last_recv;
if (conn->ping_ctask && if (conn->ping_task &&
time_before_eq(conn->last_ping + (conn->ping_timeout * HZ), time_before_eq(conn->last_ping + (conn->ping_timeout * HZ),
jiffies)) { jiffies)) {
iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs " iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs "
...@@ -1536,16 +1538,16 @@ done: ...@@ -1536,16 +1538,16 @@ done:
spin_unlock(&session->lock); spin_unlock(&session->lock);
} }
static void iscsi_prep_abort_ctask_pdu(struct iscsi_cmd_task *ctask, static void iscsi_prep_abort_task_pdu(struct iscsi_task *task,
struct iscsi_tm *hdr) struct iscsi_tm *hdr)
{ {
memset(hdr, 0, sizeof(*hdr)); memset(hdr, 0, sizeof(*hdr));
hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE; hdr->opcode = ISCSI_OP_SCSI_TMFUNC | ISCSI_OP_IMMEDIATE;
hdr->flags = ISCSI_TM_FUNC_ABORT_TASK & ISCSI_FLAG_TM_FUNC_MASK; hdr->flags = ISCSI_TM_FUNC_ABORT_TASK & ISCSI_FLAG_TM_FUNC_MASK;
hdr->flags |= ISCSI_FLAG_CMD_FINAL; hdr->flags |= ISCSI_FLAG_CMD_FINAL;
memcpy(hdr->lun, ctask->hdr->lun, sizeof(hdr->lun)); memcpy(hdr->lun, task->hdr->lun, sizeof(hdr->lun));
hdr->rtt = ctask->hdr->itt; hdr->rtt = task->hdr->itt;
hdr->refcmdsn = ctask->hdr->cmdsn; hdr->refcmdsn = task->hdr->cmdsn;
} }
int iscsi_eh_abort(struct scsi_cmnd *sc) int iscsi_eh_abort(struct scsi_cmnd *sc)
...@@ -1553,7 +1555,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ...@@ -1553,7 +1555,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
struct iscsi_cls_session *cls_session; struct iscsi_cls_session *cls_session;
struct iscsi_session *session; struct iscsi_session *session;
struct iscsi_conn *conn; struct iscsi_conn *conn;
struct iscsi_cmd_task *ctask; struct iscsi_task *task;
struct iscsi_tm *hdr; struct iscsi_tm *hdr;
int rc, age; int rc, age;
...@@ -1588,17 +1590,17 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ...@@ -1588,17 +1590,17 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
conn->eh_abort_cnt++; conn->eh_abort_cnt++;
age = session->age; age = session->age;
ctask = (struct iscsi_cmd_task *)sc->SCp.ptr; task = (struct iscsi_task *)sc->SCp.ptr;
debug_scsi("aborting [sc %p itt 0x%x]\n", sc, ctask->itt); debug_scsi("aborting [sc %p itt 0x%x]\n", sc, task->itt);
/* ctask completed before time out */ /* task completed before time out */
if (!ctask->sc) { if (!task->sc) {
debug_scsi("sc completed while abort in progress\n"); debug_scsi("sc completed while abort in progress\n");
goto success; goto success;
} }
if (ctask->state == ISCSI_TASK_PENDING) { if (task->state == ISCSI_TASK_PENDING) {
fail_command(conn, ctask, DID_ABORT << 16); fail_command(conn, task, DID_ABORT << 16);
goto success; goto success;
} }
...@@ -1608,9 +1610,9 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ...@@ -1608,9 +1610,9 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
conn->tmf_state = TMF_QUEUED; conn->tmf_state = TMF_QUEUED;
hdr = &conn->tmhdr; hdr = &conn->tmhdr;
iscsi_prep_abort_ctask_pdu(ctask, hdr); iscsi_prep_abort_task_pdu(task, hdr);
if (iscsi_exec_ctask_mgmt_fn(conn, hdr, age, session->abort_timeout)) { if (iscsi_exec_task_mgmt_fn(conn, hdr, age, session->abort_timeout)) {
rc = FAILED; rc = FAILED;
goto failed; goto failed;
} }
...@@ -1620,11 +1622,11 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ...@@ -1620,11 +1622,11 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
spin_unlock_bh(&session->lock); spin_unlock_bh(&session->lock);
iscsi_suspend_tx(conn); iscsi_suspend_tx(conn);
/* /*
* clean up ctask if aborted. grab the recv lock as a writer * clean up task if aborted. grab the recv lock as a writer
*/ */
write_lock_bh(conn->recv_lock); write_lock_bh(conn->recv_lock);
spin_lock(&session->lock); spin_lock(&session->lock);
fail_command(conn, ctask, DID_ABORT << 16); fail_command(conn, task, DID_ABORT << 16);
conn->tmf_state = TMF_INITIAL; conn->tmf_state = TMF_INITIAL;
spin_unlock(&session->lock); spin_unlock(&session->lock);
write_unlock_bh(conn->recv_lock); write_unlock_bh(conn->recv_lock);
...@@ -1637,7 +1639,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ...@@ -1637,7 +1639,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
case TMF_NOT_FOUND: case TMF_NOT_FOUND:
if (!sc->SCp.ptr) { if (!sc->SCp.ptr) {
conn->tmf_state = TMF_INITIAL; conn->tmf_state = TMF_INITIAL;
/* ctask completed before tmf abort response */ /* task completed before tmf abort response */
debug_scsi("sc completed while abort in progress\n"); debug_scsi("sc completed while abort in progress\n");
goto success; goto success;
} }
...@@ -1650,7 +1652,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ...@@ -1650,7 +1652,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
success: success:
spin_unlock_bh(&session->lock); spin_unlock_bh(&session->lock);
success_unlocked: success_unlocked:
debug_scsi("abort success [sc %lx itt 0x%x]\n", (long)sc, ctask->itt); debug_scsi("abort success [sc %lx itt 0x%x]\n", (long)sc, task->itt);
mutex_unlock(&session->eh_mutex); mutex_unlock(&session->eh_mutex);
return SUCCESS; return SUCCESS;
...@@ -1658,7 +1660,7 @@ failed: ...@@ -1658,7 +1660,7 @@ failed:
spin_unlock_bh(&session->lock); spin_unlock_bh(&session->lock);
failed_unlocked: failed_unlocked:
debug_scsi("abort failed [sc %p itt 0x%x]\n", sc, debug_scsi("abort failed [sc %p itt 0x%x]\n", sc,
ctask ? ctask->itt : 0); task ? task->itt : 0);
mutex_unlock(&session->eh_mutex); mutex_unlock(&session->eh_mutex);
return FAILED; return FAILED;
} }
...@@ -1705,7 +1707,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) ...@@ -1705,7 +1707,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc)
hdr = &conn->tmhdr; hdr = &conn->tmhdr;
iscsi_prep_lun_reset_pdu(sc, hdr); iscsi_prep_lun_reset_pdu(sc, hdr);
if (iscsi_exec_ctask_mgmt_fn(conn, hdr, session->age, if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age,
session->lu_reset_timeout)) { session->lu_reset_timeout)) {
rc = FAILED; rc = FAILED;
goto unlock; goto unlock;
...@@ -1886,7 +1888,7 @@ EXPORT_SYMBOL_GPL(iscsi_host_free); ...@@ -1886,7 +1888,7 @@ EXPORT_SYMBOL_GPL(iscsi_host_free);
* @iscsit: iscsi transport template * @iscsit: iscsi transport template
* @shost: scsi host * @shost: scsi host
* @cmds_max: session can queue * @cmds_max: session can queue
* @cmd_ctask_size: LLD ctask private data size * @cmd_task_size: LLD task private data size
* @initial_cmdsn: initial CmdSN * @initial_cmdsn: initial CmdSN
* *
* This can be used by software iscsi_transports that allocate * This can be used by software iscsi_transports that allocate
...@@ -1894,7 +1896,7 @@ EXPORT_SYMBOL_GPL(iscsi_host_free); ...@@ -1894,7 +1896,7 @@ EXPORT_SYMBOL_GPL(iscsi_host_free);
*/ */
struct iscsi_cls_session * struct iscsi_cls_session *
iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost,
uint16_t scsi_cmds_max, int cmd_ctask_size, uint16_t scsi_cmds_max, int cmd_task_size,
uint32_t initial_cmdsn) uint32_t initial_cmdsn)
{ {
struct iscsi_session *session; struct iscsi_session *session;
...@@ -1902,7 +1904,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, ...@@ -1902,7 +1904,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost,
int cmd_i, cmds_max; int cmd_i, cmds_max;
/* /*
* The iscsi layer needs some ctasks for nop handling and tmfs. * The iscsi layer needs some tasks for nop handling and tmfs.
*/ */
if (scsi_cmds_max < 1) if (scsi_cmds_max < 1)
scsi_cmds_max = ISCSI_MGMT_CMDS_MAX; scsi_cmds_max = ISCSI_MGMT_CMDS_MAX;
...@@ -1939,17 +1941,17 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, ...@@ -1939,17 +1941,17 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost,
/* initialize SCSI PDU commands pool */ /* initialize SCSI PDU commands pool */
if (iscsi_pool_init(&session->cmdpool, session->cmds_max, if (iscsi_pool_init(&session->cmdpool, session->cmds_max,
(void***)&session->cmds, (void***)&session->cmds,
cmd_ctask_size + sizeof(struct iscsi_cmd_task))) cmd_task_size + sizeof(struct iscsi_task)))
goto cmdpool_alloc_fail; goto cmdpool_alloc_fail;
/* pre-format cmds pool with ITT */ /* pre-format cmds pool with ITT */
for (cmd_i = 0; cmd_i < session->cmds_max; cmd_i++) { for (cmd_i = 0; cmd_i < session->cmds_max; cmd_i++) {
struct iscsi_cmd_task *ctask = session->cmds[cmd_i]; struct iscsi_task *task = session->cmds[cmd_i];
if (cmd_ctask_size) if (cmd_task_size)
ctask->dd_data = &ctask[1]; task->dd_data = &task[1];
ctask->itt = cmd_i; task->itt = cmd_i;
INIT_LIST_HEAD(&ctask->running); INIT_LIST_HEAD(&task->running);
} }
if (!try_module_get(iscsit->owner)) if (!try_module_get(iscsit->owner))
...@@ -2035,30 +2037,30 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, ...@@ -2035,30 +2037,30 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
INIT_LIST_HEAD(&conn->requeue); INIT_LIST_HEAD(&conn->requeue);
INIT_WORK(&conn->xmitwork, iscsi_xmitworker); INIT_WORK(&conn->xmitwork, iscsi_xmitworker);
/* allocate login_ctask used for the login/text sequences */ /* allocate login_task used for the login/text sequences */
spin_lock_bh(&session->lock); spin_lock_bh(&session->lock);
if (!__kfifo_get(session->cmdpool.queue, if (!__kfifo_get(session->cmdpool.queue,
(void*)&conn->login_ctask, (void*)&conn->login_task,
sizeof(void*))) { sizeof(void*))) {
spin_unlock_bh(&session->lock); spin_unlock_bh(&session->lock);
goto login_ctask_alloc_fail; goto login_task_alloc_fail;
} }
spin_unlock_bh(&session->lock); spin_unlock_bh(&session->lock);
data = kmalloc(ISCSI_DEF_MAX_RECV_SEG_LEN, GFP_KERNEL); data = kmalloc(ISCSI_DEF_MAX_RECV_SEG_LEN, GFP_KERNEL);
if (!data) if (!data)
goto login_ctask_data_alloc_fail; goto login_task_data_alloc_fail;
conn->login_ctask->data = conn->data = data; conn->login_task->data = conn->data = data;
init_timer(&conn->tmf_timer); init_timer(&conn->tmf_timer);
init_waitqueue_head(&conn->ehwait); init_waitqueue_head(&conn->ehwait);
return cls_conn; return cls_conn;
login_ctask_data_alloc_fail: login_task_data_alloc_fail:
__kfifo_put(session->cmdpool.queue, (void*)&conn->login_ctask, __kfifo_put(session->cmdpool.queue, (void*)&conn->login_task,
sizeof(void*)); sizeof(void*));
login_ctask_alloc_fail: login_task_alloc_fail:
iscsi_destroy_conn(cls_conn); iscsi_destroy_conn(cls_conn);
return NULL; return NULL;
} }
...@@ -2118,7 +2120,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) ...@@ -2118,7 +2120,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
spin_lock_bh(&session->lock); spin_lock_bh(&session->lock);
kfree(conn->data); kfree(conn->data);
kfree(conn->persistent_address); kfree(conn->persistent_address);
__kfifo_put(session->cmdpool.queue, (void*)&conn->login_ctask, __kfifo_put(session->cmdpool.queue, (void*)&conn->login_task,
sizeof(void*)); sizeof(void*));
if (session->leadconn == conn) if (session->leadconn == conn)
session->leadconn = NULL; session->leadconn = NULL;
...@@ -2199,23 +2201,23 @@ EXPORT_SYMBOL_GPL(iscsi_conn_start); ...@@ -2199,23 +2201,23 @@ EXPORT_SYMBOL_GPL(iscsi_conn_start);
static void static void
flush_control_queues(struct iscsi_session *session, struct iscsi_conn *conn) flush_control_queues(struct iscsi_session *session, struct iscsi_conn *conn)
{ {
struct iscsi_cmd_task *ctask, *tmp; struct iscsi_task *task, *tmp;
/* handle pending */ /* handle pending */
list_for_each_entry_safe(ctask, tmp, &conn->mgmtqueue, running) { list_for_each_entry_safe(task, tmp, &conn->mgmtqueue, running) {
debug_scsi("flushing pending mgmt ctask itt 0x%x\n", ctask->itt); debug_scsi("flushing pending mgmt task itt 0x%x\n", task->itt);
/* release ref from prep ctask */ /* release ref from prep task */
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
} }
/* handle running */ /* handle running */
list_for_each_entry_safe(ctask, tmp, &conn->mgmt_run_list, running) { list_for_each_entry_safe(task, tmp, &conn->mgmt_run_list, running) {
debug_scsi("flushing running mgmt ctask itt 0x%x\n", ctask->itt); debug_scsi("flushing running mgmt task itt 0x%x\n", task->itt);
/* release ref from prep ctask */ /* release ref from prep task */
__iscsi_put_ctask(ctask); __iscsi_put_task(task);
} }
conn->ctask = NULL; conn->task = NULL;
} }
static void iscsi_start_session_recovery(struct iscsi_session *session, static void iscsi_start_session_recovery(struct iscsi_session *session,
...@@ -2246,7 +2248,7 @@ static void iscsi_start_session_recovery(struct iscsi_session *session, ...@@ -2246,7 +2248,7 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
/* /*
* When this is called for the in_login state, we only want to clean * When this is called for the in_login state, we only want to clean
* up the login ctask and connection. We do not need to block and set * up the login task and connection. We do not need to block and set
* the recovery state again * the recovery state again
*/ */
if (flag == STOP_CONN_TERM) if (flag == STOP_CONN_TERM)
......
...@@ -92,7 +92,7 @@ enum { ...@@ -92,7 +92,7 @@ enum {
ISCSI_TASK_RUNNING, ISCSI_TASK_RUNNING,
}; };
struct iscsi_cmd_task { struct iscsi_task {
/* /*
* Because LLDs allocate their hdr differently, this is a pointer * Because LLDs allocate their hdr differently, this is a pointer
* and length to that storage. It must be setup at session * and length to that storage. It must be setup at session
...@@ -120,9 +120,9 @@ struct iscsi_cmd_task { ...@@ -120,9 +120,9 @@ struct iscsi_cmd_task {
void *dd_data; /* driver/transport data */ void *dd_data; /* driver/transport data */
}; };
static inline void* iscsi_next_hdr(struct iscsi_cmd_task *ctask) static inline void* iscsi_next_hdr(struct iscsi_task *task)
{ {
return (void*)ctask->hdr + ctask->hdr_len; return (void*)task->hdr + task->hdr_len;
} }
/* Connection's states */ /* Connection's states */
...@@ -151,7 +151,7 @@ struct iscsi_conn { ...@@ -151,7 +151,7 @@ struct iscsi_conn {
unsigned long last_ping; unsigned long last_ping;
int ping_timeout; int ping_timeout;
int recv_timeout; int recv_timeout;
struct iscsi_cmd_task *ping_ctask; struct iscsi_task *ping_task;
/* iSCSI connection-wide sequencing */ /* iSCSI connection-wide sequencing */
uint32_t exp_statsn; uint32_t exp_statsn;
...@@ -167,8 +167,8 @@ struct iscsi_conn { ...@@ -167,8 +167,8 @@ struct iscsi_conn {
* should always fit in this buffer * should always fit in this buffer
*/ */
char *data; char *data;
struct iscsi_cmd_task *login_ctask; /* mtask used for login/text */ struct iscsi_task *login_task; /* mtask used for login/text */
struct iscsi_cmd_task *ctask; /* xmit task in progress */ struct iscsi_task *task; /* xmit task in progress */
/* xmit */ /* xmit */
struct list_head mgmtqueue; /* mgmt (control) xmit queue */ struct list_head mgmtqueue; /* mgmt (control) xmit queue */
...@@ -285,7 +285,7 @@ struct iscsi_session { ...@@ -285,7 +285,7 @@ struct iscsi_session {
int scsi_cmds_max; /* max scsi commands */ int scsi_cmds_max; /* max scsi commands */
int cmds_max; /* size of cmds array */ int cmds_max; /* size of cmds array */
struct iscsi_cmd_task **cmds; /* Original Cmds arr */ struct iscsi_task **cmds; /* Original Cmds arr */
struct iscsi_pool cmdpool; /* PDU's pool */ struct iscsi_pool cmdpool; /* PDU's pool */
}; };
...@@ -365,16 +365,16 @@ extern void iscsi_suspend_tx(struct iscsi_conn *conn); ...@@ -365,16 +365,16 @@ extern void iscsi_suspend_tx(struct iscsi_conn *conn);
* pdu and task processing * pdu and task processing
*/ */
extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *); extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *);
extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *, extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_task *,
struct iscsi_data *hdr); struct iscsi_data *hdr);
extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *,
char *, uint32_t); char *, uint32_t);
extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
char *, int); char *, int);
extern int iscsi_verify_itt(struct iscsi_conn *, itt_t); extern int iscsi_verify_itt(struct iscsi_conn *, itt_t);
extern struct iscsi_cmd_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t); extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);
extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask); extern void iscsi_requeue_task(struct iscsi_task *task);
extern void iscsi_put_ctask(struct iscsi_cmd_task *ctask); extern void iscsi_put_task(struct iscsi_task *task);
/* /*
* generic helpers * generic helpers
......
...@@ -33,7 +33,7 @@ struct iscsi_transport; ...@@ -33,7 +33,7 @@ struct iscsi_transport;
struct Scsi_Host; struct Scsi_Host;
struct iscsi_cls_conn; struct iscsi_cls_conn;
struct iscsi_conn; struct iscsi_conn;
struct iscsi_cmd_task; struct iscsi_task;
struct sockaddr; struct sockaddr;
/** /**
...@@ -112,10 +112,10 @@ struct iscsi_transport { ...@@ -112,10 +112,10 @@ struct iscsi_transport {
char *data, uint32_t data_size); char *data, uint32_t data_size);
void (*get_stats) (struct iscsi_cls_conn *conn, void (*get_stats) (struct iscsi_cls_conn *conn,
struct iscsi_stats *stats); struct iscsi_stats *stats);
int (*init_task) (struct iscsi_cmd_task *task); int (*init_task) (struct iscsi_task *task);
int (*xmit_task) (struct iscsi_cmd_task *task); int (*xmit_task) (struct iscsi_task *task);
void (*cleanup_task) (struct iscsi_conn *conn, void (*cleanup_task) (struct iscsi_conn *conn,
struct iscsi_cmd_task *task); struct iscsi_task *task);
void (*session_recovery_timedout) (struct iscsi_cls_session *session); void (*session_recovery_timedout) (struct iscsi_cls_session *session);
int (*ep_connect) (struct sockaddr *dst_addr, int non_blocking, int (*ep_connect) (struct sockaddr *dst_addr, int non_blocking,
uint64_t *ep_handle); uint64_t *ep_handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment