0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __BFA_SVC_H__
0012 #define __BFA_SVC_H__
0013
0014 #include "bfa_cs.h"
0015 #include "bfi_ms.h"
0016
0017
0018
0019
0020
0021 #define BFA_SGPG_MIN (16)
0022 #define BFA_SGPG_MAX (8192)
0023
0024
0025
0026
0027 #define BFA_SGPG_ROUNDUP(_l) (((_l) + (sizeof(struct bfi_sgpg_s) - 1)) \
0028 & ~(sizeof(struct bfi_sgpg_s) - 1))
0029
0030 struct bfa_sgpg_wqe_s {
0031 struct list_head qe;
0032 int nsgpg;
0033 int nsgpg_total;
0034 void (*cbfn) (void *cbarg);
0035 void *cbarg;
0036 struct list_head sgpg_q;
0037 };
0038
0039 struct bfa_sgpg_s {
0040 struct list_head qe;
0041 struct bfi_sgpg_s *sgpg;
0042 union bfi_addr_u sgpg_pa;
0043 };
0044
0045
0046
0047
0048
0049 #define BFA_SGPG_NPAGE(_nsges) (((_nsges) / BFI_SGPG_DATA_SGES) + 1)
0050
0051
0052 #define BFA_SGPG_DMA_SEGS \
0053 BFI_MEM_DMA_NSEGS(BFA_SGPG_MAX, (uint32_t)sizeof(struct bfi_sgpg_s))
0054
0055 struct bfa_sgpg_mod_s {
0056 struct bfa_s *bfa;
0057 int num_sgpgs;
0058 int free_sgpgs;
0059 struct list_head sgpg_q;
0060 struct list_head sgpg_wait_q;
0061 struct bfa_mem_dma_s dma_seg[BFA_SGPG_DMA_SEGS];
0062 struct bfa_mem_kva_s kva_seg;
0063 };
0064 #define BFA_SGPG_MOD(__bfa) (&(__bfa)->modules.sgpg_mod)
0065 #define BFA_MEM_SGPG_KVA(__bfa) (&(BFA_SGPG_MOD(__bfa)->kva_seg))
0066
0067 bfa_status_t bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q,
0068 int nsgpgs);
0069 void bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs);
0070 void bfa_sgpg_winit(struct bfa_sgpg_wqe_s *wqe,
0071 void (*cbfn) (void *cbarg), void *cbarg);
0072 void bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpgs);
0073 void bfa_sgpg_wcancel(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe);
0074
0075
0076
0077
0078
0079 #define BFA_FCXP_MIN (1)
0080 #define BFA_FCXP_MAX (256)
0081 #define BFA_FCXP_MAX_IBUF_SZ (2 * 1024 + 256)
0082 #define BFA_FCXP_MAX_LBUF_SZ (4 * 1024 + 256)
0083
0084
0085 #define BFA_FCXP_DMA_SEGS \
0086 BFI_MEM_DMA_NSEGS(BFA_FCXP_MAX, \
0087 (u32)BFA_FCXP_MAX_IBUF_SZ + BFA_FCXP_MAX_LBUF_SZ)
0088
0089 struct bfa_fcxp_mod_s {
0090 struct bfa_s *bfa;
0091 struct bfa_fcxp_s *fcxp_list;
0092 u16 num_fcxps;
0093 struct list_head fcxp_req_free_q;
0094 struct list_head fcxp_rsp_free_q;
0095 struct list_head fcxp_active_q;
0096 struct list_head req_wait_q;
0097 struct list_head rsp_wait_q;
0098 struct list_head fcxp_req_unused_q;
0099 struct list_head fcxp_rsp_unused_q;
0100 u32 req_pld_sz;
0101 u32 rsp_pld_sz;
0102 struct bfa_mem_dma_s dma_seg[BFA_FCXP_DMA_SEGS];
0103 struct bfa_mem_kva_s kva_seg;
0104 };
0105
0106 #define BFA_FCXP_MOD(__bfa) (&(__bfa)->modules.fcxp_mod)
0107 #define BFA_FCXP_FROM_TAG(__mod, __tag) (&(__mod)->fcxp_list[__tag])
0108 #define BFA_MEM_FCXP_KVA(__bfa) (&(BFA_FCXP_MOD(__bfa)->kva_seg))
0109
0110 typedef void (*fcxp_send_cb_t) (struct bfa_s *ioc, struct bfa_fcxp_s *fcxp,
0111 void *cb_arg, bfa_status_t req_status,
0112 u32 rsp_len, u32 resid_len,
0113 struct fchs_s *rsp_fchs);
0114
0115 typedef u64 (*bfa_fcxp_get_sgaddr_t) (void *bfad_fcxp, int sgeid);
0116 typedef u32 (*bfa_fcxp_get_sglen_t) (void *bfad_fcxp, int sgeid);
0117 typedef void (*bfa_cb_fcxp_send_t) (void *bfad_fcxp, struct bfa_fcxp_s *fcxp,
0118 void *cbarg, enum bfa_status req_status,
0119 u32 rsp_len, u32 resid_len,
0120 struct fchs_s *rsp_fchs);
0121 typedef void (*bfa_fcxp_alloc_cbfn_t) (void *cbarg, struct bfa_fcxp_s *fcxp);
0122
0123
0124
0125
0126
0127
0128 struct bfa_fcxp_req_info_s {
0129 struct bfa_rport_s *bfa_rport;
0130
0131
0132
0133
0134
0135
0136 struct fchs_s fchs;
0137 u8 cts;
0138 u8 class;
0139 u16 max_frmsz;
0140 u16 vf_id;
0141 u8 lp_tag;
0142 u32 req_tot_len;
0143 };
0144
0145 struct bfa_fcxp_rsp_info_s {
0146 struct fchs_s rsp_fchs;
0147
0148
0149 u8 rsp_timeout;
0150
0151 u8 rsvd2[3];
0152 u32 rsp_maxlen;
0153 };
0154
0155 struct bfa_fcxp_s {
0156 struct list_head qe;
0157 bfa_sm_t sm;
0158 void *caller;
0159 struct bfa_fcxp_mod_s *fcxp_mod;
0160
0161 u16 fcxp_tag;
0162 struct bfa_fcxp_req_info_s req_info;
0163
0164 struct bfa_fcxp_rsp_info_s rsp_info;
0165
0166 u8 use_ireqbuf;
0167 u8 use_irspbuf;
0168 u32 nreq_sgles;
0169 u32 nrsp_sgles;
0170 struct list_head req_sgpg_q;
0171 struct list_head req_sgpg_wqe;
0172 struct list_head rsp_sgpg_q;
0173 struct list_head rsp_sgpg_wqe;
0174
0175 bfa_fcxp_get_sgaddr_t req_sga_cbfn;
0176
0177 bfa_fcxp_get_sglen_t req_sglen_cbfn;
0178
0179 bfa_fcxp_get_sgaddr_t rsp_sga_cbfn;
0180
0181 bfa_fcxp_get_sglen_t rsp_sglen_cbfn;
0182
0183 bfa_cb_fcxp_send_t send_cbfn;
0184 void *send_cbarg;
0185 struct bfa_sge_s req_sge[BFA_FCXP_MAX_SGES];
0186
0187 struct bfa_sge_s rsp_sge[BFA_FCXP_MAX_SGES];
0188
0189 u8 rsp_status;
0190 u32 rsp_len;
0191 u32 residue_len;
0192 struct fchs_s rsp_fchs;
0193 struct bfa_cb_qe_s hcb_qe;
0194 struct bfa_reqq_wait_s reqq_wqe;
0195 bfa_boolean_t reqq_waiting;
0196 bfa_boolean_t req_rsp;
0197 };
0198
0199 struct bfa_fcxp_wqe_s {
0200 struct list_head qe;
0201 bfa_fcxp_alloc_cbfn_t alloc_cbfn;
0202 void *alloc_cbarg;
0203 void *caller;
0204 struct bfa_s *bfa;
0205 int nreq_sgles;
0206 int nrsp_sgles;
0207 bfa_fcxp_get_sgaddr_t req_sga_cbfn;
0208 bfa_fcxp_get_sglen_t req_sglen_cbfn;
0209 bfa_fcxp_get_sgaddr_t rsp_sga_cbfn;
0210 bfa_fcxp_get_sglen_t rsp_sglen_cbfn;
0211 };
0212
0213 #define BFA_FCXP_REQ_PLD(_fcxp) (bfa_fcxp_get_reqbuf(_fcxp))
0214 #define BFA_FCXP_RSP_FCHS(_fcxp) (&((_fcxp)->rsp_info.fchs))
0215 #define BFA_FCXP_RSP_PLD(_fcxp) (bfa_fcxp_get_rspbuf(_fcxp))
0216
0217 #define BFA_FCXP_REQ_PLD_PA(_fcxp) \
0218 bfa_mem_get_dmabuf_pa((_fcxp)->fcxp_mod, (_fcxp)->fcxp_tag, \
0219 (_fcxp)->fcxp_mod->req_pld_sz + (_fcxp)->fcxp_mod->rsp_pld_sz)
0220
0221
0222 #define BFA_FCXP_RSP_PLD_PA(_fcxp) \
0223 (bfa_mem_get_dmabuf_pa((_fcxp)->fcxp_mod, (_fcxp)->fcxp_tag, \
0224 (_fcxp)->fcxp_mod->req_pld_sz + (_fcxp)->fcxp_mod->rsp_pld_sz) + \
0225 (_fcxp)->fcxp_mod->req_pld_sz)
0226
0227 void bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
0228
0229
0230
0231
0232
0233 enum bfa_rport_event {
0234 BFA_RPORT_SM_CREATE = 1,
0235 BFA_RPORT_SM_DELETE = 2,
0236 BFA_RPORT_SM_ONLINE = 3,
0237 BFA_RPORT_SM_OFFLINE = 4,
0238 BFA_RPORT_SM_FWRSP = 5,
0239 BFA_RPORT_SM_HWFAIL = 6,
0240 BFA_RPORT_SM_QOS_SCN = 7,
0241 BFA_RPORT_SM_SET_SPEED = 8,
0242 BFA_RPORT_SM_QRESUME = 9,
0243 };
0244
0245 #define BFA_RPORT_MIN 4
0246
0247 struct bfa_rport_mod_s {
0248 struct bfa_rport_s *rps_list;
0249 struct list_head rp_free_q;
0250 struct list_head rp_active_q;
0251 struct list_head rp_unused_q;
0252 u16 num_rports;
0253 struct bfa_mem_kva_s kva_seg;
0254 };
0255
0256 #define BFA_RPORT_MOD(__bfa) (&(__bfa)->modules.rport_mod)
0257 #define BFA_MEM_RPORT_KVA(__bfa) (&(BFA_RPORT_MOD(__bfa)->kva_seg))
0258
0259
0260
0261
0262 #define BFA_RPORT_FROM_TAG(__bfa, _tag) \
0263 (BFA_RPORT_MOD(__bfa)->rps_list + \
0264 ((_tag) & (BFA_RPORT_MOD(__bfa)->num_rports - 1)))
0265
0266
0267
0268
0269 void bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
0270 void bfa_rport_res_recfg(struct bfa_s *bfa, u16 num_rport_fw);
0271
0272
0273
0274
0275 struct bfa_rport_info_s {
0276 u16 max_frmsz;
0277 u32 pid:24,
0278 lp_tag:8;
0279 u32 local_pid:24,
0280 cisc:8;
0281 u8 fc_class;
0282 u8 vf_en;
0283 u16 vf_id;
0284 enum bfa_port_speed speed;
0285 };
0286
0287
0288
0289
0290 struct bfa_rport_s {
0291 struct list_head qe;
0292 bfa_sm_t sm;
0293 struct bfa_s *bfa;
0294 void *rport_drv;
0295 u16 fw_handle;
0296 u16 rport_tag;
0297 u8 lun_mask;
0298 struct bfa_rport_info_s rport_info;
0299 struct bfa_reqq_wait_s reqq_wait;
0300 struct bfa_cb_qe_s hcb_qe;
0301 struct bfa_rport_hal_stats_s stats;
0302 struct bfa_rport_qos_attr_s qos_attr;
0303 union a {
0304 bfa_status_t status;
0305 void *fw_msg;
0306 } event_arg;
0307 };
0308 #define BFA_RPORT_FC_COS(_rport) ((_rport)->rport_info.fc_class)
0309
0310
0311
0312
0313
0314
0315 #define BFA_UF_MIN (4)
0316 #define BFA_UF_MAX (256)
0317
0318 struct bfa_uf_s {
0319 struct list_head qe;
0320 struct bfa_s *bfa;
0321 u16 uf_tag;
0322 u16 vf_id;
0323 u16 src_rport_handle;
0324 u16 rsvd;
0325 u8 *data_ptr;
0326 u16 data_len;
0327 u16 pb_len;
0328 void *buf_kva;
0329 u64 buf_pa;
0330 struct bfa_cb_qe_s hcb_qe;
0331 struct bfa_sge_s sges[BFI_SGE_INLINE_MAX];
0332 };
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342 typedef void (*bfa_cb_uf_recv_t) (void *cbarg, struct bfa_uf_s *uf);
0343
0344 #define BFA_UF_BUFSZ (2 * 1024 + 256)
0345
0346 struct bfa_uf_buf_s {
0347 u8 d[BFA_UF_BUFSZ];
0348 };
0349
0350 #define BFA_PER_UF_DMA_SZ \
0351 (u32)BFA_ROUNDUP(sizeof(struct bfa_uf_buf_s), BFA_DMA_ALIGN_SZ)
0352
0353
0354 #define BFA_UF_DMA_SEGS BFI_MEM_DMA_NSEGS(BFA_UF_MAX, BFA_PER_UF_DMA_SZ)
0355
0356 struct bfa_uf_mod_s {
0357 struct bfa_s *bfa;
0358 struct bfa_uf_s *uf_list;
0359 u16 num_ufs;
0360 struct list_head uf_free_q;
0361 struct list_head uf_posted_q;
0362 struct list_head uf_unused_q;
0363 struct bfi_uf_buf_post_s *uf_buf_posts;
0364
0365 bfa_cb_uf_recv_t ufrecv;
0366 void *cbarg;
0367 struct bfa_mem_dma_s dma_seg[BFA_UF_DMA_SEGS];
0368 struct bfa_mem_kva_s kva_seg;
0369 };
0370
0371 #define BFA_UF_MOD(__bfa) (&(__bfa)->modules.uf_mod)
0372 #define BFA_MEM_UF_KVA(__bfa) (&(BFA_UF_MOD(__bfa)->kva_seg))
0373
0374 #define ufm_pbs_pa(_ufmod, _uftag) \
0375 bfa_mem_get_dmabuf_pa(_ufmod, _uftag, BFA_PER_UF_DMA_SZ)
0376
0377 void bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
0378 void bfa_uf_res_recfg(struct bfa_s *bfa, u16 num_uf_fw);
0379
0380
0381
0382
0383 struct bfa_lps_s {
0384 struct list_head qe;
0385 struct bfa_s *bfa;
0386 bfa_sm_t sm;
0387 u8 bfa_tag;
0388 u8 fw_tag;
0389 u8 reqq;
0390 u8 alpa;
0391 u32 lp_pid;
0392 bfa_boolean_t fdisc;
0393 bfa_boolean_t auth_en;
0394 bfa_boolean_t auth_req;
0395 bfa_boolean_t npiv_en;
0396 bfa_boolean_t fport;
0397 bfa_boolean_t brcd_switch;
0398 bfa_status_t status;
0399 u16 pdusz;
0400 u16 pr_bbcred;
0401 u8 lsrjt_rsn;
0402 u8 lsrjt_expl;
0403 u8 lun_mask;
0404 wwn_t pwwn;
0405 wwn_t nwwn;
0406 wwn_t pr_pwwn;
0407 wwn_t pr_nwwn;
0408 mac_t lp_mac;
0409 mac_t fcf_mac;
0410 struct bfa_reqq_wait_s wqe;
0411 void *uarg;
0412 struct bfa_cb_qe_s hcb_qe;
0413 struct bfi_lps_login_rsp_s *loginrsp;
0414 bfa_eproto_status_t ext_status;
0415 };
0416
0417 struct bfa_lps_mod_s {
0418 struct list_head lps_free_q;
0419 struct list_head lps_active_q;
0420 struct list_head lps_login_q;
0421 struct bfa_lps_s *lps_arr;
0422 int num_lps;
0423 struct bfa_mem_kva_s kva_seg;
0424 };
0425
0426 #define BFA_LPS_MOD(__bfa) (&(__bfa)->modules.lps_mod)
0427 #define BFA_LPS_FROM_TAG(__mod, __tag) (&(__mod)->lps_arr[__tag])
0428 #define BFA_MEM_LPS_KVA(__bfa) (&(BFA_LPS_MOD(__bfa)->kva_seg))
0429
0430
0431
0432
0433 void bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
0434
0435
0436
0437
0438
0439
0440 #define BFA_FCPORT(_bfa) (&((_bfa)->modules.port))
0441
0442
0443
0444
0445 struct bfa_fcport_ln_s {
0446 struct bfa_fcport_s *fcport;
0447 bfa_sm_t sm;
0448 struct bfa_cb_qe_s ln_qe;
0449 enum bfa_port_linkstate ln_event;
0450 };
0451
0452 struct bfa_fcport_trunk_s {
0453 struct bfa_trunk_attr_s attr;
0454 };
0455
0456
0457
0458
0459 struct bfa_fcport_s {
0460 struct bfa_s *bfa;
0461 bfa_sm_t sm;
0462 wwn_t nwwn;
0463 wwn_t pwwn;
0464 enum bfa_port_speed speed_sup;
0465
0466 enum bfa_port_speed speed;
0467 enum bfa_port_topology topology;
0468 u8 rsvd[3];
0469 u8 myalpa;
0470 u8 alpabm_valid;
0471 struct fc_alpabm_s alpabm;
0472 struct bfa_port_cfg_s cfg;
0473 bfa_boolean_t use_flash_cfg;
0474 struct bfa_qos_attr_s qos_attr;
0475 struct bfa_qos_vc_attr_s qos_vc_attr;
0476 struct bfa_reqq_wait_s reqq_wait;
0477
0478 struct bfa_reqq_wait_s svcreq_wait;
0479
0480 struct bfa_reqq_wait_s stats_reqq_wait;
0481
0482 void *event_cbarg;
0483 void (*event_cbfn) (void *cbarg,
0484 enum bfa_port_linkstate event);
0485 union {
0486 union bfi_fcport_i2h_msg_u i2hmsg;
0487 } event_arg;
0488 void *bfad;
0489 struct bfa_fcport_ln_s ln;
0490 struct bfa_cb_qe_s hcb_qe;
0491 struct bfa_timer_s timer;
0492 u32 msgtag;
0493 u8 *stats_kva;
0494 u64 stats_pa;
0495 union bfa_fcport_stats_u *stats;
0496 bfa_status_t stats_status;
0497 struct list_head stats_pending_q;
0498 struct list_head statsclr_pending_q;
0499 bfa_boolean_t stats_qfull;
0500 time64_t stats_reset_time;
0501 bfa_boolean_t diag_busy;
0502 bfa_boolean_t beacon;
0503 bfa_boolean_t link_e2e_beacon;
0504 struct bfa_fcport_trunk_s trunk;
0505 u16 fcoe_vlan;
0506 struct bfa_mem_dma_s fcport_dma;
0507 bfa_boolean_t stats_dma_ready;
0508 struct bfa_bbcr_attr_s bbcr_attr;
0509 enum bfa_fec_state_s fec_state;
0510 };
0511
0512 #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport)
0513 #define BFA_MEM_FCPORT_DMA(__bfa) (&(BFA_FCPORT_MOD(__bfa)->fcport_dma))
0514
0515
0516
0517
0518 void bfa_fcport_init(struct bfa_s *bfa);
0519 void bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
0520
0521
0522
0523
0524 bfa_status_t bfa_fcport_enable(struct bfa_s *bfa);
0525 bfa_status_t bfa_fcport_disable(struct bfa_s *bfa);
0526 bfa_status_t bfa_fcport_cfg_speed(struct bfa_s *bfa,
0527 enum bfa_port_speed speed);
0528 enum bfa_port_speed bfa_fcport_get_speed(struct bfa_s *bfa);
0529 bfa_status_t bfa_fcport_cfg_topology(struct bfa_s *bfa,
0530 enum bfa_port_topology topo);
0531 enum bfa_port_topology bfa_fcport_get_topology(struct bfa_s *bfa);
0532 enum bfa_port_topology bfa_fcport_get_cfg_topology(struct bfa_s *bfa);
0533 bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa);
0534 bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa);
0535 u8 bfa_fcport_get_myalpa(struct bfa_s *bfa);
0536 bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa);
0537 bfa_status_t bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize);
0538 u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa);
0539 u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa);
0540 void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr);
0541 wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node);
0542 void bfa_fcport_event_register(struct bfa_s *bfa,
0543 void (*event_cbfn) (void *cbarg,
0544 enum bfa_port_linkstate event), void *event_cbarg);
0545 bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa);
0546 bfa_boolean_t bfa_fcport_is_dport(struct bfa_s *bfa);
0547 bfa_boolean_t bfa_fcport_is_ddport(struct bfa_s *bfa);
0548 bfa_status_t bfa_fcport_set_qos_bw(struct bfa_s *bfa,
0549 struct bfa_qos_bw_s *qos_bw);
0550 enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa);
0551
0552 void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit);
0553 bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa);
0554 void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon,
0555 bfa_boolean_t link_e2e_beacon);
0556 bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa);
0557 bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa,
0558 struct bfa_cb_pending_q_s *cb);
0559 bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa,
0560 struct bfa_cb_pending_q_s *cb);
0561 bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa);
0562 bfa_boolean_t bfa_fcport_is_trunk_enabled(struct bfa_s *bfa);
0563 void bfa_fcport_dportenable(struct bfa_s *bfa);
0564 void bfa_fcport_dportdisable(struct bfa_s *bfa);
0565 bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa);
0566 void bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state);
0567 bfa_status_t bfa_fcport_cfg_bbcr(struct bfa_s *bfa,
0568 bfa_boolean_t on_off, u8 bb_scn);
0569 bfa_status_t bfa_fcport_get_bbcr_attr(struct bfa_s *bfa,
0570 struct bfa_bbcr_attr_s *bbcr_attr);
0571
0572
0573
0574
0575 struct bfa_rport_s *bfa_rport_create(struct bfa_s *bfa, void *rport_drv);
0576 void bfa_rport_online(struct bfa_rport_s *rport,
0577 struct bfa_rport_info_s *rport_info);
0578 void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed);
0579 void bfa_cb_rport_online(void *rport);
0580 void bfa_cb_rport_offline(void *rport);
0581 void bfa_cb_rport_qos_scn_flowid(void *rport,
0582 struct bfa_rport_qos_attr_s old_qos_attr,
0583 struct bfa_rport_qos_attr_s new_qos_attr);
0584 void bfa_cb_rport_scn_online(struct bfa_s *bfa);
0585 void bfa_cb_rport_scn_offline(struct bfa_s *bfa);
0586 void bfa_cb_rport_scn_no_dev(void *rp);
0587 void bfa_cb_rport_qos_scn_prio(void *rport,
0588 struct bfa_rport_qos_attr_s old_qos_attr,
0589 struct bfa_rport_qos_attr_s new_qos_attr);
0590
0591
0592
0593
0594 #define BFA_RPORT_TAG_INVALID 0xffff
0595 #define BFA_LP_TAG_INVALID 0xff
0596 void bfa_rport_set_lunmask(struct bfa_s *bfa, struct bfa_rport_s *rp);
0597 void bfa_rport_unset_lunmask(struct bfa_s *bfa, struct bfa_rport_s *rp);
0598
0599
0600
0601
0602 struct bfa_fcxp_s *bfa_fcxp_req_rsp_alloc(void *bfad_fcxp, struct bfa_s *bfa,
0603 int nreq_sgles, int nrsp_sgles,
0604 bfa_fcxp_get_sgaddr_t get_req_sga,
0605 bfa_fcxp_get_sglen_t get_req_sglen,
0606 bfa_fcxp_get_sgaddr_t get_rsp_sga,
0607 bfa_fcxp_get_sglen_t get_rsp_sglen,
0608 bfa_boolean_t req);
0609 void bfa_fcxp_req_rsp_alloc_wait(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe,
0610 bfa_fcxp_alloc_cbfn_t alloc_cbfn,
0611 void *cbarg, void *bfad_fcxp,
0612 int nreq_sgles, int nrsp_sgles,
0613 bfa_fcxp_get_sgaddr_t get_req_sga,
0614 bfa_fcxp_get_sglen_t get_req_sglen,
0615 bfa_fcxp_get_sgaddr_t get_rsp_sga,
0616 bfa_fcxp_get_sglen_t get_rsp_sglen,
0617 bfa_boolean_t req);
0618 void bfa_fcxp_walloc_cancel(struct bfa_s *bfa,
0619 struct bfa_fcxp_wqe_s *wqe);
0620 void bfa_fcxp_discard(struct bfa_fcxp_s *fcxp);
0621
0622 void *bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp);
0623 void *bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp);
0624
0625 void bfa_fcxp_free(struct bfa_fcxp_s *fcxp);
0626
0627 void bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport,
0628 u16 vf_id, u8 lp_tag,
0629 bfa_boolean_t cts, enum fc_cos cos,
0630 u32 reqlen, struct fchs_s *fchs,
0631 bfa_cb_fcxp_send_t cbfn,
0632 void *cbarg,
0633 u32 rsp_maxlen, u8 rsp_timeout);
0634 bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp);
0635 u32 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp);
0636 u32 bfa_fcxp_get_maxrsp(struct bfa_s *bfa);
0637 void bfa_fcxp_res_recfg(struct bfa_s *bfa, u16 num_fcxp_fw);
0638
0639 static inline void *
0640 bfa_uf_get_frmbuf(struct bfa_uf_s *uf)
0641 {
0642 return uf->data_ptr;
0643 }
0644
0645 static inline u16
0646 bfa_uf_get_frmlen(struct bfa_uf_s *uf)
0647 {
0648 return uf->data_len;
0649 }
0650
0651
0652
0653
0654 void bfa_uf_recv_register(struct bfa_s *bfa, bfa_cb_uf_recv_t ufrecv,
0655 void *cbarg);
0656 void bfa_uf_free(struct bfa_uf_s *uf);
0657
0658
0659
0660
0661
0662 u32 bfa_lps_get_max_vport(struct bfa_s *bfa);
0663 struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa);
0664 void bfa_lps_delete(struct bfa_lps_s *lps);
0665 void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa,
0666 u16 pdusz, wwn_t pwwn, wwn_t nwwn,
0667 bfa_boolean_t auth_en);
0668 void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz,
0669 wwn_t pwwn, wwn_t nwwn);
0670 void bfa_lps_fdisclogo(struct bfa_lps_s *lps);
0671 void bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, u32 n2n_pid);
0672 u8 bfa_lps_get_fwtag(struct bfa_s *bfa, u8 lp_tag);
0673 u32 bfa_lps_get_base_pid(struct bfa_s *bfa);
0674 u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid);
0675 void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status);
0676 void bfa_cb_lps_flogo_comp(void *bfad, void *uarg);
0677 void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status);
0678 void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg);
0679 void bfa_cb_lps_cvl_event(void *bfad, void *uarg);
0680
0681
0682 bfa_status_t bfa_faa_query(struct bfa_s *bfa, struct bfa_faa_attr_s *attr,
0683 bfa_cb_iocfc_t cbfn, void *cbarg);
0684
0685
0686
0687
0688 struct bfa_fcdiag_qtest_s {
0689 struct bfa_diag_qtest_result_s *result;
0690 bfa_cb_diag_t cbfn;
0691 void *cbarg;
0692 struct bfa_timer_s timer;
0693 u32 status;
0694 u32 count;
0695 u8 lock;
0696 u8 queue;
0697 u8 all;
0698 u8 timer_active;
0699 };
0700
0701 struct bfa_fcdiag_lb_s {
0702 bfa_cb_diag_t cbfn;
0703 void *cbarg;
0704 void *result;
0705 bfa_boolean_t lock;
0706 u32 status;
0707 };
0708
0709 struct bfa_dport_s {
0710 struct bfa_s *bfa;
0711 bfa_sm_t sm;
0712 struct bfa_reqq_wait_s reqq_wait;
0713 bfa_cb_diag_t cbfn;
0714 void *cbarg;
0715 union bfi_diag_dport_msg_u i2hmsg;
0716 u8 test_state;
0717 u8 dynamic;
0718 u8 rsvd[2];
0719 u32 lpcnt;
0720 u32 payload;
0721 wwn_t rp_pwwn;
0722 wwn_t rp_nwwn;
0723 struct bfa_diag_dport_result_s result;
0724 };
0725
0726 struct bfa_fcdiag_s {
0727 struct bfa_s *bfa;
0728 struct bfa_trc_mod_s *trcmod;
0729 struct bfa_fcdiag_lb_s lb;
0730 struct bfa_fcdiag_qtest_s qtest;
0731 struct bfa_dport_s dport;
0732 };
0733
0734 #define BFA_FCDIAG_MOD(__bfa) (&(__bfa)->modules.fcdiag)
0735
0736 void bfa_fcdiag_intr(struct bfa_s *bfa, struct bfi_msg_s *msg);
0737
0738 bfa_status_t bfa_fcdiag_loopback(struct bfa_s *bfa,
0739 enum bfa_port_opmode opmode,
0740 enum bfa_port_speed speed, u32 lpcnt, u32 pat,
0741 struct bfa_diag_loopback_result_s *result,
0742 bfa_cb_diag_t cbfn, void *cbarg);
0743 bfa_status_t bfa_fcdiag_queuetest(struct bfa_s *bfa, u32 ignore,
0744 u32 queue, struct bfa_diag_qtest_result_s *result,
0745 bfa_cb_diag_t cbfn, void *cbarg);
0746 bfa_status_t bfa_fcdiag_lb_is_running(struct bfa_s *bfa);
0747 bfa_status_t bfa_dport_enable(struct bfa_s *bfa, u32 lpcnt, u32 pat,
0748 bfa_cb_diag_t cbfn, void *cbarg);
0749 bfa_status_t bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn,
0750 void *cbarg);
0751 bfa_status_t bfa_dport_start(struct bfa_s *bfa, u32 lpcnt, u32 pat,
0752 bfa_cb_diag_t cbfn, void *cbarg);
0753 bfa_status_t bfa_dport_show(struct bfa_s *bfa,
0754 struct bfa_diag_dport_result_s *result);
0755
0756 #endif