1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22struct lpfc_hba;
23struct lpfc_vport;
24
25
26typedef enum _lpfc_ctx_cmd {
27 LPFC_CTX_LUN,
28 LPFC_CTX_TGT,
29 LPFC_CTX_HOST
30} lpfc_ctx_cmd;
31
32struct lpfc_cq_event {
33 struct list_head list;
34 union {
35 struct lpfc_mcqe mcqe_cmpl;
36 struct lpfc_acqe_link acqe_link;
37 struct lpfc_acqe_fip acqe_fip;
38 struct lpfc_acqe_dcbx acqe_dcbx;
39 struct lpfc_acqe_grp5 acqe_grp5;
40 struct lpfc_acqe_fc_la acqe_fc;
41 struct lpfc_acqe_sli acqe_sli;
42 struct lpfc_rcqe rcqe_cmpl;
43 struct sli4_wcqe_xri_aborted wcqe_axri;
44 struct lpfc_wcqe_complete wcqe_cmpl;
45 } cqe;
46};
47
48
49struct lpfc_iocbq {
50
51 struct list_head list;
52 struct list_head clist;
53 struct list_head dlist;
54 uint16_t iotag;
55 uint16_t sli4_lxritag;
56 uint16_t sli4_xritag;
57 struct lpfc_cq_event cq_event;
58
59 IOCB_t iocb;
60 uint8_t retry;
61 uint16_t iocb_flag;
62#define LPFC_IO_LIBDFC 1
63#define LPFC_IO_WAKE 2
64#define LPFC_IO_FCP 4
65#define LPFC_DRIVER_ABORTED 8
66#define LPFC_IO_FABRIC 0x10
67#define LPFC_DELAY_MEM_FREE 0x20
68#define LPFC_EXCHANGE_BUSY 0x40
69#define LPFC_USE_FCPWQIDX 0x80
70#define DSS_SECURITY_OP 0x100
71#define LPFC_IO_ON_Q 0x200
72#define LPFC_IO_DIF 0x400
73
74#define LPFC_FIP_ELS_ID_MASK 0xc000
75#define LPFC_FIP_ELS_ID_SHIFT 14
76
77 uint8_t rsvd2;
78 uint32_t drvrTimeout;
79 uint32_t fcp_wqidx;
80 struct lpfc_vport *vport;
81 void *context1;
82 void *context2;
83 void *context3;
84 union {
85 wait_queue_head_t *wait_queue;
86 struct lpfc_iocbq *rsp_iocb;
87 struct lpfcMboxq *mbox;
88 struct lpfc_nodelist *ndlp;
89 struct lpfc_node_rrq *rrq;
90 } context_un;
91
92 void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
93 struct lpfc_iocbq *);
94 void (*iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
95 struct lpfc_iocbq *);
96};
97
98#define SLI_IOCB_RET_IOCB 1
99
100#define IOCB_SUCCESS 0
101#define IOCB_BUSY 1
102#define IOCB_ERROR 2
103#define IOCB_TIMEDOUT 3
104
105#define LPFC_MBX_WAKE 1
106#define LPFC_MBX_IMED_UNREG 2
107
108typedef struct lpfcMboxq {
109
110 struct list_head list;
111 union {
112 MAILBOX_t mb;
113 struct lpfc_mqe mqe;
114 } u;
115 struct lpfc_vport *vport;
116 void *context1;
117 void *context2;
118
119 void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *);
120 uint8_t mbox_flag;
121 uint16_t in_ext_byte_len;
122 uint16_t out_ext_byte_len;
123 uint8_t mbox_offset_word;
124 struct lpfc_mcqe mcqe;
125 struct lpfc_mbx_nembed_sge_virt *sge_array;
126} LPFC_MBOXQ_t;
127
128#define MBX_POLL 1
129
130#define MBX_NOWAIT 2
131
132#define LPFC_MAX_RING_MASK 5
133
134#define LPFC_MAX_RING 4
135
136struct lpfc_sli_ring;
137
138struct lpfc_sli_ring_mask {
139 uint8_t profile;
140 uint8_t rctl;
141 uint8_t type;
142 uint8_t rsvd;
143
144 void (*lpfc_sli_rcv_unsol_event) (struct lpfc_hba *,
145 struct lpfc_sli_ring *,
146 struct lpfc_iocbq *);
147};
148
149
150
151struct lpfc_sli_ring_stat {
152 uint64_t iocb_event;
153 uint64_t iocb_cmd;
154 uint64_t iocb_rsp;
155 uint64_t iocb_cmd_delay;
156 uint64_t iocb_cmd_full;
157 uint64_t iocb_cmd_empty;
158 uint64_t iocb_rsp_full;
159};
160
161
162struct lpfc_sli_ring {
163 uint16_t flag;
164#define LPFC_DEFERRED_RING_EVENT 0x001
165#define LPFC_CALL_RING_AVAILABLE 0x002
166#define LPFC_STOP_IOCB_EVENT 0x020
167 uint16_t abtsiotag;
168
169 uint32_t local_getidx;
170 uint32_t next_cmdidx;
171 uint32_t rspidx;
172 uint32_t cmdidx;
173 uint8_t rsvd;
174 uint8_t ringno;
175 uint16_t numCiocb;
176 uint16_t numRiocb;
177 uint16_t sizeCiocb;
178 uint16_t sizeRiocb;
179
180 uint32_t fast_iotag;
181 uint32_t iotag_ctr;
182 uint32_t iotag_max;
183 struct list_head txq;
184 uint16_t txq_cnt;
185 uint16_t txq_max;
186 struct list_head txcmplq;
187 uint16_t txcmplq_cnt;
188 uint16_t txcmplq_max;
189 uint32_t *cmdringaddr;
190 uint32_t *rspringaddr;
191 uint32_t missbufcnt;
192 struct list_head postbufq;
193 uint16_t postbufq_cnt;
194 uint16_t postbufq_max;
195 struct list_head iocb_continueq;
196 uint16_t iocb_continueq_cnt;
197 uint16_t iocb_continueq_max;
198 struct list_head iocb_continue_saveq;
199
200 struct lpfc_sli_ring_mask prt[LPFC_MAX_RING_MASK];
201 uint32_t num_mask;
202 void (*lpfc_sli_rcv_async_status) (struct lpfc_hba *,
203 struct lpfc_sli_ring *, struct lpfc_iocbq *);
204
205 struct lpfc_sli_ring_stat stats;
206
207
208 void (*lpfc_sli_cmd_available) (struct lpfc_hba *,
209 struct lpfc_sli_ring *);
210};
211
212
213struct lpfc_hbq_init {
214 uint32_t rn;
215 uint32_t entry_count;
216 uint32_t headerLen;
217 uint32_t logEntry;
218 uint32_t profile;
219 uint32_t ring_mask;
220
221 uint32_t hbq_index;
222
223 uint32_t seqlenoff;
224 uint32_t maxlen;
225 uint32_t seqlenbcnt;
226 uint32_t cmdcodeoff;
227 uint32_t cmdmatch[8];
228 uint32_t mask_count;
229 struct hbq_mask hbqMasks[6];
230
231
232 uint32_t buffer_count;
233 uint32_t init_count;
234 uint32_t add_count;
235} ;
236
237
238struct lpfc_sli_stat {
239 uint64_t mbox_stat_err;
240 uint64_t mbox_cmd;
241 uint64_t sli_intr;
242 uint32_t err_attn_event;
243 uint32_t link_event;
244 uint32_t mbox_event;
245 uint32_t mbox_busy;
246};
247
248
249struct lpfc_lnk_stat {
250 uint32_t link_failure_count;
251 uint32_t loss_of_sync_count;
252 uint32_t loss_of_signal_count;
253 uint32_t prim_seq_protocol_err_count;
254 uint32_t invalid_tx_word_count;
255 uint32_t invalid_crc_count;
256 uint32_t error_frames;
257 uint32_t link_events;
258};
259
260
261struct lpfc_sli {
262 uint32_t num_rings;
263 uint32_t sli_flag;
264
265
266#define LPFC_SLI_MBOX_ACTIVE 0x100
267#define LPFC_SLI_ACTIVE 0x200
268#define LPFC_PROCESS_LA 0x400
269#define LPFC_BLOCK_MGMT_IO 0x800
270#define LPFC_MENLO_MAINT 0x1000
271#define LPFC_SLI_ASYNC_MBX_BLK 0x2000
272
273 struct lpfc_sli_ring ring[LPFC_MAX_RING];
274 int fcp_ring;
275 int next_ring;
276
277 int extra_ring;
278
279 struct lpfc_sli_stat slistat;
280 struct list_head mboxq;
281 uint16_t mboxq_cnt;
282 uint16_t mboxq_max;
283 LPFC_MBOXQ_t *mbox_active;
284 struct list_head mboxq_cmpl;
285
286 struct timer_list mbox_tmo;
287
288
289#define LPFC_IOCBQ_LOOKUP_INCREMENT 1024
290 struct lpfc_iocbq ** iocbq_lookup;
291 size_t iocbq_lookup_len;
292 uint16_t last_iotag;
293 unsigned long stats_start;
294 struct lpfc_lnk_stat lnk_stat_offsets;
295};
296
297
298#define LPFC_MBOX_TMO 30
299
300#define LPFC_MBOX_SLI4_CONFIG_TMO 60
301
302#define LPFC_MBOX_SLI4_CONFIG_EXTENDED_TMO 300
303
304#define LPFC_MBOX_TMO_FLASH_CMD 300
305