bfa_svc.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. /*
  2. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFA_SVC_H__
  18. #define __BFA_SVC_H__
  19. #include "bfa_cs.h"
  20. #include "bfi_ms.h"
  21. /**
  22. * Scatter-gather DMA related defines
  23. */
  24. #define BFA_SGPG_MIN (16)
  25. /**
  26. * Alignment macro for SG page allocation
  27. */
  28. #define BFA_SGPG_ROUNDUP(_l) (((_l) + (sizeof(struct bfi_sgpg_s) - 1)) \
  29. & ~(sizeof(struct bfi_sgpg_s) - 1))
  30. struct bfa_sgpg_wqe_s {
  31. struct list_head qe; /* queue sg page element */
  32. int nsgpg; /* pages to be allocated */
  33. int nsgpg_total; /* total pages required */
  34. void (*cbfn) (void *cbarg); /* callback function */
  35. void *cbarg; /* callback arg */
  36. struct list_head sgpg_q; /* queue of alloced sgpgs */
  37. };
  38. struct bfa_sgpg_s {
  39. struct list_head qe; /* queue sg page element */
  40. struct bfi_sgpg_s *sgpg; /* va of SG page */
  41. union bfi_addr_u sgpg_pa; /* pa of SG page */
  42. };
  43. /**
  44. * Given number of SG elements, BFA_SGPG_NPAGE() returns the number of
  45. * SG pages required.
  46. */
  47. #define BFA_SGPG_NPAGE(_nsges) (((_nsges) / BFI_SGPG_DATA_SGES) + 1)
  48. struct bfa_sgpg_mod_s {
  49. struct bfa_s *bfa;
  50. int num_sgpgs; /* number of SG pages */
  51. int free_sgpgs; /* number of free SG pages */
  52. struct bfa_sgpg_s *hsgpg_arr; /* BFA SG page array */
  53. struct bfi_sgpg_s *sgpg_arr; /* actual SG page array */
  54. u64 sgpg_arr_pa; /* SG page array DMA addr */
  55. struct list_head sgpg_q; /* queue of free SG pages */
  56. struct list_head sgpg_wait_q; /* wait queue for SG pages */
  57. };
  58. #define BFA_SGPG_MOD(__bfa) (&(__bfa)->modules.sgpg_mod)
  59. bfa_status_t bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q,
  60. int nsgpgs);
  61. void bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs);
  62. void bfa_sgpg_winit(struct bfa_sgpg_wqe_s *wqe,
  63. void (*cbfn) (void *cbarg), void *cbarg);
  64. void bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpgs);
  65. void bfa_sgpg_wcancel(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe);
  66. /**
  67. * FCXP related defines
  68. */
  69. #define BFA_FCXP_MIN (1)
  70. #define BFA_FCXP_MAX_IBUF_SZ (2 * 1024 + 256)
  71. #define BFA_FCXP_MAX_LBUF_SZ (4 * 1024 + 256)
  72. struct bfa_fcxp_mod_s {
  73. struct bfa_s *bfa; /* backpointer to BFA */
  74. struct bfa_fcxp_s *fcxp_list; /* array of FCXPs */
  75. u16 num_fcxps; /* max num FCXP requests */
  76. struct list_head fcxp_free_q; /* free FCXPs */
  77. struct list_head fcxp_active_q; /* active FCXPs */
  78. void *req_pld_list_kva; /* list of FCXP req pld */
  79. u64 req_pld_list_pa; /* list of FCXP req pld */
  80. void *rsp_pld_list_kva; /* list of FCXP resp pld */
  81. u64 rsp_pld_list_pa; /* list of FCXP resp pld */
  82. struct list_head wait_q; /* wait queue for free fcxp */
  83. u32 req_pld_sz;
  84. u32 rsp_pld_sz;
  85. };
  86. #define BFA_FCXP_MOD(__bfa) (&(__bfa)->modules.fcxp_mod)
  87. #define BFA_FCXP_FROM_TAG(__mod, __tag) (&(__mod)->fcxp_list[__tag])
  88. typedef void (*fcxp_send_cb_t) (struct bfa_s *ioc, struct bfa_fcxp_s *fcxp,
  89. void *cb_arg, bfa_status_t req_status,
  90. u32 rsp_len, u32 resid_len,
  91. struct fchs_s *rsp_fchs);
  92. typedef u64 (*bfa_fcxp_get_sgaddr_t) (void *bfad_fcxp, int sgeid);
  93. typedef u32 (*bfa_fcxp_get_sglen_t) (void *bfad_fcxp, int sgeid);
  94. typedef void (*bfa_cb_fcxp_send_t) (void *bfad_fcxp, struct bfa_fcxp_s *fcxp,
  95. void *cbarg, enum bfa_status req_status,
  96. u32 rsp_len, u32 resid_len,
  97. struct fchs_s *rsp_fchs);
  98. typedef void (*bfa_fcxp_alloc_cbfn_t) (void *cbarg, struct bfa_fcxp_s *fcxp);
  99. /**
  100. * Information needed for a FCXP request
  101. */
  102. struct bfa_fcxp_req_info_s {
  103. struct bfa_rport_s *bfa_rport;
  104. /** Pointer to the bfa rport that was
  105. * returned from bfa_rport_create().
  106. * This could be left NULL for WKA or
  107. * for FCXP interactions before the
  108. * rport nexus is established
  109. */
  110. struct fchs_s fchs; /* request FC header structure */
  111. u8 cts; /* continous sequence */
  112. u8 class; /* FC class for the request/response */
  113. u16 max_frmsz; /* max send frame size */
  114. u16 vf_id; /* vsan tag if applicable */
  115. u8 lp_tag; /* lport tag */
  116. u32 req_tot_len; /* request payload total length */
  117. };
  118. struct bfa_fcxp_rsp_info_s {
  119. struct fchs_s rsp_fchs;
  120. /** !< Response frame's FC header will
  121. * be sent back in this field */
  122. u8 rsp_timeout;
  123. /** !< timeout in seconds, 0-no response
  124. */
  125. u8 rsvd2[3];
  126. u32 rsp_maxlen; /* max response length expected */
  127. };
  128. struct bfa_fcxp_s {
  129. struct list_head qe; /* fcxp queue element */
  130. bfa_sm_t sm; /* state machine */
  131. void *caller; /* driver or fcs */
  132. struct bfa_fcxp_mod_s *fcxp_mod;
  133. /* back pointer to fcxp mod */
  134. u16 fcxp_tag; /* internal tag */
  135. struct bfa_fcxp_req_info_s req_info;
  136. /* request info */
  137. struct bfa_fcxp_rsp_info_s rsp_info;
  138. /* response info */
  139. u8 use_ireqbuf; /* use internal req buf */
  140. u8 use_irspbuf; /* use internal rsp buf */
  141. u32 nreq_sgles; /* num request SGLEs */
  142. u32 nrsp_sgles; /* num response SGLEs */
  143. struct list_head req_sgpg_q; /* SG pages for request buf */
  144. struct list_head req_sgpg_wqe; /* wait queue for req SG page */
  145. struct list_head rsp_sgpg_q; /* SG pages for response buf */
  146. struct list_head rsp_sgpg_wqe; /* wait queue for rsp SG page */
  147. bfa_fcxp_get_sgaddr_t req_sga_cbfn;
  148. /* SG elem addr user function */
  149. bfa_fcxp_get_sglen_t req_sglen_cbfn;
  150. /* SG elem len user function */
  151. bfa_fcxp_get_sgaddr_t rsp_sga_cbfn;
  152. /* SG elem addr user function */
  153. bfa_fcxp_get_sglen_t rsp_sglen_cbfn;
  154. /* SG elem len user function */
  155. bfa_cb_fcxp_send_t send_cbfn; /* send completion callback */
  156. void *send_cbarg; /* callback arg */
  157. struct bfa_sge_s req_sge[BFA_FCXP_MAX_SGES];
  158. /* req SG elems */
  159. struct bfa_sge_s rsp_sge[BFA_FCXP_MAX_SGES];
  160. /* rsp SG elems */
  161. u8 rsp_status; /* comp: rsp status */
  162. u32 rsp_len; /* comp: actual response len */
  163. u32 residue_len; /* comp: residual rsp length */
  164. struct fchs_s rsp_fchs; /* comp: response fchs */
  165. struct bfa_cb_qe_s hcb_qe; /* comp: callback qelem */
  166. struct bfa_reqq_wait_s reqq_wqe;
  167. bfa_boolean_t reqq_waiting;
  168. };
  169. struct bfa_fcxp_wqe_s {
  170. struct list_head qe;
  171. bfa_fcxp_alloc_cbfn_t alloc_cbfn;
  172. void *alloc_cbarg;
  173. void *caller;
  174. struct bfa_s *bfa;
  175. int nreq_sgles;
  176. int nrsp_sgles;
  177. bfa_fcxp_get_sgaddr_t req_sga_cbfn;
  178. bfa_fcxp_get_sglen_t req_sglen_cbfn;
  179. bfa_fcxp_get_sgaddr_t rsp_sga_cbfn;
  180. bfa_fcxp_get_sglen_t rsp_sglen_cbfn;
  181. };
  182. #define BFA_FCXP_REQ_PLD(_fcxp) (bfa_fcxp_get_reqbuf(_fcxp))
  183. #define BFA_FCXP_RSP_FCHS(_fcxp) (&((_fcxp)->rsp_info.fchs))
  184. #define BFA_FCXP_RSP_PLD(_fcxp) (bfa_fcxp_get_rspbuf(_fcxp))
  185. #define BFA_FCXP_REQ_PLD_PA(_fcxp) \
  186. ((_fcxp)->fcxp_mod->req_pld_list_pa + \
  187. ((_fcxp)->fcxp_mod->req_pld_sz * (_fcxp)->fcxp_tag))
  188. #define BFA_FCXP_RSP_PLD_PA(_fcxp) \
  189. ((_fcxp)->fcxp_mod->rsp_pld_list_pa + \
  190. ((_fcxp)->fcxp_mod->rsp_pld_sz * (_fcxp)->fcxp_tag))
  191. void bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
  192. /**
  193. * RPORT related defines
  194. */
  195. #define BFA_RPORT_MIN 4
  196. struct bfa_rport_mod_s {
  197. struct bfa_rport_s *rps_list; /* list of rports */
  198. struct list_head rp_free_q; /* free bfa_rports */
  199. struct list_head rp_active_q; /* free bfa_rports */
  200. u16 num_rports; /* number of rports */
  201. };
  202. #define BFA_RPORT_MOD(__bfa) (&(__bfa)->modules.rport_mod)
  203. /**
  204. * Convert rport tag to RPORT
  205. */
  206. #define BFA_RPORT_FROM_TAG(__bfa, _tag) \
  207. (BFA_RPORT_MOD(__bfa)->rps_list + \
  208. ((_tag) & (BFA_RPORT_MOD(__bfa)->num_rports - 1)))
  209. /*
  210. * protected functions
  211. */
  212. void bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
  213. /**
  214. * BFA rport information.
  215. */
  216. struct bfa_rport_info_s {
  217. u16 max_frmsz; /* max rcv pdu size */
  218. u32 pid:24, /* remote port ID */
  219. lp_tag:8; /* tag */
  220. u32 local_pid:24, /* local port ID */
  221. cisc:8; /* CIRO supported */
  222. u8 fc_class; /* supported FC classes. enum fc_cos */
  223. u8 vf_en; /* virtual fabric enable */
  224. u16 vf_id; /* virtual fabric ID */
  225. enum bfa_port_speed speed; /* Rport's current speed */
  226. };
  227. /**
  228. * BFA rport data structure
  229. */
  230. struct bfa_rport_s {
  231. struct list_head qe; /* queue element */
  232. bfa_sm_t sm; /* state machine */
  233. struct bfa_s *bfa; /* backpointer to BFA */
  234. void *rport_drv; /* fcs/driver rport object */
  235. u16 fw_handle; /* firmware rport handle */
  236. u16 rport_tag; /* BFA rport tag */
  237. struct bfa_rport_info_s rport_info; /* rport info from fcs/driver */
  238. struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
  239. struct bfa_cb_qe_s hcb_qe; /* BFA callback qelem */
  240. struct bfa_rport_hal_stats_s stats; /* BFA rport statistics */
  241. struct bfa_rport_qos_attr_s qos_attr;
  242. union a {
  243. bfa_status_t status; /* f/w status */
  244. void *fw_msg; /* QoS scn event */
  245. } event_arg;
  246. };
  247. #define BFA_RPORT_FC_COS(_rport) ((_rport)->rport_info.fc_class)
  248. /**
  249. * UF - unsolicited receive related defines
  250. */
  251. #define BFA_UF_MIN (4)
  252. struct bfa_uf_s {
  253. struct list_head qe; /* queue element */
  254. struct bfa_s *bfa; /* bfa instance */
  255. u16 uf_tag; /* identifying tag fw msgs */
  256. u16 vf_id;
  257. u16 src_rport_handle;
  258. u16 rsvd;
  259. u8 *data_ptr;
  260. u16 data_len; /* actual receive length */
  261. u16 pb_len; /* posted buffer length */
  262. void *buf_kva; /* buffer virtual address */
  263. u64 buf_pa; /* buffer physical address */
  264. struct bfa_cb_qe_s hcb_qe; /* comp: BFA comp qelem */
  265. struct bfa_sge_s sges[BFI_SGE_INLINE_MAX];
  266. };
  267. /**
  268. * Callback prototype for unsolicited frame receive handler.
  269. *
  270. * @param[in] cbarg callback arg for receive handler
  271. * @param[in] uf unsolicited frame descriptor
  272. *
  273. * @return None
  274. */
  275. typedef void (*bfa_cb_uf_recv_t) (void *cbarg, struct bfa_uf_s *uf);
  276. struct bfa_uf_mod_s {
  277. struct bfa_s *bfa; /* back pointer to BFA */
  278. struct bfa_uf_s *uf_list; /* array of UFs */
  279. u16 num_ufs; /* num unsolicited rx frames */
  280. struct list_head uf_free_q; /* free UFs */
  281. struct list_head uf_posted_q; /* UFs posted to IOC */
  282. struct bfa_uf_buf_s *uf_pbs_kva; /* list UF bufs request pld */
  283. u64 uf_pbs_pa; /* phy addr for UF bufs */
  284. struct bfi_uf_buf_post_s *uf_buf_posts;
  285. /* pre-built UF post msgs */
  286. bfa_cb_uf_recv_t ufrecv; /* uf recv handler function */
  287. void *cbarg; /* uf receive handler arg */
  288. };
  289. #define BFA_UF_MOD(__bfa) (&(__bfa)->modules.uf_mod)
  290. #define ufm_pbs_pa(_ufmod, _uftag) \
  291. ((_ufmod)->uf_pbs_pa + sizeof(struct bfa_uf_buf_s) * (_uftag))
  292. void bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
  293. #define BFA_UF_BUFSZ (2 * 1024 + 256)
  294. /**
  295. * @todo private
  296. */
  297. struct bfa_uf_buf_s {
  298. u8 d[BFA_UF_BUFSZ];
  299. };
  300. /**
  301. * LPS - bfa lport login/logout service interface
  302. */
  303. struct bfa_lps_s {
  304. struct list_head qe; /* queue element */
  305. struct bfa_s *bfa; /* parent bfa instance */
  306. bfa_sm_t sm; /* finite state machine */
  307. u8 lp_tag; /* lport tag */
  308. u8 reqq; /* lport request queue */
  309. u8 alpa; /* ALPA for loop topologies */
  310. u32 lp_pid; /* lport port ID */
  311. bfa_boolean_t fdisc; /* snd FDISC instead of FLOGI */
  312. bfa_boolean_t auth_en; /* enable authentication */
  313. bfa_boolean_t auth_req; /* authentication required */
  314. bfa_boolean_t npiv_en; /* NPIV is allowed by peer */
  315. bfa_boolean_t fport; /* attached peer is F_PORT */
  316. bfa_boolean_t brcd_switch; /* attached peer is brcd sw */
  317. bfa_status_t status; /* login status */
  318. u16 pdusz; /* max receive PDU size */
  319. u16 pr_bbcred; /* BB_CREDIT from peer */
  320. u8 lsrjt_rsn; /* LSRJT reason */
  321. u8 lsrjt_expl; /* LSRJT explanation */
  322. wwn_t pwwn; /* port wwn of lport */
  323. wwn_t nwwn; /* node wwn of lport */
  324. wwn_t pr_pwwn; /* port wwn of lport peer */
  325. wwn_t pr_nwwn; /* node wwn of lport peer */
  326. mac_t lp_mac; /* fpma/spma MAC for lport */
  327. mac_t fcf_mac; /* FCF MAC of lport */
  328. struct bfa_reqq_wait_s wqe; /* request wait queue element */
  329. void *uarg; /* user callback arg */
  330. struct bfa_cb_qe_s hcb_qe; /* comp: callback qelem */
  331. struct bfi_lps_login_rsp_s *loginrsp;
  332. bfa_eproto_status_t ext_status;
  333. };
  334. struct bfa_lps_mod_s {
  335. struct list_head lps_free_q;
  336. struct list_head lps_active_q;
  337. struct bfa_lps_s *lps_arr;
  338. int num_lps;
  339. };
  340. #define BFA_LPS_MOD(__bfa) (&(__bfa)->modules.lps_mod)
  341. #define BFA_LPS_FROM_TAG(__mod, __tag) (&(__mod)->lps_arr[__tag])
  342. /*
  343. * external functions
  344. */
  345. void bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
  346. /**
  347. * FCPORT related defines
  348. */
  349. #define BFA_FCPORT(_bfa) (&((_bfa)->modules.port))
  350. typedef void (*bfa_cb_port_t) (void *cbarg, enum bfa_status status);
  351. /**
  352. * Link notification data structure
  353. */
  354. struct bfa_fcport_ln_s {
  355. struct bfa_fcport_s *fcport;
  356. bfa_sm_t sm;
  357. struct bfa_cb_qe_s ln_qe; /* BFA callback queue elem for ln */
  358. enum bfa_port_linkstate ln_event; /* ln event for callback */
  359. };
  360. struct bfa_fcport_trunk_s {
  361. struct bfa_trunk_attr_s attr;
  362. };
  363. /**
  364. * BFA FC port data structure
  365. */
  366. struct bfa_fcport_s {
  367. struct bfa_s *bfa; /* parent BFA instance */
  368. bfa_sm_t sm; /* port state machine */
  369. wwn_t nwwn; /* node wwn of physical port */
  370. wwn_t pwwn; /* port wwn of physical oprt */
  371. enum bfa_port_speed speed_sup;
  372. /* supported speeds */
  373. enum bfa_port_speed speed; /* current speed */
  374. enum bfa_port_topology topology; /* current topology */
  375. u8 myalpa; /* my ALPA in LOOP topology */
  376. u8 rsvd[3];
  377. struct bfa_port_cfg_s cfg; /* current port configuration */
  378. struct bfa_qos_attr_s qos_attr; /* QoS Attributes */
  379. struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */
  380. struct bfa_reqq_wait_s reqq_wait;
  381. /* to wait for room in reqq */
  382. struct bfa_reqq_wait_s svcreq_wait;
  383. /* to wait for room in reqq */
  384. struct bfa_reqq_wait_s stats_reqq_wait;
  385. /* to wait for room in reqq (stats) */
  386. void *event_cbarg;
  387. void (*event_cbfn) (void *cbarg,
  388. enum bfa_port_linkstate event);
  389. union {
  390. union bfi_fcport_i2h_msg_u i2hmsg;
  391. } event_arg;
  392. void *bfad; /* BFA driver handle */
  393. struct bfa_fcport_ln_s ln; /* Link Notification */
  394. struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */
  395. struct bfa_timer_s timer; /* timer */
  396. u32 msgtag; /* fimrware msg tag for reply */
  397. u8 *stats_kva;
  398. u64 stats_pa;
  399. union bfa_fcport_stats_u *stats;
  400. union bfa_fcport_stats_u *stats_ret; /* driver stats location */
  401. bfa_status_t stats_status; /* stats/statsclr status */
  402. bfa_boolean_t stats_busy; /* outstanding stats/statsclr */
  403. bfa_boolean_t stats_qfull;
  404. u32 stats_reset_time; /* stats reset time stamp */
  405. bfa_cb_port_t stats_cbfn; /* driver callback function */
  406. void *stats_cbarg; /* *!< user callback arg */
  407. bfa_boolean_t diag_busy; /* diag busy status */
  408. bfa_boolean_t beacon; /* port beacon status */
  409. bfa_boolean_t link_e2e_beacon; /* link beacon status */
  410. struct bfa_fcport_trunk_s trunk;
  411. u16 fcoe_vlan;
  412. };
  413. #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport)
  414. /*
  415. * protected functions
  416. */
  417. void bfa_fcport_init(struct bfa_s *bfa);
  418. void bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
  419. /*
  420. * bfa fcport API functions
  421. */
  422. bfa_status_t bfa_fcport_enable(struct bfa_s *bfa);
  423. bfa_status_t bfa_fcport_disable(struct bfa_s *bfa);
  424. bfa_status_t bfa_fcport_cfg_speed(struct bfa_s *bfa,
  425. enum bfa_port_speed speed);
  426. enum bfa_port_speed bfa_fcport_get_speed(struct bfa_s *bfa);
  427. bfa_status_t bfa_fcport_cfg_topology(struct bfa_s *bfa,
  428. enum bfa_port_topology topo);
  429. enum bfa_port_topology bfa_fcport_get_topology(struct bfa_s *bfa);
  430. bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa);
  431. bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa);
  432. u8 bfa_fcport_get_myalpa(struct bfa_s *bfa);
  433. bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa);
  434. bfa_status_t bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize);
  435. u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa);
  436. u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa);
  437. void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr);
  438. wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node);
  439. void bfa_fcport_event_register(struct bfa_s *bfa,
  440. void (*event_cbfn) (void *cbarg,
  441. enum bfa_port_linkstate event), void *event_cbarg);
  442. bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa);
  443. void bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off);
  444. void bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off);
  445. bfa_status_t bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa,
  446. enum bfa_port_speed speed);
  447. enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa);
  448. void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit);
  449. void bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status);
  450. void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon,
  451. bfa_boolean_t link_e2e_beacon);
  452. void bfa_fcport_qos_get_attr(struct bfa_s *bfa,
  453. struct bfa_qos_attr_s *qos_attr);
  454. void bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa,
  455. struct bfa_qos_vc_attr_s *qos_vc_attr);
  456. bfa_status_t bfa_fcport_get_qos_stats(struct bfa_s *bfa,
  457. union bfa_fcport_stats_u *stats,
  458. bfa_cb_port_t cbfn, void *cbarg);
  459. bfa_status_t bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn,
  460. void *cbarg);
  461. bfa_status_t bfa_fcport_get_fcoe_stats(struct bfa_s *bfa,
  462. union bfa_fcport_stats_u *stats,
  463. bfa_cb_port_t cbfn, void *cbarg);
  464. bfa_status_t bfa_fcport_clear_fcoe_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn,
  465. void *cbarg);
  466. bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa);
  467. bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa);
  468. bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa,
  469. union bfa_fcport_stats_u *stats,
  470. bfa_cb_port_t cbfn, void *cbarg);
  471. bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn,
  472. void *cbarg);
  473. bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa);
  474. /*
  475. * bfa rport API functions
  476. */
  477. struct bfa_rport_s *bfa_rport_create(struct bfa_s *bfa, void *rport_drv);
  478. void bfa_rport_delete(struct bfa_rport_s *rport);
  479. void bfa_rport_online(struct bfa_rport_s *rport,
  480. struct bfa_rport_info_s *rport_info);
  481. void bfa_rport_offline(struct bfa_rport_s *rport);
  482. void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed);
  483. void bfa_rport_get_stats(struct bfa_rport_s *rport,
  484. struct bfa_rport_hal_stats_s *stats);
  485. void bfa_rport_clear_stats(struct bfa_rport_s *rport);
  486. void bfa_cb_rport_online(void *rport);
  487. void bfa_cb_rport_offline(void *rport);
  488. void bfa_cb_rport_qos_scn_flowid(void *rport,
  489. struct bfa_rport_qos_attr_s old_qos_attr,
  490. struct bfa_rport_qos_attr_s new_qos_attr);
  491. void bfa_cb_rport_qos_scn_prio(void *rport,
  492. struct bfa_rport_qos_attr_s old_qos_attr,
  493. struct bfa_rport_qos_attr_s new_qos_attr);
  494. void bfa_rport_get_qos_attr(struct bfa_rport_s *rport,
  495. struct bfa_rport_qos_attr_s *qos_attr);
  496. /*
  497. * bfa fcxp API functions
  498. */
  499. struct bfa_fcxp_s *bfa_fcxp_alloc(void *bfad_fcxp, struct bfa_s *bfa,
  500. int nreq_sgles, int nrsp_sgles,
  501. bfa_fcxp_get_sgaddr_t get_req_sga,
  502. bfa_fcxp_get_sglen_t get_req_sglen,
  503. bfa_fcxp_get_sgaddr_t get_rsp_sga,
  504. bfa_fcxp_get_sglen_t get_rsp_sglen);
  505. void bfa_fcxp_alloc_wait(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe,
  506. bfa_fcxp_alloc_cbfn_t alloc_cbfn,
  507. void *cbarg, void *bfad_fcxp,
  508. int nreq_sgles, int nrsp_sgles,
  509. bfa_fcxp_get_sgaddr_t get_req_sga,
  510. bfa_fcxp_get_sglen_t get_req_sglen,
  511. bfa_fcxp_get_sgaddr_t get_rsp_sga,
  512. bfa_fcxp_get_sglen_t get_rsp_sglen);
  513. void bfa_fcxp_walloc_cancel(struct bfa_s *bfa,
  514. struct bfa_fcxp_wqe_s *wqe);
  515. void bfa_fcxp_discard(struct bfa_fcxp_s *fcxp);
  516. void *bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp);
  517. void *bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp);
  518. void bfa_fcxp_free(struct bfa_fcxp_s *fcxp);
  519. void bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport,
  520. u16 vf_id, u8 lp_tag,
  521. bfa_boolean_t cts, enum fc_cos cos,
  522. u32 reqlen, struct fchs_s *fchs,
  523. bfa_cb_fcxp_send_t cbfn,
  524. void *cbarg,
  525. u32 rsp_maxlen, u8 rsp_timeout);
  526. bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp);
  527. u32 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp);
  528. u32 bfa_fcxp_get_maxrsp(struct bfa_s *bfa);
  529. static inline void *
  530. bfa_uf_get_frmbuf(struct bfa_uf_s *uf)
  531. {
  532. return uf->data_ptr;
  533. }
  534. static inline u16
  535. bfa_uf_get_frmlen(struct bfa_uf_s *uf)
  536. {
  537. return uf->data_len;
  538. }
  539. /*
  540. * bfa uf API functions
  541. */
  542. void bfa_uf_recv_register(struct bfa_s *bfa, bfa_cb_uf_recv_t ufrecv,
  543. void *cbarg);
  544. void bfa_uf_free(struct bfa_uf_s *uf);
  545. /**
  546. * bfa lport service api
  547. */
  548. u32 bfa_lps_get_max_vport(struct bfa_s *bfa);
  549. struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa);
  550. void bfa_lps_delete(struct bfa_lps_s *lps);
  551. void bfa_lps_discard(struct bfa_lps_s *lps);
  552. void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa,
  553. u16 pdusz, wwn_t pwwn, wwn_t nwwn,
  554. bfa_boolean_t auth_en);
  555. void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz,
  556. wwn_t pwwn, wwn_t nwwn);
  557. void bfa_lps_flogo(struct bfa_lps_s *lps);
  558. void bfa_lps_fdisclogo(struct bfa_lps_s *lps);
  559. u8 bfa_lps_get_tag(struct bfa_lps_s *lps);
  560. bfa_boolean_t bfa_lps_is_npiv_en(struct bfa_lps_s *lps);
  561. bfa_boolean_t bfa_lps_is_fport(struct bfa_lps_s *lps);
  562. bfa_boolean_t bfa_lps_is_brcd_fabric(struct bfa_lps_s *lps);
  563. bfa_boolean_t bfa_lps_is_authreq(struct bfa_lps_s *lps);
  564. bfa_eproto_status_t bfa_lps_get_extstatus(struct bfa_lps_s *lps);
  565. u32 bfa_lps_get_pid(struct bfa_lps_s *lps);
  566. u32 bfa_lps_get_base_pid(struct bfa_s *bfa);
  567. u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid);
  568. u16 bfa_lps_get_peer_bbcredit(struct bfa_lps_s *lps);
  569. wwn_t bfa_lps_get_peer_pwwn(struct bfa_lps_s *lps);
  570. wwn_t bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps);
  571. u8 bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps);
  572. u8 bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps);
  573. mac_t bfa_lps_get_lp_mac(struct bfa_lps_s *lps);
  574. void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status);
  575. void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status);
  576. void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg);
  577. void bfa_cb_lps_cvl_event(void *bfad, void *uarg);
  578. void bfa_trunk_enable_cfg(struct bfa_s *bfa);
  579. bfa_status_t bfa_trunk_enable(struct bfa_s *bfa);
  580. bfa_status_t bfa_trunk_disable(struct bfa_s *bfa);
  581. bfa_status_t bfa_trunk_get_attr(struct bfa_s *bfa,
  582. struct bfa_trunk_attr_s *attr);
  583. #endif /* __BFA_SVC_H__ */