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