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
220struct bfa_fcs_s;
221struct bfa_fcs_fabric_s;
222
223
224
225
226
227#define BFA_FCS_MAX_RPORTS_SUPP 256
228
229#define bfa_fcs_lport_t struct bfa_fcs_lport_s
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246#define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | "
247
248#define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 16
249#define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10
250#define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30
251#define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 44
252#define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16
253
254
255
256
257#define bfa_fcs_lport_get_fcid(_lport) ((_lport)->pid)
258#define bfa_fcs_lport_get_pwwn(_lport) ((_lport)->port_cfg.pwwn)
259#define bfa_fcs_lport_get_nwwn(_lport) ((_lport)->port_cfg.nwwn)
260#define bfa_fcs_lport_get_psym_name(_lport) ((_lport)->port_cfg.sym_name)
261#define bfa_fcs_lport_get_nsym_name(_lport) ((_lport)->port_cfg.node_sym_name)
262#define bfa_fcs_lport_is_initiator(_lport) \
263 ((_lport)->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM)
264#define bfa_fcs_lport_get_nrports(_lport) \
265 ((_lport) ? (_lport)->num_rports : 0)
266
267static inline struct bfad_port_s *
268bfa_fcs_lport_get_drvport(struct bfa_fcs_lport_s *port)
269{
270 return port->bfad_port;
271}
272
273#define bfa_fcs_lport_get_opertype(_lport) ((_lport)->fabric->oper_type)
274#define bfa_fcs_lport_get_fabric_name(_lport) ((_lport)->fabric->fabric_name)
275#define bfa_fcs_lport_get_fabric_ipaddr(_lport) \
276 ((_lport)->fabric->fabric_ip_addr)
277
278
279
280
281
282bfa_boolean_t bfa_fcs_lport_is_online(struct bfa_fcs_lport_s *port);
283struct bfa_fcs_lport_s *bfa_fcs_get_base_port(struct bfa_fcs_s *fcs);
284void bfa_fcs_lport_get_rport_quals(struct bfa_fcs_lport_s *port,
285 struct bfa_rport_qualifier_s rport[], int *nrports);
286wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn,
287 int index, int nrports, bfa_boolean_t bwwn);
288
289struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs,
290 u16 vf_id, wwn_t lpwwn);
291
292void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname);
293void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port,
294 struct bfa_lport_info_s *port_info);
295void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port,
296 struct bfa_lport_attr_s *port_attr);
297void bfa_fcs_lport_get_stats(struct bfa_fcs_lport_s *fcs_port,
298 struct bfa_lport_stats_s *port_stats);
299void bfa_fcs_lport_clear_stats(struct bfa_fcs_lport_s *fcs_port);
300enum bfa_port_speed bfa_fcs_lport_get_rport_max_speed(
301 struct bfa_fcs_lport_s *port);
302
303
304void bfa_fcs_lport_ms_init(struct bfa_fcs_lport_s *port);
305void bfa_fcs_lport_ms_offline(struct bfa_fcs_lport_s *port);
306void bfa_fcs_lport_ms_online(struct bfa_fcs_lport_s *port);
307void bfa_fcs_lport_ms_fabric_rscn(struct bfa_fcs_lport_s *port);
308
309
310void bfa_fcs_lport_fdmi_init(struct bfa_fcs_lport_ms_s *ms);
311void bfa_fcs_lport_fdmi_offline(struct bfa_fcs_lport_ms_s *ms);
312void bfa_fcs_lport_fdmi_online(struct bfa_fcs_lport_ms_s *ms);
313void bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, struct fchs_s *fchs,
314 u16 len);
315void bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs,
316 u16 vf_id, struct bfa_fcs_vport_s *vport);
317void bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport,
318 struct bfa_lport_cfg_s *port_cfg);
319void bfa_fcs_lport_online(struct bfa_fcs_lport_s *port);
320void bfa_fcs_lport_offline(struct bfa_fcs_lport_s *port);
321void bfa_fcs_lport_delete(struct bfa_fcs_lport_s *port);
322void bfa_fcs_lport_stop(struct bfa_fcs_lport_s *port);
323struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pid(
324 struct bfa_fcs_lport_s *port, u32 pid);
325struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_old_pid(
326 struct bfa_fcs_lport_s *port, u32 pid);
327struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pwwn(
328 struct bfa_fcs_lport_s *port, wwn_t pwwn);
329struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_nwwn(
330 struct bfa_fcs_lport_s *port, wwn_t nwwn);
331struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_qualifier(
332 struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 pid);
333void bfa_fcs_lport_add_rport(struct bfa_fcs_lport_s *port,
334 struct bfa_fcs_rport_s *rport);
335void bfa_fcs_lport_del_rport(struct bfa_fcs_lport_s *port,
336 struct bfa_fcs_rport_s *rport);
337void bfa_fcs_lport_ns_init(struct bfa_fcs_lport_s *vport);
338void bfa_fcs_lport_ns_offline(struct bfa_fcs_lport_s *vport);
339void bfa_fcs_lport_ns_online(struct bfa_fcs_lport_s *vport);
340void bfa_fcs_lport_ns_query(struct bfa_fcs_lport_s *port);
341void bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg,
342 struct bfa_fcxp_s *fcxp_alloced);
343void bfa_fcs_lport_scn_init(struct bfa_fcs_lport_s *vport);
344void bfa_fcs_lport_scn_offline(struct bfa_fcs_lport_s *vport);
345void bfa_fcs_lport_fab_scn_online(struct bfa_fcs_lport_s *vport);
346void bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port,
347 struct fchs_s *rx_frame, u32 len);
348void bfa_fcs_lport_lip_scn_online(bfa_fcs_lport_t *port);
349
350struct bfa_fcs_vport_s {
351 struct list_head qe;
352 bfa_sm_t sm;
353 bfa_fcs_lport_t lport;
354 struct bfa_timer_s timer;
355 struct bfad_vport_s *vport_drv;
356 struct bfa_vport_stats_s vport_stats;
357 struct bfa_lps_s *lps;
358 int fdisc_retries;
359};
360
361#define bfa_fcs_vport_get_port(vport) \
362 ((struct bfa_fcs_lport_s *)(&vport->port))
363
364
365
366
367bfa_status_t bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport,
368 struct bfa_fcs_s *fcs, u16 vf_id,
369 struct bfa_lport_cfg_s *port_cfg,
370 struct bfad_vport_s *vport_drv);
371bfa_status_t bfa_fcs_pbc_vport_create(struct bfa_fcs_vport_s *vport,
372 struct bfa_fcs_s *fcs, u16 vf_id,
373 struct bfa_lport_cfg_s *port_cfg,
374 struct bfad_vport_s *vport_drv);
375bfa_boolean_t bfa_fcs_is_pbc_vport(struct bfa_fcs_vport_s *vport);
376bfa_status_t bfa_fcs_vport_delete(struct bfa_fcs_vport_s *vport);
377bfa_status_t bfa_fcs_vport_start(struct bfa_fcs_vport_s *vport);
378bfa_status_t bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport);
379void bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport,
380 struct bfa_vport_attr_s *vport_attr);
381struct bfa_fcs_vport_s *bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs,
382 u16 vf_id, wwn_t vpwwn);
383void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport);
384void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport);
385void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport);
386void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport);
387void bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport);
388void bfa_fcs_vport_fcs_stop(struct bfa_fcs_vport_s *vport);
389void bfa_fcs_vport_stop_comp(struct bfa_fcs_vport_s *vport);
390
391#define BFA_FCS_RPORT_DEF_DEL_TIMEOUT 90
392#define BFA_FCS_RPORT_MAX_RETRIES (5)
393
394
395
396
397struct bfad_rport_s;
398
399struct bfa_fcs_itnim_s;
400struct bfa_fcs_tin_s;
401struct bfa_fcs_iprp_s;
402
403
404struct bfa_fcs_rpf_s {
405 bfa_sm_t sm;
406 struct bfa_fcs_rport_s *rport;
407 struct bfa_timer_s timer;
408 struct bfa_fcxp_s *fcxp;
409 struct bfa_fcxp_wqe_s fcxp_wqe;
410 int rpsc_retries;
411 enum bfa_port_speed rpsc_speed;
412
413 enum bfa_port_speed assigned_speed;
414
415
416
417
418};
419
420struct bfa_fcs_rport_s {
421 struct list_head qe;
422 struct bfa_fcs_lport_s *port;
423 struct bfa_fcs_s *fcs;
424 struct bfad_rport_s *rp_drv;
425 u32 pid;
426 u32 old_pid;
427 u16 maxfrsize;
428 __be16 reply_oxid;
429 enum fc_cos fc_cos;
430 bfa_boolean_t cisc;
431 bfa_boolean_t prlo;
432 bfa_boolean_t plogi_pending;
433 wwn_t pwwn;
434 wwn_t nwwn;
435 struct bfa_rport_symname_s psym_name;
436 bfa_sm_t sm;
437 struct bfa_timer_s timer;
438 struct bfa_fcs_itnim_s *itnim;
439 struct bfa_fcs_tin_s *tin;
440 struct bfa_fcs_iprp_s *iprp;
441 struct bfa_rport_s *bfa_rport;
442 struct bfa_fcxp_s *fcxp;
443 int plogi_retries;
444 int ns_retries;
445 struct bfa_fcxp_wqe_s fcxp_wqe;
446 struct bfa_rport_stats_s stats;
447 enum bfa_rport_function scsi_function;
448 struct bfa_fcs_rpf_s rpf;
449 bfa_boolean_t scn_online;
450};
451
452static inline struct bfa_rport_s *
453bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport)
454{
455 return rport->bfa_rport;
456}
457
458
459
460
461void bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
462 struct bfa_rport_attr_s *attr);
463struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port,
464 wwn_t rpwwn);
465struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn(
466 struct bfa_fcs_lport_s *port, wwn_t rnwwn);
467void bfa_fcs_rport_set_del_timeout(u8 rport_tmo);
468void bfa_fcs_rport_set_max_logins(u32 max_logins);
469void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport,
470 struct fchs_s *fchs, u16 len);
471void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport);
472
473struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port,
474 u32 pid);
475void bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs,
476 struct fc_logi_s *plogi_rsp);
477void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port,
478 struct fchs_s *rx_fchs,
479 struct fc_logi_s *plogi);
480void bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs,
481 struct fc_logi_s *plogi);
482void bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id);
483
484void bfa_fcs_rport_itntm_ack(struct bfa_fcs_rport_s *rport);
485void bfa_fcs_rport_fcptm_offline_done(struct bfa_fcs_rport_s *rport);
486int bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport);
487struct bfa_fcs_rport_s *bfa_fcs_rport_create_by_wwn(
488 struct bfa_fcs_lport_s *port, wwn_t wwn);
489void bfa_fcs_rpf_init(struct bfa_fcs_rport_s *rport);
490void bfa_fcs_rpf_rport_online(struct bfa_fcs_rport_s *rport);
491void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport);
492
493
494
495
496struct bfad_itnim_s;
497
498struct bfa_fcs_itnim_s {
499 bfa_sm_t sm;
500 struct bfa_fcs_rport_s *rport;
501 struct bfad_itnim_s *itnim_drv;
502 struct bfa_fcs_s *fcs;
503 struct bfa_timer_s timer;
504 struct bfa_itnim_s *bfa_itnim;
505 u32 prli_retries;
506 bfa_boolean_t seq_rec;
507 bfa_boolean_t rec_support;
508 bfa_boolean_t conf_comp;
509 bfa_boolean_t task_retry_id;
510 struct bfa_fcxp_wqe_s fcxp_wqe;
511 struct bfa_fcxp_s *fcxp;
512 struct bfa_itnim_stats_s stats;
513};
514#define bfa_fcs_fcxp_alloc(__fcs, __req) \
515 bfa_fcxp_req_rsp_alloc(NULL, (__fcs)->bfa, 0, 0, \
516 NULL, NULL, NULL, NULL, __req)
517#define bfa_fcs_fcxp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \
518 __alloc_cbarg, __req) \
519 bfa_fcxp_req_rsp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \
520 __alloc_cbarg, NULL, 0, 0, NULL, NULL, NULL, NULL, __req)
521
522static inline struct bfad_port_s *
523bfa_fcs_itnim_get_drvport(struct bfa_fcs_itnim_s *itnim)
524{
525 return itnim->rport->port->bfad_port;
526}
527
528
529static inline struct bfa_fcs_lport_s *
530bfa_fcs_itnim_get_port(struct bfa_fcs_itnim_s *itnim)
531{
532 return itnim->rport->port;
533}
534
535
536static inline wwn_t
537bfa_fcs_itnim_get_nwwn(struct bfa_fcs_itnim_s *itnim)
538{
539 return itnim->rport->nwwn;
540}
541
542
543static inline wwn_t
544bfa_fcs_itnim_get_pwwn(struct bfa_fcs_itnim_s *itnim)
545{
546 return itnim->rport->pwwn;
547}
548
549
550static inline u32
551bfa_fcs_itnim_get_fcid(struct bfa_fcs_itnim_s *itnim)
552{
553 return itnim->rport->pid;
554}
555
556
557static inline u32
558bfa_fcs_itnim_get_maxfrsize(struct bfa_fcs_itnim_s *itnim)
559{
560 return itnim->rport->maxfrsize;
561}
562
563
564static inline enum fc_cos
565bfa_fcs_itnim_get_cos(struct bfa_fcs_itnim_s *itnim)
566{
567 return itnim->rport->fc_cos;
568}
569
570
571static inline struct bfad_itnim_s *
572bfa_fcs_itnim_get_drvitn(struct bfa_fcs_itnim_s *itnim)
573{
574 return itnim->itnim_drv;
575}
576
577
578static inline struct bfa_itnim_s *
579bfa_fcs_itnim_get_halitn(struct bfa_fcs_itnim_s *itnim)
580{
581 return itnim->bfa_itnim;
582}
583
584
585
586
587void bfa_fcs_itnim_get_attr(struct bfa_fcs_itnim_s *itnim,
588 struct bfa_itnim_attr_s *attr);
589void bfa_fcs_itnim_get_stats(struct bfa_fcs_itnim_s *itnim,
590 struct bfa_itnim_stats_s *stats);
591struct bfa_fcs_itnim_s *bfa_fcs_itnim_lookup(struct bfa_fcs_lport_s *port,
592 wwn_t rpwwn);
593bfa_status_t bfa_fcs_itnim_attr_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
594 struct bfa_itnim_attr_s *attr);
595bfa_status_t bfa_fcs_itnim_stats_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
596 struct bfa_itnim_stats_s *stats);
597bfa_status_t bfa_fcs_itnim_stats_clear(struct bfa_fcs_lport_s *port,
598 wwn_t rpwwn);
599struct bfa_fcs_itnim_s *bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport);
600void bfa_fcs_itnim_delete(struct bfa_fcs_itnim_s *itnim);
601void bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim);
602void bfa_fcs_itnim_brp_online(struct bfa_fcs_itnim_s *itnim);
603bfa_status_t bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim);
604void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim);
605void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim,
606 struct fchs_s *fchs, u16 len);
607
608#define BFA_FCS_FDMI_SUPP_SPEEDS_4G (FDMI_TRANS_SPEED_1G | \
609 FDMI_TRANS_SPEED_2G | \
610 FDMI_TRANS_SPEED_4G)
611
612#define BFA_FCS_FDMI_SUPP_SPEEDS_8G (FDMI_TRANS_SPEED_1G | \
613 FDMI_TRANS_SPEED_2G | \
614 FDMI_TRANS_SPEED_4G | \
615 FDMI_TRANS_SPEED_8G)
616
617#define BFA_FCS_FDMI_SUPP_SPEEDS_16G (FDMI_TRANS_SPEED_2G | \
618 FDMI_TRANS_SPEED_4G | \
619 FDMI_TRANS_SPEED_8G | \
620 FDMI_TRANS_SPEED_16G)
621
622#define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G
623
624#define BFA_FCS_FDMI_VENDOR_INFO_LEN 8
625#define BFA_FCS_FDMI_FC4_TYPE_LEN 32
626
627
628
629
630
631
632struct bfa_fcs_fdmi_hba_attr_s {
633 wwn_t node_name;
634 u8 manufacturer[64];
635 u8 serial_num[64];
636 u8 model[16];
637 u8 model_desc[128];
638 u8 hw_version[8];
639 u8 driver_version[BFA_VERSION_LEN];
640 u8 option_rom_ver[BFA_VERSION_LEN];
641 u8 fw_version[BFA_VERSION_LEN];
642 u8 os_name[256];
643 __be32 max_ct_pyld;
644 struct bfa_lport_symname_s node_sym_name;
645 u8 vendor_info[BFA_FCS_FDMI_VENDOR_INFO_LEN];
646 __be32 num_ports;
647 wwn_t fabric_name;
648 u8 bios_ver[BFA_VERSION_LEN];
649};
650
651
652
653
654struct bfa_fcs_fdmi_port_attr_s {
655 u8 supp_fc4_types[BFA_FCS_FDMI_FC4_TYPE_LEN];
656 __be32 supp_speed;
657 __be32 curr_speed;
658 __be32 max_frm_size;
659 u8 os_device_name[256];
660 u8 host_name[256];
661 wwn_t port_name;
662 wwn_t node_name;
663 struct bfa_lport_symname_s port_sym_name;
664 __be32 port_type;
665 enum fc_cos scos;
666 wwn_t port_fabric_name;
667 u8 port_act_fc4_type[BFA_FCS_FDMI_FC4_TYPE_LEN];
668 __be32 port_state;
669 __be32 num_ports;
670};
671
672struct bfa_fcs_stats_s {
673 struct {
674 u32 untagged;
675 u32 tagged;
676 u32 vfid_unknown;
677 } uf;
678};
679
680struct bfa_fcs_driver_info_s {
681 u8 version[BFA_VERSION_LEN];
682 u8 host_machine_name[BFA_FCS_OS_STR_LEN];
683 u8 host_os_name[BFA_FCS_OS_STR_LEN];
684 u8 host_os_patch[BFA_FCS_OS_STR_LEN];
685 u8 os_device_name[BFA_FCS_OS_STR_LEN];
686};
687
688struct bfa_fcs_s {
689 struct bfa_s *bfa;
690 struct bfad_s *bfad;
691 struct bfa_trc_mod_s *trcmod;
692 bfa_boolean_t vf_enabled;
693 bfa_boolean_t fdmi_enabled;
694 bfa_boolean_t min_cfg;
695 u16 port_vfid;
696 struct bfa_fcs_driver_info_s driver_info;
697 struct bfa_fcs_fabric_s fabric;
698 struct bfa_fcs_stats_s stats;
699 struct bfa_wc_s wc;
700 int fcs_aen_seq;
701 u32 num_rport_logins;
702};
703
704
705
706
707
708
709
710
711enum bfa_fcs_fabric_event {
712 BFA_FCS_FABRIC_SM_CREATE = 1,
713 BFA_FCS_FABRIC_SM_DELETE = 2,
714 BFA_FCS_FABRIC_SM_LINK_DOWN = 3,
715 BFA_FCS_FABRIC_SM_LINK_UP = 4,
716 BFA_FCS_FABRIC_SM_CONT_OP = 5,
717 BFA_FCS_FABRIC_SM_RETRY_OP = 6,
718 BFA_FCS_FABRIC_SM_NO_FABRIC = 7,
719 BFA_FCS_FABRIC_SM_PERF_EVFP = 8,
720 BFA_FCS_FABRIC_SM_ISOLATE = 9,
721 BFA_FCS_FABRIC_SM_NO_TAGGING = 10,
722 BFA_FCS_FABRIC_SM_DELAYED = 11,
723 BFA_FCS_FABRIC_SM_AUTH_FAILED = 12,
724 BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13,
725 BFA_FCS_FABRIC_SM_DELCOMP = 14,
726 BFA_FCS_FABRIC_SM_LOOPBACK = 15,
727 BFA_FCS_FABRIC_SM_START = 16,
728 BFA_FCS_FABRIC_SM_STOP = 17,
729 BFA_FCS_FABRIC_SM_STOPCOMP = 18,
730 BFA_FCS_FABRIC_SM_LOGOCOMP = 19,
731};
732
733
734
735
736
737enum rport_event {
738 RPSM_EVENT_PLOGI_SEND = 1,
739 RPSM_EVENT_PLOGI_RCVD = 2,
740 RPSM_EVENT_PLOGI_COMP = 3,
741 RPSM_EVENT_LOGO_RCVD = 4,
742 RPSM_EVENT_LOGO_IMP = 5,
743 RPSM_EVENT_FCXP_SENT = 6,
744 RPSM_EVENT_DELETE = 7,
745 RPSM_EVENT_FAB_SCN = 8,
746 RPSM_EVENT_ACCEPTED = 9,
747 RPSM_EVENT_FAILED = 10,
748 RPSM_EVENT_TIMEOUT = 11,
749 RPSM_EVENT_HCB_ONLINE = 12,
750 RPSM_EVENT_HCB_OFFLINE = 13,
751 RPSM_EVENT_FC4_OFFLINE = 14,
752 RPSM_EVENT_ADDRESS_CHANGE = 15,
753 RPSM_EVENT_ADDRESS_DISC = 16,
754 RPSM_EVENT_PRLO_RCVD = 17,
755 RPSM_EVENT_PLOGI_RETRY = 18,
756 RPSM_EVENT_SCN_OFFLINE = 19,
757 RPSM_EVENT_SCN_ONLINE = 20,
758 RPSM_EVENT_FC4_FCS_ONLINE = 21,
759};
760
761
762
763
764enum bfa_fcs_itnim_event {
765 BFA_FCS_ITNIM_SM_FCS_ONLINE = 1,
766 BFA_FCS_ITNIM_SM_OFFLINE = 2,
767 BFA_FCS_ITNIM_SM_FRMSENT = 3,
768 BFA_FCS_ITNIM_SM_RSP_OK = 4,
769 BFA_FCS_ITNIM_SM_RSP_ERROR = 5,
770 BFA_FCS_ITNIM_SM_TIMEOUT = 6,
771 BFA_FCS_ITNIM_SM_HCB_OFFLINE = 7,
772 BFA_FCS_ITNIM_SM_HCB_ONLINE = 8,
773 BFA_FCS_ITNIM_SM_INITIATOR = 9,
774 BFA_FCS_ITNIM_SM_DELETE = 10,
775 BFA_FCS_ITNIM_SM_PRLO = 11,
776 BFA_FCS_ITNIM_SM_RSP_NOT_SUPP = 12,
777 BFA_FCS_ITNIM_SM_HAL_ONLINE = 13,
778};
779
780
781
782
783void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa,
784 struct bfad_s *bfad,
785 bfa_boolean_t min_cfg);
786void bfa_fcs_init(struct bfa_fcs_s *fcs);
787void bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs);
788void bfa_fcs_update_cfg(struct bfa_fcs_s *fcs);
789void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
790 struct bfa_fcs_driver_info_s *driver_info);
791void bfa_fcs_exit(struct bfa_fcs_s *fcs);
792void bfa_fcs_stop(struct bfa_fcs_s *fcs);
793
794
795
796
797bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id);
798void bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t vpwwn[], int *nports);
799
800
801
802
803void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs);
804void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric);
805void bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric);
806void bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric,
807 struct bfa_fcs_vport_s *vport);
808void bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric,
809 struct bfa_fcs_vport_s *vport);
810struct bfa_fcs_vport_s *bfa_fcs_fabric_vport_lookup(
811 struct bfa_fcs_fabric_s *fabric, wwn_t pwwn);
812void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs);
813void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric,
814 struct fchs_s *fchs, u16 len);
815void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric);
816void bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric);
817void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
818 wwn_t fabric_name);
819u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric);
820void bfa_fcs_fabric_modstop(struct bfa_fcs_s *fcs);
821void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
822 enum bfa_fcs_fabric_event event);
823void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
824 enum bfa_fcs_fabric_event event);
825void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
826 enum bfa_fcs_fabric_event event);
827
828
829
830
831
832
833
834
835
836struct bfad_port_s;
837struct bfad_vf_s;
838struct bfad_vport_s;
839struct bfad_rport_s;
840
841
842
843
844struct bfad_port_s *bfa_fcb_lport_new(struct bfad_s *bfad,
845 struct bfa_fcs_lport_s *port,
846 enum bfa_lport_role roles,
847 struct bfad_vf_s *vf_drv,
848 struct bfad_vport_s *vp_drv);
849
850
851
852
853void bfa_fcb_pbc_vport_create(struct bfad_s *bfad, struct bfi_pbc_vport_s);
854
855
856
857
858bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad,
859 struct bfa_fcs_rport_s **rport,
860 struct bfad_rport_s **rport_drv);
861
862
863
864
865int bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim,
866 struct bfad_itnim_s **itnim_drv);
867void bfa_fcb_itnim_free(struct bfad_s *bfad,
868 struct bfad_itnim_s *itnim_drv);
869void bfa_fcb_itnim_online(struct bfad_itnim_s *itnim_drv);
870void bfa_fcb_itnim_offline(struct bfad_itnim_s *itnim_drv);
871
872#endif
873