• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/scsi/bfa/include/protocol/
1/*
2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef __FC_SP_H__
19#define __FC_SP_H__
20
21#include <protocol/types.h>
22
23#pragma pack(1)
24
25enum auth_els_flags{
26	FC_AUTH_ELS_MORE_FRAGS_FLAG 	= 0x80,	/*! bit-7. More Fragments
27						 * Follow
28						 */
29	FC_AUTH_ELS_CONCAT_FLAG 	= 0x40,	/*! bit-6. Concatenation Flag */
30	FC_AUTH_ELS_SEQ_NUM_FLAG 	= 0x01 	/*! bit-0. Sequence Number */
31};
32
33enum auth_msg_codes{
34	FC_AUTH_MC_AUTH_RJT		= 0x0A,	/*! Auth Reject */
35	FC_AUTH_MC_AUTH_NEG 		= 0x0B, /*! Auth Negotiate */
36	FC_AUTH_MC_AUTH_DONE 		= 0x0C, /*! Auth Done */
37
38	FC_AUTH_MC_DHCHAP_CHAL 		= 0x10, /*! DHCHAP Challenge */
39	FC_AUTH_MC_DHCHAP_REPLY 	= 0x11, /*! DHCHAP Reply */
40	FC_AUTH_MC_DHCHAP_SUCC 		= 0x12, /*! DHCHAP Success */
41
42	FC_AUTH_MC_FCAP_REQ 		= 0x13, /*! FCAP Request */
43	FC_AUTH_MC_FCAP_ACK 		= 0x14, /*! FCAP Acknowledge */
44	FC_AUTH_MC_FCAP_CONF 		= 0x15, /*! FCAP Confirm */
45
46	FC_AUTH_MC_FCPAP_INIT 		= 0x16, /*! FCPAP Init */
47	FC_AUTH_MC_FCPAP_ACC 		= 0x17, /*! FCPAP Accept */
48	FC_AUTH_MC_FCPAP_COMP 		= 0x18, /*! FCPAP Complete */
49
50	FC_AUTH_MC_IKE_SA_INIT 		= 0x22, /*! IKE SA INIT */
51	FC_AUTH_MC_IKE_SA_AUTH 		= 0x23, /*! IKE SA Auth */
52	FC_AUTH_MC_IKE_CREATE_CHILD_SA	= 0x24, /*! IKE Create Child SA */
53	FC_AUTH_MC_IKE_INFO 		= 0x25, /*! IKE informational */
54};
55
56enum auth_proto_version{
57	FC_AUTH_PROTO_VER_1 	= 1,	/*! Protocol Version 1 */
58};
59
60enum {
61	FC_AUTH_ELS_COMMAND_CODE = 0x90,/*! Authentication ELS Command code  */
62	FC_AUTH_PROTO_PARAM_LEN_SZ = 4,	/*! Size of Proto Parameter Len Field */
63	FC_AUTH_PROTO_PARAM_VAL_SZ = 4,	/*! Size of Proto Parameter Val Field */
64	FC_MAX_AUTH_SECRET_LEN     = 256,
65					/*! Maximum secret string length */
66	FC_AUTH_NUM_USABLE_PROTO_LEN_SZ = 4,
67					/*! Size of usable protocols field */
68	FC_AUTH_RESP_VALUE_LEN_SZ	= 4,
69					/*! Size of response value length */
70	FC_MAX_CHAP_KEY_LEN	= 256,	/*! Maximum md5 digest length */
71	FC_MAX_AUTH_RETRIES     = 3,	/*! Maximum number of retries */
72	FC_MD5_DIGEST_LEN       = 16,	/*! MD5 digest length */
73	FC_SHA1_DIGEST_LEN      = 20,	/*! SHA1 digest length */
74	FC_MAX_DHG_SUPPORTED    = 1,	/*! Maximum DH Groups supported */
75	FC_MAX_ALG_SUPPORTED    = 1,	/*! Maximum algorithms supported */
76	FC_MAX_PROTO_SUPPORTED  = 1,	/*! Maximum protocols supported */
77	FC_START_TXN_ID         = 2,	/*! Starting transaction ID */
78};
79
80enum auth_proto_id{
81	FC_AUTH_PROTO_DHCHAP		= 0x00000001,
82	FC_AUTH_PROTO_FCAP 		= 0x00000002,
83	FC_AUTH_PROTO_FCPAP 		= 0x00000003,
84	FC_AUTH_PROTO_IKEv2 		= 0x00000004,
85	FC_AUTH_PROTO_IKEv2_AUTH 	= 0x00000005,
86};
87
88struct auth_name_s{
89	u16	name_tag;	/*! Name Tag = 1 for Authentication */
90	u16	name_len;	/*! Name Length = 8 for Authentication
91					 */
92	wwn_t		name;  		/*! Name. TODO - is this PWWN */
93};
94
95
96enum auth_hash_func{
97	FC_AUTH_HASH_FUNC_MD5 		= 0x00000005,
98	FC_AUTH_HASH_FUNC_SHA_1 	= 0x00000006,
99};
100
101enum auth_dh_gid{
102	FC_AUTH_DH_GID_0_DHG_NULL	= 0x00000000,
103	FC_AUTH_DH_GID_1_DHG_1024	= 0x00000001,
104	FC_AUTH_DH_GID_2_DHG_1280	= 0x00000002,
105	FC_AUTH_DH_GID_3_DHG_1536	= 0x00000003,
106	FC_AUTH_DH_GID_4_DHG_2048	= 0x00000004,
107	FC_AUTH_DH_GID_6_DHG_3072	= 0x00000006,
108	FC_AUTH_DH_GID_7_DHG_4096	= 0x00000007,
109	FC_AUTH_DH_GID_8_DHG_6144	= 0x00000008,
110	FC_AUTH_DH_GID_9_DHG_8192	= 0x00000009,
111};
112
113struct auth_els_msg_s {
114	u8		auth_els_code;	/*  Authentication ELS Code (0x90) */
115	u8 	auth_els_flag; 	/*  Authentication ELS Flags */
116	u8 	auth_msg_code; 	/*  Authentication Message Code */
117	u8 	proto_version; 	/*  Protocol Version */
118	u32	msg_len; 	/*  Message Length */
119	u32	trans_id; 	/*  Transaction Identifier (T_ID) */
120
121	/* Msg payload follows... */
122};
123
124
125enum auth_neg_param_tags {
126	FC_AUTH_NEG_DHCHAP_HASHLIST 	= 0x0001,
127	FC_AUTH_NEG_DHCHAP_DHG_ID_LIST 	= 0x0002,
128};
129
130
131struct dhchap_param_format_s {
132	u16	tag;		/*! Parameter Tag. See
133					 * auth_neg_param_tags_t
134					 */
135	u16	word_cnt;
136
137	/* followed by variable length parameter value... */
138};
139
140struct auth_proto_params_s {
141	u32	proto_param_len;
142	u32	proto_id;
143
144	/*
145	 * Followed by variable length Protocol specific parameters. DH-CHAP
146	 * uses dhchap_param_format_t
147	 */
148};
149
150struct auth_neg_msg_s {
151	struct auth_name_s	auth_ini_name;
152	u32		usable_auth_protos;
153	struct auth_proto_params_s proto_params[1]; /*! (1..usable_auth_proto)
154						     * protocol params
155						     */
156};
157
158struct auth_dh_val_s {
159	u32 dh_val_len;
160	u32 dh_val[1];
161};
162
163struct auth_dhchap_chal_msg_s {
164	struct auth_els_msg_s	hdr;
165	struct auth_name_s auth_responder_name;	/* TODO VRK - is auth_name_t
166						 * type OK?
167						 */
168	u32 	hash_id;
169	u32 	dh_grp_id;
170	u32 	chal_val_len;
171	char		chal_val[1];
172
173	/* ...followed by variable Challenge length/value and DH length/value */
174};
175
176
177enum auth_rjt_codes {
178	FC_AUTH_RJT_CODE_AUTH_FAILURE 	= 0x01,
179	FC_AUTH_RJT_CODE_LOGICAL_ERR	= 0x02,
180};
181
182enum auth_rjt_code_exps {
183	FC_AUTH_CEXP_AUTH_MECH_NOT_USABLE	= 0x01,
184	FC_AUTH_CEXP_DH_GROUP_NOT_USABLE 	= 0x02,
185	FC_AUTH_CEXP_HASH_FUNC_NOT_USABLE 	= 0x03,
186	FC_AUTH_CEXP_AUTH_XACT_STARTED		= 0x04,
187	FC_AUTH_CEXP_AUTH_FAILED 		= 0x05,
188	FC_AUTH_CEXP_INCORRECT_PLD 		= 0x06,
189	FC_AUTH_CEXP_INCORRECT_PROTO_MSG 	= 0x07,
190	FC_AUTH_CEXP_RESTART_AUTH_PROTO 	= 0x08,
191	FC_AUTH_CEXP_AUTH_CONCAT_NOT_SUPP 	= 0x09,
192	FC_AUTH_CEXP_PROTO_VER_NOT_SUPP 	= 0x0A,
193};
194
195enum auth_status {
196	FC_AUTH_STATE_INPROGRESS = 0, 	/*! authentication in progress 	*/
197	FC_AUTH_STATE_FAILED	= 1, 	/*! authentication failed */
198	FC_AUTH_STATE_SUCCESS	= 2 	/*! authentication successful	*/
199};
200
201struct auth_rjt_msg_s {
202	struct auth_els_msg_s	hdr;
203	u8		reason_code;
204	u8		reason_code_exp;
205	u8		rsvd[2];
206};
207
208
209struct auth_dhchap_neg_msg_s {
210	struct auth_els_msg_s hdr;
211	struct auth_neg_msg_s nego;
212};
213
214struct auth_dhchap_reply_msg_s {
215	struct auth_els_msg_s	hdr;
216
217	/*
218	 * followed by response value length & Value + DH Value Length & Value
219	 */
220};
221
222#pragma pack()
223
224#endif /* __FC_SP_H__ */
225