提交 843c0a8a 编写于 作者: M Mike Christie 提交者: James Bottomley

[SCSI] libiscsi, iscsi_tcp: add device support

This patch adds logical unit reset support. This should work for ib_iser,
but I have not finished testing that driver so it is not hooked in yet.

This patch also temporarily reverts the iscsi_tcp r2t write out patch.
That code is completely rewritten in this patchset.
Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
上级 8ae732a9
......@@ -220,12 +220,6 @@ iscsi_iser_ctask_xmit(struct iscsi_conn *conn,
debug_scsi("ctask deq [cid %d itt 0x%x]\n",
conn->id, ctask->itt);
/*
* serialize with TMF AbortTask
*/
if (ctask->mtask)
return error;
/* Send the cmd PDU */
if (!iser_ctask->command_sent) {
error = iser_send_command(conn, ctask);
......
......@@ -197,7 +197,7 @@ iscsi_tcp_cleanup_ctask(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
if (unlikely(!sc))
return;
tcp_ctask->xmstate = XMSTATE_VALUE_IDLE;
tcp_ctask->xmstate = XMSTATE_IDLE;
tcp_ctask->r2t = NULL;
}
......@@ -369,8 +369,7 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
spin_lock(&session->lock);
iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr);
if (!ctask->sc || ctask->mtask ||
session->state != ISCSI_STATE_LOGGED_IN) {
if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) {
printk(KERN_INFO "iscsi_tcp: dropping R2T itt %d in "
"recovery...\n", ctask->itt);
spin_unlock(&session->lock);
......@@ -409,11 +408,10 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
tcp_ctask->exp_datasn = r2tsn + 1;
__kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*));
set_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate);
list_move_tail(&ctask->running, &conn->xmitqueue);
scsi_queue_work(session->host, &conn->xmitwork);
tcp_ctask->xmstate |= XMSTATE_SOL_HDR_INIT;
conn->r2t_pdus_cnt++;
iscsi_requeue_ctask(ctask);
spin_unlock(&session->lock);
return 0;
......@@ -1254,7 +1252,7 @@ static void iscsi_set_padding(struct iscsi_tcp_cmd_task *tcp_ctask,
tcp_ctask->pad_count = ISCSI_PAD_LEN - tcp_ctask->pad_count;
debug_scsi("write padding %d bytes\n", tcp_ctask->pad_count);
set_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate);
tcp_ctask->xmstate |= XMSTATE_W_PAD;
}
/**
......@@ -1269,7 +1267,7 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask)
struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;
BUG_ON(__kfifo_len(tcp_ctask->r2tqueue));
tcp_ctask->xmstate = 1 << XMSTATE_BIT_CMD_HDR_INIT;
tcp_ctask->xmstate = XMSTATE_CMD_HDR_INIT;
}
/**
......@@ -1283,10 +1281,10 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask)
* xmit.
*
* Management xmit state machine consists of these states:
* XMSTATE_BIT_IMM_HDR_INIT - calculate digest of PDU Header
* XMSTATE_BIT_IMM_HDR - PDU Header xmit in progress
* XMSTATE_BIT_IMM_DATA - PDU Data xmit in progress
* XMSTATE_VALUE_IDLE - management PDU is done
* XMSTATE_IMM_HDR_INIT - calculate digest of PDU Header
* XMSTATE_IMM_HDR - PDU Header xmit in progress
* XMSTATE_IMM_DATA - PDU Data xmit in progress
* XMSTATE_IDLE - management PDU is done
**/
static int
iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
......@@ -1297,12 +1295,12 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
debug_scsi("mtask deq [cid %d state %x itt 0x%x]\n",
conn->id, tcp_mtask->xmstate, mtask->itt);
if (test_bit(XMSTATE_BIT_IMM_HDR_INIT, &tcp_mtask->xmstate)) {
if (tcp_mtask->xmstate & XMSTATE_IMM_HDR_INIT) {
iscsi_buf_init_iov(&tcp_mtask->headbuf, (char*)mtask->hdr,
sizeof(struct iscsi_hdr));
if (mtask->data_count) {
set_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate);
tcp_mtask->xmstate |= XMSTATE_IMM_DATA;
iscsi_buf_init_iov(&tcp_mtask->sendbuf,
(char*)mtask->data,
mtask->data_count);
......@@ -1315,20 +1313,21 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
(u8*)tcp_mtask->hdrext);
tcp_mtask->sent = 0;
clear_bit(XMSTATE_BIT_IMM_HDR_INIT, &tcp_mtask->xmstate);
set_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate);
tcp_mtask->xmstate &= ~XMSTATE_IMM_HDR_INIT;
tcp_mtask->xmstate |= XMSTATE_IMM_HDR;
}
if (test_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate)) {
if (tcp_mtask->xmstate & XMSTATE_IMM_HDR) {
rc = iscsi_sendhdr(conn, &tcp_mtask->headbuf,
mtask->data_count);
if (rc)
return rc;
clear_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate);
tcp_mtask->xmstate &= ~XMSTATE_IMM_HDR;
}
if (test_and_clear_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate)) {
if (tcp_mtask->xmstate & XMSTATE_IMM_DATA) {
BUG_ON(!mtask->data_count);
tcp_mtask->xmstate &= ~XMSTATE_IMM_DATA;
/* FIXME: implement.
* Virtual buffer could be spreaded across multiple pages...
*/
......@@ -1338,13 +1337,13 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
rc = iscsi_sendpage(conn, &tcp_mtask->sendbuf,
&mtask->data_count, &tcp_mtask->sent);
if (rc) {
set_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate);
tcp_mtask->xmstate |= XMSTATE_IMM_DATA;
return rc;
}
} while (mtask->data_count);
}
BUG_ON(tcp_mtask->xmstate != XMSTATE_VALUE_IDLE);
BUG_ON(tcp_mtask->xmstate != XMSTATE_IDLE);
if (mtask->hdr->itt == RESERVED_ITT) {
struct iscsi_session *session = conn->session;
......@@ -1364,7 +1363,7 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;
int rc = 0;
if (test_bit(XMSTATE_BIT_CMD_HDR_INIT, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_CMD_HDR_INIT) {
tcp_ctask->sent = 0;
tcp_ctask->sg_count = 0;
tcp_ctask->exp_datasn = 0;
......@@ -1389,21 +1388,21 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
if (conn->hdrdgst_en)
iscsi_hdr_digest(conn, &tcp_ctask->headbuf,
(u8*)tcp_ctask->hdrext);
clear_bit(XMSTATE_BIT_CMD_HDR_INIT, &tcp_ctask->xmstate);
set_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_INIT;
tcp_ctask->xmstate |= XMSTATE_CMD_HDR_XMIT;
}
if (test_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_CMD_HDR_XMIT) {
rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->imm_count);
if (rc)
return rc;
clear_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_XMIT;
if (sc->sc_data_direction != DMA_TO_DEVICE)
return 0;
if (ctask->imm_count) {
set_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate);
tcp_ctask->xmstate |= XMSTATE_IMM_DATA;
iscsi_set_padding(tcp_ctask, ctask->imm_count);
if (ctask->conn->datadgst_en) {
......@@ -1413,10 +1412,9 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
}
}
if (ctask->unsol_count) {
set_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate);
set_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate);
}
if (ctask->unsol_count)
tcp_ctask->xmstate |=
XMSTATE_UNS_HDR | XMSTATE_UNS_INIT;
}
return rc;
}
......@@ -1428,25 +1426,25 @@ iscsi_send_padding(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
int sent = 0, rc;
if (test_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_W_PAD) {
iscsi_buf_init_iov(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad,
tcp_ctask->pad_count);
if (conn->datadgst_en)
crypto_hash_update(&tcp_conn->tx_hash,
&tcp_ctask->sendbuf.sg,
tcp_ctask->sendbuf.sg.length);
} else if (!test_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate))
} else if (!(tcp_ctask->xmstate & XMSTATE_W_RESEND_PAD))
return 0;
clear_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate);
clear_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_W_PAD;
tcp_ctask->xmstate &= ~XMSTATE_W_RESEND_PAD;
debug_scsi("sending %d pad bytes for itt 0x%x\n",
tcp_ctask->pad_count, ctask->itt);
rc = iscsi_sendpage(conn, &tcp_ctask->sendbuf, &tcp_ctask->pad_count,
&sent);
if (rc) {
debug_scsi("padding send failed %d\n", rc);
set_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate);
tcp_ctask->xmstate |= XMSTATE_W_RESEND_PAD;
}
return rc;
}
......@@ -1465,11 +1463,11 @@ iscsi_send_digest(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
tcp_ctask = ctask->dd_data;
tcp_conn = conn->dd_data;
if (!test_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate)) {
if (!(tcp_ctask->xmstate & XMSTATE_W_RESEND_DATA_DIGEST)) {
crypto_hash_final(&tcp_conn->tx_hash, (u8*)digest);
iscsi_buf_init_iov(buf, (char*)digest, 4);
}
clear_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_W_RESEND_DATA_DIGEST;
rc = iscsi_sendpage(conn, buf, &tcp_ctask->digest_count, &sent);
if (!rc)
......@@ -1478,7 +1476,7 @@ iscsi_send_digest(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
else {
debug_scsi("sending digest 0x%x failed for itt 0x%x!\n",
*digest, ctask->itt);
set_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate);
tcp_ctask->xmstate |= XMSTATE_W_RESEND_DATA_DIGEST;
}
return rc;
}
......@@ -1526,8 +1524,8 @@ iscsi_send_unsol_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
struct iscsi_data_task *dtask;
int rc;
set_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate);
if (test_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate)) {
tcp_ctask->xmstate |= XMSTATE_UNS_DATA;
if (tcp_ctask->xmstate & XMSTATE_UNS_INIT) {
dtask = &tcp_ctask->unsol_dtask;
iscsi_prep_unsolicit_data_pdu(ctask, &dtask->hdr);
......@@ -1537,14 +1535,14 @@ iscsi_send_unsol_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
iscsi_hdr_digest(conn, &tcp_ctask->headbuf,
(u8*)dtask->hdrext);
clear_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_UNS_INIT;
iscsi_set_padding(tcp_ctask, ctask->data_count);
}
rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->data_count);
if (rc) {
clear_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate);
set_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_UNS_DATA;
tcp_ctask->xmstate |= XMSTATE_UNS_HDR;
return rc;
}
......@@ -1565,15 +1563,16 @@ iscsi_send_unsol_pdu(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;
int rc;
if (test_and_clear_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_UNS_HDR) {
BUG_ON(!ctask->unsol_count);
tcp_ctask->xmstate &= ~XMSTATE_UNS_HDR;
send_hdr:
rc = iscsi_send_unsol_hdr(conn, ctask);
if (rc)
return rc;
}
if (test_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_UNS_DATA) {
struct iscsi_data_task *dtask = &tcp_ctask->unsol_dtask;
int start = tcp_ctask->sent;
......@@ -1583,14 +1582,14 @@ iscsi_send_unsol_pdu(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
ctask->unsol_count -= tcp_ctask->sent - start;
if (rc)
return rc;
clear_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_UNS_DATA;
/*
* Done with the Data-Out. Next, check if we need
* to send another unsolicited Data-Out.
*/
if (ctask->unsol_count) {
debug_scsi("sending more uns\n");
set_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate);
tcp_ctask->xmstate |= XMSTATE_UNS_INIT;
goto send_hdr;
}
}
......@@ -1606,7 +1605,7 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn,
struct iscsi_data_task *dtask;
int left, rc;
if (test_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_SOL_HDR_INIT) {
if (!tcp_ctask->r2t) {
spin_lock_bh(&session->lock);
__kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t,
......@@ -1620,19 +1619,19 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn,
if (conn->hdrdgst_en)
iscsi_hdr_digest(conn, &r2t->headbuf,
(u8*)dtask->hdrext);
clear_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate);
set_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR_INIT;
tcp_ctask->xmstate |= XMSTATE_SOL_HDR;
}
if (test_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_SOL_HDR) {
r2t = tcp_ctask->r2t;
dtask = &r2t->dtask;
rc = iscsi_sendhdr(conn, &r2t->headbuf, r2t->data_count);
if (rc)
return rc;
clear_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate);
set_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR;
tcp_ctask->xmstate |= XMSTATE_SOL_DATA;
if (conn->datadgst_en) {
iscsi_data_digest_init(conn->dd_data, tcp_ctask);
......@@ -1645,7 +1644,7 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn,
r2t->sent);
}
if (test_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_SOL_DATA) {
r2t = tcp_ctask->r2t;
dtask = &r2t->dtask;
......@@ -1654,7 +1653,7 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn,
&dtask->digestbuf, &dtask->digest);
if (rc)
return rc;
clear_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_SOL_DATA;
/*
* Done with this Data-Out. Next, check if we have
......@@ -1699,32 +1698,32 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn,
* xmit stages.
*
*iscsi_send_cmd_hdr()
* XMSTATE_BIT_CMD_HDR_INIT - prepare Header and Data buffers Calculate
* Header Digest
* XMSTATE_BIT_CMD_HDR_XMIT - Transmit header in progress
* XMSTATE_CMD_HDR_INIT - prepare Header and Data buffers Calculate
* Header Digest
* XMSTATE_CMD_HDR_XMIT - Transmit header in progress
*
*iscsi_send_padding
* XMSTATE_BIT_W_PAD - Prepare and send pading
* XMSTATE_BIT_W_RESEND_PAD - retry send pading
* XMSTATE_W_PAD - Prepare and send pading
* XMSTATE_W_RESEND_PAD - retry send pading
*
*iscsi_send_digest
* XMSTATE_BIT_W_RESEND_DATA_DIGEST - Finalize and send Data Digest
* XMSTATE_BIT_W_RESEND_DATA_DIGEST - retry sending digest
* XMSTATE_W_RESEND_DATA_DIGEST - Finalize and send Data Digest
* XMSTATE_W_RESEND_DATA_DIGEST - retry sending digest
*
*iscsi_send_unsol_hdr
* XMSTATE_BIT_UNS_INIT - prepare un-solicit data header and digest
* XMSTATE_BIT_UNS_HDR - send un-solicit header
* XMSTATE_UNS_INIT - prepare un-solicit data header and digest
* XMSTATE_UNS_HDR - send un-solicit header
*
*iscsi_send_unsol_pdu
* XMSTATE_BIT_UNS_DATA - send un-solicit data in progress
* XMSTATE_UNS_DATA - send un-solicit data in progress
*
*iscsi_send_sol_pdu
* XMSTATE_BIT_SOL_HDR_INIT - solicit data header and digest initialize
* XMSTATE_BIT_SOL_HDR - send solicit header
* XMSTATE_BIT_SOL_DATA - send solicit data
* XMSTATE_SOL_HDR_INIT - solicit data header and digest initialize
* XMSTATE_SOL_HDR - send solicit header
* XMSTATE_SOL_DATA - send solicit data
*
*iscsi_tcp_ctask_xmit
* XMSTATE_BIT_IMM_DATA - xmit managment data (??)
* XMSTATE_IMM_DATA - xmit managment data (??)
**/
static int
iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
......@@ -1741,13 +1740,13 @@ iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
if (ctask->sc->sc_data_direction != DMA_TO_DEVICE)
return 0;
if (test_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate)) {
if (tcp_ctask->xmstate & XMSTATE_IMM_DATA) {
rc = iscsi_send_data(ctask, &tcp_ctask->sendbuf, &tcp_ctask->sg,
&tcp_ctask->sent, &ctask->imm_count,
&tcp_ctask->immbuf, &tcp_ctask->immdigest);
if (rc)
return rc;
clear_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate);
tcp_ctask->xmstate &= ~XMSTATE_IMM_DATA;
}
rc = iscsi_send_unsol_pdu(conn, ctask);
......@@ -1980,7 +1979,7 @@ static void
iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
{
struct iscsi_tcp_mgmt_task *tcp_mtask = mtask->dd_data;
tcp_mtask->xmstate = 1 << XMSTATE_BIT_IMM_HDR_INIT;
tcp_mtask->xmstate = XMSTATE_IMM_HDR_INIT;
}
static int
......@@ -2226,6 +2225,7 @@ static struct scsi_host_template iscsi_sht = {
.max_sectors = 0xFFFF,
.cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
.eh_abort_handler = iscsi_eh_abort,
.eh_device_reset_handler= iscsi_eh_device_reset,
.eh_host_reset_handler = iscsi_eh_host_reset,
.use_clustering = DISABLE_CLUSTERING,
.slave_configure = iscsi_tcp_slave_configure,
......@@ -2257,7 +2257,8 @@ static struct iscsi_transport iscsi_tcp_transport = {
ISCSI_PERSISTENT_ADDRESS |
ISCSI_TARGET_NAME | ISCSI_TPGT |
ISCSI_USERNAME | ISCSI_PASSWORD |
ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN,
ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
ISCSI_FAST_ABORT,
.host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
ISCSI_HOST_INITIATOR_NAME |
ISCSI_HOST_NETDEV_NAME,
......
......@@ -32,21 +32,21 @@
#define IN_PROGRESS_PAD_RECV 0x4
/* xmit state machine */
#define XMSTATE_VALUE_IDLE 0
#define XMSTATE_BIT_CMD_HDR_INIT 0
#define XMSTATE_BIT_CMD_HDR_XMIT 1
#define XMSTATE_BIT_IMM_HDR 2
#define XMSTATE_BIT_IMM_DATA 3
#define XMSTATE_BIT_UNS_INIT 4
#define XMSTATE_BIT_UNS_HDR 5
#define XMSTATE_BIT_UNS_DATA 6
#define XMSTATE_BIT_SOL_HDR 7
#define XMSTATE_BIT_SOL_DATA 8
#define XMSTATE_BIT_W_PAD 9
#define XMSTATE_BIT_W_RESEND_PAD 10
#define XMSTATE_BIT_W_RESEND_DATA_DIGEST 11
#define XMSTATE_BIT_IMM_HDR_INIT 12
#define XMSTATE_BIT_SOL_HDR_INIT 13
#define XMSTATE_IDLE 0x0
#define XMSTATE_CMD_HDR_INIT 0x1
#define XMSTATE_CMD_HDR_XMIT 0x2
#define XMSTATE_IMM_HDR 0x4
#define XMSTATE_IMM_DATA 0x8
#define XMSTATE_UNS_INIT 0x10
#define XMSTATE_UNS_HDR 0x20
#define XMSTATE_UNS_DATA 0x40
#define XMSTATE_SOL_HDR 0x80
#define XMSTATE_SOL_DATA 0x100
#define XMSTATE_W_PAD 0x200
#define XMSTATE_W_RESEND_PAD 0x400
#define XMSTATE_W_RESEND_DATA_DIGEST 0x800
#define XMSTATE_IMM_HDR_INIT 0x1000
#define XMSTATE_SOL_HDR_INIT 0x2000
#define ISCSI_PAD_LEN 4
#define ISCSI_SG_TABLESIZE SG_ALL
......@@ -122,7 +122,7 @@ struct iscsi_data_task {
struct iscsi_tcp_mgmt_task {
struct iscsi_hdr hdr;
char hdrext[sizeof(__u32)]; /* Header-Digest */
unsigned long xmstate; /* mgmt xmit progress */
int xmstate; /* mgmt xmit progress */
struct iscsi_buf headbuf; /* header buffer */
struct iscsi_buf sendbuf; /* in progress buffer */
int sent;
......@@ -150,7 +150,7 @@ struct iscsi_tcp_cmd_task {
int pad_count; /* padded bytes */
struct iscsi_buf headbuf; /* header buf (xmit) */
struct iscsi_buf sendbuf; /* in progress buffer*/
unsigned long xmstate; /* xmit xtate machine */
int xmstate; /* xmit xtate machine */
int sent;
struct scatterlist *sg; /* per-cmd SG list */
struct scatterlist *bad_sg; /* assert statement */
......
此差异已折叠。
......@@ -30,7 +30,7 @@
#include <scsi/scsi_transport_iscsi.h>
#include <scsi/iscsi_if.h>
#define ISCSI_SESSION_ATTRS 15
#define ISCSI_SESSION_ATTRS 16
#define ISCSI_CONN_ATTRS 11
#define ISCSI_HOST_ATTRS 4
#define ISCSI_TRANSPORT_VERSION "2.0-724"
......@@ -1218,6 +1218,7 @@ iscsi_session_attr(username, ISCSI_PARAM_USERNAME, 1);
iscsi_session_attr(username_in, ISCSI_PARAM_USERNAME_IN, 1);
iscsi_session_attr(password, ISCSI_PARAM_PASSWORD, 1);
iscsi_session_attr(password_in, ISCSI_PARAM_PASSWORD_IN, 1);
iscsi_session_attr(fast_abort, ISCSI_PARAM_FAST_ABORT, 1);
#define iscsi_priv_session_attr_show(field, format) \
static ssize_t \
......@@ -1439,6 +1440,7 @@ iscsi_register_transport(struct iscsi_transport *tt)
SETUP_SESSION_RD_ATTR(password_in, ISCSI_USERNAME_IN);
SETUP_SESSION_RD_ATTR(username, ISCSI_PASSWORD);
SETUP_SESSION_RD_ATTR(username_in, ISCSI_PASSWORD_IN);
SETUP_SESSION_RD_ATTR(fast_abort, ISCSI_FAST_ABORT);
SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo);
BUG_ON(count > ISCSI_SESSION_ATTRS);
......
......@@ -236,6 +236,7 @@ enum iscsi_param {
ISCSI_PARAM_PASSWORD,
ISCSI_PARAM_PASSWORD_IN,
ISCSI_PARAM_FAST_ABORT,
/* must always be last */
ISCSI_PARAM_MAX,
};
......@@ -266,6 +267,7 @@ enum iscsi_param {
#define ISCSI_USERNAME_IN (1 << ISCSI_PARAM_USERNAME_IN)
#define ISCSI_PASSWORD (1 << ISCSI_PARAM_PASSWORD)
#define ISCSI_PASSWORD_IN (1 << ISCSI_PARAM_PASSWORD_IN)
#define ISCSI_FAST_ABORT (1 << ISCSI_PARAM_FAST_ABORT)
/* iSCSI HBA params */
enum iscsi_host_param {
......
......@@ -600,6 +600,8 @@ struct iscsi_reject {
#define ISCSI_MIN_MAX_BURST_LEN 512
#define ISCSI_MAX_MAX_BURST_LEN 16777215
#define ISCSI_DEF_TIME2WAIT 2
/************************* RFC 3720 End *****************************/
#endif /* ISCSI_PROTO_H */
......@@ -57,11 +57,14 @@ struct iscsi_nopin;
#define ISCSI_MAX_CMD_PER_LUN 128
/* Task Mgmt states */
#define TMABORT_INITIAL 0x0
#define TMABORT_SUCCESS 0x1
#define TMABORT_FAILED 0x2
#define TMABORT_TIMEDOUT 0x3
#define TMABORT_NOT_FOUND 0x4
enum {
TMF_INITIAL,
TMF_QUEUED,
TMF_SUCCESS,
TMF_FAILED,
TMF_TIMEDOUT,
TMF_NOT_FOUND,
};
/* Connection suspend "bit" */
#define ISCSI_SUSPEND_BIT 1
......@@ -91,7 +94,6 @@ enum {
ISCSI_TASK_COMPLETED,
ISCSI_TASK_PENDING,
ISCSI_TASK_RUNNING,
ISCSI_TASK_ABORTING,
};
struct iscsi_cmd_task {
......@@ -110,7 +112,6 @@ struct iscsi_cmd_task {
unsigned data_count; /* remaining Data-Out */
struct scsi_cmnd *sc; /* associated SCSI cmd*/
struct iscsi_conn *conn; /* used connection */
struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */
/* state set/tested under session->lock */
int state;
......@@ -152,10 +153,11 @@ struct iscsi_conn {
struct iscsi_cmd_task *ctask; /* xmit ctask in progress */
/* xmit */
struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */
struct list_head mgmtqueue; /* mgmt (control) xmit queue */
struct list_head mgmt_run_list; /* list of control tasks */
struct list_head xmitqueue; /* data-path cmd queue */
struct list_head run_list; /* list of cmds in progress */
struct list_head requeue; /* tasks needing another run */
struct work_struct xmitwork; /* per-conn. xmit workqueue */
unsigned long suspend_tx; /* suspend Tx */
unsigned long suspend_rx; /* suspend Rx */
......@@ -163,8 +165,8 @@ struct iscsi_conn {
/* abort */
wait_queue_head_t ehwait; /* used in eh_abort() */
struct iscsi_tm tmhdr;
struct timer_list tmabort_timer;
int tmabort_state; /* see TMABORT_INITIAL, etc.*/
struct timer_list tmf_timer;
int tmf_state; /* see TMF_INITIAL, etc.*/
/* negotiated params */
unsigned max_recv_dlength; /* initiator_max_recv_dsl*/
......@@ -231,6 +233,7 @@ struct iscsi_session {
int pdu_inorder_en;
int dataseq_inorder_en;
int erl;
int fast_abort;
int tpgt;
char *username;
char *username_in;
......@@ -268,6 +271,7 @@ struct iscsi_session {
extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth);
extern int iscsi_eh_abort(struct scsi_cmnd *sc);
extern int iscsi_eh_host_reset(struct scsi_cmnd *sc);
extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
extern int iscsi_queuecommand(struct scsi_cmnd *sc,
void (*done)(struct scsi_cmnd *));
......@@ -326,6 +330,7 @@ extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
char *, int);
extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *,
uint32_t *);
extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask);
/*
* generic helpers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册