Commit 843c0a8a authored by Mike Christie's avatar Mike Christie Committed by 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: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 8ae732a9
...@@ -220,12 +220,6 @@ iscsi_iser_ctask_xmit(struct iscsi_conn *conn, ...@@ -220,12 +220,6 @@ iscsi_iser_ctask_xmit(struct iscsi_conn *conn,
debug_scsi("ctask deq [cid %d itt 0x%x]\n", debug_scsi("ctask deq [cid %d itt 0x%x]\n",
conn->id, ctask->itt); conn->id, ctask->itt);
/*
* serialize with TMF AbortTask
*/
if (ctask->mtask)
return error;
/* Send the cmd PDU */ /* Send the cmd PDU */
if (!iser_ctask->command_sent) { if (!iser_ctask->command_sent) {
error = iser_send_command(conn, ctask); error = iser_send_command(conn, ctask);
......
This diff is collapsed.
...@@ -32,21 +32,21 @@ ...@@ -32,21 +32,21 @@
#define IN_PROGRESS_PAD_RECV 0x4 #define IN_PROGRESS_PAD_RECV 0x4
/* xmit state machine */ /* xmit state machine */
#define XMSTATE_VALUE_IDLE 0 #define XMSTATE_IDLE 0x0
#define XMSTATE_BIT_CMD_HDR_INIT 0 #define XMSTATE_CMD_HDR_INIT 0x1
#define XMSTATE_BIT_CMD_HDR_XMIT 1 #define XMSTATE_CMD_HDR_XMIT 0x2
#define XMSTATE_BIT_IMM_HDR 2 #define XMSTATE_IMM_HDR 0x4
#define XMSTATE_BIT_IMM_DATA 3 #define XMSTATE_IMM_DATA 0x8
#define XMSTATE_BIT_UNS_INIT 4 #define XMSTATE_UNS_INIT 0x10
#define XMSTATE_BIT_UNS_HDR 5 #define XMSTATE_UNS_HDR 0x20
#define XMSTATE_BIT_UNS_DATA 6 #define XMSTATE_UNS_DATA 0x40
#define XMSTATE_BIT_SOL_HDR 7 #define XMSTATE_SOL_HDR 0x80
#define XMSTATE_BIT_SOL_DATA 8 #define XMSTATE_SOL_DATA 0x100
#define XMSTATE_BIT_W_PAD 9 #define XMSTATE_W_PAD 0x200
#define XMSTATE_BIT_W_RESEND_PAD 10 #define XMSTATE_W_RESEND_PAD 0x400
#define XMSTATE_BIT_W_RESEND_DATA_DIGEST 11 #define XMSTATE_W_RESEND_DATA_DIGEST 0x800
#define XMSTATE_BIT_IMM_HDR_INIT 12 #define XMSTATE_IMM_HDR_INIT 0x1000
#define XMSTATE_BIT_SOL_HDR_INIT 13 #define XMSTATE_SOL_HDR_INIT 0x2000
#define ISCSI_PAD_LEN 4 #define ISCSI_PAD_LEN 4
#define ISCSI_SG_TABLESIZE SG_ALL #define ISCSI_SG_TABLESIZE SG_ALL
...@@ -122,7 +122,7 @@ struct iscsi_data_task { ...@@ -122,7 +122,7 @@ struct iscsi_data_task {
struct iscsi_tcp_mgmt_task { struct iscsi_tcp_mgmt_task {
struct iscsi_hdr hdr; struct iscsi_hdr hdr;
char hdrext[sizeof(__u32)]; /* Header-Digest */ 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 headbuf; /* header buffer */
struct iscsi_buf sendbuf; /* in progress buffer */ struct iscsi_buf sendbuf; /* in progress buffer */
int sent; int sent;
...@@ -150,7 +150,7 @@ struct iscsi_tcp_cmd_task { ...@@ -150,7 +150,7 @@ struct iscsi_tcp_cmd_task {
int pad_count; /* padded bytes */ int pad_count; /* padded bytes */
struct iscsi_buf headbuf; /* header buf (xmit) */ struct iscsi_buf headbuf; /* header buf (xmit) */
struct iscsi_buf sendbuf; /* in progress buffer*/ struct iscsi_buf sendbuf; /* in progress buffer*/
unsigned long xmstate; /* xmit xtate machine */ int xmstate; /* xmit xtate machine */
int sent; int sent;
struct scatterlist *sg; /* per-cmd SG list */ struct scatterlist *sg; /* per-cmd SG list */
struct scatterlist *bad_sg; /* assert statement */ struct scatterlist *bad_sg; /* assert statement */
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <scsi/scsi_transport_iscsi.h> #include <scsi/scsi_transport_iscsi.h>
#include <scsi/iscsi_if.h> #include <scsi/iscsi_if.h>
#define ISCSI_SESSION_ATTRS 15 #define ISCSI_SESSION_ATTRS 16
#define ISCSI_CONN_ATTRS 11 #define ISCSI_CONN_ATTRS 11
#define ISCSI_HOST_ATTRS 4 #define ISCSI_HOST_ATTRS 4
#define ISCSI_TRANSPORT_VERSION "2.0-724" #define ISCSI_TRANSPORT_VERSION "2.0-724"
...@@ -1218,6 +1218,7 @@ iscsi_session_attr(username, ISCSI_PARAM_USERNAME, 1); ...@@ -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(username_in, ISCSI_PARAM_USERNAME_IN, 1);
iscsi_session_attr(password, ISCSI_PARAM_PASSWORD, 1); iscsi_session_attr(password, ISCSI_PARAM_PASSWORD, 1);
iscsi_session_attr(password_in, ISCSI_PARAM_PASSWORD_IN, 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) \ #define iscsi_priv_session_attr_show(field, format) \
static ssize_t \ static ssize_t \
...@@ -1439,6 +1440,7 @@ iscsi_register_transport(struct iscsi_transport *tt) ...@@ -1439,6 +1440,7 @@ iscsi_register_transport(struct iscsi_transport *tt)
SETUP_SESSION_RD_ATTR(password_in, ISCSI_USERNAME_IN); SETUP_SESSION_RD_ATTR(password_in, ISCSI_USERNAME_IN);
SETUP_SESSION_RD_ATTR(username, ISCSI_PASSWORD); SETUP_SESSION_RD_ATTR(username, ISCSI_PASSWORD);
SETUP_SESSION_RD_ATTR(username_in, ISCSI_PASSWORD_IN); 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); SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo);
BUG_ON(count > ISCSI_SESSION_ATTRS); BUG_ON(count > ISCSI_SESSION_ATTRS);
......
...@@ -236,6 +236,7 @@ enum iscsi_param { ...@@ -236,6 +236,7 @@ enum iscsi_param {
ISCSI_PARAM_PASSWORD, ISCSI_PARAM_PASSWORD,
ISCSI_PARAM_PASSWORD_IN, ISCSI_PARAM_PASSWORD_IN,
ISCSI_PARAM_FAST_ABORT,
/* must always be last */ /* must always be last */
ISCSI_PARAM_MAX, ISCSI_PARAM_MAX,
}; };
...@@ -266,6 +267,7 @@ enum iscsi_param { ...@@ -266,6 +267,7 @@ enum iscsi_param {
#define ISCSI_USERNAME_IN (1 << ISCSI_PARAM_USERNAME_IN) #define ISCSI_USERNAME_IN (1 << ISCSI_PARAM_USERNAME_IN)
#define ISCSI_PASSWORD (1 << ISCSI_PARAM_PASSWORD) #define ISCSI_PASSWORD (1 << ISCSI_PARAM_PASSWORD)
#define ISCSI_PASSWORD_IN (1 << ISCSI_PARAM_PASSWORD_IN) #define ISCSI_PASSWORD_IN (1 << ISCSI_PARAM_PASSWORD_IN)
#define ISCSI_FAST_ABORT (1 << ISCSI_PARAM_FAST_ABORT)
/* iSCSI HBA params */ /* iSCSI HBA params */
enum iscsi_host_param { enum iscsi_host_param {
......
...@@ -600,6 +600,8 @@ struct iscsi_reject { ...@@ -600,6 +600,8 @@ struct iscsi_reject {
#define ISCSI_MIN_MAX_BURST_LEN 512 #define ISCSI_MIN_MAX_BURST_LEN 512
#define ISCSI_MAX_MAX_BURST_LEN 16777215 #define ISCSI_MAX_MAX_BURST_LEN 16777215
#define ISCSI_DEF_TIME2WAIT 2
/************************* RFC 3720 End *****************************/ /************************* RFC 3720 End *****************************/
#endif /* ISCSI_PROTO_H */ #endif /* ISCSI_PROTO_H */
...@@ -57,11 +57,14 @@ struct iscsi_nopin; ...@@ -57,11 +57,14 @@ struct iscsi_nopin;
#define ISCSI_MAX_CMD_PER_LUN 128 #define ISCSI_MAX_CMD_PER_LUN 128
/* Task Mgmt states */ /* Task Mgmt states */
#define TMABORT_INITIAL 0x0 enum {
#define TMABORT_SUCCESS 0x1 TMF_INITIAL,
#define TMABORT_FAILED 0x2 TMF_QUEUED,
#define TMABORT_TIMEDOUT 0x3 TMF_SUCCESS,
#define TMABORT_NOT_FOUND 0x4 TMF_FAILED,
TMF_TIMEDOUT,
TMF_NOT_FOUND,
};
/* Connection suspend "bit" */ /* Connection suspend "bit" */
#define ISCSI_SUSPEND_BIT 1 #define ISCSI_SUSPEND_BIT 1
...@@ -91,7 +94,6 @@ enum { ...@@ -91,7 +94,6 @@ enum {
ISCSI_TASK_COMPLETED, ISCSI_TASK_COMPLETED,
ISCSI_TASK_PENDING, ISCSI_TASK_PENDING,
ISCSI_TASK_RUNNING, ISCSI_TASK_RUNNING,
ISCSI_TASK_ABORTING,
}; };
struct iscsi_cmd_task { struct iscsi_cmd_task {
...@@ -110,7 +112,6 @@ struct iscsi_cmd_task { ...@@ -110,7 +112,6 @@ struct iscsi_cmd_task {
unsigned data_count; /* remaining Data-Out */ unsigned data_count; /* remaining Data-Out */
struct scsi_cmnd *sc; /* associated SCSI cmd*/ struct scsi_cmnd *sc; /* associated SCSI cmd*/
struct iscsi_conn *conn; /* used connection */ struct iscsi_conn *conn; /* used connection */
struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */
/* state set/tested under session->lock */ /* state set/tested under session->lock */
int state; int state;
...@@ -152,10 +153,11 @@ struct iscsi_conn { ...@@ -152,10 +153,11 @@ struct iscsi_conn {
struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ struct iscsi_cmd_task *ctask; /* xmit ctask in progress */
/* xmit */ /* 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 mgmt_run_list; /* list of control tasks */
struct list_head xmitqueue; /* data-path cmd queue */ struct list_head xmitqueue; /* data-path cmd queue */
struct list_head run_list; /* list of cmds in progress */ 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 */ struct work_struct xmitwork; /* per-conn. xmit workqueue */
unsigned long suspend_tx; /* suspend Tx */ unsigned long suspend_tx; /* suspend Tx */
unsigned long suspend_rx; /* suspend Rx */ unsigned long suspend_rx; /* suspend Rx */
...@@ -163,8 +165,8 @@ struct iscsi_conn { ...@@ -163,8 +165,8 @@ struct iscsi_conn {
/* abort */ /* abort */
wait_queue_head_t ehwait; /* used in eh_abort() */ wait_queue_head_t ehwait; /* used in eh_abort() */
struct iscsi_tm tmhdr; struct iscsi_tm tmhdr;
struct timer_list tmabort_timer; struct timer_list tmf_timer;
int tmabort_state; /* see TMABORT_INITIAL, etc.*/ int tmf_state; /* see TMF_INITIAL, etc.*/
/* negotiated params */ /* negotiated params */
unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ unsigned max_recv_dlength; /* initiator_max_recv_dsl*/
...@@ -231,6 +233,7 @@ struct iscsi_session { ...@@ -231,6 +233,7 @@ struct iscsi_session {
int pdu_inorder_en; int pdu_inorder_en;
int dataseq_inorder_en; int dataseq_inorder_en;
int erl; int erl;
int fast_abort;
int tpgt; int tpgt;
char *username; char *username;
char *username_in; char *username_in;
...@@ -268,6 +271,7 @@ struct iscsi_session { ...@@ -268,6 +271,7 @@ struct iscsi_session {
extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); 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_abort(struct scsi_cmnd *sc);
extern int iscsi_eh_host_reset(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, extern int iscsi_queuecommand(struct scsi_cmnd *sc,
void (*done)(struct scsi_cmnd *)); void (*done)(struct scsi_cmnd *));
...@@ -326,6 +330,7 @@ extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, ...@@ -326,6 +330,7 @@ extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
char *, int); char *, int);
extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *, extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *,
uint32_t *); uint32_t *);
extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask);
/* /*
* generic helpers * generic helpers
......
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