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