2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2012 The FreeBSD Foundation
6 * This software was developed by Edward Tomasz Napierala under sponsorship
7 * from the FreeBSD Foundation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 #define ISCSI_NAME_LEN 224 /* 223 bytes, by RFC 3720, + '\0' */
40 #define ISCSI_ADDR_LEN 47 /* INET6_ADDRSTRLEN + '\0' */
41 #define ISCSI_SECRET_LEN 17 /* 16 + '\0' */
43 struct iscsi_outstanding {
44 TAILQ_ENTRY(iscsi_outstanding) io_next;
48 uint32_t io_initiator_task_tag;
49 uint32_t io_referenced_task_tag;
53 struct iscsi_session {
54 TAILQ_ENTRY(iscsi_session) is_next;
56 struct icl_conn *is_conn;
63 uint32_t is_initiator_task_tag;
64 int is_protocol_level;
66 int is_max_burst_length;
67 int is_first_burst_length;
70 bool is_immediate_data;
71 char is_target_alias[ISCSI_ALIAS_LEN];
73 TAILQ_HEAD(, iscsi_outstanding) is_outstanding;
74 STAILQ_HEAD(, icl_pdu) is_postponed;
76 struct callout is_callout;
77 unsigned int is_timeout;
80 * XXX: This could be rewritten using a single variable,
81 * but somehow it results in uglier code.
84 * We're waiting for iscsid(8); after iscsid_timeout
85 * expires, kernel will wake up an iscsid(8) to handle
88 bool is_waiting_for_iscsid;
91 * Some iscsid(8) instance is handling the session;
92 * after login_timeout expires, kernel will wake up
93 * another iscsid(8) to handle the session.
98 * We're in the process of removing the iSCSI session.
103 * We're waiting for the maintenance thread to do some
104 * reconnection tasks.
106 bool is_reconnecting;
110 struct cam_devq *is_devq;
111 struct cam_sim *is_sim;
112 struct cam_path *is_path;
113 struct cv is_maintenance_cv;
114 struct iscsi_softc *is_softc;
116 struct iscsi_session_conf is_conf;
119 char is_reason[ISCSI_REASON_LEN];
121 #ifdef ICL_KERNEL_PROXY
122 struct cv is_login_cv;
123 struct icl_pdu *is_login_pdu;
130 struct cdev *sc_cdev;
131 TAILQ_HEAD(, iscsi_session) sc_sessions;
133 unsigned int sc_last_session_id;
135 eventhandler_tag sc_shutdown_pre_eh;
136 eventhandler_tag sc_shutdown_post_eh;
139 #endif /* !ISCSI_H */