diff options
Diffstat (limited to 'drivers/scsi/bfa/bfa_svc.h')
-rw-r--r-- | drivers/scsi/bfa/bfa_svc.h | 657 |
1 files changed, 657 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfa_svc.h b/drivers/scsi/bfa/bfa_svc.h new file mode 100644 index 000000000000..9921dad0d039 --- /dev/null +++ b/drivers/scsi/bfa/bfa_svc.h | |||
@@ -0,0 +1,657 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. | ||
3 | * All rights reserved | ||
4 | * www.brocade.com | ||
5 | * | ||
6 | * Linux driver for Brocade Fibre Channel Host Bus Adapter. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License (GPL) Version 2 as | ||
10 | * published by the Free Software Foundation | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #ifndef __BFA_SVC_H__ | ||
19 | #define __BFA_SVC_H__ | ||
20 | |||
21 | #include "bfa_cs.h" | ||
22 | #include "bfi_ms.h" | ||
23 | |||
24 | |||
25 | /** | ||
26 | * Scatter-gather DMA related defines | ||
27 | */ | ||
28 | #define BFA_SGPG_MIN (16) | ||
29 | |||
30 | /** | ||
31 | * Alignment macro for SG page allocation | ||
32 | */ | ||
33 | #define BFA_SGPG_ROUNDUP(_l) (((_l) + (sizeof(struct bfi_sgpg_s) - 1)) \ | ||
34 | & ~(sizeof(struct bfi_sgpg_s) - 1)) | ||
35 | |||
36 | struct bfa_sgpg_wqe_s { | ||
37 | struct list_head qe; /* queue sg page element */ | ||
38 | int nsgpg; /* pages to be allocated */ | ||
39 | int nsgpg_total; /* total pages required */ | ||
40 | void (*cbfn) (void *cbarg); /* callback function */ | ||
41 | void *cbarg; /* callback arg */ | ||
42 | struct list_head sgpg_q; /* queue of alloced sgpgs */ | ||
43 | }; | ||
44 | |||
45 | struct bfa_sgpg_s { | ||
46 | struct list_head qe; /* queue sg page element */ | ||
47 | struct bfi_sgpg_s *sgpg; /* va of SG page */ | ||
48 | union bfi_addr_u sgpg_pa; /* pa of SG page */ | ||
49 | }; | ||
50 | |||
51 | /** | ||
52 | * Given number of SG elements, BFA_SGPG_NPAGE() returns the number of | ||
53 | * SG pages required. | ||
54 | */ | ||
55 | #define BFA_SGPG_NPAGE(_nsges) (((_nsges) / BFI_SGPG_DATA_SGES) + 1) | ||
56 | |||
57 | struct bfa_sgpg_mod_s { | ||
58 | struct bfa_s *bfa; | ||
59 | int num_sgpgs; /* number of SG pages */ | ||
60 | int free_sgpgs; /* number of free SG pages */ | ||
61 | struct bfa_sgpg_s *hsgpg_arr; /* BFA SG page array */ | ||
62 | struct bfi_sgpg_s *sgpg_arr; /* actual SG page array */ | ||
63 | u64 sgpg_arr_pa; /* SG page array DMA addr */ | ||
64 | struct list_head sgpg_q; /* queue of free SG pages */ | ||
65 | struct list_head sgpg_wait_q; /* wait queue for SG pages */ | ||
66 | }; | ||
67 | #define BFA_SGPG_MOD(__bfa) (&(__bfa)->modules.sgpg_mod) | ||
68 | |||
69 | bfa_status_t bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q, | ||
70 | int nsgpgs); | ||
71 | void bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs); | ||
72 | void bfa_sgpg_winit(struct bfa_sgpg_wqe_s *wqe, | ||
73 | void (*cbfn) (void *cbarg), void *cbarg); | ||
74 | void bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpgs); | ||
75 | void bfa_sgpg_wcancel(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe); | ||
76 | |||
77 | |||
78 | /** | ||
79 | * FCXP related defines | ||
80 | */ | ||
81 | #define BFA_FCXP_MIN (1) | ||
82 | #define BFA_FCXP_MAX_IBUF_SZ (2 * 1024 + 256) | ||
83 | #define BFA_FCXP_MAX_LBUF_SZ (4 * 1024 + 256) | ||
84 | |||
85 | struct bfa_fcxp_mod_s { | ||
86 | struct bfa_s *bfa; /* backpointer to BFA */ | ||
87 | struct bfa_fcxp_s *fcxp_list; /* array of FCXPs */ | ||
88 | u16 num_fcxps; /* max num FCXP requests */ | ||
89 | struct list_head fcxp_free_q; /* free FCXPs */ | ||
90 | struct list_head fcxp_active_q; /* active FCXPs */ | ||
91 | void *req_pld_list_kva; /* list of FCXP req pld */ | ||
92 | u64 req_pld_list_pa; /* list of FCXP req pld */ | ||
93 | void *rsp_pld_list_kva; /* list of FCXP resp pld */ | ||
94 | u64 rsp_pld_list_pa; /* list of FCXP resp pld */ | ||
95 | struct list_head wait_q; /* wait queue for free fcxp */ | ||
96 | u32 req_pld_sz; | ||
97 | u32 rsp_pld_sz; | ||
98 | }; | ||
99 | |||
100 | #define BFA_FCXP_MOD(__bfa) (&(__bfa)->modules.fcxp_mod) | ||
101 | #define BFA_FCXP_FROM_TAG(__mod, __tag) (&(__mod)->fcxp_list[__tag]) | ||
102 | |||
103 | typedef void (*fcxp_send_cb_t) (struct bfa_s *ioc, struct bfa_fcxp_s *fcxp, | ||
104 | void *cb_arg, bfa_status_t req_status, | ||
105 | u32 rsp_len, u32 resid_len, | ||
106 | struct fchs_s *rsp_fchs); | ||
107 | |||
108 | typedef u64 (*bfa_fcxp_get_sgaddr_t) (void *bfad_fcxp, int sgeid); | ||
109 | typedef u32 (*bfa_fcxp_get_sglen_t) (void *bfad_fcxp, int sgeid); | ||
110 | typedef void (*bfa_cb_fcxp_send_t) (void *bfad_fcxp, struct bfa_fcxp_s *fcxp, | ||
111 | void *cbarg, enum bfa_status req_status, | ||
112 | u32 rsp_len, u32 resid_len, | ||
113 | struct fchs_s *rsp_fchs); | ||
114 | typedef void (*bfa_fcxp_alloc_cbfn_t) (void *cbarg, struct bfa_fcxp_s *fcxp); | ||
115 | |||
116 | |||
117 | |||
118 | /** | ||
119 | * Information needed for a FCXP request | ||
120 | */ | ||
121 | struct bfa_fcxp_req_info_s { | ||
122 | struct bfa_rport_s *bfa_rport; | ||
123 | /** Pointer to the bfa rport that was | ||
124 | * returned from bfa_rport_create(). | ||
125 | * This could be left NULL for WKA or | ||
126 | * for FCXP interactions before the | ||
127 | * rport nexus is established | ||
128 | */ | ||
129 | struct fchs_s fchs; /* request FC header structure */ | ||
130 | u8 cts; /* continous sequence */ | ||
131 | u8 class; /* FC class for the request/response */ | ||
132 | u16 max_frmsz; /* max send frame size */ | ||
133 | u16 vf_id; /* vsan tag if applicable */ | ||
134 | u8 lp_tag; /* lport tag */ | ||
135 | u32 req_tot_len; /* request payload total length */ | ||
136 | }; | ||
137 | |||
138 | struct bfa_fcxp_rsp_info_s { | ||
139 | struct fchs_s rsp_fchs; | ||
140 | /** !< Response frame's FC header will | ||
141 | * be sent back in this field */ | ||
142 | u8 rsp_timeout; | ||
143 | /** !< timeout in seconds, 0-no response | ||
144 | */ | ||
145 | u8 rsvd2[3]; | ||
146 | u32 rsp_maxlen; /* max response length expected */ | ||
147 | }; | ||
148 | |||
149 | struct bfa_fcxp_s { | ||
150 | struct list_head qe; /* fcxp queue element */ | ||
151 | bfa_sm_t sm; /* state machine */ | ||
152 | void *caller; /* driver or fcs */ | ||
153 | struct bfa_fcxp_mod_s *fcxp_mod; | ||
154 | /* back pointer to fcxp mod */ | ||
155 | u16 fcxp_tag; /* internal tag */ | ||
156 | struct bfa_fcxp_req_info_s req_info; | ||
157 | /* request info */ | ||
158 | struct bfa_fcxp_rsp_info_s rsp_info; | ||
159 | /* response info */ | ||
160 | u8 use_ireqbuf; /* use internal req buf */ | ||
161 | u8 use_irspbuf; /* use internal rsp buf */ | ||
162 | u32 nreq_sgles; /* num request SGLEs */ | ||
163 | u32 nrsp_sgles; /* num response SGLEs */ | ||
164 | struct list_head req_sgpg_q; /* SG pages for request buf */ | ||
165 | struct list_head req_sgpg_wqe; /* wait queue for req SG page */ | ||
166 | struct list_head rsp_sgpg_q; /* SG pages for response buf */ | ||
167 | struct list_head rsp_sgpg_wqe; /* wait queue for rsp SG page */ | ||
168 | |||
169 | bfa_fcxp_get_sgaddr_t req_sga_cbfn; | ||
170 | /* SG elem addr user function */ | ||
171 | bfa_fcxp_get_sglen_t req_sglen_cbfn; | ||
172 | /* SG elem len user function */ | ||
173 | bfa_fcxp_get_sgaddr_t rsp_sga_cbfn; | ||
174 | /* SG elem addr user function */ | ||
175 | bfa_fcxp_get_sglen_t rsp_sglen_cbfn; | ||
176 | /* SG elem len user function */ | ||
177 | bfa_cb_fcxp_send_t send_cbfn; /* send completion callback */ | ||
178 | void *send_cbarg; /* callback arg */ | ||
179 | struct bfa_sge_s req_sge[BFA_FCXP_MAX_SGES]; | ||
180 | /* req SG elems */ | ||
181 | struct bfa_sge_s rsp_sge[BFA_FCXP_MAX_SGES]; | ||
182 | /* rsp SG elems */ | ||
183 | u8 rsp_status; /* comp: rsp status */ | ||
184 | u32 rsp_len; /* comp: actual response len */ | ||
185 | u32 residue_len; /* comp: residual rsp length */ | ||
186 | struct fchs_s rsp_fchs; /* comp: response fchs */ | ||
187 | struct bfa_cb_qe_s hcb_qe; /* comp: callback qelem */ | ||
188 | struct bfa_reqq_wait_s reqq_wqe; | ||
189 | bfa_boolean_t reqq_waiting; | ||
190 | }; | ||
191 | |||
192 | struct bfa_fcxp_wqe_s { | ||
193 | struct list_head qe; | ||
194 | bfa_fcxp_alloc_cbfn_t alloc_cbfn; | ||
195 | void *alloc_cbarg; | ||
196 | void *caller; | ||
197 | struct bfa_s *bfa; | ||
198 | int nreq_sgles; | ||
199 | int nrsp_sgles; | ||
200 | bfa_fcxp_get_sgaddr_t req_sga_cbfn; | ||
201 | bfa_fcxp_get_sglen_t req_sglen_cbfn; | ||
202 | bfa_fcxp_get_sgaddr_t rsp_sga_cbfn; | ||
203 | bfa_fcxp_get_sglen_t rsp_sglen_cbfn; | ||
204 | }; | ||
205 | |||
206 | #define BFA_FCXP_REQ_PLD(_fcxp) (bfa_fcxp_get_reqbuf(_fcxp)) | ||
207 | #define BFA_FCXP_RSP_FCHS(_fcxp) (&((_fcxp)->rsp_info.fchs)) | ||
208 | #define BFA_FCXP_RSP_PLD(_fcxp) (bfa_fcxp_get_rspbuf(_fcxp)) | ||
209 | |||
210 | #define BFA_FCXP_REQ_PLD_PA(_fcxp) \ | ||
211 | ((_fcxp)->fcxp_mod->req_pld_list_pa + \ | ||
212 | ((_fcxp)->fcxp_mod->req_pld_sz * (_fcxp)->fcxp_tag)) | ||
213 | |||
214 | #define BFA_FCXP_RSP_PLD_PA(_fcxp) \ | ||
215 | ((_fcxp)->fcxp_mod->rsp_pld_list_pa + \ | ||
216 | ((_fcxp)->fcxp_mod->rsp_pld_sz * (_fcxp)->fcxp_tag)) | ||
217 | |||
218 | void bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | ||
219 | |||
220 | |||
221 | /** | ||
222 | * RPORT related defines | ||
223 | */ | ||
224 | #define BFA_RPORT_MIN 4 | ||
225 | |||
226 | struct bfa_rport_mod_s { | ||
227 | struct bfa_rport_s *rps_list; /* list of rports */ | ||
228 | struct list_head rp_free_q; /* free bfa_rports */ | ||
229 | struct list_head rp_active_q; /* free bfa_rports */ | ||
230 | u16 num_rports; /* number of rports */ | ||
231 | }; | ||
232 | |||
233 | #define BFA_RPORT_MOD(__bfa) (&(__bfa)->modules.rport_mod) | ||
234 | |||
235 | /** | ||
236 | * Convert rport tag to RPORT | ||
237 | */ | ||
238 | #define BFA_RPORT_FROM_TAG(__bfa, _tag) \ | ||
239 | (BFA_RPORT_MOD(__bfa)->rps_list + \ | ||
240 | ((_tag) & (BFA_RPORT_MOD(__bfa)->num_rports - 1))) | ||
241 | |||
242 | /* | ||
243 | * protected functions | ||
244 | */ | ||
245 | void bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | ||
246 | |||
247 | /** | ||
248 | * BFA rport information. | ||
249 | */ | ||
250 | struct bfa_rport_info_s { | ||
251 | u16 max_frmsz; /* max rcv pdu size */ | ||
252 | u32 pid:24, /* remote port ID */ | ||
253 | lp_tag:8; /* tag */ | ||
254 | u32 local_pid:24, /* local port ID */ | ||
255 | cisc:8; /* CIRO supported */ | ||
256 | u8 fc_class; /* supported FC classes. enum fc_cos */ | ||
257 | u8 vf_en; /* virtual fabric enable */ | ||
258 | u16 vf_id; /* virtual fabric ID */ | ||
259 | enum bfa_port_speed speed; /* Rport's current speed */ | ||
260 | }; | ||
261 | |||
262 | /** | ||
263 | * BFA rport data structure | ||
264 | */ | ||
265 | struct bfa_rport_s { | ||
266 | struct list_head qe; /* queue element */ | ||
267 | bfa_sm_t sm; /* state machine */ | ||
268 | struct bfa_s *bfa; /* backpointer to BFA */ | ||
269 | void *rport_drv; /* fcs/driver rport object */ | ||
270 | u16 fw_handle; /* firmware rport handle */ | ||
271 | u16 rport_tag; /* BFA rport tag */ | ||
272 | struct bfa_rport_info_s rport_info; /* rport info from fcs/driver */ | ||
273 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ | ||
274 | struct bfa_cb_qe_s hcb_qe; /* BFA callback qelem */ | ||
275 | struct bfa_rport_hal_stats_s stats; /* BFA rport statistics */ | ||
276 | struct bfa_rport_qos_attr_s qos_attr; | ||
277 | union a { | ||
278 | bfa_status_t status; /* f/w status */ | ||
279 | void *fw_msg; /* QoS scn event */ | ||
280 | } event_arg; | ||
281 | }; | ||
282 | #define BFA_RPORT_FC_COS(_rport) ((_rport)->rport_info.fc_class) | ||
283 | |||
284 | |||
285 | /** | ||
286 | * UF - unsolicited receive related defines | ||
287 | */ | ||
288 | |||
289 | #define BFA_UF_MIN (4) | ||
290 | |||
291 | |||
292 | struct bfa_uf_s { | ||
293 | struct list_head qe; /* queue element */ | ||
294 | struct bfa_s *bfa; /* bfa instance */ | ||
295 | u16 uf_tag; /* identifying tag fw msgs */ | ||
296 | u16 vf_id; | ||
297 | u16 src_rport_handle; | ||
298 | u16 rsvd; | ||
299 | u8 *data_ptr; | ||
300 | u16 data_len; /* actual receive length */ | ||
301 | u16 pb_len; /* posted buffer length */ | ||
302 | void *buf_kva; /* buffer virtual address */ | ||
303 | u64 buf_pa; /* buffer physical address */ | ||
304 | struct bfa_cb_qe_s hcb_qe; /* comp: BFA comp qelem */ | ||
305 | struct bfa_sge_s sges[BFI_SGE_INLINE_MAX]; | ||
306 | }; | ||
307 | |||
308 | /** | ||
309 | * Callback prototype for unsolicited frame receive handler. | ||
310 | * | ||
311 | * @param[in] cbarg callback arg for receive handler | ||
312 | * @param[in] uf unsolicited frame descriptor | ||
313 | * | ||
314 | * @return None | ||
315 | */ | ||
316 | typedef void (*bfa_cb_uf_recv_t) (void *cbarg, struct bfa_uf_s *uf); | ||
317 | |||
318 | struct bfa_uf_mod_s { | ||
319 | struct bfa_s *bfa; /* back pointer to BFA */ | ||
320 | struct bfa_uf_s *uf_list; /* array of UFs */ | ||
321 | u16 num_ufs; /* num unsolicited rx frames */ | ||
322 | struct list_head uf_free_q; /* free UFs */ | ||
323 | struct list_head uf_posted_q; /* UFs posted to IOC */ | ||
324 | struct bfa_uf_buf_s *uf_pbs_kva; /* list UF bufs request pld */ | ||
325 | u64 uf_pbs_pa; /* phy addr for UF bufs */ | ||
326 | struct bfi_uf_buf_post_s *uf_buf_posts; | ||
327 | /* pre-built UF post msgs */ | ||
328 | bfa_cb_uf_recv_t ufrecv; /* uf recv handler function */ | ||
329 | void *cbarg; /* uf receive handler arg */ | ||
330 | }; | ||
331 | |||
332 | #define BFA_UF_MOD(__bfa) (&(__bfa)->modules.uf_mod) | ||
333 | |||
334 | #define ufm_pbs_pa(_ufmod, _uftag) \ | ||
335 | ((_ufmod)->uf_pbs_pa + sizeof(struct bfa_uf_buf_s) * (_uftag)) | ||
336 | |||
337 | void bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | ||
338 | |||
339 | #define BFA_UF_BUFSZ (2 * 1024 + 256) | ||
340 | |||
341 | /** | ||
342 | * @todo private | ||
343 | */ | ||
344 | struct bfa_uf_buf_s { | ||
345 | u8 d[BFA_UF_BUFSZ]; | ||
346 | }; | ||
347 | |||
348 | |||
349 | /** | ||
350 | * LPS - bfa lport login/logout service interface | ||
351 | */ | ||
352 | struct bfa_lps_s { | ||
353 | struct list_head qe; /* queue element */ | ||
354 | struct bfa_s *bfa; /* parent bfa instance */ | ||
355 | bfa_sm_t sm; /* finite state machine */ | ||
356 | u8 lp_tag; /* lport tag */ | ||
357 | u8 reqq; /* lport request queue */ | ||
358 | u8 alpa; /* ALPA for loop topologies */ | ||
359 | u32 lp_pid; /* lport port ID */ | ||
360 | bfa_boolean_t fdisc; /* snd FDISC instead of FLOGI */ | ||
361 | bfa_boolean_t auth_en; /* enable authentication */ | ||
362 | bfa_boolean_t auth_req; /* authentication required */ | ||
363 | bfa_boolean_t npiv_en; /* NPIV is allowed by peer */ | ||
364 | bfa_boolean_t fport; /* attached peer is F_PORT */ | ||
365 | bfa_boolean_t brcd_switch; /* attached peer is brcd sw */ | ||
366 | bfa_status_t status; /* login status */ | ||
367 | u16 pdusz; /* max receive PDU size */ | ||
368 | u16 pr_bbcred; /* BB_CREDIT from peer */ | ||
369 | u8 lsrjt_rsn; /* LSRJT reason */ | ||
370 | u8 lsrjt_expl; /* LSRJT explanation */ | ||
371 | wwn_t pwwn; /* port wwn of lport */ | ||
372 | wwn_t nwwn; /* node wwn of lport */ | ||
373 | wwn_t pr_pwwn; /* port wwn of lport peer */ | ||
374 | wwn_t pr_nwwn; /* node wwn of lport peer */ | ||
375 | mac_t lp_mac; /* fpma/spma MAC for lport */ | ||
376 | mac_t fcf_mac; /* FCF MAC of lport */ | ||
377 | struct bfa_reqq_wait_s wqe; /* request wait queue element */ | ||
378 | void *uarg; /* user callback arg */ | ||
379 | struct bfa_cb_qe_s hcb_qe; /* comp: callback qelem */ | ||
380 | struct bfi_lps_login_rsp_s *loginrsp; | ||
381 | bfa_eproto_status_t ext_status; | ||
382 | }; | ||
383 | |||
384 | struct bfa_lps_mod_s { | ||
385 | struct list_head lps_free_q; | ||
386 | struct list_head lps_active_q; | ||
387 | struct bfa_lps_s *lps_arr; | ||
388 | int num_lps; | ||
389 | }; | ||
390 | |||
391 | #define BFA_LPS_MOD(__bfa) (&(__bfa)->modules.lps_mod) | ||
392 | #define BFA_LPS_FROM_TAG(__mod, __tag) (&(__mod)->lps_arr[__tag]) | ||
393 | |||
394 | /* | ||
395 | * external functions | ||
396 | */ | ||
397 | void bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | ||
398 | |||
399 | |||
400 | /** | ||
401 | * FCPORT related defines | ||
402 | */ | ||
403 | |||
404 | #define BFA_FCPORT(_bfa) (&((_bfa)->modules.port)) | ||
405 | typedef void (*bfa_cb_port_t) (void *cbarg, enum bfa_status status); | ||
406 | |||
407 | /** | ||
408 | * Link notification data structure | ||
409 | */ | ||
410 | struct bfa_fcport_ln_s { | ||
411 | struct bfa_fcport_s *fcport; | ||
412 | bfa_sm_t sm; | ||
413 | struct bfa_cb_qe_s ln_qe; /* BFA callback queue elem for ln */ | ||
414 | enum bfa_port_linkstate ln_event; /* ln event for callback */ | ||
415 | }; | ||
416 | |||
417 | struct bfa_fcport_trunk_s { | ||
418 | struct bfa_trunk_attr_s attr; | ||
419 | }; | ||
420 | |||
421 | /** | ||
422 | * BFA FC port data structure | ||
423 | */ | ||
424 | struct bfa_fcport_s { | ||
425 | struct bfa_s *bfa; /* parent BFA instance */ | ||
426 | bfa_sm_t sm; /* port state machine */ | ||
427 | wwn_t nwwn; /* node wwn of physical port */ | ||
428 | wwn_t pwwn; /* port wwn of physical oprt */ | ||
429 | enum bfa_port_speed speed_sup; | ||
430 | /* supported speeds */ | ||
431 | enum bfa_port_speed speed; /* current speed */ | ||
432 | enum bfa_port_topology topology; /* current topology */ | ||
433 | u8 myalpa; /* my ALPA in LOOP topology */ | ||
434 | u8 rsvd[3]; | ||
435 | struct bfa_port_cfg_s cfg; /* current port configuration */ | ||
436 | struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ | ||
437 | struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */ | ||
438 | struct bfa_reqq_wait_s reqq_wait; | ||
439 | /* to wait for room in reqq */ | ||
440 | struct bfa_reqq_wait_s svcreq_wait; | ||
441 | /* to wait for room in reqq */ | ||
442 | struct bfa_reqq_wait_s stats_reqq_wait; | ||
443 | /* to wait for room in reqq (stats) */ | ||
444 | void *event_cbarg; | ||
445 | void (*event_cbfn) (void *cbarg, | ||
446 | enum bfa_port_linkstate event); | ||
447 | union { | ||
448 | union bfi_fcport_i2h_msg_u i2hmsg; | ||
449 | } event_arg; | ||
450 | void *bfad; /* BFA driver handle */ | ||
451 | struct bfa_fcport_ln_s ln; /* Link Notification */ | ||
452 | struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */ | ||
453 | struct bfa_timer_s timer; /* timer */ | ||
454 | u32 msgtag; /* fimrware msg tag for reply */ | ||
455 | u8 *stats_kva; | ||
456 | u64 stats_pa; | ||
457 | union bfa_fcport_stats_u *stats; | ||
458 | union bfa_fcport_stats_u *stats_ret; /* driver stats location */ | ||
459 | bfa_status_t stats_status; /* stats/statsclr status */ | ||
460 | bfa_boolean_t stats_busy; /* outstanding stats/statsclr */ | ||
461 | bfa_boolean_t stats_qfull; | ||
462 | u32 stats_reset_time; /* stats reset time stamp */ | ||
463 | bfa_cb_port_t stats_cbfn; /* driver callback function */ | ||
464 | void *stats_cbarg; /* *!< user callback arg */ | ||
465 | bfa_boolean_t diag_busy; /* diag busy status */ | ||
466 | bfa_boolean_t beacon; /* port beacon status */ | ||
467 | bfa_boolean_t link_e2e_beacon; /* link beacon status */ | ||
468 | struct bfa_fcport_trunk_s trunk; | ||
469 | u16 fcoe_vlan; | ||
470 | }; | ||
471 | |||
472 | #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) | ||
473 | |||
474 | /* | ||
475 | * protected functions | ||
476 | */ | ||
477 | void bfa_fcport_init(struct bfa_s *bfa); | ||
478 | void bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | ||
479 | |||
480 | /* | ||
481 | * bfa fcport API functions | ||
482 | */ | ||
483 | bfa_status_t bfa_fcport_enable(struct bfa_s *bfa); | ||
484 | bfa_status_t bfa_fcport_disable(struct bfa_s *bfa); | ||
485 | bfa_status_t bfa_fcport_cfg_speed(struct bfa_s *bfa, | ||
486 | enum bfa_port_speed speed); | ||
487 | enum bfa_port_speed bfa_fcport_get_speed(struct bfa_s *bfa); | ||
488 | bfa_status_t bfa_fcport_cfg_topology(struct bfa_s *bfa, | ||
489 | enum bfa_port_topology topo); | ||
490 | enum bfa_port_topology bfa_fcport_get_topology(struct bfa_s *bfa); | ||
491 | bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa); | ||
492 | bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa); | ||
493 | u8 bfa_fcport_get_myalpa(struct bfa_s *bfa); | ||
494 | bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa); | ||
495 | bfa_status_t bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize); | ||
496 | u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa); | ||
497 | u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa); | ||
498 | void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr); | ||
499 | wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node); | ||
500 | void bfa_fcport_event_register(struct bfa_s *bfa, | ||
501 | void (*event_cbfn) (void *cbarg, | ||
502 | enum bfa_port_linkstate event), void *event_cbarg); | ||
503 | bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa); | ||
504 | void bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off); | ||
505 | void bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off); | ||
506 | bfa_status_t bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa, | ||
507 | enum bfa_port_speed speed); | ||
508 | enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); | ||
509 | |||
510 | void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit); | ||
511 | void bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status); | ||
512 | void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon, | ||
513 | bfa_boolean_t link_e2e_beacon); | ||
514 | void bfa_fcport_qos_get_attr(struct bfa_s *bfa, | ||
515 | struct bfa_qos_attr_s *qos_attr); | ||
516 | void bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa, | ||
517 | struct bfa_qos_vc_attr_s *qos_vc_attr); | ||
518 | bfa_status_t bfa_fcport_get_qos_stats(struct bfa_s *bfa, | ||
519 | union bfa_fcport_stats_u *stats, | ||
520 | bfa_cb_port_t cbfn, void *cbarg); | ||
521 | bfa_status_t bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, | ||
522 | void *cbarg); | ||
523 | bfa_status_t bfa_fcport_get_fcoe_stats(struct bfa_s *bfa, | ||
524 | union bfa_fcport_stats_u *stats, | ||
525 | bfa_cb_port_t cbfn, void *cbarg); | ||
526 | bfa_status_t bfa_fcport_clear_fcoe_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, | ||
527 | void *cbarg); | ||
528 | bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa); | ||
529 | bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa); | ||
530 | bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa, | ||
531 | union bfa_fcport_stats_u *stats, | ||
532 | bfa_cb_port_t cbfn, void *cbarg); | ||
533 | bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, | ||
534 | void *cbarg); | ||
535 | bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa); | ||
536 | |||
537 | /* | ||
538 | * bfa rport API functions | ||
539 | */ | ||
540 | struct bfa_rport_s *bfa_rport_create(struct bfa_s *bfa, void *rport_drv); | ||
541 | void bfa_rport_delete(struct bfa_rport_s *rport); | ||
542 | void bfa_rport_online(struct bfa_rport_s *rport, | ||
543 | struct bfa_rport_info_s *rport_info); | ||
544 | void bfa_rport_offline(struct bfa_rport_s *rport); | ||
545 | void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed); | ||
546 | void bfa_rport_get_stats(struct bfa_rport_s *rport, | ||
547 | struct bfa_rport_hal_stats_s *stats); | ||
548 | void bfa_rport_clear_stats(struct bfa_rport_s *rport); | ||
549 | void bfa_cb_rport_online(void *rport); | ||
550 | void bfa_cb_rport_offline(void *rport); | ||
551 | void bfa_cb_rport_qos_scn_flowid(void *rport, | ||
552 | struct bfa_rport_qos_attr_s old_qos_attr, | ||
553 | struct bfa_rport_qos_attr_s new_qos_attr); | ||
554 | void bfa_cb_rport_qos_scn_prio(void *rport, | ||
555 | struct bfa_rport_qos_attr_s old_qos_attr, | ||
556 | struct bfa_rport_qos_attr_s new_qos_attr); | ||
557 | void bfa_rport_get_qos_attr(struct bfa_rport_s *rport, | ||
558 | struct bfa_rport_qos_attr_s *qos_attr); | ||
559 | |||
560 | /* | ||
561 | * bfa fcxp API functions | ||
562 | */ | ||
563 | struct bfa_fcxp_s *bfa_fcxp_alloc(void *bfad_fcxp, struct bfa_s *bfa, | ||
564 | int nreq_sgles, int nrsp_sgles, | ||
565 | bfa_fcxp_get_sgaddr_t get_req_sga, | ||
566 | bfa_fcxp_get_sglen_t get_req_sglen, | ||
567 | bfa_fcxp_get_sgaddr_t get_rsp_sga, | ||
568 | bfa_fcxp_get_sglen_t get_rsp_sglen); | ||
569 | void bfa_fcxp_alloc_wait(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe, | ||
570 | bfa_fcxp_alloc_cbfn_t alloc_cbfn, | ||
571 | void *cbarg, void *bfad_fcxp, | ||
572 | int nreq_sgles, int nrsp_sgles, | ||
573 | bfa_fcxp_get_sgaddr_t get_req_sga, | ||
574 | bfa_fcxp_get_sglen_t get_req_sglen, | ||
575 | bfa_fcxp_get_sgaddr_t get_rsp_sga, | ||
576 | bfa_fcxp_get_sglen_t get_rsp_sglen); | ||
577 | void bfa_fcxp_walloc_cancel(struct bfa_s *bfa, | ||
578 | struct bfa_fcxp_wqe_s *wqe); | ||
579 | void bfa_fcxp_discard(struct bfa_fcxp_s *fcxp); | ||
580 | |||
581 | void *bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp); | ||
582 | void *bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp); | ||
583 | |||
584 | void bfa_fcxp_free(struct bfa_fcxp_s *fcxp); | ||
585 | |||
586 | void bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport, | ||
587 | u16 vf_id, u8 lp_tag, | ||
588 | bfa_boolean_t cts, enum fc_cos cos, | ||
589 | u32 reqlen, struct fchs_s *fchs, | ||
590 | bfa_cb_fcxp_send_t cbfn, | ||
591 | void *cbarg, | ||
592 | u32 rsp_maxlen, u8 rsp_timeout); | ||
593 | bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp); | ||
594 | u32 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp); | ||
595 | u32 bfa_fcxp_get_maxrsp(struct bfa_s *bfa); | ||
596 | |||
597 | static inline void * | ||
598 | bfa_uf_get_frmbuf(struct bfa_uf_s *uf) | ||
599 | { | ||
600 | return uf->data_ptr; | ||
601 | } | ||
602 | |||
603 | static inline u16 | ||
604 | bfa_uf_get_frmlen(struct bfa_uf_s *uf) | ||
605 | { | ||
606 | return uf->data_len; | ||
607 | } | ||
608 | |||
609 | /* | ||
610 | * bfa uf API functions | ||
611 | */ | ||
612 | void bfa_uf_recv_register(struct bfa_s *bfa, bfa_cb_uf_recv_t ufrecv, | ||
613 | void *cbarg); | ||
614 | void bfa_uf_free(struct bfa_uf_s *uf); | ||
615 | |||
616 | /** | ||
617 | * bfa lport service api | ||
618 | */ | ||
619 | |||
620 | u32 bfa_lps_get_max_vport(struct bfa_s *bfa); | ||
621 | struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa); | ||
622 | void bfa_lps_delete(struct bfa_lps_s *lps); | ||
623 | void bfa_lps_discard(struct bfa_lps_s *lps); | ||
624 | void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, | ||
625 | u16 pdusz, wwn_t pwwn, wwn_t nwwn, | ||
626 | bfa_boolean_t auth_en); | ||
627 | void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, | ||
628 | wwn_t pwwn, wwn_t nwwn); | ||
629 | void bfa_lps_flogo(struct bfa_lps_s *lps); | ||
630 | void bfa_lps_fdisclogo(struct bfa_lps_s *lps); | ||
631 | u8 bfa_lps_get_tag(struct bfa_lps_s *lps); | ||
632 | bfa_boolean_t bfa_lps_is_npiv_en(struct bfa_lps_s *lps); | ||
633 | bfa_boolean_t bfa_lps_is_fport(struct bfa_lps_s *lps); | ||
634 | bfa_boolean_t bfa_lps_is_brcd_fabric(struct bfa_lps_s *lps); | ||
635 | bfa_boolean_t bfa_lps_is_authreq(struct bfa_lps_s *lps); | ||
636 | bfa_eproto_status_t bfa_lps_get_extstatus(struct bfa_lps_s *lps); | ||
637 | u32 bfa_lps_get_pid(struct bfa_lps_s *lps); | ||
638 | u32 bfa_lps_get_base_pid(struct bfa_s *bfa); | ||
639 | u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid); | ||
640 | u16 bfa_lps_get_peer_bbcredit(struct bfa_lps_s *lps); | ||
641 | wwn_t bfa_lps_get_peer_pwwn(struct bfa_lps_s *lps); | ||
642 | wwn_t bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps); | ||
643 | u8 bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps); | ||
644 | u8 bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps); | ||
645 | mac_t bfa_lps_get_lp_mac(struct bfa_lps_s *lps); | ||
646 | void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status); | ||
647 | void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status); | ||
648 | void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg); | ||
649 | void bfa_cb_lps_cvl_event(void *bfad, void *uarg); | ||
650 | |||
651 | void bfa_trunk_enable_cfg(struct bfa_s *bfa); | ||
652 | bfa_status_t bfa_trunk_enable(struct bfa_s *bfa); | ||
653 | bfa_status_t bfa_trunk_disable(struct bfa_s *bfa); | ||
654 | bfa_status_t bfa_trunk_get_attr(struct bfa_s *bfa, | ||
655 | struct bfa_trunk_attr_s *attr); | ||
656 | |||
657 | #endif /* __BFA_SVC_H__ */ | ||