1
2
3
4
5
6
7
8
9
10
11#ifndef __BFA_FCS_H__
12#define __BFA_FCS_H__
13
14#include "bfa_cs.h"
15#include "bfa_defs.h"
16#include "bfa_defs_fcs.h"
17#include "bfa_modules.h"
18#include "bfa_fc.h"
19
20#define BFA_FCS_OS_STR_LEN 64
21
22
23
24
25
26enum bfa_lps_event {
27 BFA_LPS_SM_LOGIN = 1,
28 BFA_LPS_SM_LOGOUT = 2,
29 BFA_LPS_SM_FWRSP = 3,
30 BFA_LPS_SM_RESUME = 4,
31 BFA_LPS_SM_DELETE = 5,
32 BFA_LPS_SM_OFFLINE = 6,
33 BFA_LPS_SM_RX_CVL = 7,
34 BFA_LPS_SM_SET_N2N_PID = 8,
35};
36
37
38
39
40
41
42enum {
43 BFA_TRC_FCS_FCS = 1,
44 BFA_TRC_FCS_PORT = 2,
45 BFA_TRC_FCS_RPORT = 3,
46 BFA_TRC_FCS_FCPIM = 4,
47};
48
49
50struct bfa_fcs_s;
51
52#define __fcs_min_cfg(__fcs) ((__fcs)->min_cfg)
53
54#define BFA_FCS_BRCD_SWITCH_OUI 0x051e
55#define N2N_LOCAL_PID 0x010000
56#define N2N_REMOTE_PID 0x020000
57#define BFA_FCS_RETRY_TIMEOUT 2000
58#define BFA_FCS_MAX_NS_RETRIES 5
59#define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0)
60#define BFA_FCS_MAX_RPORT_LOGINS 1024
61
62struct bfa_fcs_lport_ns_s {
63 bfa_sm_t sm;
64 struct bfa_timer_s timer;
65 struct bfa_fcs_lport_s *port;
66 struct bfa_fcxp_s *fcxp;
67 struct bfa_fcxp_wqe_s fcxp_wqe;
68 u8 num_rnnid_retries;
69 u8 num_rsnn_nn_retries;
70};
71
72
73struct bfa_fcs_lport_scn_s {
74 bfa_sm_t sm;
75 struct bfa_timer_s timer;
76 struct bfa_fcs_lport_s *port;
77 struct bfa_fcxp_s *fcxp;
78 struct bfa_fcxp_wqe_s fcxp_wqe;
79};
80
81
82struct bfa_fcs_lport_fdmi_s {
83 bfa_sm_t sm;
84 struct bfa_timer_s timer;
85 struct bfa_fcs_lport_ms_s *ms;
86 struct bfa_fcxp_s *fcxp;
87 struct bfa_fcxp_wqe_s fcxp_wqe;
88 u8 retry_cnt;
89 u8 rsvd[3];
90};
91
92
93struct bfa_fcs_lport_ms_s {
94 bfa_sm_t sm;
95 struct bfa_timer_s timer;
96 struct bfa_fcs_lport_s *port;
97 struct bfa_fcxp_s *fcxp;
98 struct bfa_fcxp_wqe_s fcxp_wqe;
99 struct bfa_fcs_lport_fdmi_s fdmi;
100 u8 retry_cnt;
101 u8 rsvd[3];
102};
103
104
105struct bfa_fcs_lport_fab_s {
106 struct bfa_fcs_lport_ns_s ns;
107 struct bfa_fcs_lport_scn_s scn;
108 struct bfa_fcs_lport_ms_s ms;
109};
110
111#define MAX_ALPA_COUNT 127
112
113struct bfa_fcs_lport_loop_s {
114 u8 num_alpa;
115 u8 alpabm_valid;
116 u8 alpa_pos_map[MAX_ALPA_COUNT];
117 struct bfa_fcs_lport_s *port;
118};
119
120struct bfa_fcs_lport_n2n_s {
121 u32 rsvd;
122 __be16 reply_oxid;
123
124 wwn_t rem_port_wwn;
125};
126
127
128union bfa_fcs_lport_topo_u {
129 struct bfa_fcs_lport_fab_s pfab;
130 struct bfa_fcs_lport_loop_s ploop;
131 struct bfa_fcs_lport_n2n_s pn2n;
132};
133
134
135struct bfa_fcs_lport_s {
136 struct list_head qe;
137 bfa_sm_t sm;
138 struct bfa_fcs_fabric_s *fabric;
139 struct bfa_lport_cfg_s port_cfg;
140 struct bfa_timer_s link_timer;
141 u32 pid:24;
142 u8 lp_tag;
143 u16 num_rports;
144 struct list_head rport_q;
145 struct bfa_fcs_s *fcs;
146 union bfa_fcs_lport_topo_u port_topo;
147 struct bfad_port_s *bfad_port;
148 struct bfa_fcs_vport_s *vport;
149 struct bfa_fcxp_s *fcxp;
150 struct bfa_fcxp_wqe_s fcxp_wqe;
151 struct bfa_lport_stats_s stats;
152 struct bfa_wc_s wc;
153};
154#define BFA_FCS_GET_HAL_FROM_PORT(port) (port->fcs->bfa)
155#define BFA_FCS_GET_NS_FROM_PORT(port) (&port->port_topo.pfab.ns)
156#define BFA_FCS_GET_SCN_FROM_PORT(port) (&port->port_topo.pfab.scn)
157#define BFA_FCS_GET_MS_FROM_PORT(port) (&port->port_topo.pfab.ms)
158#define BFA_FCS_GET_FDMI_FROM_PORT(port) (&port->port_topo.pfab.ms.fdmi)
159#define BFA_FCS_VPORT_IS_INITIATOR_MODE(port) \
160 (port->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM)
161
162
163
164
165struct bfad_vf_s;
166
167enum bfa_fcs_fabric_type {
168 BFA_FCS_FABRIC_UNKNOWN = 0,
169 BFA_FCS_FABRIC_SWITCHED = 1,
170 BFA_FCS_FABRIC_N2N = 2,
171 BFA_FCS_FABRIC_LOOP = 3,
172};
173
174
175struct bfa_fcs_fabric_s {
176 struct list_head qe;
177 bfa_sm_t sm;
178 struct bfa_fcs_s *fcs;
179 struct bfa_fcs_lport_s bport;
180 enum bfa_fcs_fabric_type fab_type;
181 enum bfa_port_type oper_type;
182 u8 is_vf;
183 u8 is_npiv;
184 u8 is_auth;
185 u16 bb_credit;
186 u16 vf_id;
187 u16 num_vports;
188 u16 rsvd;
189 struct list_head vport_q;
190 struct list_head vf_q;
191 struct bfad_vf_s *vf_drv;
192 struct bfa_timer_s link_timer;
193 wwn_t fabric_name;
194 bfa_boolean_t auth_reqd;
195 struct bfa_timer_s delay_timer;
196 union {
197 u16 swp_vfid;
198 } event_arg;
199 struct bfa_wc_s wc;
200 struct bfa_vf_stats_s stats;
201 struct bfa_lps_s *lps;
202 u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ];
203
204 struct bfa_wc_s stop_wc;
205};
206
207#define bfa_fcs_fabric_npiv_capable(__f) ((__f)->is_npiv)
208#define bfa_fcs_fabric_is_switched(__f) \
209 ((__f)->fab_type == BFA_FCS_FABRIC_SWITCHED)
210
211
212
213
214#define bfa_fcs_vf_t struct bfa_fcs_fabric_s
215
216struct bfa_vf_event_s {
217 u32 undefined;
218};
219
220
221
222
223
224#define BFA_FCS_MAX_RPORTS_SUPP 256
225
226#define bfa_fcs_lport_t struct bfa_fcs_lport_s
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243#define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | "
244
245#define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 16
246#define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10
247#define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30
248#define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 44
249#define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16
250
251
252
253
254#define bfa_fcs_lport_get_fcid(_lport) ((_lport)->pid)
255#define bfa_fcs_lport_get_pwwn(_lport) ((_lport)->port_cfg.pwwn)
256#define bfa_fcs_lport_get_nwwn(_lport) ((_lport)->port_cfg.nwwn)
257#define bfa_fcs_lport_get_psym_name(_lport) ((_lport)->port_cfg.sym_name)
258#define bfa_fcs_lport_get_nsym_name(_lport) ((_lport)->port_cfg.node_sym_name)
259#define bfa_fcs_lport_is_initiator(_lport) \
260 ((_lport)->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM)
261#define bfa_fcs_lport_get_nrports(_lport) \
262 ((_lport) ? (_lport)->num_rports : 0)
263
264static inline struct bfad_port_s *
265bfa_fcs_lport_get_drvport(struct bfa_fcs_lport_s *port)
266{
267 return port->bfad_port;
268}
269
270#define bfa_fcs_lport_get_opertype(_lport) ((_lport)->fabric->oper_type)
271#define bfa_fcs_lport_get_fabric_name(_lport) ((_lport)->fabric->fabric_name)
272#define bfa_fcs_lport_get_fabric_ipaddr(_lport) \
273 ((_lport)->fabric->fabric_ip_addr)
274
275
276
277
278
279bfa_boolean_t bfa_fcs_lport_is_online(struct bfa_fcs_lport_s *port);
280struct bfa_fcs_lport_s *bfa_fcs_get_base_port(struct bfa_fcs_s *fcs);
281void bfa_fcs_lport_get_rport_quals(struct bfa_fcs_lport_s *port,
282 struct bfa_rport_qualifier_s rport[], int *nrports);
283wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn,
284 int index, int nrports, bfa_boolean_t bwwn);
285
286struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs,
287 u16 vf_id, wwn_t lpwwn);
288
289void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname);
290void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port,
291 struct bfa_lport_info_s *port_info);
292void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port,
293 struct bfa_lport_attr_s *port_attr);
294void bfa_fcs_lport_get_stats(struct bfa_fcs_lport_s *fcs_port,
295 struct bfa_lport_stats_s *port_stats);
296void bfa_fcs_lport_clear_stats(struct bfa_fcs_lport_s *fcs_port);
297enum bfa_port_speed bfa_fcs_lport_get_rport_max_speed(
298 struct bfa_fcs_lport_s *port);
299
300
301void bfa_fcs_lport_ms_init(struct bfa_fcs_lport_s *port);
302void bfa_fcs_lport_ms_offline(struct bfa_fcs_lport_s *port);
303void bfa_fcs_lport_ms_online(struct bfa_fcs_lport_s *port);
304void bfa_fcs_lport_ms_fabric_rscn(struct bfa_fcs_lport_s *port);
305
306
307void bfa_fcs_lport_fdmi_init(struct bfa_fcs_lport_ms_s *ms);
308void bfa_fcs_lport_fdmi_offline(struct bfa_fcs_lport_ms_s *ms);
309void bfa_fcs_lport_fdmi_online(struct bfa_fcs_lport_ms_s *ms);
310void bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, struct fchs_s *fchs,
311 u16 len);
312void bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs,
313 u16 vf_id, struct bfa_fcs_vport_s *vport);
314void bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport,
315 struct bfa_lport_cfg_s *port_cfg);
316void bfa_fcs_lport_online(struct bfa_fcs_lport_s *port);
317void bfa_fcs_lport_offline(struct bfa_fcs_lport_s *port);
318void bfa_fcs_lport_delete(struct bfa_fcs_lport_s *port);
319void bfa_fcs_lport_stop(struct bfa_fcs_lport_s *port);
320struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pid(
321 struct bfa_fcs_lport_s *port, u32 pid);
322struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_old_pid(
323 struct bfa_fcs_lport_s *port, u32 pid);
324struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pwwn(
325 struct bfa_fcs_lport_s *port, wwn_t pwwn);
326struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_nwwn(
327 struct bfa_fcs_lport_s *port, wwn_t nwwn);
328struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_qualifier(
329 struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 pid);
330void bfa_fcs_lport_add_rport(struct bfa_fcs_lport_s *port,
331 struct bfa_fcs_rport_s *rport);
332void bfa_fcs_lport_del_rport(struct bfa_fcs_lport_s *port,
333 struct bfa_fcs_rport_s *rport);
334void bfa_fcs_lport_ns_init(struct bfa_fcs_lport_s *vport);
335void bfa_fcs_lport_ns_offline(struct bfa_fcs_lport_s *vport);
336void bfa_fcs_lport_ns_online(struct bfa_fcs_lport_s *vport);
337void bfa_fcs_lport_ns_query(struct bfa_fcs_lport_s *port);
338void bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg,
339 struct bfa_fcxp_s *fcxp_alloced);
340void bfa_fcs_lport_scn_init(struct bfa_fcs_lport_s *vport);
341void bfa_fcs_lport_scn_offline(struct bfa_fcs_lport_s *vport);
342void bfa_fcs_lport_fab_scn_online(struct bfa_fcs_lport_s *vport);
343void bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port,
344 struct fchs_s *rx_frame, u32 len);
345void bfa_fcs_lport_lip_scn_online(bfa_fcs_lport_t *port);
346
347struct bfa_fcs_vport_s {
348 struct list_head qe;
349 bfa_sm_t sm;
350 bfa_fcs_lport_t lport;
351 struct bfa_timer_s timer;
352 struct bfad_vport_s *vport_drv;
353 struct bfa_vport_stats_s vport_stats;
354 struct bfa_lps_s *lps;
355 int fdisc_retries;
356};
357
358#define bfa_fcs_vport_get_port(vport) \
359 ((struct bfa_fcs_lport_s *)(&vport->port))
360
361
362
363
364bfa_status_t bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport,
365 struct bfa_fcs_s *fcs, u16 vf_id,
366 struct bfa_lport_cfg_s *port_cfg,
367 struct bfad_vport_s *vport_drv);
368bfa_status_t bfa_fcs_pbc_vport_create(struct bfa_fcs_vport_s *vport,
369 struct bfa_fcs_s *fcs, u16 vf_id,
370 struct bfa_lport_cfg_s *port_cfg,
371 struct bfad_vport_s *vport_drv);
372bfa_boolean_t bfa_fcs_is_pbc_vport(struct bfa_fcs_vport_s *vport);
373bfa_status_t bfa_fcs_vport_delete(struct bfa_fcs_vport_s *vport);
374bfa_status_t bfa_fcs_vport_start(struct bfa_fcs_vport_s *vport);
375bfa_status_t bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport);
376void bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport,
377 struct bfa_vport_attr_s *vport_attr);
378struct bfa_fcs_vport_s *bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs,
379 u16 vf_id, wwn_t vpwwn);
380void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport);
381void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport);
382void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport);
383void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport);
384void bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport);
385void bfa_fcs_vport_fcs_stop(struct bfa_fcs_vport_s *vport);
386void bfa_fcs_vport_stop_comp(struct bfa_fcs_vport_s *vport);
387
388#define BFA_FCS_RPORT_DEF_DEL_TIMEOUT 90
389#define BFA_FCS_RPORT_MAX_RETRIES (5)
390
391
392
393
394struct bfad_rport_s;
395
396struct bfa_fcs_itnim_s;
397struct bfa_fcs_tin_s;
398struct bfa_fcs_iprp_s;
399
400
401struct bfa_fcs_rpf_s {
402 bfa_sm_t sm;
403 struct bfa_fcs_rport_s *rport;
404 struct bfa_timer_s timer;
405 struct bfa_fcxp_s *fcxp;
406 struct bfa_fcxp_wqe_s fcxp_wqe;
407 int rpsc_retries;
408 enum bfa_port_speed rpsc_speed;
409
410 enum bfa_port_speed assigned_speed;
411
412
413
414
415};
416
417struct bfa_fcs_rport_s {
418 struct list_head qe;
419 struct bfa_fcs_lport_s *port;
420 struct bfa_fcs_s *fcs;
421 struct bfad_rport_s *rp_drv;
422 u32 pid;
423 u32 old_pid;
424 u16 maxfrsize;
425 __be16 reply_oxid;
426 enum fc_cos fc_cos;
427 bfa_boolean_t cisc;
428 bfa_boolean_t prlo;
429 bfa_boolean_t plogi_pending;
430 wwn_t pwwn;
431 wwn_t nwwn;
432 struct bfa_rport_symname_s psym_name;
433 bfa_sm_t sm;
434 struct bfa_timer_s timer;
435 struct bfa_fcs_itnim_s *itnim;
436 struct bfa_fcs_tin_s *tin;
437 struct bfa_fcs_iprp_s *iprp;
438 struct bfa_rport_s *bfa_rport;
439 struct bfa_fcxp_s *fcxp;
440 int plogi_retries;
441 int ns_retries;
442 struct bfa_fcxp_wqe_s fcxp_wqe;
443 struct bfa_rport_stats_s stats;
444 enum bfa_rport_function scsi_function;
445 struct bfa_fcs_rpf_s rpf;
446 bfa_boolean_t scn_online;
447};
448
449static inline struct bfa_rport_s *
450bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport)
451{
452 return rport->bfa_rport;
453}
454
455
456
457
458void bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
459 struct bfa_rport_attr_s *attr);
460struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port,
461 wwn_t rpwwn);
462struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn(
463 struct bfa_fcs_lport_s *port, wwn_t rnwwn);
464void bfa_fcs_rport_set_del_timeout(u8 rport_tmo);
465void bfa_fcs_rport_set_max_logins(u32 max_logins);
466void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport,
467 struct fchs_s *fchs, u16 len);
468void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport);
469
470struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port,
471 u32 pid);
472void bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs,
473 struct fc_logi_s *plogi_rsp);
474void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port,
475 struct fchs_s *rx_fchs,
476 struct fc_logi_s *plogi);
477void bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs,
478 struct fc_logi_s *plogi);
479void bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id);
480
481void bfa_fcs_rport_itntm_ack(struct bfa_fcs_rport_s *rport);
482void bfa_fcs_rport_fcptm_offline_done(struct bfa_fcs_rport_s *rport);
483int bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport);
484struct bfa_fcs_rport_s *bfa_fcs_rport_create_by_wwn(
485 struct bfa_fcs_lport_s *port, wwn_t wwn);
486void bfa_fcs_rpf_init(struct bfa_fcs_rport_s *rport);
487void bfa_fcs_rpf_rport_online(struct bfa_fcs_rport_s *rport);
488void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport);
489
490
491
492
493struct bfad_itnim_s;
494
495struct bfa_fcs_itnim_s {
496 bfa_sm_t sm;
497 struct bfa_fcs_rport_s *rport;
498 struct bfad_itnim_s *itnim_drv;
499 struct bfa_fcs_s *fcs;
500 struct bfa_timer_s timer;
501 struct bfa_itnim_s *bfa_itnim;
502 u32 prli_retries;
503 bfa_boolean_t seq_rec;
504 bfa_boolean_t rec_support;
505 bfa_boolean_t conf_comp;
506 bfa_boolean_t task_retry_id;
507 struct bfa_fcxp_wqe_s fcxp_wqe;
508 struct bfa_fcxp_s *fcxp;
509 struct bfa_itnim_stats_s stats;
510};
511#define bfa_fcs_fcxp_alloc(__fcs, __req) \
512 bfa_fcxp_req_rsp_alloc(NULL, (__fcs)->bfa, 0, 0, \
513 NULL, NULL, NULL, NULL, __req)
514#define bfa_fcs_fcxp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \
515 __alloc_cbarg, __req) \
516 bfa_fcxp_req_rsp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \
517 __alloc_cbarg, NULL, 0, 0, NULL, NULL, NULL, NULL, __req)
518
519static inline struct bfad_port_s *
520bfa_fcs_itnim_get_drvport(struct bfa_fcs_itnim_s *itnim)
521{
522 return itnim->rport->port->bfad_port;
523}
524
525
526static inline struct bfa_fcs_lport_s *
527bfa_fcs_itnim_get_port(struct bfa_fcs_itnim_s *itnim)
528{
529 return itnim->rport->port;
530}
531
532
533static inline wwn_t
534bfa_fcs_itnim_get_nwwn(struct bfa_fcs_itnim_s *itnim)
535{
536 return itnim->rport->nwwn;
537}
538
539
540static inline wwn_t
541bfa_fcs_itnim_get_pwwn(struct bfa_fcs_itnim_s *itnim)
542{
543 return itnim->rport->pwwn;
544}
545
546
547static inline u32
548bfa_fcs_itnim_get_fcid(struct bfa_fcs_itnim_s *itnim)
549{
550 return itnim->rport->pid;
551}
552
553
554static inline u32
555bfa_fcs_itnim_get_maxfrsize(struct bfa_fcs_itnim_s *itnim)
556{
557 return itnim->rport->maxfrsize;
558}
559
560
561static inline enum fc_cos
562bfa_fcs_itnim_get_cos(struct bfa_fcs_itnim_s *itnim)
563{
564 return itnim->rport->fc_cos;
565}
566
567
568static inline struct bfad_itnim_s *
569bfa_fcs_itnim_get_drvitn(struct bfa_fcs_itnim_s *itnim)
570{
571 return itnim->itnim_drv;
572}
573
574
575static inline struct bfa_itnim_s *
576bfa_fcs_itnim_get_halitn(struct bfa_fcs_itnim_s *itnim)
577{
578 return itnim->bfa_itnim;
579}
580
581
582
583
584void bfa_fcs_itnim_get_attr(struct bfa_fcs_itnim_s *itnim,
585 struct bfa_itnim_attr_s *attr);
586void bfa_fcs_itnim_get_stats(struct bfa_fcs_itnim_s *itnim,
587 struct bfa_itnim_stats_s *stats);
588struct bfa_fcs_itnim_s *bfa_fcs_itnim_lookup(struct bfa_fcs_lport_s *port,
589 wwn_t rpwwn);
590bfa_status_t bfa_fcs_itnim_attr_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
591 struct bfa_itnim_attr_s *attr);
592bfa_status_t bfa_fcs_itnim_stats_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
593 struct bfa_itnim_stats_s *stats);
594bfa_status_t bfa_fcs_itnim_stats_clear(struct bfa_fcs_lport_s *port,
595 wwn_t rpwwn);
596struct bfa_fcs_itnim_s *bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport);
597void bfa_fcs_itnim_delete(struct bfa_fcs_itnim_s *itnim);
598void bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim);
599void bfa_fcs_itnim_brp_online(struct bfa_fcs_itnim_s *itnim);
600bfa_status_t bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim);
601void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim);
602void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim,
603 struct fchs_s *fchs, u16 len);
604
605#define BFA_FCS_FDMI_SUPP_SPEEDS_4G (FDMI_TRANS_SPEED_1G | \
606 FDMI_TRANS_SPEED_2G | \
607 FDMI_TRANS_SPEED_4G)
608
609#define BFA_FCS_FDMI_SUPP_SPEEDS_8G (FDMI_TRANS_SPEED_1G | \
610 FDMI_TRANS_SPEED_2G | \
611 FDMI_TRANS_SPEED_4G | \
612 FDMI_TRANS_SPEED_8G)
613
614#define BFA_FCS_FDMI_SUPP_SPEEDS_16G (FDMI_TRANS_SPEED_2G | \
615 FDMI_TRANS_SPEED_4G | \
616 FDMI_TRANS_SPEED_8G | \
617 FDMI_TRANS_SPEED_16G)
618
619#define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G
620
621#define BFA_FCS_FDMI_VENDOR_INFO_LEN 8
622#define BFA_FCS_FDMI_FC4_TYPE_LEN 32
623
624
625
626
627
628
629struct bfa_fcs_fdmi_hba_attr_s {
630 wwn_t node_name;
631 u8 manufacturer[64];
632 u8 serial_num[64];
633 u8 model[16];
634 u8 model_desc[128];
635 u8 hw_version[8];
636 u8 driver_version[BFA_VERSION_LEN];
637 u8 option_rom_ver[BFA_VERSION_LEN];
638 u8 fw_version[BFA_VERSION_LEN];
639 u8 os_name[256];
640 __be32 max_ct_pyld;
641 struct bfa_lport_symname_s node_sym_name;
642 u8 vendor_info[BFA_FCS_FDMI_VENDOR_INFO_LEN];
643 __be32 num_ports;
644 wwn_t fabric_name;
645 u8 bios_ver[BFA_VERSION_LEN];
646};
647
648
649
650
651struct bfa_fcs_fdmi_port_attr_s {
652 u8 supp_fc4_types[BFA_FCS_FDMI_FC4_TYPE_LEN];
653 __be32 supp_speed;
654 __be32 curr_speed;
655 __be32 max_frm_size;
656 u8 os_device_name[256];
657 u8 host_name[256];
658 wwn_t port_name;
659 wwn_t node_name;
660 struct bfa_lport_symname_s port_sym_name;
661 __be32 port_type;
662 enum fc_cos scos;
663 wwn_t port_fabric_name;
664 u8 port_act_fc4_type[BFA_FCS_FDMI_FC4_TYPE_LEN];
665 __be32 port_state;
666 __be32 num_ports;
667};
668
669struct bfa_fcs_stats_s {
670 struct {
671 u32 untagged;
672 u32 tagged;
673 u32 vfid_unknown;
674 } uf;
675};
676
677struct bfa_fcs_driver_info_s {
678 u8 version[BFA_VERSION_LEN];
679 u8 host_machine_name[BFA_FCS_OS_STR_LEN];
680 u8 host_os_name[BFA_FCS_OS_STR_LEN];
681 u8 host_os_patch[BFA_FCS_OS_STR_LEN];
682 u8 os_device_name[BFA_FCS_OS_STR_LEN];
683};
684
685struct bfa_fcs_s {
686 struct bfa_s *bfa;
687 struct bfad_s *bfad;
688 struct bfa_trc_mod_s *trcmod;
689 bfa_boolean_t vf_enabled;
690 bfa_boolean_t fdmi_enabled;
691 bfa_boolean_t min_cfg;
692 u16 port_vfid;
693 struct bfa_fcs_driver_info_s driver_info;
694 struct bfa_fcs_fabric_s fabric;
695 struct bfa_fcs_stats_s stats;
696 struct bfa_wc_s wc;
697 int fcs_aen_seq;
698 u32 num_rport_logins;
699};
700
701
702
703
704
705
706
707
708enum bfa_fcs_fabric_event {
709 BFA_FCS_FABRIC_SM_CREATE = 1,
710 BFA_FCS_FABRIC_SM_DELETE = 2,
711 BFA_FCS_FABRIC_SM_LINK_DOWN = 3,
712 BFA_FCS_FABRIC_SM_LINK_UP = 4,
713 BFA_FCS_FABRIC_SM_CONT_OP = 5,
714 BFA_FCS_FABRIC_SM_RETRY_OP = 6,
715 BFA_FCS_FABRIC_SM_NO_FABRIC = 7,
716 BFA_FCS_FABRIC_SM_PERF_EVFP = 8,
717 BFA_FCS_FABRIC_SM_ISOLATE = 9,
718 BFA_FCS_FABRIC_SM_NO_TAGGING = 10,
719 BFA_FCS_FABRIC_SM_DELAYED = 11,
720 BFA_FCS_FABRIC_SM_AUTH_FAILED = 12,
721 BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13,
722 BFA_FCS_FABRIC_SM_DELCOMP = 14,
723 BFA_FCS_FABRIC_SM_LOOPBACK = 15,
724 BFA_FCS_FABRIC_SM_START = 16,
725 BFA_FCS_FABRIC_SM_STOP = 17,
726 BFA_FCS_FABRIC_SM_STOPCOMP = 18,
727 BFA_FCS_FABRIC_SM_LOGOCOMP = 19,
728};
729
730
731
732
733
734enum rport_event {
735 RPSM_EVENT_PLOGI_SEND = 1,
736 RPSM_EVENT_PLOGI_RCVD = 2,
737 RPSM_EVENT_PLOGI_COMP = 3,
738 RPSM_EVENT_LOGO_RCVD = 4,
739 RPSM_EVENT_LOGO_IMP = 5,
740 RPSM_EVENT_FCXP_SENT = 6,
741 RPSM_EVENT_DELETE = 7,
742 RPSM_EVENT_FAB_SCN = 8,
743 RPSM_EVENT_ACCEPTED = 9,
744 RPSM_EVENT_FAILED = 10,
745 RPSM_EVENT_TIMEOUT = 11,
746 RPSM_EVENT_HCB_ONLINE = 12,
747 RPSM_EVENT_HCB_OFFLINE = 13,
748 RPSM_EVENT_FC4_OFFLINE = 14,
749 RPSM_EVENT_ADDRESS_CHANGE = 15,
750 RPSM_EVENT_ADDRESS_DISC = 16,
751 RPSM_EVENT_PRLO_RCVD = 17,
752 RPSM_EVENT_PLOGI_RETRY = 18,
753 RPSM_EVENT_SCN_OFFLINE = 19,
754 RPSM_EVENT_SCN_ONLINE = 20,
755 RPSM_EVENT_FC4_FCS_ONLINE = 21,
756};
757
758
759
760
761enum bfa_fcs_itnim_event {
762 BFA_FCS_ITNIM_SM_FCS_ONLINE = 1,
763 BFA_FCS_ITNIM_SM_OFFLINE = 2,
764 BFA_FCS_ITNIM_SM_FRMSENT = 3,
765 BFA_FCS_ITNIM_SM_RSP_OK = 4,
766 BFA_FCS_ITNIM_SM_RSP_ERROR = 5,
767 BFA_FCS_ITNIM_SM_TIMEOUT = 6,
768 BFA_FCS_ITNIM_SM_HCB_OFFLINE = 7,
769 BFA_FCS_ITNIM_SM_HCB_ONLINE = 8,
770 BFA_FCS_ITNIM_SM_INITIATOR = 9,
771 BFA_FCS_ITNIM_SM_DELETE = 10,
772 BFA_FCS_ITNIM_SM_PRLO = 11,
773 BFA_FCS_ITNIM_SM_RSP_NOT_SUPP = 12,
774 BFA_FCS_ITNIM_SM_HAL_ONLINE = 13,
775};
776
777
778
779
780void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa,
781 struct bfad_s *bfad,
782 bfa_boolean_t min_cfg);
783void bfa_fcs_init(struct bfa_fcs_s *fcs);
784void bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs);
785void bfa_fcs_update_cfg(struct bfa_fcs_s *fcs);
786void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
787 struct bfa_fcs_driver_info_s *driver_info);
788void bfa_fcs_exit(struct bfa_fcs_s *fcs);
789void bfa_fcs_stop(struct bfa_fcs_s *fcs);
790
791
792
793
794bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id);
795void bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t vpwwn[], int *nports);
796
797
798
799
800void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs);
801void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric);
802void bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric);
803void bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric,
804 struct bfa_fcs_vport_s *vport);
805void bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric,
806 struct bfa_fcs_vport_s *vport);
807struct bfa_fcs_vport_s *bfa_fcs_fabric_vport_lookup(
808 struct bfa_fcs_fabric_s *fabric, wwn_t pwwn);
809void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs);
810void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric,
811 struct fchs_s *fchs, u16 len);
812void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric);
813void bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric);
814void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
815 wwn_t fabric_name);
816u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric);
817void bfa_fcs_fabric_modstop(struct bfa_fcs_s *fcs);
818void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
819 enum bfa_fcs_fabric_event event);
820void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
821 enum bfa_fcs_fabric_event event);
822void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
823 enum bfa_fcs_fabric_event event);
824
825
826
827
828
829
830
831
832
833struct bfad_port_s;
834struct bfad_vf_s;
835struct bfad_vport_s;
836struct bfad_rport_s;
837
838
839
840
841struct bfad_port_s *bfa_fcb_lport_new(struct bfad_s *bfad,
842 struct bfa_fcs_lport_s *port,
843 enum bfa_lport_role roles,
844 struct bfad_vf_s *vf_drv,
845 struct bfad_vport_s *vp_drv);
846
847
848
849
850void bfa_fcb_pbc_vport_create(struct bfad_s *bfad, struct bfi_pbc_vport_s);
851
852
853
854
855bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad,
856 struct bfa_fcs_rport_s **rport,
857 struct bfad_rport_s **rport_drv);
858
859
860
861
862int bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim,
863 struct bfad_itnim_s **itnim_drv);
864void bfa_fcb_itnim_free(struct bfad_s *bfad,
865 struct bfad_itnim_s *itnim_drv);
866void bfa_fcb_itnim_online(struct bfad_itnim_s *itnim_drv);
867void bfa_fcb_itnim_offline(struct bfad_itnim_s *itnim_drv);
868
869#endif
870