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 uint32_t iocb_flag;
62#define LPFC_IO_LIBDFC 1
63#define LPFC_IO_WAKE 2
64#define LPFC_IO_WAKE_TMO LPFC_IO_WAKE
65#define LPFC_IO_FCP 4
66#define LPFC_DRIVER_ABORTED 8
67#define LPFC_IO_FABRIC 0x10
68#define LPFC_DELAY_MEM_FREE 0x20
69#define LPFC_EXCHANGE_BUSY 0x40
70#define LPFC_USE_FCPWQIDX 0x80
71#define DSS_SECURITY_OP 0x100
72#define LPFC_IO_ON_TXCMPLQ 0x200
73#define LPFC_IO_DIF_PASS 0x400
74#define LPFC_IO_DIF_STRIP 0x800
75#define LPFC_IO_DIF_INSERT 0x1000
76#define LPFC_IO_CMD_OUTSTANDING 0x2000
77
78#define LPFC_FIP_ELS_ID_MASK 0xc000
79#define LPFC_FIP_ELS_ID_SHIFT 14
80
81#define LPFC_IO_OAS 0x10000
82#define LPFC_IO_FOF 0x20000
83#define LPFC_IO_LOOPBACK 0x40000
84
85 uint32_t drvrTimeout;
86 uint32_t fcp_wqidx;
87 struct lpfc_vport *vport;
88 void *context1;
89 void *context2;
90 void *context3;
91 union {
92 wait_queue_head_t *wait_queue;
93 struct lpfc_iocbq *rsp_iocb;
94 struct lpfcMboxq *mbox;
95 struct lpfc_nodelist *ndlp;
96 struct lpfc_node_rrq *rrq;
97 } context_un;
98
99 void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
100 struct lpfc_iocbq *);
101 void (*wait_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
102 struct lpfc_iocbq *);
103 void (*iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
104 struct lpfc_iocbq *);
105};
106
107#define SLI_IOCB_RET_IOCB 1
108
109#define IOCB_SUCCESS 0
110#define IOCB_BUSY 1
111#define IOCB_ERROR 2
112#define IOCB_TIMEDOUT 3
113
114#define LPFC_MBX_WAKE 1
115#define LPFC_MBX_IMED_UNREG 2
116
117typedef struct lpfcMboxq {
118
119 struct list_head list;
120 union {
121 MAILBOX_t mb;
122 struct lpfc_mqe mqe;
123 } u;
124 struct lpfc_vport *vport;
125 void *context1;
126 void *context2;
127
128 void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *);
129 uint8_t mbox_flag;
130 uint16_t in_ext_byte_len;
131 uint16_t out_ext_byte_len;
132 uint8_t mbox_offset_word;
133 struct lpfc_mcqe mcqe;
134 struct lpfc_mbx_nembed_sge_virt *sge_array;
135} LPFC_MBOXQ_t;
136
137#define MBX_POLL 1
138
139#define MBX_NOWAIT 2
140
141#define LPFC_MAX_RING_MASK 5
142
143#define LPFC_SLI3_MAX_RING 4
144
145
146
147struct lpfc_sli_ring;
148
149struct lpfc_sli_ring_mask {
150 uint8_t profile;
151 uint8_t rctl;
152 uint8_t type;
153 uint8_t rsvd;
154
155 void (*lpfc_sli_rcv_unsol_event) (struct lpfc_hba *,
156 struct lpfc_sli_ring *,
157 struct lpfc_iocbq *);
158};
159
160
161
162struct lpfc_sli_ring_stat {
163 uint64_t iocb_event;
164 uint64_t iocb_cmd;
165 uint64_t iocb_rsp;
166 uint64_t iocb_cmd_delay;
167 uint64_t iocb_cmd_full;
168 uint64_t iocb_cmd_empty;
169 uint64_t iocb_rsp_full;
170};
171
172struct lpfc_sli3_ring {
173 uint32_t local_getidx;
174 uint32_t next_cmdidx;
175 uint32_t rspidx;
176 uint32_t cmdidx;
177 uint16_t numCiocb;
178 uint16_t numRiocb;
179 uint16_t sizeCiocb;
180 uint16_t sizeRiocb;
181 uint32_t *cmdringaddr;
182 uint32_t *rspringaddr;
183};
184
185struct lpfc_sli4_ring {
186 struct lpfc_queue *wqp;
187};
188
189
190
191struct lpfc_sli_ring {
192 uint16_t flag;
193#define LPFC_DEFERRED_RING_EVENT 0x001
194#define LPFC_CALL_RING_AVAILABLE 0x002
195#define LPFC_STOP_IOCB_EVENT 0x020
196 uint16_t abtsiotag;
197
198 uint8_t rsvd;
199 uint8_t ringno;
200
201 spinlock_t ring_lock;
202
203 uint32_t fast_iotag;
204 uint32_t iotag_ctr;
205 uint32_t iotag_max;
206 struct list_head txq;
207 uint16_t txq_cnt;
208 uint16_t txq_max;
209 struct list_head txcmplq;
210 uint16_t txcmplq_cnt;
211 uint16_t txcmplq_max;
212 uint32_t missbufcnt;
213 struct list_head postbufq;
214 uint16_t postbufq_cnt;
215 uint16_t postbufq_max;
216 struct list_head iocb_continueq;
217 uint16_t iocb_continueq_cnt;
218 uint16_t iocb_continueq_max;
219 struct list_head iocb_continue_saveq;
220
221 struct lpfc_sli_ring_mask prt[LPFC_MAX_RING_MASK];
222 uint32_t num_mask;
223 void (*lpfc_sli_rcv_async_status) (struct lpfc_hba *,
224 struct lpfc_sli_ring *, struct lpfc_iocbq *);
225
226 struct lpfc_sli_ring_stat stats;
227
228
229 void (*lpfc_sli_cmd_available) (struct lpfc_hba *,
230 struct lpfc_sli_ring *);
231 union {
232 struct lpfc_sli3_ring sli3;
233 struct lpfc_sli4_ring sli4;
234 } sli;
235};
236
237
238struct lpfc_hbq_init {
239 uint32_t rn;
240 uint32_t entry_count;
241 uint32_t headerLen;
242 uint32_t logEntry;
243 uint32_t profile;
244 uint32_t ring_mask;
245
246 uint32_t hbq_index;
247
248 uint32_t seqlenoff;
249 uint32_t maxlen;
250 uint32_t seqlenbcnt;
251 uint32_t cmdcodeoff;
252 uint32_t cmdmatch[8];
253 uint32_t mask_count;
254 struct hbq_mask hbqMasks[6];
255
256
257 uint32_t buffer_count;
258 uint32_t init_count;
259 uint32_t add_count;
260} ;
261
262
263struct lpfc_sli_stat {
264 uint64_t mbox_stat_err;
265 uint64_t mbox_cmd;
266 uint64_t sli_intr;
267 uint64_t sli_prev_intr;
268 uint64_t sli_ips;
269 uint32_t err_attn_event;
270 uint32_t link_event;
271 uint32_t mbox_event;
272 uint32_t mbox_busy;
273};
274
275
276struct lpfc_lnk_stat {
277 uint32_t link_failure_count;
278 uint32_t loss_of_sync_count;
279 uint32_t loss_of_signal_count;
280 uint32_t prim_seq_protocol_err_count;
281 uint32_t invalid_tx_word_count;
282 uint32_t invalid_crc_count;
283 uint32_t error_frames;
284 uint32_t link_events;
285};
286
287
288struct lpfc_sli {
289 uint32_t num_rings;
290 uint32_t sli_flag;
291
292
293#define LPFC_SLI_MBOX_ACTIVE 0x100
294#define LPFC_SLI_ACTIVE 0x200
295#define LPFC_PROCESS_LA 0x400
296#define LPFC_BLOCK_MGMT_IO 0x800
297#define LPFC_MENLO_MAINT 0x1000
298#define LPFC_SLI_ASYNC_MBX_BLK 0x2000
299
300 struct lpfc_sli_ring *ring;
301 int fcp_ring;
302 int next_ring;
303
304 int extra_ring;
305
306 struct lpfc_sli_stat slistat;
307 struct list_head mboxq;
308 uint16_t mboxq_cnt;
309 uint16_t mboxq_max;
310 LPFC_MBOXQ_t *mbox_active;
311 struct list_head mboxq_cmpl;
312
313 struct timer_list mbox_tmo;
314
315
316#define LPFC_IOCBQ_LOOKUP_INCREMENT 1024
317 struct lpfc_iocbq ** iocbq_lookup;
318 size_t iocbq_lookup_len;
319 uint16_t last_iotag;
320 unsigned long stats_start;
321 struct lpfc_lnk_stat lnk_stat_offsets;
322};
323
324
325#define LPFC_MBOX_TMO 30
326
327#define LPFC_MBOX_SLI4_CONFIG_TMO 60
328
329#define LPFC_MBOX_SLI4_CONFIG_EXTENDED_TMO 300
330
331#define LPFC_MBOX_TMO_FLASH_CMD 300
332