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