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