PageRenderTime 39ms CodeModel.GetById 15ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/fc4/fc.h

https://bitbucket.org/evzijst/gittest
C Header | 230 lines | 185 code | 19 blank | 26 comment | 0 complexity | 58b5e931f982405ec3514f54b913c08f MD5 | raw file
  1/* fc.h: Definitions for Fibre Channel Physical and Signaling Interface.
  2 *
  3 * Copyright (C) 1996-1997,1999 Jakub Jelinek (jj@ultra.linux.cz)
  4 *
  5 * Sources:
  6 *	Fibre Channel Physical & Signaling Interface (FC-PH), dpANS, 1994
  7 *	dpANS Fibre Channel Protocol for SCSI (X3.269-199X), Rev. 012, 1995
  8 */
  9
 10#ifndef __FC_H
 11#define __FC_H
 12
 13/* World Wide Name */
 14#define NAAID_IEEE		1
 15#define NAAID_IEEE_EXT		2
 16#define NAAID_LOCAL		3
 17#define NAAID_IP		4
 18#define NAAID_IEEE_REG		5
 19#define NAAID_IEEE_REG_EXT	6
 20#define NAAID_CCITT		12
 21#define NAAID_CCITT_GRP		14
 22
 23/* This is NAAID_IEEE_EXT scheme */
 24typedef struct {
 25	u32	naaid:4;
 26	u32	nportid:12;
 27	u32	hi:16;
 28	u32	lo;
 29} fc_wwn;
 30
 31/* Frame header for FC-PH frames */
 32
 33/* r_ctl field */
 34#define R_CTL_DEVICE_DATA	0x00	/* FC4 Device_Data frame */
 35#define R_CTL_EXTENDED_SVC	0x20	/* Extended Link_Data frame */
 36#define R_CTL_FC4_SVC		0x30	/* FC4 Link_Data frame */
 37#define R_CTL_VIDEO		0x40	/* Video_Data frame */
 38#define R_CTL_BASIC_SVC		0x80	/* Basic Link_Data frame */
 39#define R_CTL_LINK_CTL		0xc0	/* Link_Control frame */
 40/* FC4 Device_Data frames */
 41#define R_CTL_UNCATEGORIZED	0x00
 42#define R_CTL_SOLICITED_DATA	0x01
 43#define R_CTL_UNSOL_CONTROL	0x02
 44#define R_CTL_SOLICITED_CONTROL	0x03
 45#define R_CTL_UNSOL_DATA	0x04
 46#define R_CTL_XFER_RDY		0x05
 47#define R_CTL_COMMAND		0x06
 48#define R_CTL_STATUS		0x07
 49/* Basic Link_Data frames */
 50#define R_CTL_LS_NOP		0x80
 51#define R_CTL_LS_ABTS		0x81
 52#define R_CTL_LS_RMC		0x82
 53#define R_CTL_LS_BA_ACC		0x84
 54#define R_CTL_LS_BA_RJT		0x85
 55/* Extended Link_Data frames */
 56#define R_CTL_ELS_REQ		0x22
 57#define R_CTL_ELS_RSP		0x23
 58/* Link_Control frames */
 59#define R_CTL_ACK_1		0xc0
 60#define R_CTL_ACK_N		0xc1
 61#define R_CTL_P_RJT		0xc2
 62#define R_CTL_F_RJT		0xc3
 63#define R_CTL_P_BSY		0xc4
 64#define R_CTL_F_BSY_DF		0xc5
 65#define R_CTL_F_BSY_LC		0xc6
 66#define R_CTL_LCR		0xc7
 67
 68/* type field */
 69#define TYPE_BASIC_LS		0x00
 70#define TYPE_EXTENDED_LS	0x01
 71#define TYPE_IS8802		0x04
 72#define TYPE_IS8802_SNAP	0x05
 73#define TYPE_SCSI_FCP		0x08
 74#define TYPE_SCSI_GPP		0x09
 75#define TYPE_HIPP_FP		0x0a
 76#define TYPE_IPI3_MASTER	0x11
 77#define TYPE_IPI3_SLAVE		0x12
 78#define TYPE_IPI3_PEER		0x13
 79
 80/* f_ctl field */
 81#define F_CTL_FILL_BYTES	0x000003
 82#define F_CTL_XCHG_REASSEMBLE	0x000004
 83#define F_CTL_RO_PRESENT	0x000008
 84#define F_CTL_ABORT_SEQ		0x000030
 85#define F_CTL_CONTINUE_SEQ	0x0000c0
 86#define F_CTL_INVALIDATE_XID	0x004000
 87#define F_CTL_XID_REASSIGNED	0x008000
 88#define F_CTL_SEQ_INITIATIVE	0x010000
 89#define F_CTL_CHAINED_SEQ	0x020000
 90#define F_CTL_END_CONNECT	0x040000
 91#define F_CTL_END_SEQ		0x080000
 92#define F_CTL_LAST_SEQ		0x100000
 93#define F_CTL_FIRST_SEQ		0x200000
 94#define F_CTL_SEQ_CONTEXT	0x400000
 95#define F_CTL_XCHG_CONTEXT	0x800000
 96
 97typedef struct {
 98	u32	r_ctl:8,	did:24;
 99	u32	xxx1:8,		sid:24;
100	u32	type:8,		f_ctl:24;
101	u32	seq_id:8,	df_ctl:8,	seq_cnt:16;
102	u16	ox_id,		rx_id;
103	u32	param;
104} fc_hdr;
105/* The following are ugly macros to make setup of this structure faster */
106#define FILL_FCHDR_RCTL_DID(fch, r_ctl, did) *(u32 *)(fch) = ((r_ctl) << 24) | (did);
107#define FILL_FCHDR_SID(fch, sid) *((u32 *)(fch)+1) = (sid);
108#define FILL_FCHDR_TYPE_FCTL(fch, type, f_ctl) *((u32 *)(fch)+2) = ((type) << 24) | (f_ctl);
109#define FILL_FCHDR_SEQ_DF_SEQ(fch, seq_id, df_ctl, seq_cnt) *((u32 *)(fch)+3) = ((seq_id) << 24) | ((df_ctl) << 16) | (seq_cnt);
110#define FILL_FCHDR_OXRX(fch, ox_id, rx_id) *((u32 *)(fch)+4) = ((ox_id) << 16) | (rx_id);
111
112/* Well known addresses */
113#define FS_GENERAL_MULTICAST	0xfffff7
114#define FS_WELL_KNOWN_MULTICAST	0xfffff8
115#define FS_HUNT_GROUP		0xfffff9
116#define FS_MANAGEMENT_SERVER	0xfffffa
117#define FS_TIME_SERVER		0xfffffb
118#define FS_NAME_SERVER		0xfffffc
119#define FS_FABRIC_CONTROLLER	0xfffffd
120#define FS_FABRIC_F_PORT	0xfffffe
121#define FS_BROADCAST		0xffffff
122
123/* Reject frames */
124/* The param field should be cast to this structure */
125typedef struct {
126	u8	action;
127	u8	reason;
128	u8	xxx;
129	u8	vendor_unique;
130} rjt_param;
131
132/* Reject action codes */
133#define RJT_RETRY			0x01
134#define RJT_NONRETRY			0x02
135
136/* Reject reason codes */
137#define RJT_INVALID_DID			0x01
138#define RJT_INVALID_SID			0x02
139#define RJT_NPORT_NOT_AVAIL_TEMP	0x03
140#define RJT_NPORT_NOT_AVAIL_PERM	0x04
141#define RJT_CLASS_NOT_SUPPORTED		0x05
142#define RJT_DELIMITER_ERROR		0x06
143#define RJT_TYPE_NOT_SUPPORTED		0x07
144#define RJT_INVALID_LINK_CONTROL	0x08
145#define RJT_INVALID_R_CTL		0x09
146#define RJT_INVALID_F_CTL		0x0a
147#define RJT_INVALID_OX_ID		0x0b
148#define RJT_INVALID_RX_ID		0x0c
149#define RJT_INVALID_SEQ_ID		0x0d
150#define RJT_INVALID_DF_CTL		0x0e
151#define RJT_INVALID_SEQ_CNT		0x0f
152#define RJT_INVALID_PARAMETER		0x10
153#define RJT_EXCHANGE_ERROR		0x11
154#define RJT_PROTOCOL_ERROR		0x12
155#define RJT_INCORRECT_LENGTH		0x13
156#define RJT_UNEXPECTED_ACK		0x14
157#define RJT_UNEXPECTED_LINK_RESP	0x15
158#define RJT_LOGIN_REQUIRED		0x16
159#define RJT_EXCESSIVE_SEQUENCES		0x17
160#define RJT_CANT_ESTABLISH_EXCHANGE	0x18
161#define RJT_SECURITY_NOT_SUPPORTED	0x19
162#define RJT_FABRIC_NA			0x1a
163#define RJT_VENDOR_UNIQUE		0xff
164
165
166#define SP_F_PORT_LOGIN			0x10
167
168/* Extended SVC commands */
169#define LS_RJT			0x01000000
170#define LS_ACC			0x02000000
171#define LS_PRLI_ACC		0x02100014
172#define LS_PLOGI		0x03000000
173#define LS_FLOGI		0x04000000
174#define LS_LOGO			0x05000000
175#define LS_ABTX			0x06000000
176#define LS_RCS			0x07000000
177#define LS_RES			0x08000000
178#define LS_RSS			0x09000000
179#define LS_RSI			0x0a000000
180#define LS_ESTS			0x0b000000
181#define LS_ESTC			0x0c000000
182#define LS_ADVC			0x0d000000
183#define LS_RTV			0x0e000000
184#define LS_RLS			0x0f000000
185#define LS_ECHO			0x10000000
186#define LS_TEST			0x11000000
187#define LS_RRQ			0x12000000
188#define LS_IDENT		0x20000000
189#define LS_PRLI			0x20100014
190#define LS_DISPLAY		0x21000000
191#define LS_PRLO			0x21100014
192#define LS_PDISC		0x50000000
193#define LS_ADISC		0x52000000
194
195typedef struct {
196	u8	fcph_hi, fcph_lo;
197	u16	buf2buf_credit;
198	u8	common_features;
199	u8	xxx1;
200	u16	buf2buf_size;
201	u8	xxx2;
202	u8	total_concurrent;
203	u16	off_by_info;
204	u32	e_d_tov;
205} common_svc_parm;
206
207typedef struct {
208	u16	serv_opts;
209	u16	initiator_ctl;
210	u16	rcpt_ctl;
211	u16	recv_size;
212	u8	xxx1;
213	u8	concurrent_seqs;
214	u16	end2end_credit;
215	u16	open_seqs_per_xchg;
216	u16	xxx2;
217} svc_parm;
218
219/* Login */
220typedef struct {
221	u32		code;
222	common_svc_parm	common;
223	fc_wwn		nport_wwn;
224	fc_wwn		node_wwn;
225	svc_parm	class1;
226	svc_parm	class2;
227	svc_parm	class3;
228} logi;
229
230#endif /* !(__FC_H) */