1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
27
28#define BFA_SGPG_MIN (16)
29#define BFA_SGPG_MAX (8192)
30
31
32
33
34#define BFA_SGPG_ROUNDUP(_l) (((_l) + (sizeof(struct bfi_sgpg_s) - 1)) \
35 & ~(sizeof(struct bfi_sgpg_s) - 1))
36
37struct bfa_sgpg_wqe_s {
38 struct list_head qe;
39 int nsgpg;
40 int nsgpg_total;
41 void (*cbfn) (void *cbarg);
42 void *cbarg;
43 struct list_head sgpg_q;
44};
45
46struct bfa_sgpg_s {
47 struct list_head qe;
48 struct bfi_sgpg_s *sgpg;
49 union bfi_addr_u sgpg_pa;
50};
51
52
53
54
55
56#define BFA_SGPG_NPAGE(_nsges) (((_nsges) / BFI_SGPG_DATA_SGES) + 1)
57
58
59#define BFA_SGPG_DMA_SEGS \
60 BFI_MEM_DMA_NSEGS(BFA_SGPG_MAX, (uint32_t)sizeof(struct bfi_sgpg_s))
61
62struct bfa_sgpg_mod_s {
63 struct bfa_s *bfa;
64 int num_sgpgs;
65 int free_sgpgs;
66 struct list_head sgpg_q;
67 struct list_head sgpg_wait_q;
68 struct bfa_mem_dma_s dma_seg[BFA_SGPG_DMA_SEGS];
69 struct bfa_mem_kva_s kva_seg;
70};
71#define BFA_SGPG_MOD(__bfa) (&(__bfa)->modules.sgpg_mod)
72#define BFA_MEM_SGPG_KVA(__bfa) (&(BFA_SGPG_MOD(__bfa)->kva_seg))
73
74bfa_status_t bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q,
75 int nsgpgs);
76void bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs);
77void bfa_sgpg_winit(struct bfa_sgpg_wqe_s *wqe,
78 void (*cbfn) (void *cbarg), void *cbarg);
79void bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpgs);
80void bfa_sgpg_wcancel(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe);
81
82
83
84
85
86#define BFA_FCXP_MIN (1)
87#define BFA_FCXP_MAX (256)
88#define BFA_FCXP_MAX_IBUF_SZ (2 * 1024 + 256)
89#define BFA_FCXP_MAX_LBUF_SZ (4 * 1024 + 256)
90
91
92#define BFA_FCXP_DMA_SEGS \
93 BFI_MEM_DMA_NSEGS(BFA_FCXP_MAX, \
94 (u32)BFA_FCXP_MAX_IBUF_SZ + BFA_FCXP_MAX_LBUF_SZ)
95
96struct bfa_fcxp_mod_s {
97 struct bfa_s *bfa;
98 struct bfa_fcxp_s *fcxp_list;
99 u16 num_fcxps;
100 struct list_head fcxp_req_free_q;
101 struct list_head fcxp_rsp_free_q;
102 struct list_head fcxp_active_q;
103 struct list_head req_wait_q;
104 struct list_head rsp_wait_q;
105 struct list_head fcxp_req_unused_q;
106 struct list_head fcxp_rsp_unused_q;
107 u32 req_pld_sz;
108 u32 rsp_pld_sz;
109 struct bfa_mem_dma_s dma_seg[BFA_FCXP_DMA_SEGS];
110 struct bfa_mem_kva_s kva_seg;
111};
112
113#define BFA_FCXP_MOD(__bfa) (&(__bfa)->modules.fcxp_mod)
114#define BFA_FCXP_FROM_TAG(__mod, __tag) (&(__mod)->fcxp_list[__tag])
115#define BFA_MEM_FCXP_KVA(__bfa) (&(BFA_FCXP_MOD(__bfa)->kva_seg))
116
117typedef void (*fcxp_send_cb_t) (struct bfa_s *ioc, struct bfa_fcxp_s *fcxp,
118 void *cb_arg, bfa_status_t req_status,
119 u32 rsp_len, u32 resid_len,
120 struct fchs_s *rsp_fchs);
121
122typedef u64 (*bfa_fcxp_get_sgaddr_t) (void *bfad_fcxp, int sgeid);
123typedef u32 (*bfa_fcxp_get_sglen_t) (void *bfad_fcxp, int sgeid);
124typedef void (*bfa_cb_fcxp_send_t) (void *bfad_fcxp, struct bfa_fcxp_s *fcxp,
125 void *cbarg, enum bfa_status req_status,
126 u32 rsp_len, u32 resid_len,
127 struct fchs_s *rsp_fchs);
128typedef void (*bfa_fcxp_alloc_cbfn_t) (void *cbarg, struct bfa_fcxp_s *fcxp);
129
130
131
132
133
134
135struct bfa_fcxp_req_info_s {
136 struct bfa_rport_s *bfa_rport;
137
138
139
140
141
142
143 struct fchs_s fchs;
144 u8 cts;
145 u8 class;
146 u16 max_frmsz;
147 u16 vf_id;
148 u8 lp_tag;
149 u32 req_tot_len;
150};
151
152struct bfa_fcxp_rsp_info_s {
153 struct fchs_s rsp_fchs;
154
155
156 u8 rsp_timeout;
157
158 u8 rsvd2[3];
159 u32 rsp_maxlen;
160};
161
162struct bfa_fcxp_s {
163 struct list_head qe;
164 bfa_sm_t sm;
165 void *caller;
166 struct bfa_fcxp_mod_s *fcxp_mod;
167
168 u16 fcxp_tag;
169 struct bfa_fcxp_req_info_s req_info;
170
171 struct bfa_fcxp_rsp_info_s rsp_info;
172
173 u8 use_ireqbuf;
174 u8 use_irspbuf;
175 u32 nreq_sgles;
176 u32 nrsp_sgles;
177 struct list_head req_sgpg_q;
178 struct list_head req_sgpg_wqe;
179 struct list_head rsp_sgpg_q;
180 struct list_head rsp_sgpg_wqe;
181
182 bfa_fcxp_get_sgaddr_t req_sga_cbfn;
183
184 bfa_fcxp_get_sglen_t req_sglen_cbfn;
185
186 bfa_fcxp_get_sgaddr_t rsp_sga_cbfn;
187
188 bfa_fcxp_get_sglen_t rsp_sglen_cbfn;
189
190 bfa_cb_fcxp_send_t send_cbfn;
191 void *send_cbarg;
192 struct bfa_sge_s req_sge[BFA_FCXP_MAX_SGES];
193
194 struct bfa_sge_s rsp_sge[BFA_FCXP_MAX_SGES];
195
196 u8 rsp_status;
197 u32 rsp_len;
198 u32 residue_len;
199 struct fchs_s rsp_fchs;
200 struct bfa_cb_qe_s hcb_qe;
201 struct bfa_reqq_wait_s reqq_wqe;
202 bfa_boolean_t reqq_waiting;
203 bfa_boolean_t req_rsp;
204};
205
206struct bfa_fcxp_wqe_s {
207 struct list_head qe;
208 bfa_fcxp_alloc_cbfn_t alloc_cbfn;
209 void *alloc_cbarg;
210 void *caller;
211 struct bfa_s *bfa;
212 int nreq_sgles;
213 int nrsp_sgles;
214 bfa_fcxp_get_sgaddr_t req_sga_cbfn;
215 bfa_fcxp_get_sglen_t req_sglen_cbfn;
216 bfa_fcxp_get_sgaddr_t rsp_sga_cbfn;
217 bfa_fcxp_get_sglen_t rsp_sglen_cbfn;
218};
219
220#define BFA_FCXP_REQ_PLD(_fcxp) (bfa_fcxp_get_reqbuf(_fcxp))
221#define BFA_FCXP_RSP_FCHS(_fcxp) (&((_fcxp)->rsp_info.fchs))
222#define BFA_FCXP_RSP_PLD(_fcxp) (bfa_fcxp_get_rspbuf(_fcxp))
223
224#define BFA_FCXP_REQ_PLD_PA(_fcxp) \
225 bfa_mem_get_dmabuf_pa((_fcxp)->fcxp_mod, (_fcxp)->fcxp_tag, \
226 (_fcxp)->fcxp_mod->req_pld_sz + (_fcxp)->fcxp_mod->rsp_pld_sz)
227
228
229#define BFA_FCXP_RSP_PLD_PA(_fcxp) \
230 (bfa_mem_get_dmabuf_pa((_fcxp)->fcxp_mod, (_fcxp)->fcxp_tag, \
231 (_fcxp)->fcxp_mod->req_pld_sz + (_fcxp)->fcxp_mod->rsp_pld_sz) + \
232 (_fcxp)->fcxp_mod->req_pld_sz)
233
234void bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
235
236
237
238
239
240enum bfa_rport_event {
241 BFA_RPORT_SM_CREATE = 1,
242 BFA_RPORT_SM_DELETE = 2,
243 BFA_RPORT_SM_ONLINE = 3,
244 BFA_RPORT_SM_OFFLINE = 4,
245 BFA_RPORT_SM_FWRSP = 5,
246 BFA_RPORT_SM_HWFAIL = 6,
247 BFA_RPORT_SM_QOS_SCN = 7,
248 BFA_RPORT_SM_SET_SPEED = 8,
249 BFA_RPORT_SM_QRESUME = 9,
250};
251
252#define BFA_RPORT_MIN 4
253
254struct bfa_rport_mod_s {
255 struct bfa_rport_s *rps_list;
256 struct list_head rp_free_q;
257 struct list_head rp_active_q;
258 struct list_head rp_unused_q;
259 u16 num_rports;
260 struct bfa_mem_kva_s kva_seg;
261};
262
263#define BFA_RPORT_MOD(__bfa) (&(__bfa)->modules.rport_mod)
264#define BFA_MEM_RPORT_KVA(__bfa) (&(BFA_RPORT_MOD(__bfa)->kva_seg))
265
266
267
268
269#define BFA_RPORT_FROM_TAG(__bfa, _tag) \
270 (BFA_RPORT_MOD(__bfa)->rps_list + \
271 ((_tag) & (BFA_RPORT_MOD(__bfa)->num_rports - 1)))
272
273
274
275
276void bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
277void bfa_rport_res_recfg(struct bfa_s *bfa, u16 num_rport_fw);
278
279
280
281
282struct bfa_rport_info_s {
283 u16 max_frmsz;
284 u32 pid:24,
285 lp_tag:8;
286 u32 local_pid:24,
287 cisc:8;
288 u8 fc_class;
289 u8 vf_en;
290 u16 vf_id;
291 enum bfa_port_speed speed;
292};
293
294
295
296
297struct bfa_rport_s {
298 struct list_head qe;
299 bfa_sm_t sm;
300 struct bfa_s *bfa;
301 void *rport_drv;
302 u16 fw_handle;
303 u16 rport_tag;
304 u8 lun_mask;
305 struct bfa_rport_info_s rport_info;
306 struct bfa_reqq_wait_s reqq_wait;
307 struct bfa_cb_qe_s hcb_qe;
308 struct bfa_rport_hal_stats_s stats;
309 struct bfa_rport_qos_attr_s qos_attr;
310 union a {
311 bfa_status_t status;
312 void *fw_msg;
313 } event_arg;
314};
315#define BFA_RPORT_FC_COS(_rport) ((_rport)->rport_info.fc_class)
316
317
318
319
320
321
322#define BFA_UF_MIN (4)
323#define BFA_UF_MAX (256)
324
325struct bfa_uf_s {
326 struct list_head qe;
327 struct bfa_s *bfa;
328 u16 uf_tag;
329 u16 vf_id;
330 u16 src_rport_handle;
331 u16 rsvd;
332 u8 *data_ptr;
333 u16 data_len;
334 u16 pb_len;
335 void *buf_kva;
336 u64 buf_pa;
337 struct bfa_cb_qe_s hcb_qe;
338 struct bfa_sge_s sges[BFI_SGE_INLINE_MAX];
339};
340
341
342
343
344
345
346
347
348
349typedef void (*bfa_cb_uf_recv_t) (void *cbarg, struct bfa_uf_s *uf);
350
351#define BFA_UF_BUFSZ (2 * 1024 + 256)
352
353struct bfa_uf_buf_s {
354 u8 d[BFA_UF_BUFSZ];
355};
356
357#define BFA_PER_UF_DMA_SZ \
358 (u32)BFA_ROUNDUP(sizeof(struct bfa_uf_buf_s), BFA_DMA_ALIGN_SZ)
359
360
361#define BFA_UF_DMA_SEGS BFI_MEM_DMA_NSEGS(BFA_UF_MAX, BFA_PER_UF_DMA_SZ)
362
363struct bfa_uf_mod_s {
364 struct bfa_s *bfa;
365 struct bfa_uf_s *uf_list;
366 u16 num_ufs;
367 struct list_head uf_free_q;
368 struct list_head uf_posted_q;
369 struct list_head uf_unused_q;
370 struct bfi_uf_buf_post_s *uf_buf_posts;
371
372 bfa_cb_uf_recv_t ufrecv;
373 void *cbarg;
374 struct bfa_mem_dma_s dma_seg[BFA_UF_DMA_SEGS];
375 struct bfa_mem_kva_s kva_seg;
376};
377
378#define BFA_UF_MOD(__bfa) (&(__bfa)->modules.uf_mod)
379#define BFA_MEM_UF_KVA(__bfa) (&(BFA_UF_MOD(__bfa)->kva_seg))
380
381#define ufm_pbs_pa(_ufmod, _uftag) \
382 bfa_mem_get_dmabuf_pa(_ufmod, _uftag, BFA_PER_UF_DMA_SZ)
383
384void bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
385void bfa_uf_res_recfg(struct bfa_s *bfa, u16 num_uf_fw);
386
387
388
389
390struct bfa_lps_s {
391 struct list_head qe;
392 struct bfa_s *bfa;
393 bfa_sm_t sm;
394 u8 bfa_tag;
395 u8 fw_tag;
396 u8 reqq;
397 u8 alpa;
398 u32 lp_pid;
399 bfa_boolean_t fdisc;
400 bfa_boolean_t auth_en;
401 bfa_boolean_t auth_req;
402 bfa_boolean_t npiv_en;
403 bfa_boolean_t fport;
404 bfa_boolean_t brcd_switch;
405 bfa_status_t status;
406 u16 pdusz;
407 u16 pr_bbcred;
408 u8 pr_bbscn;
409 u8 bb_scn;
410 u8 lsrjt_rsn;
411 u8 lsrjt_expl;
412 u8 lun_mask;
413 wwn_t pwwn;
414 wwn_t nwwn;
415 wwn_t pr_pwwn;
416 wwn_t pr_nwwn;
417 mac_t lp_mac;
418 mac_t fcf_mac;
419 struct bfa_reqq_wait_s wqe;
420 void *uarg;
421 struct bfa_cb_qe_s hcb_qe;
422 struct bfi_lps_login_rsp_s *loginrsp;
423 bfa_eproto_status_t ext_status;
424};
425
426struct bfa_lps_mod_s {
427 struct list_head lps_free_q;
428 struct list_head lps_active_q;
429 struct list_head lps_login_q;
430 struct bfa_lps_s *lps_arr;
431 int num_lps;
432 struct bfa_mem_kva_s kva_seg;
433};
434
435#define BFA_LPS_MOD(__bfa) (&(__bfa)->modules.lps_mod)
436#define BFA_LPS_FROM_TAG(__mod, __tag) (&(__mod)->lps_arr[__tag])
437#define BFA_MEM_LPS_KVA(__bfa) (&(BFA_LPS_MOD(__bfa)->kva_seg))
438
439
440
441
442void bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
443
444
445
446
447
448
449#define BFA_FCPORT(_bfa) (&((_bfa)->modules.port))
450
451
452
453
454struct bfa_fcport_ln_s {
455 struct bfa_fcport_s *fcport;
456 bfa_sm_t sm;
457 struct bfa_cb_qe_s ln_qe;
458 enum bfa_port_linkstate ln_event;
459};
460
461struct bfa_fcport_trunk_s {
462 struct bfa_trunk_attr_s attr;
463};
464
465
466
467
468struct bfa_fcport_s {
469 struct bfa_s *bfa;
470 bfa_sm_t sm;
471 wwn_t nwwn;
472 wwn_t pwwn;
473 enum bfa_port_speed speed_sup;
474
475 enum bfa_port_speed speed;
476 enum bfa_port_topology topology;
477 u8 rsvd[3];
478 u8 myalpa;
479 u8 alpabm_valid;
480 struct fc_alpabm_s alpabm;
481 struct bfa_port_cfg_s cfg;
482 bfa_boolean_t use_flash_cfg;
483 struct bfa_qos_attr_s qos_attr;
484 struct bfa_qos_vc_attr_s qos_vc_attr;
485 struct bfa_reqq_wait_s reqq_wait;
486
487 struct bfa_reqq_wait_s svcreq_wait;
488
489 struct bfa_reqq_wait_s stats_reqq_wait;
490
491 void *event_cbarg;
492 void (*event_cbfn) (void *cbarg,
493 enum bfa_port_linkstate event);
494 union {
495 union bfi_fcport_i2h_msg_u i2hmsg;
496 } event_arg;
497 void *bfad;
498 struct bfa_fcport_ln_s ln;
499 struct bfa_cb_qe_s hcb_qe;
500 struct bfa_timer_s timer;
501 u32 msgtag;
502 u8 *stats_kva;
503 u64 stats_pa;
504 union bfa_fcport_stats_u *stats;
505 bfa_status_t stats_status;
506 struct list_head stats_pending_q;
507 struct list_head statsclr_pending_q;
508 bfa_boolean_t stats_qfull;
509 u32 stats_reset_time;
510 bfa_boolean_t diag_busy;
511 bfa_boolean_t beacon;
512 bfa_boolean_t link_e2e_beacon;
513 bfa_boolean_t bbsc_op_state;
514 struct bfa_fcport_trunk_s trunk;
515 u16 fcoe_vlan;
516 struct bfa_mem_dma_s fcport_dma;
517 bfa_boolean_t stats_dma_ready;
518};
519
520#define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport)
521#define BFA_MEM_FCPORT_DMA(__bfa) (&(BFA_FCPORT_MOD(__bfa)->fcport_dma))
522
523
524
525
526void bfa_fcport_init(struct bfa_s *bfa);
527void bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
528
529
530
531
532bfa_status_t bfa_fcport_enable(struct bfa_s *bfa);
533bfa_status_t bfa_fcport_disable(struct bfa_s *bfa);
534bfa_status_t bfa_fcport_cfg_speed(struct bfa_s *bfa,
535 enum bfa_port_speed speed);
536enum bfa_port_speed bfa_fcport_get_speed(struct bfa_s *bfa);
537bfa_status_t bfa_fcport_cfg_topology(struct bfa_s *bfa,
538 enum bfa_port_topology topo);
539enum bfa_port_topology bfa_fcport_get_topology(struct bfa_s *bfa);
540enum bfa_port_topology bfa_fcport_get_cfg_topology(struct bfa_s *bfa);
541bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa);
542bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa);
543u8 bfa_fcport_get_myalpa(struct bfa_s *bfa);
544bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa);
545bfa_status_t bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize);
546u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa);
547u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa);
548void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr);
549wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node);
550void bfa_fcport_event_register(struct bfa_s *bfa,
551 void (*event_cbfn) (void *cbarg,
552 enum bfa_port_linkstate event), void *event_cbarg);
553bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa);
554bfa_boolean_t bfa_fcport_is_dport(struct bfa_s *bfa);
555bfa_status_t bfa_fcport_set_qos_bw(struct bfa_s *bfa,
556 struct bfa_qos_bw_s *qos_bw);
557enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa);
558
559void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit, u8 bb_scn);
560bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa);
561void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon,
562 bfa_boolean_t link_e2e_beacon);
563bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa);
564bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa,
565 struct bfa_cb_pending_q_s *cb);
566bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa,
567 struct bfa_cb_pending_q_s *cb);
568bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa);
569bfa_boolean_t bfa_fcport_is_trunk_enabled(struct bfa_s *bfa);
570void bfa_fcport_dportenable(struct bfa_s *bfa);
571void bfa_fcport_dportdisable(struct bfa_s *bfa);
572bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa);
573void bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state);
574
575
576
577
578struct bfa_rport_s *bfa_rport_create(struct bfa_s *bfa, void *rport_drv);
579void bfa_rport_online(struct bfa_rport_s *rport,
580 struct bfa_rport_info_s *rport_info);
581void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed);
582void bfa_cb_rport_online(void *rport);
583void bfa_cb_rport_offline(void *rport);
584void bfa_cb_rport_qos_scn_flowid(void *rport,
585 struct bfa_rport_qos_attr_s old_qos_attr,
586 struct bfa_rport_qos_attr_s new_qos_attr);
587void bfa_cb_rport_scn_online(struct bfa_s *bfa);
588void bfa_cb_rport_scn_offline(struct bfa_s *bfa);
589void bfa_cb_rport_scn_no_dev(void *rp);
590void bfa_cb_rport_qos_scn_prio(void *rport,
591 struct bfa_rport_qos_attr_s old_qos_attr,
592 struct bfa_rport_qos_attr_s new_qos_attr);
593
594
595
596
597#define BFA_RPORT_TAG_INVALID 0xffff
598#define BFA_LP_TAG_INVALID 0xff
599void bfa_rport_set_lunmask(struct bfa_s *bfa, struct bfa_rport_s *rp);
600void bfa_rport_unset_lunmask(struct bfa_s *bfa, struct bfa_rport_s *rp);
601
602
603
604
605struct bfa_fcxp_s *bfa_fcxp_req_rsp_alloc(void *bfad_fcxp, struct bfa_s *bfa,
606 int nreq_sgles, int nrsp_sgles,
607 bfa_fcxp_get_sgaddr_t get_req_sga,
608 bfa_fcxp_get_sglen_t get_req_sglen,
609 bfa_fcxp_get_sgaddr_t get_rsp_sga,
610 bfa_fcxp_get_sglen_t get_rsp_sglen,
611 bfa_boolean_t req);
612void bfa_fcxp_req_rsp_alloc_wait(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe,
613 bfa_fcxp_alloc_cbfn_t alloc_cbfn,
614 void *cbarg, void *bfad_fcxp,
615 int nreq_sgles, int nrsp_sgles,
616 bfa_fcxp_get_sgaddr_t get_req_sga,
617 bfa_fcxp_get_sglen_t get_req_sglen,
618 bfa_fcxp_get_sgaddr_t get_rsp_sga,
619 bfa_fcxp_get_sglen_t get_rsp_sglen,
620 bfa_boolean_t req);
621void bfa_fcxp_walloc_cancel(struct bfa_s *bfa,
622 struct bfa_fcxp_wqe_s *wqe);
623void bfa_fcxp_discard(struct bfa_fcxp_s *fcxp);
624
625void *bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp);
626void *bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp);
627
628void bfa_fcxp_free(struct bfa_fcxp_s *fcxp);
629
630void bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport,
631 u16 vf_id, u8 lp_tag,
632 bfa_boolean_t cts, enum fc_cos cos,
633 u32 reqlen, struct fchs_s *fchs,
634 bfa_cb_fcxp_send_t cbfn,
635 void *cbarg,
636 u32 rsp_maxlen, u8 rsp_timeout);
637bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp);
638u32 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp);
639u32 bfa_fcxp_get_maxrsp(struct bfa_s *bfa);
640void bfa_fcxp_res_recfg(struct bfa_s *bfa, u16 num_fcxp_fw);
641
642static inline void *
643bfa_uf_get_frmbuf(struct bfa_uf_s *uf)
644{
645 return uf->data_ptr;
646}
647
648static inline u16
649bfa_uf_get_frmlen(struct bfa_uf_s *uf)
650{
651 return uf->data_len;
652}
653
654
655
656
657void bfa_uf_recv_register(struct bfa_s *bfa, bfa_cb_uf_recv_t ufrecv,
658 void *cbarg);
659void bfa_uf_free(struct bfa_uf_s *uf);
660
661
662
663
664
665u32 bfa_lps_get_max_vport(struct bfa_s *bfa);
666struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa);
667void bfa_lps_delete(struct bfa_lps_s *lps);
668void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa,
669 u16 pdusz, wwn_t pwwn, wwn_t nwwn,
670 bfa_boolean_t auth_en, u8 bb_scn);
671void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz,
672 wwn_t pwwn, wwn_t nwwn);
673void bfa_lps_fdisclogo(struct bfa_lps_s *lps);
674void bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, u32 n2n_pid);
675u8 bfa_lps_get_fwtag(struct bfa_s *bfa, u8 lp_tag);
676u32 bfa_lps_get_base_pid(struct bfa_s *bfa);
677u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid);
678void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status);
679void bfa_cb_lps_flogo_comp(void *bfad, void *uarg);
680void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status);
681void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg);
682void bfa_cb_lps_cvl_event(void *bfad, void *uarg);
683
684
685bfa_status_t bfa_faa_query(struct bfa_s *bfa, struct bfa_faa_attr_s *attr,
686 bfa_cb_iocfc_t cbfn, void *cbarg);
687
688
689
690
691struct bfa_fcdiag_qtest_s {
692 struct bfa_diag_qtest_result_s *result;
693 bfa_cb_diag_t cbfn;
694 void *cbarg;
695 struct bfa_timer_s timer;
696 u32 status;
697 u32 count;
698 u8 lock;
699 u8 queue;
700 u8 all;
701 u8 timer_active;
702};
703
704struct bfa_fcdiag_lb_s {
705 bfa_cb_diag_t cbfn;
706 void *cbarg;
707 void *result;
708 bfa_boolean_t lock;
709 u32 status;
710};
711
712struct bfa_dport_s {
713 struct bfa_s *bfa;
714 bfa_sm_t sm;
715 u32 msgtag;
716 struct bfa_reqq_wait_s reqq_wait;
717 bfa_cb_diag_t cbfn;
718 void *cbarg;
719};
720
721struct bfa_fcdiag_s {
722 struct bfa_s *bfa;
723 struct bfa_trc_mod_s *trcmod;
724 struct bfa_fcdiag_lb_s lb;
725 struct bfa_fcdiag_qtest_s qtest;
726 struct bfa_dport_s dport;
727};
728
729#define BFA_FCDIAG_MOD(__bfa) (&(__bfa)->modules.fcdiag)
730
731void bfa_fcdiag_intr(struct bfa_s *bfa, struct bfi_msg_s *msg);
732
733bfa_status_t bfa_fcdiag_loopback(struct bfa_s *bfa,
734 enum bfa_port_opmode opmode,
735 enum bfa_port_speed speed, u32 lpcnt, u32 pat,
736 struct bfa_diag_loopback_result_s *result,
737 bfa_cb_diag_t cbfn, void *cbarg);
738bfa_status_t bfa_fcdiag_queuetest(struct bfa_s *bfa, u32 ignore,
739 u32 queue, struct bfa_diag_qtest_result_s *result,
740 bfa_cb_diag_t cbfn, void *cbarg);
741bfa_status_t bfa_fcdiag_lb_is_running(struct bfa_s *bfa);
742bfa_status_t bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn,
743 void *cbarg);
744bfa_status_t bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn,
745 void *cbarg);
746bfa_status_t bfa_dport_get_state(struct bfa_s *bfa,
747 enum bfa_dport_state *state);
748
749#endif
750