0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __BFA_FCS_H__
0012 #define __BFA_FCS_H__
0013
0014 #include "bfa_cs.h"
0015 #include "bfa_defs.h"
0016 #include "bfa_defs_fcs.h"
0017 #include "bfa_modules.h"
0018 #include "bfa_fc.h"
0019
0020 #define BFA_FCS_OS_STR_LEN 64
0021
0022
0023
0024
0025
0026 enum bfa_lps_event {
0027 BFA_LPS_SM_LOGIN = 1,
0028 BFA_LPS_SM_LOGOUT = 2,
0029 BFA_LPS_SM_FWRSP = 3,
0030 BFA_LPS_SM_RESUME = 4,
0031 BFA_LPS_SM_DELETE = 5,
0032 BFA_LPS_SM_OFFLINE = 6,
0033 BFA_LPS_SM_RX_CVL = 7,
0034 BFA_LPS_SM_SET_N2N_PID = 8,
0035 };
0036
0037
0038
0039
0040
0041
0042 enum {
0043 BFA_TRC_FCS_FCS = 1,
0044 BFA_TRC_FCS_PORT = 2,
0045 BFA_TRC_FCS_RPORT = 3,
0046 BFA_TRC_FCS_FCPIM = 4,
0047 };
0048
0049
0050 struct bfa_fcs_s;
0051
0052 #define __fcs_min_cfg(__fcs) ((__fcs)->min_cfg)
0053
0054 #define BFA_FCS_BRCD_SWITCH_OUI 0x051e
0055 #define N2N_LOCAL_PID 0x010000
0056 #define N2N_REMOTE_PID 0x020000
0057 #define BFA_FCS_RETRY_TIMEOUT 2000
0058 #define BFA_FCS_MAX_NS_RETRIES 5
0059 #define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0)
0060 #define BFA_FCS_MAX_RPORT_LOGINS 1024
0061
0062 struct bfa_fcs_lport_ns_s {
0063 bfa_sm_t sm;
0064 struct bfa_timer_s timer;
0065 struct bfa_fcs_lport_s *port;
0066 struct bfa_fcxp_s *fcxp;
0067 struct bfa_fcxp_wqe_s fcxp_wqe;
0068 u8 num_rnnid_retries;
0069 u8 num_rsnn_nn_retries;
0070 };
0071
0072
0073 struct bfa_fcs_lport_scn_s {
0074 bfa_sm_t sm;
0075 struct bfa_timer_s timer;
0076 struct bfa_fcs_lport_s *port;
0077 struct bfa_fcxp_s *fcxp;
0078 struct bfa_fcxp_wqe_s fcxp_wqe;
0079 };
0080
0081
0082 struct bfa_fcs_lport_fdmi_s {
0083 bfa_sm_t sm;
0084 struct bfa_timer_s timer;
0085 struct bfa_fcs_lport_ms_s *ms;
0086 struct bfa_fcxp_s *fcxp;
0087 struct bfa_fcxp_wqe_s fcxp_wqe;
0088 u8 retry_cnt;
0089 u8 rsvd[3];
0090 };
0091
0092
0093 struct bfa_fcs_lport_ms_s {
0094 bfa_sm_t sm;
0095 struct bfa_timer_s timer;
0096 struct bfa_fcs_lport_s *port;
0097 struct bfa_fcxp_s *fcxp;
0098 struct bfa_fcxp_wqe_s fcxp_wqe;
0099 struct bfa_fcs_lport_fdmi_s fdmi;
0100 u8 retry_cnt;
0101 u8 rsvd[3];
0102 };
0103
0104
0105 struct bfa_fcs_lport_fab_s {
0106 struct bfa_fcs_lport_ns_s ns;
0107 struct bfa_fcs_lport_scn_s scn;
0108 struct bfa_fcs_lport_ms_s ms;
0109 };
0110
0111 #define MAX_ALPA_COUNT 127
0112
0113 struct bfa_fcs_lport_loop_s {
0114 u8 num_alpa;
0115 u8 alpabm_valid;
0116 u8 alpa_pos_map[MAX_ALPA_COUNT];
0117 struct bfa_fcs_lport_s *port;
0118 };
0119
0120 struct bfa_fcs_lport_n2n_s {
0121 u32 rsvd;
0122 __be16 reply_oxid;
0123
0124 wwn_t rem_port_wwn;
0125 };
0126
0127
0128 union bfa_fcs_lport_topo_u {
0129 struct bfa_fcs_lport_fab_s pfab;
0130 struct bfa_fcs_lport_loop_s ploop;
0131 struct bfa_fcs_lport_n2n_s pn2n;
0132 };
0133
0134
0135 struct bfa_fcs_lport_s {
0136 struct list_head qe;
0137 bfa_sm_t sm;
0138 struct bfa_fcs_fabric_s *fabric;
0139 struct bfa_lport_cfg_s port_cfg;
0140 struct bfa_timer_s link_timer;
0141 u32 pid:24;
0142 u8 lp_tag;
0143 u16 num_rports;
0144 struct list_head rport_q;
0145 struct bfa_fcs_s *fcs;
0146 union bfa_fcs_lport_topo_u port_topo;
0147 struct bfad_port_s *bfad_port;
0148 struct bfa_fcs_vport_s *vport;
0149 struct bfa_fcxp_s *fcxp;
0150 struct bfa_fcxp_wqe_s fcxp_wqe;
0151 struct bfa_lport_stats_s stats;
0152 struct bfa_wc_s wc;
0153 };
0154 #define BFA_FCS_GET_HAL_FROM_PORT(port) (port->fcs->bfa)
0155 #define BFA_FCS_GET_NS_FROM_PORT(port) (&port->port_topo.pfab.ns)
0156 #define BFA_FCS_GET_SCN_FROM_PORT(port) (&port->port_topo.pfab.scn)
0157 #define BFA_FCS_GET_MS_FROM_PORT(port) (&port->port_topo.pfab.ms)
0158 #define BFA_FCS_GET_FDMI_FROM_PORT(port) (&port->port_topo.pfab.ms.fdmi)
0159 #define BFA_FCS_VPORT_IS_INITIATOR_MODE(port) \
0160 (port->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM)
0161
0162
0163
0164
0165 struct bfad_vf_s;
0166
0167 enum bfa_fcs_fabric_type {
0168 BFA_FCS_FABRIC_UNKNOWN = 0,
0169 BFA_FCS_FABRIC_SWITCHED = 1,
0170 BFA_FCS_FABRIC_N2N = 2,
0171 BFA_FCS_FABRIC_LOOP = 3,
0172 };
0173
0174
0175 struct bfa_fcs_fabric_s {
0176 struct list_head qe;
0177 bfa_sm_t sm;
0178 struct bfa_fcs_s *fcs;
0179 struct bfa_fcs_lport_s bport;
0180 enum bfa_fcs_fabric_type fab_type;
0181 enum bfa_port_type oper_type;
0182 u8 is_vf;
0183 u8 is_npiv;
0184 u8 is_auth;
0185 u16 bb_credit;
0186 u16 vf_id;
0187 u16 num_vports;
0188 u16 rsvd;
0189 struct list_head vport_q;
0190 struct list_head vf_q;
0191 struct bfad_vf_s *vf_drv;
0192 struct bfa_timer_s link_timer;
0193 wwn_t fabric_name;
0194 bfa_boolean_t auth_reqd;
0195 struct bfa_timer_s delay_timer;
0196 union {
0197 u16 swp_vfid;
0198 } event_arg;
0199 struct bfa_wc_s wc;
0200 struct bfa_vf_stats_s stats;
0201 struct bfa_lps_s *lps;
0202 u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ];
0203
0204 struct bfa_wc_s stop_wc;
0205 };
0206
0207 #define bfa_fcs_fabric_npiv_capable(__f) ((__f)->is_npiv)
0208 #define bfa_fcs_fabric_is_switched(__f) \
0209 ((__f)->fab_type == BFA_FCS_FABRIC_SWITCHED)
0210
0211
0212
0213
0214 #define bfa_fcs_vf_t struct bfa_fcs_fabric_s
0215
0216 struct bfa_vf_event_s {
0217 u32 undefined;
0218 };
0219
0220
0221
0222
0223
0224 #define BFA_FCS_MAX_RPORTS_SUPP 256
0225
0226 #define bfa_fcs_lport_t struct bfa_fcs_lport_s
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243 #define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | "
0244
0245 #define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 16
0246 #define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10
0247 #define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30
0248 #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 44
0249 #define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16
0250
0251
0252
0253
0254 #define bfa_fcs_lport_get_fcid(_lport) ((_lport)->pid)
0255 #define bfa_fcs_lport_get_pwwn(_lport) ((_lport)->port_cfg.pwwn)
0256 #define bfa_fcs_lport_get_nwwn(_lport) ((_lport)->port_cfg.nwwn)
0257 #define bfa_fcs_lport_get_psym_name(_lport) ((_lport)->port_cfg.sym_name)
0258 #define bfa_fcs_lport_get_nsym_name(_lport) ((_lport)->port_cfg.node_sym_name)
0259 #define bfa_fcs_lport_is_initiator(_lport) \
0260 ((_lport)->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM)
0261 #define bfa_fcs_lport_get_nrports(_lport) \
0262 ((_lport) ? (_lport)->num_rports : 0)
0263
0264 static inline struct bfad_port_s *
0265 bfa_fcs_lport_get_drvport(struct bfa_fcs_lport_s *port)
0266 {
0267 return port->bfad_port;
0268 }
0269
0270 #define bfa_fcs_lport_get_opertype(_lport) ((_lport)->fabric->oper_type)
0271 #define bfa_fcs_lport_get_fabric_name(_lport) ((_lport)->fabric->fabric_name)
0272 #define bfa_fcs_lport_get_fabric_ipaddr(_lport) \
0273 ((_lport)->fabric->fabric_ip_addr)
0274
0275
0276
0277
0278
0279 bfa_boolean_t bfa_fcs_lport_is_online(struct bfa_fcs_lport_s *port);
0280 struct bfa_fcs_lport_s *bfa_fcs_get_base_port(struct bfa_fcs_s *fcs);
0281 void bfa_fcs_lport_get_rport_quals(struct bfa_fcs_lport_s *port,
0282 struct bfa_rport_qualifier_s rport[], int *nrports);
0283 wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn,
0284 int index, int nrports, bfa_boolean_t bwwn);
0285
0286 struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs,
0287 u16 vf_id, wwn_t lpwwn);
0288
0289 void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname);
0290 void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port,
0291 struct bfa_lport_info_s *port_info);
0292 void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port,
0293 struct bfa_lport_attr_s *port_attr);
0294 void bfa_fcs_lport_get_stats(struct bfa_fcs_lport_s *fcs_port,
0295 struct bfa_lport_stats_s *port_stats);
0296 void bfa_fcs_lport_clear_stats(struct bfa_fcs_lport_s *fcs_port);
0297 enum bfa_port_speed bfa_fcs_lport_get_rport_max_speed(
0298 struct bfa_fcs_lport_s *port);
0299
0300
0301 void bfa_fcs_lport_ms_init(struct bfa_fcs_lport_s *port);
0302 void bfa_fcs_lport_ms_offline(struct bfa_fcs_lport_s *port);
0303 void bfa_fcs_lport_ms_online(struct bfa_fcs_lport_s *port);
0304 void bfa_fcs_lport_ms_fabric_rscn(struct bfa_fcs_lport_s *port);
0305
0306
0307 void bfa_fcs_lport_fdmi_init(struct bfa_fcs_lport_ms_s *ms);
0308 void bfa_fcs_lport_fdmi_offline(struct bfa_fcs_lport_ms_s *ms);
0309 void bfa_fcs_lport_fdmi_online(struct bfa_fcs_lport_ms_s *ms);
0310 void bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, struct fchs_s *fchs,
0311 u16 len);
0312 void bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs,
0313 u16 vf_id, struct bfa_fcs_vport_s *vport);
0314 void bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport,
0315 struct bfa_lport_cfg_s *port_cfg);
0316 void bfa_fcs_lport_online(struct bfa_fcs_lport_s *port);
0317 void bfa_fcs_lport_offline(struct bfa_fcs_lport_s *port);
0318 void bfa_fcs_lport_delete(struct bfa_fcs_lport_s *port);
0319 void bfa_fcs_lport_stop(struct bfa_fcs_lport_s *port);
0320 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pid(
0321 struct bfa_fcs_lport_s *port, u32 pid);
0322 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_old_pid(
0323 struct bfa_fcs_lport_s *port, u32 pid);
0324 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pwwn(
0325 struct bfa_fcs_lport_s *port, wwn_t pwwn);
0326 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_nwwn(
0327 struct bfa_fcs_lport_s *port, wwn_t nwwn);
0328 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_qualifier(
0329 struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 pid);
0330 void bfa_fcs_lport_add_rport(struct bfa_fcs_lport_s *port,
0331 struct bfa_fcs_rport_s *rport);
0332 void bfa_fcs_lport_del_rport(struct bfa_fcs_lport_s *port,
0333 struct bfa_fcs_rport_s *rport);
0334 void bfa_fcs_lport_ns_init(struct bfa_fcs_lport_s *vport);
0335 void bfa_fcs_lport_ns_offline(struct bfa_fcs_lport_s *vport);
0336 void bfa_fcs_lport_ns_online(struct bfa_fcs_lport_s *vport);
0337 void bfa_fcs_lport_ns_query(struct bfa_fcs_lport_s *port);
0338 void bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg,
0339 struct bfa_fcxp_s *fcxp_alloced);
0340 void bfa_fcs_lport_scn_init(struct bfa_fcs_lport_s *vport);
0341 void bfa_fcs_lport_scn_offline(struct bfa_fcs_lport_s *vport);
0342 void bfa_fcs_lport_fab_scn_online(struct bfa_fcs_lport_s *vport);
0343 void bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port,
0344 struct fchs_s *rx_frame, u32 len);
0345 void bfa_fcs_lport_lip_scn_online(bfa_fcs_lport_t *port);
0346
0347 struct bfa_fcs_vport_s {
0348 struct list_head qe;
0349 bfa_sm_t sm;
0350 bfa_fcs_lport_t lport;
0351 struct bfa_timer_s timer;
0352 struct bfad_vport_s *vport_drv;
0353 struct bfa_vport_stats_s vport_stats;
0354 struct bfa_lps_s *lps;
0355 int fdisc_retries;
0356 };
0357
0358 #define bfa_fcs_vport_get_port(vport) \
0359 ((struct bfa_fcs_lport_s *)(&vport->port))
0360
0361
0362
0363
0364 bfa_status_t bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport,
0365 struct bfa_fcs_s *fcs, u16 vf_id,
0366 struct bfa_lport_cfg_s *port_cfg,
0367 struct bfad_vport_s *vport_drv);
0368 bfa_status_t bfa_fcs_pbc_vport_create(struct bfa_fcs_vport_s *vport,
0369 struct bfa_fcs_s *fcs, u16 vf_id,
0370 struct bfa_lport_cfg_s *port_cfg,
0371 struct bfad_vport_s *vport_drv);
0372 bfa_boolean_t bfa_fcs_is_pbc_vport(struct bfa_fcs_vport_s *vport);
0373 bfa_status_t bfa_fcs_vport_delete(struct bfa_fcs_vport_s *vport);
0374 bfa_status_t bfa_fcs_vport_start(struct bfa_fcs_vport_s *vport);
0375 bfa_status_t bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport);
0376 void bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport,
0377 struct bfa_vport_attr_s *vport_attr);
0378 struct bfa_fcs_vport_s *bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs,
0379 u16 vf_id, wwn_t vpwwn);
0380 void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport);
0381 void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport);
0382 void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport);
0383 void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport);
0384 void bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport);
0385 void bfa_fcs_vport_fcs_stop(struct bfa_fcs_vport_s *vport);
0386 void bfa_fcs_vport_stop_comp(struct bfa_fcs_vport_s *vport);
0387
0388 #define BFA_FCS_RPORT_DEF_DEL_TIMEOUT 90
0389 #define BFA_FCS_RPORT_MAX_RETRIES (5)
0390
0391
0392
0393
0394 struct bfad_rport_s;
0395
0396 struct bfa_fcs_itnim_s;
0397 struct bfa_fcs_tin_s;
0398 struct bfa_fcs_iprp_s;
0399
0400
0401 struct bfa_fcs_rpf_s {
0402 bfa_sm_t sm;
0403 struct bfa_fcs_rport_s *rport;
0404 struct bfa_timer_s timer;
0405 struct bfa_fcxp_s *fcxp;
0406 struct bfa_fcxp_wqe_s fcxp_wqe;
0407 int rpsc_retries;
0408 enum bfa_port_speed rpsc_speed;
0409
0410 enum bfa_port_speed assigned_speed;
0411
0412
0413
0414
0415 };
0416
0417 struct bfa_fcs_rport_s {
0418 struct list_head qe;
0419 struct bfa_fcs_lport_s *port;
0420 struct bfa_fcs_s *fcs;
0421 struct bfad_rport_s *rp_drv;
0422 u32 pid;
0423 u32 old_pid;
0424 u16 maxfrsize;
0425 __be16 reply_oxid;
0426 enum fc_cos fc_cos;
0427 bfa_boolean_t cisc;
0428 bfa_boolean_t prlo;
0429 bfa_boolean_t plogi_pending;
0430 wwn_t pwwn;
0431 wwn_t nwwn;
0432 struct bfa_rport_symname_s psym_name;
0433 bfa_sm_t sm;
0434 struct bfa_timer_s timer;
0435 struct bfa_fcs_itnim_s *itnim;
0436 struct bfa_fcs_tin_s *tin;
0437 struct bfa_fcs_iprp_s *iprp;
0438 struct bfa_rport_s *bfa_rport;
0439 struct bfa_fcxp_s *fcxp;
0440 int plogi_retries;
0441 int ns_retries;
0442 struct bfa_fcxp_wqe_s fcxp_wqe;
0443 struct bfa_rport_stats_s stats;
0444 enum bfa_rport_function scsi_function;
0445 struct bfa_fcs_rpf_s rpf;
0446 bfa_boolean_t scn_online;
0447 };
0448
0449 static inline struct bfa_rport_s *
0450 bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport)
0451 {
0452 return rport->bfa_rport;
0453 }
0454
0455
0456
0457
0458 void bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
0459 struct bfa_rport_attr_s *attr);
0460 struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port,
0461 wwn_t rpwwn);
0462 struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn(
0463 struct bfa_fcs_lport_s *port, wwn_t rnwwn);
0464 void bfa_fcs_rport_set_del_timeout(u8 rport_tmo);
0465 void bfa_fcs_rport_set_max_logins(u32 max_logins);
0466 void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport,
0467 struct fchs_s *fchs, u16 len);
0468 void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport);
0469
0470 struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port,
0471 u32 pid);
0472 void bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs,
0473 struct fc_logi_s *plogi_rsp);
0474 void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port,
0475 struct fchs_s *rx_fchs,
0476 struct fc_logi_s *plogi);
0477 void bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs,
0478 struct fc_logi_s *plogi);
0479 void bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id);
0480
0481 void bfa_fcs_rport_itntm_ack(struct bfa_fcs_rport_s *rport);
0482 void bfa_fcs_rport_fcptm_offline_done(struct bfa_fcs_rport_s *rport);
0483 int bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport);
0484 struct bfa_fcs_rport_s *bfa_fcs_rport_create_by_wwn(
0485 struct bfa_fcs_lport_s *port, wwn_t wwn);
0486 void bfa_fcs_rpf_init(struct bfa_fcs_rport_s *rport);
0487 void bfa_fcs_rpf_rport_online(struct bfa_fcs_rport_s *rport);
0488 void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport);
0489
0490
0491
0492
0493 struct bfad_itnim_s;
0494
0495 struct bfa_fcs_itnim_s {
0496 bfa_sm_t sm;
0497 struct bfa_fcs_rport_s *rport;
0498 struct bfad_itnim_s *itnim_drv;
0499 struct bfa_fcs_s *fcs;
0500 struct bfa_timer_s timer;
0501 struct bfa_itnim_s *bfa_itnim;
0502 u32 prli_retries;
0503 bfa_boolean_t seq_rec;
0504 bfa_boolean_t rec_support;
0505 bfa_boolean_t conf_comp;
0506 bfa_boolean_t task_retry_id;
0507 struct bfa_fcxp_wqe_s fcxp_wqe;
0508 struct bfa_fcxp_s *fcxp;
0509 struct bfa_itnim_stats_s stats;
0510 };
0511 #define bfa_fcs_fcxp_alloc(__fcs, __req) \
0512 bfa_fcxp_req_rsp_alloc(NULL, (__fcs)->bfa, 0, 0, \
0513 NULL, NULL, NULL, NULL, __req)
0514 #define bfa_fcs_fcxp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \
0515 __alloc_cbarg, __req) \
0516 bfa_fcxp_req_rsp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \
0517 __alloc_cbarg, NULL, 0, 0, NULL, NULL, NULL, NULL, __req)
0518
0519 static inline struct bfad_port_s *
0520 bfa_fcs_itnim_get_drvport(struct bfa_fcs_itnim_s *itnim)
0521 {
0522 return itnim->rport->port->bfad_port;
0523 }
0524
0525
0526 static inline struct bfa_fcs_lport_s *
0527 bfa_fcs_itnim_get_port(struct bfa_fcs_itnim_s *itnim)
0528 {
0529 return itnim->rport->port;
0530 }
0531
0532
0533 static inline wwn_t
0534 bfa_fcs_itnim_get_nwwn(struct bfa_fcs_itnim_s *itnim)
0535 {
0536 return itnim->rport->nwwn;
0537 }
0538
0539
0540 static inline wwn_t
0541 bfa_fcs_itnim_get_pwwn(struct bfa_fcs_itnim_s *itnim)
0542 {
0543 return itnim->rport->pwwn;
0544 }
0545
0546
0547 static inline u32
0548 bfa_fcs_itnim_get_fcid(struct bfa_fcs_itnim_s *itnim)
0549 {
0550 return itnim->rport->pid;
0551 }
0552
0553
0554 static inline u32
0555 bfa_fcs_itnim_get_maxfrsize(struct bfa_fcs_itnim_s *itnim)
0556 {
0557 return itnim->rport->maxfrsize;
0558 }
0559
0560
0561 static inline enum fc_cos
0562 bfa_fcs_itnim_get_cos(struct bfa_fcs_itnim_s *itnim)
0563 {
0564 return itnim->rport->fc_cos;
0565 }
0566
0567
0568 static inline struct bfad_itnim_s *
0569 bfa_fcs_itnim_get_drvitn(struct bfa_fcs_itnim_s *itnim)
0570 {
0571 return itnim->itnim_drv;
0572 }
0573
0574
0575 static inline struct bfa_itnim_s *
0576 bfa_fcs_itnim_get_halitn(struct bfa_fcs_itnim_s *itnim)
0577 {
0578 return itnim->bfa_itnim;
0579 }
0580
0581
0582
0583
0584 void bfa_fcs_itnim_get_attr(struct bfa_fcs_itnim_s *itnim,
0585 struct bfa_itnim_attr_s *attr);
0586 void bfa_fcs_itnim_get_stats(struct bfa_fcs_itnim_s *itnim,
0587 struct bfa_itnim_stats_s *stats);
0588 struct bfa_fcs_itnim_s *bfa_fcs_itnim_lookup(struct bfa_fcs_lport_s *port,
0589 wwn_t rpwwn);
0590 bfa_status_t bfa_fcs_itnim_attr_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
0591 struct bfa_itnim_attr_s *attr);
0592 bfa_status_t bfa_fcs_itnim_stats_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
0593 struct bfa_itnim_stats_s *stats);
0594 bfa_status_t bfa_fcs_itnim_stats_clear(struct bfa_fcs_lport_s *port,
0595 wwn_t rpwwn);
0596 struct bfa_fcs_itnim_s *bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport);
0597 void bfa_fcs_itnim_delete(struct bfa_fcs_itnim_s *itnim);
0598 void bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim);
0599 void bfa_fcs_itnim_brp_online(struct bfa_fcs_itnim_s *itnim);
0600 bfa_status_t bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim);
0601 void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim);
0602 void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim,
0603 struct fchs_s *fchs, u16 len);
0604
0605 #define BFA_FCS_FDMI_SUPP_SPEEDS_4G (FDMI_TRANS_SPEED_1G | \
0606 FDMI_TRANS_SPEED_2G | \
0607 FDMI_TRANS_SPEED_4G)
0608
0609 #define BFA_FCS_FDMI_SUPP_SPEEDS_8G (FDMI_TRANS_SPEED_1G | \
0610 FDMI_TRANS_SPEED_2G | \
0611 FDMI_TRANS_SPEED_4G | \
0612 FDMI_TRANS_SPEED_8G)
0613
0614 #define BFA_FCS_FDMI_SUPP_SPEEDS_16G (FDMI_TRANS_SPEED_2G | \
0615 FDMI_TRANS_SPEED_4G | \
0616 FDMI_TRANS_SPEED_8G | \
0617 FDMI_TRANS_SPEED_16G)
0618
0619 #define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G
0620
0621 #define BFA_FCS_FDMI_VENDOR_INFO_LEN 8
0622 #define BFA_FCS_FDMI_FC4_TYPE_LEN 32
0623
0624
0625
0626
0627
0628
0629 struct bfa_fcs_fdmi_hba_attr_s {
0630 wwn_t node_name;
0631 u8 manufacturer[64];
0632 u8 serial_num[64];
0633 u8 model[16];
0634 u8 model_desc[128];
0635 u8 hw_version[8];
0636 u8 driver_version[BFA_VERSION_LEN];
0637 u8 option_rom_ver[BFA_VERSION_LEN];
0638 u8 fw_version[BFA_VERSION_LEN];
0639 u8 os_name[256];
0640 __be32 max_ct_pyld;
0641 struct bfa_lport_symname_s node_sym_name;
0642 u8 vendor_info[BFA_FCS_FDMI_VENDOR_INFO_LEN];
0643 __be32 num_ports;
0644 wwn_t fabric_name;
0645 u8 bios_ver[BFA_VERSION_LEN];
0646 };
0647
0648
0649
0650
0651 struct bfa_fcs_fdmi_port_attr_s {
0652 u8 supp_fc4_types[BFA_FCS_FDMI_FC4_TYPE_LEN];
0653 __be32 supp_speed;
0654 __be32 curr_speed;
0655 __be32 max_frm_size;
0656 u8 os_device_name[256];
0657 u8 host_name[256];
0658 wwn_t port_name;
0659 wwn_t node_name;
0660 struct bfa_lport_symname_s port_sym_name;
0661 __be32 port_type;
0662 enum fc_cos scos;
0663 wwn_t port_fabric_name;
0664 u8 port_act_fc4_type[BFA_FCS_FDMI_FC4_TYPE_LEN];
0665 __be32 port_state;
0666 __be32 num_ports;
0667 };
0668
0669 struct bfa_fcs_stats_s {
0670 struct {
0671 u32 untagged;
0672 u32 tagged;
0673 u32 vfid_unknown;
0674 } uf;
0675 };
0676
0677 struct bfa_fcs_driver_info_s {
0678 u8 version[BFA_VERSION_LEN];
0679 u8 host_machine_name[BFA_FCS_OS_STR_LEN];
0680 u8 host_os_name[BFA_FCS_OS_STR_LEN];
0681 u8 host_os_patch[BFA_FCS_OS_STR_LEN];
0682 u8 os_device_name[BFA_FCS_OS_STR_LEN];
0683 };
0684
0685 struct bfa_fcs_s {
0686 struct bfa_s *bfa;
0687 struct bfad_s *bfad;
0688 struct bfa_trc_mod_s *trcmod;
0689 bfa_boolean_t vf_enabled;
0690 bfa_boolean_t fdmi_enabled;
0691 bfa_boolean_t min_cfg;
0692 u16 port_vfid;
0693 struct bfa_fcs_driver_info_s driver_info;
0694 struct bfa_fcs_fabric_s fabric;
0695 struct bfa_fcs_stats_s stats;
0696 struct bfa_wc_s wc;
0697 int fcs_aen_seq;
0698 u32 num_rport_logins;
0699 };
0700
0701
0702
0703
0704
0705
0706
0707
0708 enum bfa_fcs_fabric_event {
0709 BFA_FCS_FABRIC_SM_CREATE = 1,
0710 BFA_FCS_FABRIC_SM_DELETE = 2,
0711 BFA_FCS_FABRIC_SM_LINK_DOWN = 3,
0712 BFA_FCS_FABRIC_SM_LINK_UP = 4,
0713 BFA_FCS_FABRIC_SM_CONT_OP = 5,
0714 BFA_FCS_FABRIC_SM_RETRY_OP = 6,
0715 BFA_FCS_FABRIC_SM_NO_FABRIC = 7,
0716 BFA_FCS_FABRIC_SM_PERF_EVFP = 8,
0717 BFA_FCS_FABRIC_SM_ISOLATE = 9,
0718 BFA_FCS_FABRIC_SM_NO_TAGGING = 10,
0719 BFA_FCS_FABRIC_SM_DELAYED = 11,
0720 BFA_FCS_FABRIC_SM_AUTH_FAILED = 12,
0721 BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13,
0722 BFA_FCS_FABRIC_SM_DELCOMP = 14,
0723 BFA_FCS_FABRIC_SM_LOOPBACK = 15,
0724 BFA_FCS_FABRIC_SM_START = 16,
0725 BFA_FCS_FABRIC_SM_STOP = 17,
0726 BFA_FCS_FABRIC_SM_STOPCOMP = 18,
0727 BFA_FCS_FABRIC_SM_LOGOCOMP = 19,
0728 };
0729
0730
0731
0732
0733
0734 enum rport_event {
0735 RPSM_EVENT_PLOGI_SEND = 1,
0736 RPSM_EVENT_PLOGI_RCVD = 2,
0737 RPSM_EVENT_PLOGI_COMP = 3,
0738 RPSM_EVENT_LOGO_RCVD = 4,
0739 RPSM_EVENT_LOGO_IMP = 5,
0740 RPSM_EVENT_FCXP_SENT = 6,
0741 RPSM_EVENT_DELETE = 7,
0742 RPSM_EVENT_FAB_SCN = 8,
0743 RPSM_EVENT_ACCEPTED = 9,
0744 RPSM_EVENT_FAILED = 10,
0745 RPSM_EVENT_TIMEOUT = 11,
0746 RPSM_EVENT_HCB_ONLINE = 12,
0747 RPSM_EVENT_HCB_OFFLINE = 13,
0748 RPSM_EVENT_FC4_OFFLINE = 14,
0749 RPSM_EVENT_ADDRESS_CHANGE = 15,
0750 RPSM_EVENT_ADDRESS_DISC = 16,
0751 RPSM_EVENT_PRLO_RCVD = 17,
0752 RPSM_EVENT_PLOGI_RETRY = 18,
0753 RPSM_EVENT_SCN_OFFLINE = 19,
0754 RPSM_EVENT_SCN_ONLINE = 20,
0755 RPSM_EVENT_FC4_FCS_ONLINE = 21,
0756 };
0757
0758
0759
0760
0761 enum bfa_fcs_itnim_event {
0762 BFA_FCS_ITNIM_SM_FCS_ONLINE = 1,
0763 BFA_FCS_ITNIM_SM_OFFLINE = 2,
0764 BFA_FCS_ITNIM_SM_FRMSENT = 3,
0765 BFA_FCS_ITNIM_SM_RSP_OK = 4,
0766 BFA_FCS_ITNIM_SM_RSP_ERROR = 5,
0767 BFA_FCS_ITNIM_SM_TIMEOUT = 6,
0768 BFA_FCS_ITNIM_SM_HCB_OFFLINE = 7,
0769 BFA_FCS_ITNIM_SM_HCB_ONLINE = 8,
0770 BFA_FCS_ITNIM_SM_INITIATOR = 9,
0771 BFA_FCS_ITNIM_SM_DELETE = 10,
0772 BFA_FCS_ITNIM_SM_PRLO = 11,
0773 BFA_FCS_ITNIM_SM_RSP_NOT_SUPP = 12,
0774 BFA_FCS_ITNIM_SM_HAL_ONLINE = 13,
0775 };
0776
0777
0778
0779
0780 void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa,
0781 struct bfad_s *bfad,
0782 bfa_boolean_t min_cfg);
0783 void bfa_fcs_init(struct bfa_fcs_s *fcs);
0784 void bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs);
0785 void bfa_fcs_update_cfg(struct bfa_fcs_s *fcs);
0786 void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
0787 struct bfa_fcs_driver_info_s *driver_info);
0788 void bfa_fcs_exit(struct bfa_fcs_s *fcs);
0789 void bfa_fcs_stop(struct bfa_fcs_s *fcs);
0790
0791
0792
0793
0794 bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id);
0795 void bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t vpwwn[], int *nports);
0796
0797
0798
0799
0800 void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs);
0801 void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric);
0802 void bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric);
0803 void bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric,
0804 struct bfa_fcs_vport_s *vport);
0805 void bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric,
0806 struct bfa_fcs_vport_s *vport);
0807 struct bfa_fcs_vport_s *bfa_fcs_fabric_vport_lookup(
0808 struct bfa_fcs_fabric_s *fabric, wwn_t pwwn);
0809 void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs);
0810 void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric,
0811 struct fchs_s *fchs, u16 len);
0812 void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric);
0813 void bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric);
0814 void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
0815 wwn_t fabric_name);
0816 u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric);
0817 void bfa_fcs_fabric_modstop(struct bfa_fcs_s *fcs);
0818 void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
0819 enum bfa_fcs_fabric_event event);
0820 void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
0821 enum bfa_fcs_fabric_event event);
0822 void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
0823 enum bfa_fcs_fabric_event event);
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833 struct bfad_port_s;
0834 struct bfad_vf_s;
0835 struct bfad_vport_s;
0836 struct bfad_rport_s;
0837
0838
0839
0840
0841 struct bfad_port_s *bfa_fcb_lport_new(struct bfad_s *bfad,
0842 struct bfa_fcs_lport_s *port,
0843 enum bfa_lport_role roles,
0844 struct bfad_vf_s *vf_drv,
0845 struct bfad_vport_s *vp_drv);
0846
0847
0848
0849
0850 void bfa_fcb_pbc_vport_create(struct bfad_s *bfad, struct bfi_pbc_vport_s);
0851
0852
0853
0854
0855 bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad,
0856 struct bfa_fcs_rport_s **rport,
0857 struct bfad_rport_s **rport_drv);
0858
0859
0860
0861
0862 int bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim,
0863 struct bfad_itnim_s **itnim_drv);
0864 void bfa_fcb_itnim_free(struct bfad_s *bfad,
0865 struct bfad_itnim_s *itnim_drv);
0866 void bfa_fcb_itnim_online(struct bfad_itnim_s *itnim_drv);
0867 void bfa_fcb_itnim_offline(struct bfad_itnim_s *itnim_drv);
0868
0869 #endif