aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/iscsi_if.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/iscsi_if.h')
-rw-r--r--include/scsi/iscsi_if.h151
1 files changed, 119 insertions, 32 deletions
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index e5618b90996..55ebf035e62 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -43,10 +43,23 @@ enum iscsi_uevent_e {
43 ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10, 43 ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10,
44 ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11, 44 ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11,
45 45
46 ISCSI_UEVENT_TRANSPORT_EP_CONNECT = UEVENT_BASE + 12,
47 ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13,
48 ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14,
49
50 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
51
46 /* up events */ 52 /* up events */
47 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 53 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
48 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, 54 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
49 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3, 55 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
56 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
57};
58
59enum iscsi_tgt_dscvr {
60 ISCSI_TGT_DSCVR_SEND_TARGETS = 1,
61 ISCSI_TGT_DSCVR_ISNS = 2,
62 ISCSI_TGT_DSCVR_SLP = 3,
50}; 63};
51 64
52struct iscsi_uevent { 65struct iscsi_uevent {
@@ -60,61 +73,98 @@ struct iscsi_uevent {
60 uint32_t initial_cmdsn; 73 uint32_t initial_cmdsn;
61 } c_session; 74 } c_session;
62 struct msg_destroy_session { 75 struct msg_destroy_session {
63 uint64_t session_handle;
64 uint32_t sid; 76 uint32_t sid;
65 } d_session; 77 } d_session;
66 struct msg_create_conn { 78 struct msg_create_conn {
67 uint64_t session_handle;
68 uint32_t cid;
69 uint32_t sid; 79 uint32_t sid;
80 uint32_t cid;
70 } c_conn; 81 } c_conn;
71 struct msg_bind_conn { 82 struct msg_bind_conn {
72 uint64_t session_handle; 83 uint32_t sid;
73 uint64_t conn_handle; 84 uint32_t cid;
74 uint32_t transport_fd; 85 uint64_t transport_eph;
75 uint32_t is_leading; 86 uint32_t is_leading;
76 } b_conn; 87 } b_conn;
77 struct msg_destroy_conn { 88 struct msg_destroy_conn {
78 uint64_t conn_handle; 89 uint32_t sid;
79 uint32_t cid; 90 uint32_t cid;
80 } d_conn; 91 } d_conn;
81 struct msg_send_pdu { 92 struct msg_send_pdu {
93 uint32_t sid;
94 uint32_t cid;
82 uint32_t hdr_size; 95 uint32_t hdr_size;
83 uint32_t data_size; 96 uint32_t data_size;
84 uint64_t conn_handle;
85 } send_pdu; 97 } send_pdu;
86 struct msg_set_param { 98 struct msg_set_param {
87 uint64_t conn_handle; 99 uint32_t sid;
100 uint32_t cid;
88 uint32_t param; /* enum iscsi_param */ 101 uint32_t param; /* enum iscsi_param */
89 uint32_t value; 102 uint32_t len;
90 } set_param; 103 } set_param;
91 struct msg_start_conn { 104 struct msg_start_conn {
92 uint64_t conn_handle; 105 uint32_t sid;
106 uint32_t cid;
93 } start_conn; 107 } start_conn;
94 struct msg_stop_conn { 108 struct msg_stop_conn {
109 uint32_t sid;
110 uint32_t cid;
95 uint64_t conn_handle; 111 uint64_t conn_handle;
96 uint32_t flag; 112 uint32_t flag;
97 } stop_conn; 113 } stop_conn;
98 struct msg_get_stats { 114 struct msg_get_stats {
99 uint64_t conn_handle; 115 uint32_t sid;
116 uint32_t cid;
100 } get_stats; 117 } get_stats;
118 struct msg_transport_connect {
119 uint32_t non_blocking;
120 } ep_connect;
121 struct msg_transport_poll {
122 uint64_t ep_handle;
123 uint32_t timeout_ms;
124 } ep_poll;
125 struct msg_transport_disconnect {
126 uint64_t ep_handle;
127 } ep_disconnect;
128 struct msg_tgt_dscvr {
129 enum iscsi_tgt_dscvr type;
130 uint32_t host_no;
131 /*
132 * enable = 1 to establish a new connection
133 * with the server. enable = 0 to disconnect
134 * from the server. Used primarily to switch
135 * from one iSNS server to another.
136 */
137 uint32_t enable;
138 } tgt_dscvr;
101 } u; 139 } u;
102 union { 140 union {
103 /* messages k -> u */ 141 /* messages k -> u */
104 uint64_t handle;
105 int retcode; 142 int retcode;
106 struct msg_create_session_ret { 143 struct msg_create_session_ret {
107 uint64_t session_handle;
108 uint32_t sid; 144 uint32_t sid;
145 uint32_t host_no;
109 } c_session_ret; 146 } c_session_ret;
147 struct msg_create_conn_ret {
148 uint32_t sid;
149 uint32_t cid;
150 } c_conn_ret;
110 struct msg_recv_req { 151 struct msg_recv_req {
152 uint32_t sid;
153 uint32_t cid;
111 uint64_t recv_handle; 154 uint64_t recv_handle;
112 uint64_t conn_handle;
113 } recv_req; 155 } recv_req;
114 struct msg_conn_error { 156 struct msg_conn_error {
115 uint64_t conn_handle; 157 uint32_t sid;
158 uint32_t cid;
116 uint32_t error; /* enum iscsi_err */ 159 uint32_t error; /* enum iscsi_err */
117 } connerror; 160 } connerror;
161 struct msg_session_destroyed {
162 uint32_t host_no;
163 uint32_t sid;
164 } d_session;
165 struct msg_transport_connect_ret {
166 uint64_t handle;
167 } ep_connect_ret;
118 } r; 168 } r;
119} __attribute__ ((aligned (sizeof(uint64_t)))); 169} __attribute__ ((aligned (sizeof(uint64_t))));
120 170
@@ -139,29 +189,66 @@ enum iscsi_err {
139 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13, 189 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13,
140 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14, 190 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14,
141 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, 191 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
142 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16 192 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
193 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
143}; 194};
144 195
145/* 196/*
146 * iSCSI Parameters (RFC3720) 197 * iSCSI Parameters (RFC3720)
147 */ 198 */
148enum iscsi_param { 199enum iscsi_param {
149 ISCSI_PARAM_MAX_RECV_DLENGTH = 0, 200 /* passed in using netlink set param */
150 ISCSI_PARAM_MAX_XMIT_DLENGTH = 1, 201 ISCSI_PARAM_MAX_RECV_DLENGTH,
151 ISCSI_PARAM_HDRDGST_EN = 2, 202 ISCSI_PARAM_MAX_XMIT_DLENGTH,
152 ISCSI_PARAM_DATADGST_EN = 3, 203 ISCSI_PARAM_HDRDGST_EN,
153 ISCSI_PARAM_INITIAL_R2T_EN = 4, 204 ISCSI_PARAM_DATADGST_EN,
154 ISCSI_PARAM_MAX_R2T = 5, 205 ISCSI_PARAM_INITIAL_R2T_EN,
155 ISCSI_PARAM_IMM_DATA_EN = 6, 206 ISCSI_PARAM_MAX_R2T,
156 ISCSI_PARAM_FIRST_BURST = 7, 207 ISCSI_PARAM_IMM_DATA_EN,
157 ISCSI_PARAM_MAX_BURST = 8, 208 ISCSI_PARAM_FIRST_BURST,
158 ISCSI_PARAM_PDU_INORDER_EN = 9, 209 ISCSI_PARAM_MAX_BURST,
159 ISCSI_PARAM_DATASEQ_INORDER_EN = 10, 210 ISCSI_PARAM_PDU_INORDER_EN,
160 ISCSI_PARAM_ERL = 11, 211 ISCSI_PARAM_DATASEQ_INORDER_EN,
161 ISCSI_PARAM_IFMARKER_EN = 12, 212 ISCSI_PARAM_ERL,
162 ISCSI_PARAM_OFMARKER_EN = 13, 213 ISCSI_PARAM_IFMARKER_EN,
214 ISCSI_PARAM_OFMARKER_EN,
215 ISCSI_PARAM_EXP_STATSN,
216 ISCSI_PARAM_TARGET_NAME,
217 ISCSI_PARAM_TPGT,
218 ISCSI_PARAM_PERSISTENT_ADDRESS,
219 ISCSI_PARAM_PERSISTENT_PORT,
220 ISCSI_PARAM_SESS_RECOVERY_TMO,
221
222 /* pased in through bind conn using transport_fd */
223 ISCSI_PARAM_CONN_PORT,
224 ISCSI_PARAM_CONN_ADDRESS,
225
226 /* must always be last */
227 ISCSI_PARAM_MAX,
163}; 228};
164#define ISCSI_PARAM_MAX 14 229
230#define ISCSI_MAX_RECV_DLENGTH (1 << ISCSI_PARAM_MAX_RECV_DLENGTH)
231#define ISCSI_MAX_XMIT_DLENGTH (1 << ISCSI_PARAM_MAX_XMIT_DLENGTH)
232#define ISCSI_HDRDGST_EN (1 << ISCSI_PARAM_HDRDGST_EN)
233#define ISCSI_DATADGST_EN (1 << ISCSI_PARAM_DATADGST_EN)
234#define ISCSI_INITIAL_R2T_EN (1 << ISCSI_PARAM_INITIAL_R2T_EN)
235#define ISCSI_MAX_R2T (1 << ISCSI_PARAM_MAX_R2T)
236#define ISCSI_IMM_DATA_EN (1 << ISCSI_PARAM_IMM_DATA_EN)
237#define ISCSI_FIRST_BURST (1 << ISCSI_PARAM_FIRST_BURST)
238#define ISCSI_MAX_BURST (1 << ISCSI_PARAM_MAX_BURST)
239#define ISCSI_PDU_INORDER_EN (1 << ISCSI_PARAM_PDU_INORDER_EN)
240#define ISCSI_DATASEQ_INORDER_EN (1 << ISCSI_PARAM_DATASEQ_INORDER_EN)
241#define ISCSI_ERL (1 << ISCSI_PARAM_ERL)
242#define ISCSI_IFMARKER_EN (1 << ISCSI_PARAM_IFMARKER_EN)
243#define ISCSI_OFMARKER_EN (1 << ISCSI_PARAM_OFMARKER_EN)
244#define ISCSI_EXP_STATSN (1 << ISCSI_PARAM_EXP_STATSN)
245#define ISCSI_TARGET_NAME (1 << ISCSI_PARAM_TARGET_NAME)
246#define ISCSI_TPGT (1 << ISCSI_PARAM_TPGT)
247#define ISCSI_PERSISTENT_ADDRESS (1 << ISCSI_PARAM_PERSISTENT_ADDRESS)
248#define ISCSI_PERSISTENT_PORT (1 << ISCSI_PARAM_PERSISTENT_PORT)
249#define ISCSI_SESS_RECOVERY_TMO (1 << ISCSI_PARAM_SESS_RECOVERY_TMO)
250#define ISCSI_CONN_PORT (1 << ISCSI_PARAM_CONN_PORT)
251#define ISCSI_CONN_ADDRESS (1 << ISCSI_PARAM_CONN_ADDRESS)
165 252
166#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 253#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
167#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) 254#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)