bna.h 17 KB

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