spi-topcliff-pch: supports a spi mode setup and bit order setup by IO control
[zen-stable.git] / drivers / target / iscsi / iscsi_target_parameters.h
blob6a37fd6f128500d774c4b3b9bd3979e189a8d9c8
1 #ifndef ISCSI_PARAMETERS_H
2 #define ISCSI_PARAMETERS_H
4 struct iscsi_extra_response {
5 char key[64];
6 char value[32];
7 struct list_head er_list;
8 } ____cacheline_aligned;
10 struct iscsi_param {
11 char *name;
12 char *value;
13 u8 set_param;
14 u8 phase;
15 u8 scope;
16 u8 sender;
17 u8 type;
18 u8 use;
19 u16 type_range;
20 u32 state;
21 struct list_head p_list;
22 } ____cacheline_aligned;
24 extern int iscsi_login_rx_data(struct iscsi_conn *, char *, int);
25 extern int iscsi_login_tx_data(struct iscsi_conn *, char *, char *, int);
26 extern void iscsi_dump_conn_ops(struct iscsi_conn_ops *);
27 extern void iscsi_dump_sess_ops(struct iscsi_sess_ops *);
28 extern void iscsi_print_params(struct iscsi_param_list *);
29 extern int iscsi_create_default_params(struct iscsi_param_list **);
30 extern int iscsi_set_keys_to_negotiate(int, struct iscsi_param_list *);
31 extern int iscsi_set_keys_irrelevant_for_discovery(struct iscsi_param_list *);
32 extern int iscsi_copy_param_list(struct iscsi_param_list **,
33 struct iscsi_param_list *, int);
34 extern int iscsi_change_param_value(char *, struct iscsi_param_list *, int);
35 extern void iscsi_release_param_list(struct iscsi_param_list *);
36 extern struct iscsi_param *iscsi_find_param_from_key(char *, struct iscsi_param_list *);
37 extern int iscsi_extract_key_value(char *, char **, char **);
38 extern int iscsi_update_param_value(struct iscsi_param *, char *);
39 extern int iscsi_decode_text_input(u8, u8, char *, u32, struct iscsi_param_list *);
40 extern int iscsi_encode_text_output(u8, u8, char *, u32 *,
41 struct iscsi_param_list *);
42 extern int iscsi_check_negotiated_keys(struct iscsi_param_list *);
43 extern void iscsi_set_connection_parameters(struct iscsi_conn_ops *,
44 struct iscsi_param_list *);
45 extern void iscsi_set_session_parameters(struct iscsi_sess_ops *,
46 struct iscsi_param_list *, int);
48 #define YES "Yes"
49 #define NO "No"
50 #define ALL "All"
51 #define IRRELEVANT "Irrelevant"
52 #define NONE "None"
53 #define NOTUNDERSTOOD "NotUnderstood"
54 #define REJECT "Reject"
57 * The Parameter Names.
59 #define AUTHMETHOD "AuthMethod"
60 #define HEADERDIGEST "HeaderDigest"
61 #define DATADIGEST "DataDigest"
62 #define MAXCONNECTIONS "MaxConnections"
63 #define SENDTARGETS "SendTargets"
64 #define TARGETNAME "TargetName"
65 #define INITIATORNAME "InitiatorName"
66 #define TARGETALIAS "TargetAlias"
67 #define INITIATORALIAS "InitiatorAlias"
68 #define TARGETADDRESS "TargetAddress"
69 #define TARGETPORTALGROUPTAG "TargetPortalGroupTag"
70 #define INITIALR2T "InitialR2T"
71 #define IMMEDIATEDATA "ImmediateData"
72 #define MAXRECVDATASEGMENTLENGTH "MaxRecvDataSegmentLength"
73 #define MAXBURSTLENGTH "MaxBurstLength"
74 #define FIRSTBURSTLENGTH "FirstBurstLength"
75 #define DEFAULTTIME2WAIT "DefaultTime2Wait"
76 #define DEFAULTTIME2RETAIN "DefaultTime2Retain"
77 #define MAXOUTSTANDINGR2T "MaxOutstandingR2T"
78 #define DATAPDUINORDER "DataPDUInOrder"
79 #define DATASEQUENCEINORDER "DataSequenceInOrder"
80 #define ERRORRECOVERYLEVEL "ErrorRecoveryLevel"
81 #define SESSIONTYPE "SessionType"
82 #define IFMARKER "IFMarker"
83 #define OFMARKER "OFMarker"
84 #define IFMARKINT "IFMarkInt"
85 #define OFMARKINT "OFMarkInt"
86 #define X_EXTENSIONKEY "X-com.sbei.version"
87 #define X_EXTENSIONKEY_CISCO_NEW "X-com.cisco.protocol"
88 #define X_EXTENSIONKEY_CISCO_OLD "X-com.cisco.iscsi.draft"
91 * For AuthMethod.
93 #define KRB5 "KRB5"
94 #define SPKM1 "SPKM1"
95 #define SPKM2 "SPKM2"
96 #define SRP "SRP"
97 #define CHAP "CHAP"
100 * Initial values for Parameter Negotiation.
102 #define INITIAL_AUTHMETHOD CHAP
103 #define INITIAL_HEADERDIGEST "CRC32C,None"
104 #define INITIAL_DATADIGEST "CRC32C,None"
105 #define INITIAL_MAXCONNECTIONS "1"
106 #define INITIAL_SENDTARGETS ALL
107 #define INITIAL_TARGETNAME "LIO.Target"
108 #define INITIAL_INITIATORNAME "LIO.Initiator"
109 #define INITIAL_TARGETALIAS "LIO Target"
110 #define INITIAL_INITIATORALIAS "LIO Initiator"
111 #define INITIAL_TARGETADDRESS "0.0.0.0:0000,0"
112 #define INITIAL_TARGETPORTALGROUPTAG "1"
113 #define INITIAL_INITIALR2T YES
114 #define INITIAL_IMMEDIATEDATA YES
115 #define INITIAL_MAXRECVDATASEGMENTLENGTH "8192"
116 #define INITIAL_MAXBURSTLENGTH "262144"
117 #define INITIAL_FIRSTBURSTLENGTH "65536"
118 #define INITIAL_DEFAULTTIME2WAIT "2"
119 #define INITIAL_DEFAULTTIME2RETAIN "20"
120 #define INITIAL_MAXOUTSTANDINGR2T "1"
121 #define INITIAL_DATAPDUINORDER YES
122 #define INITIAL_DATASEQUENCEINORDER YES
123 #define INITIAL_ERRORRECOVERYLEVEL "0"
124 #define INITIAL_SESSIONTYPE NORMAL
125 #define INITIAL_IFMARKER NO
126 #define INITIAL_OFMARKER NO
127 #define INITIAL_IFMARKINT "2048~65535"
128 #define INITIAL_OFMARKINT "2048~65535"
131 * For [Header,Data]Digests.
133 #define CRC32C "CRC32C"
136 * For SessionType.
138 #define DISCOVERY "Discovery"
139 #define NORMAL "Normal"
142 * struct iscsi_param->use
144 #define USE_LEADING_ONLY 0x01
145 #define USE_INITIAL_ONLY 0x02
146 #define USE_ALL 0x04
148 #define IS_USE_LEADING_ONLY(p) ((p)->use & USE_LEADING_ONLY)
149 #define IS_USE_INITIAL_ONLY(p) ((p)->use & USE_INITIAL_ONLY)
150 #define IS_USE_ALL(p) ((p)->use & USE_ALL)
152 #define SET_USE_INITIAL_ONLY(p) ((p)->use |= USE_INITIAL_ONLY)
155 * struct iscsi_param->sender
157 #define SENDER_INITIATOR 0x01
158 #define SENDER_TARGET 0x02
159 #define SENDER_BOTH 0x03
160 /* Used in iscsi_check_key() */
161 #define SENDER_RECEIVER 0x04
163 #define IS_SENDER_INITIATOR(p) ((p)->sender & SENDER_INITIATOR)
164 #define IS_SENDER_TARGET(p) ((p)->sender & SENDER_TARGET)
165 #define IS_SENDER_BOTH(p) ((p)->sender & SENDER_BOTH)
168 * struct iscsi_param->scope
170 #define SCOPE_CONNECTION_ONLY 0x01
171 #define SCOPE_SESSION_WIDE 0x02
173 #define IS_SCOPE_CONNECTION_ONLY(p) ((p)->scope & SCOPE_CONNECTION_ONLY)
174 #define IS_SCOPE_SESSION_WIDE(p) ((p)->scope & SCOPE_SESSION_WIDE)
177 * struct iscsi_param->phase
179 #define PHASE_SECURITY 0x01
180 #define PHASE_OPERATIONAL 0x02
181 #define PHASE_DECLARATIVE 0x04
182 #define PHASE_FFP0 0x08
184 #define IS_PHASE_SECURITY(p) ((p)->phase & PHASE_SECURITY)
185 #define IS_PHASE_OPERATIONAL(p) ((p)->phase & PHASE_OPERATIONAL)
186 #define IS_PHASE_DECLARATIVE(p) ((p)->phase & PHASE_DECLARATIVE)
187 #define IS_PHASE_FFP0(p) ((p)->phase & PHASE_FFP0)
190 * struct iscsi_param->type
192 #define TYPE_BOOL_AND 0x01
193 #define TYPE_BOOL_OR 0x02
194 #define TYPE_NUMBER 0x04
195 #define TYPE_NUMBER_RANGE 0x08
196 #define TYPE_STRING 0x10
197 #define TYPE_VALUE_LIST 0x20
199 #define IS_TYPE_BOOL_AND(p) ((p)->type & TYPE_BOOL_AND)
200 #define IS_TYPE_BOOL_OR(p) ((p)->type & TYPE_BOOL_OR)
201 #define IS_TYPE_NUMBER(p) ((p)->type & TYPE_NUMBER)
202 #define IS_TYPE_NUMBER_RANGE(p) ((p)->type & TYPE_NUMBER_RANGE)
203 #define IS_TYPE_STRING(p) ((p)->type & TYPE_STRING)
204 #define IS_TYPE_VALUE_LIST(p) ((p)->type & TYPE_VALUE_LIST)
207 * struct iscsi_param->type_range
209 #define TYPERANGE_BOOL_AND 0x0001
210 #define TYPERANGE_BOOL_OR 0x0002
211 #define TYPERANGE_0_TO_2 0x0004
212 #define TYPERANGE_0_TO_3600 0x0008
213 #define TYPERANGE_0_TO_32767 0x0010
214 #define TYPERANGE_0_TO_65535 0x0020
215 #define TYPERANGE_1_TO_65535 0x0040
216 #define TYPERANGE_2_TO_3600 0x0080
217 #define TYPERANGE_512_TO_16777215 0x0100
218 #define TYPERANGE_AUTH 0x0200
219 #define TYPERANGE_DIGEST 0x0400
220 #define TYPERANGE_ISCSINAME 0x0800
221 #define TYPERANGE_MARKINT 0x1000
222 #define TYPERANGE_SESSIONTYPE 0x2000
223 #define TYPERANGE_TARGETADDRESS 0x4000
224 #define TYPERANGE_UTF8 0x8000
226 #define IS_TYPERANGE_0_TO_2(p) ((p)->type_range & TYPERANGE_0_TO_2)
227 #define IS_TYPERANGE_0_TO_3600(p) ((p)->type_range & TYPERANGE_0_TO_3600)
228 #define IS_TYPERANGE_0_TO_32767(p) ((p)->type_range & TYPERANGE_0_TO_32767)
229 #define IS_TYPERANGE_0_TO_65535(p) ((p)->type_range & TYPERANGE_0_TO_65535)
230 #define IS_TYPERANGE_1_TO_65535(p) ((p)->type_range & TYPERANGE_1_TO_65535)
231 #define IS_TYPERANGE_2_TO_3600(p) ((p)->type_range & TYPERANGE_2_TO_3600)
232 #define IS_TYPERANGE_512_TO_16777215(p) ((p)->type_range & \
233 TYPERANGE_512_TO_16777215)
234 #define IS_TYPERANGE_AUTH_PARAM(p) ((p)->type_range & TYPERANGE_AUTH)
235 #define IS_TYPERANGE_DIGEST_PARAM(p) ((p)->type_range & TYPERANGE_DIGEST)
236 #define IS_TYPERANGE_SESSIONTYPE(p) ((p)->type_range & \
237 TYPERANGE_SESSIONTYPE)
240 * struct iscsi_param->state
242 #define PSTATE_ACCEPTOR 0x01
243 #define PSTATE_NEGOTIATE 0x02
244 #define PSTATE_PROPOSER 0x04
245 #define PSTATE_IRRELEVANT 0x08
246 #define PSTATE_REJECT 0x10
247 #define PSTATE_REPLY_OPTIONAL 0x20
248 #define PSTATE_RESPONSE_GOT 0x40
249 #define PSTATE_RESPONSE_SENT 0x80
251 #define IS_PSTATE_ACCEPTOR(p) ((p)->state & PSTATE_ACCEPTOR)
252 #define IS_PSTATE_NEGOTIATE(p) ((p)->state & PSTATE_NEGOTIATE)
253 #define IS_PSTATE_PROPOSER(p) ((p)->state & PSTATE_PROPOSER)
254 #define IS_PSTATE_IRRELEVANT(p) ((p)->state & PSTATE_IRRELEVANT)
255 #define IS_PSTATE_REJECT(p) ((p)->state & PSTATE_REJECT)
256 #define IS_PSTATE_REPLY_OPTIONAL(p) ((p)->state & PSTATE_REPLY_OPTIONAL)
257 #define IS_PSTATE_RESPONSE_GOT(p) ((p)->state & PSTATE_RESPONSE_GOT)
258 #define IS_PSTATE_RESPONSE_SENT(p) ((p)->state & PSTATE_RESPONSE_SENT)
260 #define SET_PSTATE_ACCEPTOR(p) ((p)->state |= PSTATE_ACCEPTOR)
261 #define SET_PSTATE_NEGOTIATE(p) ((p)->state |= PSTATE_NEGOTIATE)
262 #define SET_PSTATE_PROPOSER(p) ((p)->state |= PSTATE_PROPOSER)
263 #define SET_PSTATE_IRRELEVANT(p) ((p)->state |= PSTATE_IRRELEVANT)
264 #define SET_PSTATE_REJECT(p) ((p)->state |= PSTATE_REJECT)
265 #define SET_PSTATE_REPLY_OPTIONAL(p) ((p)->state |= PSTATE_REPLY_OPTIONAL)
266 #define SET_PSTATE_RESPONSE_GOT(p) ((p)->state |= PSTATE_RESPONSE_GOT)
267 #define SET_PSTATE_RESPONSE_SENT(p) ((p)->state |= PSTATE_RESPONSE_SENT)
269 #endif /* ISCSI_PARAMETERS_H */