bna.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. /*
  2. * Linux network driver for Brocade Converged Network Adapter.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License (GPL) Version 2 as
  6. * published by the Free Software Foundation
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * General Public License for more details.
  12. */
  13. /*
  14. * Copyright (c) 2005-2011 Brocade Communications Systems, Inc.
  15. * All rights reserved
  16. * www.brocade.com
  17. */
  18. #ifndef __BNA_H__
  19. #define __BNA_H__
  20. #include "bfa_defs.h"
  21. #include "bfa_ioc.h"
  22. #include "bfi_enet.h"
  23. #include "bna_types.h"
  24. extern const u32 bna_napi_dim_vector[][BNA_BIAS_T_MAX];
  25. /* Macros and constants */
  26. #define BNA_IOC_TIMER_FREQ 200
  27. /* Log string size */
  28. #define BNA_MESSAGE_SIZE 256
  29. #define bna_is_small_rxq(_id) ((_id) & 0x1)
  30. #define BNA_MAC_IS_EQUAL(_mac1, _mac2) \
  31. (!memcmp((_mac1), (_mac2), sizeof(mac_t)))
  32. #define BNA_POWER_OF_2(x) (((x) & ((x) - 1)) == 0)
  33. #define BNA_TO_POWER_OF_2(x) \
  34. do { \
  35. int _shift = 0; \
  36. while ((x) && (x) != 1) { \
  37. (x) >>= 1; \
  38. _shift++; \
  39. } \
  40. (x) <<= _shift; \
  41. } while (0)
  42. #define BNA_TO_POWER_OF_2_HIGH(x) \
  43. do { \
  44. int n = 1; \
  45. while (n < (x)) \
  46. n <<= 1; \
  47. (x) = n; \
  48. } while (0)
  49. /*
  50. * input : _addr-> os dma addr in host endian format,
  51. * output : _bna_dma_addr-> pointer to hw dma addr
  52. */
  53. #define BNA_SET_DMA_ADDR(_addr, _bna_dma_addr) \
  54. do { \
  55. u64 tmp_addr = \
  56. cpu_to_be64((u64)(_addr)); \
  57. (_bna_dma_addr)->msb = ((struct bna_dma_addr *)&tmp_addr)->msb; \
  58. (_bna_dma_addr)->lsb = ((struct bna_dma_addr *)&tmp_addr)->lsb; \
  59. } while (0)
  60. /*
  61. * input : _bna_dma_addr-> pointer to hw dma addr
  62. * output : _addr-> os dma addr in host endian format
  63. */
  64. #define BNA_GET_DMA_ADDR(_bna_dma_addr, _addr) \
  65. do { \
  66. (_addr) = ((((u64)ntohl((_bna_dma_addr)->msb))) << 32) \
  67. | ((ntohl((_bna_dma_addr)->lsb) & 0xffffffff)); \
  68. } while (0)
  69. #define containing_rec(addr, type, field) \
  70. ((type *)((unsigned char *)(addr) - \
  71. (unsigned char *)(&((type *)0)->field)))
  72. #define BNA_TXQ_WI_NEEDED(_vectors) (((_vectors) + 3) >> 2)
  73. /* TxQ element is 64 bytes */
  74. #define BNA_TXQ_PAGE_INDEX_MAX (PAGE_SIZE >> 6)
  75. #define BNA_TXQ_PAGE_INDEX_MAX_SHIFT (PAGE_SHIFT - 6)
  76. #define BNA_TXQ_QPGE_PTR_GET(_qe_idx, _qpt_ptr, _qe_ptr, _qe_ptr_range) \
  77. { \
  78. unsigned int page_index; /* index within a page */ \
  79. void *page_addr; \
  80. page_index = (_qe_idx) & (BNA_TXQ_PAGE_INDEX_MAX - 1); \
  81. (_qe_ptr_range) = (BNA_TXQ_PAGE_INDEX_MAX - page_index); \
  82. page_addr = (_qpt_ptr)[((_qe_idx) >> BNA_TXQ_PAGE_INDEX_MAX_SHIFT)];\
  83. (_qe_ptr) = &((struct bna_txq_entry *)(page_addr))[page_index]; \
  84. }
  85. /* RxQ element is 8 bytes */
  86. #define BNA_RXQ_PAGE_INDEX_MAX (PAGE_SIZE >> 3)
  87. #define BNA_RXQ_PAGE_INDEX_MAX_SHIFT (PAGE_SHIFT - 3)
  88. #define BNA_RXQ_QPGE_PTR_GET(_qe_idx, _qpt_ptr, _qe_ptr, _qe_ptr_range) \
  89. { \
  90. unsigned int page_index; /* index within a page */ \
  91. void *page_addr; \
  92. page_index = (_qe_idx) & (BNA_RXQ_PAGE_INDEX_MAX - 1); \
  93. (_qe_ptr_range) = (BNA_RXQ_PAGE_INDEX_MAX - page_index); \
  94. page_addr = (_qpt_ptr)[((_qe_idx) >> \
  95. BNA_RXQ_PAGE_INDEX_MAX_SHIFT)]; \
  96. (_qe_ptr) = &((struct bna_rxq_entry *)(page_addr))[page_index]; \
  97. }
  98. /* CQ element is 16 bytes */
  99. #define BNA_CQ_PAGE_INDEX_MAX (PAGE_SIZE >> 4)
  100. #define BNA_CQ_PAGE_INDEX_MAX_SHIFT (PAGE_SHIFT - 4)
  101. #define BNA_CQ_QPGE_PTR_GET(_qe_idx, _qpt_ptr, _qe_ptr, _qe_ptr_range) \
  102. { \
  103. unsigned int page_index; /* index within a page */ \
  104. void *page_addr; \
  105. \
  106. page_index = (_qe_idx) & (BNA_CQ_PAGE_INDEX_MAX - 1); \
  107. (_qe_ptr_range) = (BNA_CQ_PAGE_INDEX_MAX - page_index); \
  108. page_addr = (_qpt_ptr)[((_qe_idx) >> \
  109. BNA_CQ_PAGE_INDEX_MAX_SHIFT)]; \
  110. (_qe_ptr) = &((struct bna_cq_entry *)(page_addr))[page_index];\
  111. }
  112. #define BNA_QE_INDX_2_PTR(_cast, _qe_idx, _q_base) \
  113. (&((_cast *)(_q_base))[(_qe_idx)])
  114. #define BNA_QE_INDX_RANGE(_qe_idx, _q_depth) ((_q_depth) - (_qe_idx))
  115. #define BNA_QE_INDX_ADD(_qe_idx, _qe_num, _q_depth) \
  116. ((_qe_idx) = ((_qe_idx) + (_qe_num)) & ((_q_depth) - 1))
  117. #define BNA_QE_INDX_INC(_idx, _q_depth) BNA_QE_INDX_ADD(_idx, 1, _q_depth)
  118. #define BNA_Q_INDEX_CHANGE(_old_idx, _updated_idx, _q_depth) \
  119. (((_updated_idx) - (_old_idx)) & ((_q_depth) - 1))
  120. #define BNA_QE_FREE_CNT(_q_ptr, _q_depth) \
  121. (((_q_ptr)->consumer_index - (_q_ptr)->producer_index - 1) & \
  122. ((_q_depth) - 1))
  123. #define BNA_QE_IN_USE_CNT(_q_ptr, _q_depth) \
  124. ((((_q_ptr)->producer_index - (_q_ptr)->consumer_index)) & \
  125. (_q_depth - 1))
  126. #define BNA_Q_GET_CI(_q_ptr) ((_q_ptr)->q.consumer_index)
  127. #define BNA_Q_GET_PI(_q_ptr) ((_q_ptr)->q.producer_index)
  128. #define BNA_Q_PI_ADD(_q_ptr, _num) \
  129. (_q_ptr)->q.producer_index = \
  130. (((_q_ptr)->q.producer_index + (_num)) & \
  131. ((_q_ptr)->q.q_depth - 1))
  132. #define BNA_Q_CI_ADD(_q_ptr, _num) \
  133. (_q_ptr)->q.consumer_index = \
  134. (((_q_ptr)->q.consumer_index + (_num)) \
  135. & ((_q_ptr)->q.q_depth - 1))
  136. #define BNA_Q_FREE_COUNT(_q_ptr) \
  137. (BNA_QE_FREE_CNT(&((_q_ptr)->q), (_q_ptr)->q.q_depth))
  138. #define BNA_Q_IN_USE_COUNT(_q_ptr) \
  139. (BNA_QE_IN_USE_CNT(&(_q_ptr)->q, (_q_ptr)->q.q_depth))
  140. #define BNA_LARGE_PKT_SIZE 1000
  141. #define BNA_UPDATE_PKT_CNT(_pkt, _len) \
  142. do { \
  143. if ((_len) > BNA_LARGE_PKT_SIZE) { \
  144. (_pkt)->large_pkt_cnt++; \
  145. } else { \
  146. (_pkt)->small_pkt_cnt++; \
  147. } \
  148. } while (0)
  149. #define call_rxf_stop_cbfn(rxf) \
  150. do { \
  151. if ((rxf)->stop_cbfn) { \
  152. void (*cbfn)(struct bna_rx *); \
  153. struct bna_rx *cbarg; \
  154. cbfn = (rxf)->stop_cbfn; \
  155. cbarg = (rxf)->stop_cbarg; \
  156. (rxf)->stop_cbfn = NULL; \
  157. (rxf)->stop_cbarg = NULL; \
  158. cbfn(cbarg); \
  159. } \
  160. } while (0)
  161. #define call_rxf_start_cbfn(rxf) \
  162. do { \
  163. if ((rxf)->start_cbfn) { \
  164. void (*cbfn)(struct bna_rx *); \
  165. struct bna_rx *cbarg; \
  166. cbfn = (rxf)->start_cbfn; \
  167. cbarg = (rxf)->start_cbarg; \
  168. (rxf)->start_cbfn = NULL; \
  169. (rxf)->start_cbarg = NULL; \
  170. cbfn(cbarg); \
  171. } \
  172. } while (0)
  173. #define call_rxf_cam_fltr_cbfn(rxf) \
  174. do { \
  175. if ((rxf)->cam_fltr_cbfn) { \
  176. void (*cbfn)(struct bnad *, struct bna_rx *); \
  177. struct bnad *cbarg; \
  178. cbfn = (rxf)->cam_fltr_cbfn; \
  179. cbarg = (rxf)->cam_fltr_cbarg; \
  180. (rxf)->cam_fltr_cbfn = NULL; \
  181. (rxf)->cam_fltr_cbarg = NULL; \
  182. cbfn(cbarg, rxf->rx); \
  183. } \
  184. } while (0)
  185. #define call_rxf_pause_cbfn(rxf) \
  186. do { \
  187. if ((rxf)->oper_state_cbfn) { \
  188. void (*cbfn)(struct bnad *, struct bna_rx *); \
  189. struct bnad *cbarg; \
  190. cbfn = (rxf)->oper_state_cbfn; \
  191. cbarg = (rxf)->oper_state_cbarg; \
  192. (rxf)->oper_state_cbfn = NULL; \
  193. (rxf)->oper_state_cbarg = NULL; \
  194. cbfn(cbarg, rxf->rx); \
  195. } \
  196. } while (0)
  197. #define call_rxf_resume_cbfn(rxf) call_rxf_pause_cbfn(rxf)
  198. #define is_xxx_enable(mode, bitmask, xxx) ((bitmask & xxx) && (mode & xxx))
  199. #define is_xxx_disable(mode, bitmask, xxx) ((bitmask & xxx) && !(mode & xxx))
  200. #define xxx_enable(mode, bitmask, xxx) \
  201. do { \
  202. bitmask |= xxx; \
  203. mode |= xxx; \
  204. } while (0)
  205. #define xxx_disable(mode, bitmask, xxx) \
  206. do { \
  207. bitmask |= xxx; \
  208. mode &= ~xxx; \
  209. } while (0)
  210. #define xxx_inactive(mode, bitmask, xxx) \
  211. do { \
  212. bitmask &= ~xxx; \
  213. mode &= ~xxx; \
  214. } while (0)
  215. #define is_promisc_enable(mode, bitmask) \
  216. is_xxx_enable(mode, bitmask, BNA_RXMODE_PROMISC)
  217. #define is_promisc_disable(mode, bitmask) \
  218. is_xxx_disable(mode, bitmask, BNA_RXMODE_PROMISC)
  219. #define promisc_enable(mode, bitmask) \
  220. xxx_enable(mode, bitmask, BNA_RXMODE_PROMISC)
  221. #define promisc_disable(mode, bitmask) \
  222. xxx_disable(mode, bitmask, BNA_RXMODE_PROMISC)
  223. #define promisc_inactive(mode, bitmask) \
  224. xxx_inactive(mode, bitmask, BNA_RXMODE_PROMISC)
  225. #define is_default_enable(mode, bitmask) \
  226. is_xxx_enable(mode, bitmask, BNA_RXMODE_DEFAULT)
  227. #define is_default_disable(mode, bitmask) \
  228. is_xxx_disable(mode, bitmask, BNA_RXMODE_DEFAULT)
  229. #define default_enable(mode, bitmask) \
  230. xxx_enable(mode, bitmask, BNA_RXMODE_DEFAULT)
  231. #define default_disable(mode, bitmask) \
  232. xxx_disable(mode, bitmask, BNA_RXMODE_DEFAULT)
  233. #define default_inactive(mode, bitmask) \
  234. xxx_inactive(mode, bitmask, BNA_RXMODE_DEFAULT)
  235. #define is_allmulti_enable(mode, bitmask) \
  236. is_xxx_enable(mode, bitmask, BNA_RXMODE_ALLMULTI)
  237. #define is_allmulti_disable(mode, bitmask) \
  238. is_xxx_disable(mode, bitmask, BNA_RXMODE_ALLMULTI)
  239. #define allmulti_enable(mode, bitmask) \
  240. xxx_enable(mode, bitmask, BNA_RXMODE_ALLMULTI)
  241. #define allmulti_disable(mode, bitmask) \
  242. xxx_disable(mode, bitmask, BNA_RXMODE_ALLMULTI)
  243. #define allmulti_inactive(mode, bitmask) \
  244. xxx_inactive(mode, bitmask, BNA_RXMODE_ALLMULTI)
  245. #define GET_RXQS(rxp, q0, q1) do { \
  246. switch ((rxp)->type) { \
  247. case BNA_RXP_SINGLE: \
  248. (q0) = rxp->rxq.single.only; \
  249. (q1) = NULL; \
  250. break; \
  251. case BNA_RXP_SLR: \
  252. (q0) = rxp->rxq.slr.large; \
  253. (q1) = rxp->rxq.slr.small; \
  254. break; \
  255. case BNA_RXP_HDS: \
  256. (q0) = rxp->rxq.hds.data; \
  257. (q1) = rxp->rxq.hds.hdr; \
  258. break; \
  259. } \
  260. } while (0)
  261. #define bna_tx_rid_mask(_bna) ((_bna)->tx_mod.rid_mask)
  262. #define bna_rx_rid_mask(_bna) ((_bna)->rx_mod.rid_mask)
  263. #define bna_tx_from_rid(_bna, _rid, _tx) \
  264. do { \
  265. struct bna_tx_mod *__tx_mod = &(_bna)->tx_mod; \
  266. struct bna_tx *__tx; \
  267. struct list_head *qe; \
  268. _tx = NULL; \
  269. list_for_each(qe, &__tx_mod->tx_active_q) { \
  270. __tx = (struct bna_tx *)qe; \
  271. if (__tx->rid == (_rid)) { \
  272. (_tx) = __tx; \
  273. break; \
  274. } \
  275. } \
  276. } while (0)
  277. #define bna_rx_from_rid(_bna, _rid, _rx) \
  278. do { \
  279. struct bna_rx_mod *__rx_mod = &(_bna)->rx_mod; \
  280. struct bna_rx *__rx; \
  281. struct list_head *qe; \
  282. _rx = NULL; \
  283. list_for_each(qe, &__rx_mod->rx_active_q) { \
  284. __rx = (struct bna_rx *)qe; \
  285. if (__rx->rid == (_rid)) { \
  286. (_rx) = __rx; \
  287. break; \
  288. } \
  289. } \
  290. } while (0)
  291. /* Inline functions */
  292. static inline struct bna_mac *bna_mac_find(struct list_head *q, u8 *addr)
  293. {
  294. struct bna_mac *mac = NULL;
  295. struct list_head *qe;
  296. list_for_each(qe, q) {
  297. if (BNA_MAC_IS_EQUAL(((struct bna_mac *)qe)->addr, addr)) {
  298. mac = (struct bna_mac *)qe;
  299. break;
  300. }
  301. }
  302. return mac;
  303. }
  304. #define bna_attr(_bna) (&(_bna)->ioceth.attr)
  305. /* Function prototypes */
  306. /* BNA */
  307. /* FW response handlers */
  308. void bna_bfi_stats_clr_rsp(struct bna *bna, struct bfi_msgq_mhdr *msghdr);
  309. /* APIs for BNAD */
  310. void bna_res_req(struct bna_res_info *res_info);
  311. void bna_mod_res_req(struct bna *bna, struct bna_res_info *res_info);
  312. void bna_init(struct bna *bna, struct bnad *bnad,
  313. struct bfa_pcidev *pcidev,
  314. struct bna_res_info *res_info);
  315. void bna_mod_init(struct bna *bna, struct bna_res_info *res_info);
  316. void bna_uninit(struct bna *bna);
  317. int bna_num_txq_set(struct bna *bna, int num_txq);
  318. int bna_num_rxp_set(struct bna *bna, int num_rxp);
  319. void bna_hw_stats_get(struct bna *bna);
  320. /* APIs for RxF */
  321. struct bna_mac *bna_ucam_mod_mac_get(struct bna_ucam_mod *ucam_mod);
  322. void bna_ucam_mod_mac_put(struct bna_ucam_mod *ucam_mod,
  323. struct bna_mac *mac);
  324. struct bna_mac *bna_mcam_mod_mac_get(struct bna_mcam_mod *mcam_mod);
  325. void bna_mcam_mod_mac_put(struct bna_mcam_mod *mcam_mod,
  326. struct bna_mac *mac);
  327. struct bna_mcam_handle *bna_mcam_mod_handle_get(struct bna_mcam_mod *mod);
  328. void bna_mcam_mod_handle_put(struct bna_mcam_mod *mcam_mod,
  329. struct bna_mcam_handle *handle);
  330. /* MBOX */
  331. /* API for BNAD */
  332. void bna_mbox_handler(struct bna *bna, u32 intr_status);
  333. /* ETHPORT */
  334. /* Callbacks for RX */
  335. void bna_ethport_cb_rx_started(struct bna_ethport *ethport);
  336. void bna_ethport_cb_rx_stopped(struct bna_ethport *ethport);
  337. /* TX MODULE AND TX */
  338. /* FW response handelrs */
  339. void bna_bfi_tx_enet_start_rsp(struct bna_tx *tx,
  340. struct bfi_msgq_mhdr *msghdr);
  341. void bna_bfi_tx_enet_stop_rsp(struct bna_tx *tx,
  342. struct bfi_msgq_mhdr *msghdr);
  343. void bna_bfi_bw_update_aen(struct bna_tx_mod *tx_mod);
  344. /* APIs for BNA */
  345. void bna_tx_mod_init(struct bna_tx_mod *tx_mod, struct bna *bna,
  346. struct bna_res_info *res_info);
  347. void bna_tx_mod_uninit(struct bna_tx_mod *tx_mod);
  348. /* APIs for ENET */
  349. void bna_tx_mod_start(struct bna_tx_mod *tx_mod, enum bna_tx_type type);
  350. void bna_tx_mod_stop(struct bna_tx_mod *tx_mod, enum bna_tx_type type);
  351. void bna_tx_mod_fail(struct bna_tx_mod *tx_mod);
  352. /* APIs for BNAD */
  353. void bna_tx_res_req(int num_txq, int txq_depth,
  354. struct bna_res_info *res_info);
  355. struct bna_tx *bna_tx_create(struct bna *bna, struct bnad *bnad,
  356. struct bna_tx_config *tx_cfg,
  357. const struct bna_tx_event_cbfn *tx_cbfn,
  358. struct bna_res_info *res_info, void *priv);
  359. void bna_tx_destroy(struct bna_tx *tx);
  360. void bna_tx_enable(struct bna_tx *tx);
  361. void bna_tx_disable(struct bna_tx *tx, enum bna_cleanup_type type,
  362. void (*cbfn)(void *, struct bna_tx *));
  363. void bna_tx_cleanup_complete(struct bna_tx *tx);
  364. void bna_tx_coalescing_timeo_set(struct bna_tx *tx, int coalescing_timeo);
  365. /* RX MODULE, RX, RXF */
  366. /* FW response handlers */
  367. void bna_bfi_rx_enet_start_rsp(struct bna_rx *rx,
  368. struct bfi_msgq_mhdr *msghdr);
  369. void bna_bfi_rx_enet_stop_rsp(struct bna_rx *rx,
  370. struct bfi_msgq_mhdr *msghdr);
  371. void bna_bfi_rxf_cfg_rsp(struct bna_rxf *rxf, struct bfi_msgq_mhdr *msghdr);
  372. void bna_bfi_rxf_mcast_add_rsp(struct bna_rxf *rxf,
  373. struct bfi_msgq_mhdr *msghdr);
  374. /* APIs for BNA */
  375. void bna_rx_mod_init(struct bna_rx_mod *rx_mod, struct bna *bna,
  376. struct bna_res_info *res_info);
  377. void bna_rx_mod_uninit(struct bna_rx_mod *rx_mod);
  378. /* APIs for ENET */
  379. void bna_rx_mod_start(struct bna_rx_mod *rx_mod, enum bna_rx_type type);
  380. void bna_rx_mod_stop(struct bna_rx_mod *rx_mod, enum bna_rx_type type);
  381. void bna_rx_mod_fail(struct bna_rx_mod *rx_mod);
  382. /* APIs for BNAD */
  383. void bna_rx_res_req(struct bna_rx_config *rx_config,
  384. struct bna_res_info *res_info);
  385. struct bna_rx *bna_rx_create(struct bna *bna, struct bnad *bnad,
  386. struct bna_rx_config *rx_cfg,
  387. const struct bna_rx_event_cbfn *rx_cbfn,
  388. struct bna_res_info *res_info, void *priv);
  389. void bna_rx_destroy(struct bna_rx *rx);
  390. void bna_rx_enable(struct bna_rx *rx);
  391. void bna_rx_disable(struct bna_rx *rx, enum bna_cleanup_type type,
  392. void (*cbfn)(void *, struct bna_rx *));
  393. void bna_rx_cleanup_complete(struct bna_rx *rx);
  394. void bna_rx_coalescing_timeo_set(struct bna_rx *rx, int coalescing_timeo);
  395. void bna_rx_dim_reconfig(struct bna *bna, const u32 vector[][BNA_BIAS_T_MAX]);
  396. void bna_rx_dim_update(struct bna_ccb *ccb);
  397. enum bna_cb_status
  398. bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac,
  399. void (*cbfn)(struct bnad *, struct bna_rx *));
  400. enum bna_cb_status
  401. bna_rx_ucast_add(struct bna_rx *rx, u8* ucmac,
  402. void (*cbfn)(struct bnad *, struct bna_rx *));
  403. enum bna_cb_status
  404. bna_rx_ucast_del(struct bna_rx *rx, u8 *ucmac,
  405. void (*cbfn)(struct bnad *, struct bna_rx *));
  406. enum bna_cb_status
  407. bna_rx_mcast_add(struct bna_rx *rx, u8 *mcmac,
  408. void (*cbfn)(struct bnad *, struct bna_rx *));
  409. enum bna_cb_status
  410. bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac,
  411. void (*cbfn)(struct bnad *, struct bna_rx *));
  412. enum bna_cb_status
  413. bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode rxmode,
  414. enum bna_rxmode bitmask,
  415. void (*cbfn)(struct bnad *, struct bna_rx *));
  416. void bna_rx_vlan_add(struct bna_rx *rx, int vlan_id);
  417. void bna_rx_vlan_del(struct bna_rx *rx, int vlan_id);
  418. void bna_rx_vlanfilter_enable(struct bna_rx *rx);
  419. /* ENET */
  420. /* API for RX */
  421. int bna_enet_mtu_get(struct bna_enet *enet);
  422. /* Callbacks for TX, RX */
  423. void bna_enet_cb_tx_stopped(struct bna_enet *enet);
  424. void bna_enet_cb_rx_stopped(struct bna_enet *enet);
  425. /* API for BNAD */
  426. void bna_enet_enable(struct bna_enet *enet);
  427. void bna_enet_disable(struct bna_enet *enet, enum bna_cleanup_type type,
  428. void (*cbfn)(void *));
  429. void bna_enet_pause_config(struct bna_enet *enet,
  430. struct bna_pause_config *pause_config,
  431. void (*cbfn)(struct bnad *));
  432. void bna_enet_mtu_set(struct bna_enet *enet, int mtu,
  433. void (*cbfn)(struct bnad *));
  434. void bna_enet_perm_mac_get(struct bna_enet *enet, mac_t *mac);
  435. /* IOCETH */
  436. /* APIs for BNAD */
  437. void bna_ioceth_enable(struct bna_ioceth *ioceth);
  438. void bna_ioceth_disable(struct bna_ioceth *ioceth,
  439. enum bna_cleanup_type type);
  440. /* BNAD */
  441. /* Callbacks for ENET */
  442. void bnad_cb_ethport_link_status(struct bnad *bnad,
  443. enum bna_link_status status);
  444. /* Callbacks for IOCETH */
  445. void bnad_cb_ioceth_ready(struct bnad *bnad);
  446. void bnad_cb_ioceth_failed(struct bnad *bnad);
  447. void bnad_cb_ioceth_disabled(struct bnad *bnad);
  448. void bnad_cb_mbox_intr_enable(struct bnad *bnad);
  449. void bnad_cb_mbox_intr_disable(struct bnad *bnad);
  450. /* Callbacks for BNA */
  451. void bnad_cb_stats_get(struct bnad *bnad, enum bna_cb_status status,
  452. struct bna_stats *stats);
  453. #endif /* __BNA_H__ */