1 #ifndef __BNX2FC_CONSTANTS_H_
2 #define __BNX2FC_CONSTANTS_H_
3 
4 /**
5  * This file defines HSI constants for the FCoE flows
6  */
7 
8 /* KWQ/KCQ FCoE layer code */
9 #define FCOE_KWQE_LAYER_CODE   (7)
10 
11 /* KWQ (kernel work queue) request op codes */
12 #define FCOE_KWQE_OPCODE_INIT1			(0)
13 #define FCOE_KWQE_OPCODE_INIT2			(1)
14 #define FCOE_KWQE_OPCODE_INIT3			(2)
15 #define FCOE_KWQE_OPCODE_OFFLOAD_CONN1	(3)
16 #define FCOE_KWQE_OPCODE_OFFLOAD_CONN2	(4)
17 #define FCOE_KWQE_OPCODE_OFFLOAD_CONN3	(5)
18 #define FCOE_KWQE_OPCODE_OFFLOAD_CONN4	(6)
19 #define FCOE_KWQE_OPCODE_ENABLE_CONN	(7)
20 #define FCOE_KWQE_OPCODE_DISABLE_CONN	(8)
21 #define FCOE_KWQE_OPCODE_DESTROY_CONN	(9)
22 #define FCOE_KWQE_OPCODE_DESTROY		(10)
23 #define FCOE_KWQE_OPCODE_STAT			(11)
24 
25 /* KCQ (kernel completion queue) response op codes */
26 #define FCOE_KCQE_OPCODE_INIT_FUNC				(0x10)
27 #define FCOE_KCQE_OPCODE_DESTROY_FUNC			(0x11)
28 #define FCOE_KCQE_OPCODE_STAT_FUNC				(0x12)
29 #define FCOE_KCQE_OPCODE_OFFLOAD_CONN			(0x15)
30 #define FCOE_KCQE_OPCODE_ENABLE_CONN			(0x16)
31 #define FCOE_KCQE_OPCODE_DISABLE_CONN			(0x17)
32 #define FCOE_KCQE_OPCODE_DESTROY_CONN			(0x18)
33 #define FCOE_KCQE_OPCODE_CQ_EVENT_NOTIFICATION  (0x20)
34 #define FCOE_KCQE_OPCODE_FCOE_ERROR				(0x21)
35 
36 /* KCQ (kernel completion queue) completion status */
37 #define FCOE_KCQE_COMPLETION_STATUS_SUCCESS				(0x0)
38 #define FCOE_KCQE_COMPLETION_STATUS_ERROR				(0x1)
39 #define FCOE_KCQE_COMPLETION_STATUS_INVALID_OPCODE		(0x2)
40 #define FCOE_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE	(0x3)
41 #define FCOE_KCQE_COMPLETION_STATUS_CTX_FREE_FAILURE	(0x4)
42 #define FCOE_KCQE_COMPLETION_STATUS_NIC_ERROR			(0x5)
43 
44 /* Unsolicited CQE type */
45 #define FCOE_UNSOLICITED_FRAME_CQE_TYPE			0
46 #define FCOE_ERROR_DETECTION_CQE_TYPE			1
47 #define FCOE_WARNING_DETECTION_CQE_TYPE			2
48 
49 /* Task context constants */
50 /* After driver has initialize the task in case timer services required */
51 #define	FCOE_TASK_TX_STATE_INIT					0
52 /* In case timer services are required then shall be updated by Xstorm after
53  * start processing the task. In case no timer facilities are required then the
54  * driver would initialize the state to this value */
55 #define	FCOE_TASK_TX_STATE_NORMAL				1
56 /* Task is under abort procedure. Updated in order to stop processing of
57  * pending WQEs on this task */
58 #define	FCOE_TASK_TX_STATE_ABORT				2
59 /* For E_D_T_TOV timer expiration in Xstorm (Class 2 only) */
60 #define	FCOE_TASK_TX_STATE_ERROR				3
61 /* For REC_TOV timer expiration indication received from Xstorm */
62 #define	FCOE_TASK_TX_STATE_WARNING				4
63 /* For completed unsolicited task */
64 #define	FCOE_TASK_TX_STATE_UNSOLICITED_COMPLETED		5
65 /* For exchange cleanup request task */
66 #define	FCOE_TASK_TX_STATE_EXCHANGE_CLEANUP			6
67 /* For sequence cleanup request task */
68 #define	FCOE_TASK_TX_STATE_SEQUENCE_CLEANUP			7
69 /* Mark task as aborted and indicate that ABTS was not transmitted */
70 #define	FCOE_TASK_TX_STATE_BEFORE_ABTS_TX			8
71 /* Mark task as aborted and indicate that ABTS was transmitted */
72 #define	FCOE_TASK_TX_STATE_AFTER_ABTS_TX			9
73 /* For completion the ABTS task. */
74 #define	FCOE_TASK_TX_STATE_ABTS_TX_COMPLETED			10
75 /* Mark task as aborted and indicate that Exchange cleanup was not transmitted
76  */
77 #define	FCOE_TASK_TX_STATE_BEFORE_EXCHANGE_CLEANUP_TX		11
78 /* Mark task as aborted and indicate that Exchange cleanup was transmitted */
79 #define	FCOE_TASK_TX_STATE_AFTER_EXCHANGE_CLEANUP_TX		12
80 
81 #define	FCOE_TASK_RX_STATE_NORMAL				0
82 #define	FCOE_TASK_RX_STATE_COMPLETED				1
83 /* Obsolete: Intermediate completion (middle path with local completion) */
84 #define	FCOE_TASK_RX_STATE_INTER_COMP				2
85 /* For REC_TOV timer expiration indication received from Xstorm */
86 #define	FCOE_TASK_RX_STATE_WARNING				3
87 /* For E_D_T_TOV timer expiration in Ustorm */
88 #define	FCOE_TASK_RX_STATE_ERROR				4
89 /* ABTS ACC arrived wait for local completion to finally complete the task. */
90 #define	FCOE_TASK_RX_STATE_ABTS_ACC_ARRIVED			5
91 /* local completion arrived wait for ABTS ACC to finally complete the task. */
92 #define	FCOE_TASK_RX_STATE_ABTS_LOCAL_COMP_ARRIVED		6
93 /* Special completion indication in case of task was aborted. */
94 #define FCOE_TASK_RX_STATE_ABTS_COMPLETED			7
95 /* Special completion indication in case of task was cleaned. */
96 #define FCOE_TASK_RX_STATE_EXCHANGE_CLEANUP_COMPLETED		8
97 /* Special completion indication (in task requested the exchange cleanup) in
98  * case cleaned task is in non-valid. */
99 #define FCOE_TASK_RX_STATE_ABORT_CLEANUP_COMPLETED		9
100 /* Special completion indication (in task requested the sequence cleanup) in
101  * case cleaned task was already returned to normal. */
102 #define FCOE_TASK_RX_STATE_IGNORED_SEQUENCE_CLEANUP		10
103 /* Exchange cleanup arrived wait until xfer will be handled to finally
104  * complete the task. */
105 #define	FCOE_TASK_RX_STATE_EXCHANGE_CLEANUP_ARRIVED		11
106 /* Xfer handled, wait for exchange cleanup to finally complete the task. */
107 #define	FCOE_TASK_RX_STATE_EXCHANGE_CLEANUP_HANDLED_XFER	12
108 
109 #define	FCOE_TASK_TYPE_WRITE			0
110 #define	FCOE_TASK_TYPE_READ				1
111 #define	FCOE_TASK_TYPE_MIDPATH			2
112 #define	FCOE_TASK_TYPE_UNSOLICITED		3
113 #define	FCOE_TASK_TYPE_ABTS				4
114 #define	FCOE_TASK_TYPE_EXCHANGE_CLEANUP	5
115 #define	FCOE_TASK_TYPE_SEQUENCE_CLEANUP	6
116 
117 #define FCOE_TASK_DEV_TYPE_DISK			0
118 #define FCOE_TASK_DEV_TYPE_TAPE			1
119 
120 #define FCOE_TASK_CLASS_TYPE_3			0
121 #define FCOE_TASK_CLASS_TYPE_2			1
122 
123 /* Everest FCoE connection type */
124 #define B577XX_FCOE_CONNECTION_TYPE		4
125 
126 /* Error codes for Error Reporting in fast path flows */
127 /* XFER error codes */
128 #define FCOE_ERROR_CODE_XFER_OOO_RO					0
129 #define FCOE_ERROR_CODE_XFER_RO_NOT_ALIGNED				1
130 #define FCOE_ERROR_CODE_XFER_NULL_BURST_LEN				2
131 #define FCOE_ERROR_CODE_XFER_RO_GREATER_THAN_DATA2TRNS			3
132 #define FCOE_ERROR_CODE_XFER_INVALID_PAYLOAD_SIZE			4
133 #define FCOE_ERROR_CODE_XFER_TASK_TYPE_NOT_WRITE			5
134 #define FCOE_ERROR_CODE_XFER_PEND_XFER_SET				6
135 #define FCOE_ERROR_CODE_XFER_OPENED_SEQ					7
136 #define FCOE_ERROR_CODE_XFER_FCTL					8
137 
138 /* FCP RSP error codes */
139 #define FCOE_ERROR_CODE_FCP_RSP_BIDI_FLAGS_SET				9
140 #define FCOE_ERROR_CODE_FCP_RSP_UNDERFLOW				10
141 #define FCOE_ERROR_CODE_FCP_RSP_OVERFLOW				11
142 #define FCOE_ERROR_CODE_FCP_RSP_INVALID_LENGTH_FIELD			12
143 #define FCOE_ERROR_CODE_FCP_RSP_INVALID_SNS_FIELD			13
144 #define FCOE_ERROR_CODE_FCP_RSP_INVALID_PAYLOAD_SIZE			14
145 #define FCOE_ERROR_CODE_FCP_RSP_PEND_XFER_SET				15
146 #define FCOE_ERROR_CODE_FCP_RSP_OPENED_SEQ				16
147 #define FCOE_ERROR_CODE_FCP_RSP_FCTL					17
148 #define FCOE_ERROR_CODE_FCP_RSP_LAST_SEQ_RESET				18
149 #define FCOE_ERROR_CODE_FCP_RSP_CONF_REQ_NOT_SUPPORTED_YET		19
150 
151 /* FCP DATA error codes */
152 #define FCOE_ERROR_CODE_DATA_OOO_RO					20
153 #define FCOE_ERROR_CODE_DATA_EXCEEDS_DEFINED_MAX_FRAME_SIZE		21
154 #define FCOE_ERROR_CODE_DATA_EXCEEDS_DATA2TRNS				22
155 #define FCOE_ERROR_CODE_DATA_SOFI3_SEQ_ACTIVE_SET			23
156 #define FCOE_ERROR_CODE_DATA_SOFN_SEQ_ACTIVE_RESET			24
157 #define FCOE_ERROR_CODE_DATA_EOFN_END_SEQ_SET				25
158 #define FCOE_ERROR_CODE_DATA_EOFT_END_SEQ_RESET			26
159 #define FCOE_ERROR_CODE_DATA_TASK_TYPE_NOT_READ			27
160 #define FCOE_ERROR_CODE_DATA_FCTL					28
161 
162 /* Middle path error codes */
163 #define FCOE_ERROR_CODE_MIDPATH_TYPE_NOT_ELS				29
164 #define FCOE_ERROR_CODE_MIDPATH_SOFI3_SEQ_ACTIVE_SET			30
165 #define FCOE_ERROR_CODE_MIDPATH_SOFN_SEQ_ACTIVE_RESET			31
166 #define FCOE_ERROR_CODE_MIDPATH_EOFN_END_SEQ_SET			32
167 #define FCOE_ERROR_CODE_MIDPATH_EOFT_END_SEQ_RESET			33
168 #define FCOE_ERROR_CODE_MIDPATH_ELS_REPLY_FCTL				34
169 #define FCOE_ERROR_CODE_MIDPATH_INVALID_REPLY				35
170 #define FCOE_ERROR_CODE_MIDPATH_ELS_REPLY_RCTL				36
171 
172 /* ABTS error codes */
173 #define FCOE_ERROR_CODE_ABTS_REPLY_F_CTL				37
174 #define FCOE_ERROR_CODE_ABTS_REPLY_DDF_RCTL_FIELD			38
175 #define FCOE_ERROR_CODE_ABTS_REPLY_INVALID_BLS_RCTL			39
176 #define FCOE_ERROR_CODE_ABTS_REPLY_INVALID_RCTL			40
177 #define FCOE_ERROR_CODE_ABTS_REPLY_RCTL_GENERAL_MISMATCH		41
178 
179 /* Common error codes */
180 #define FCOE_ERROR_CODE_COMMON_MIDDLE_FRAME_WITH_PAD			42
181 #define FCOE_ERROR_CODE_COMMON_SEQ_INIT_IN_TCE				43
182 #define FCOE_ERROR_CODE_COMMON_FC_HDR_RX_ID_MISMATCH			44
183 #define FCOE_ERROR_CODE_COMMON_INCORRECT_SEQ_CNT			45
184 #define FCOE_ERROR_CODE_COMMON_DATA_FC_HDR_FCP_TYPE_MISMATCH		46
185 #define FCOE_ERROR_CODE_COMMON_DATA_NO_MORE_SGES			47
186 #define FCOE_ERROR_CODE_COMMON_OPTIONAL_FC_HDR				48
187 #define FCOE_ERROR_CODE_COMMON_READ_TCE_OX_ID_TOO_BIG			49
188 #define FCOE_ERROR_CODE_COMMON_DATA_WAS_NOT_TRANSMITTED		50
189 
190 /* Unsolicited Rx error codes */
191 #define FCOE_ERROR_CODE_UNSOLICITED_TYPE_NOT_ELS			51
192 #define FCOE_ERROR_CODE_UNSOLICITED_TYPE_NOT_BLS			52
193 #define FCOE_ERROR_CODE_UNSOLICITED_FCTL_ELS				53
194 #define FCOE_ERROR_CODE_UNSOLICITED_FCTL_BLS				54
195 #define FCOE_ERROR_CODE_UNSOLICITED_R_CTL				55
196 
197 #define FCOE_ERROR_CODE_RW_TASK_DDF_RCTL_INFO_FIELD			56
198 #define FCOE_ERROR_CODE_RW_TASK_INVALID_RCTL				57
199 #define FCOE_ERROR_CODE_RW_TASK_RCTL_GENERAL_MISMATCH			58
200 
201 /* Timer error codes */
202 #define FCOE_ERROR_CODE_E_D_TOV_TIMER_EXPIRATION			60
203 #define FCOE_ERROR_CODE_REC_TOV_TIMER_EXPIRATION			61
204 
205 
206 #endif /* BNX2FC_CONSTANTS_H_ */
207