]> bbs.cooldavid.org Git - net-next-2.6.git/blob - drivers/net/bna/bna.h
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[net-next-2.6.git] / drivers / net / bna / bna.h
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 #ifndef __BNA_H__
14 #define __BNA_H__
15
16 #include "bfa_wc.h"
17 #include "bfa_ioc.h"
18 #include "cna.h"
19 #include "bfi_ll.h"
20 #include "bna_types.h"
21
22 extern u32 bna_dim_vector[][BNA_BIAS_T_MAX];
23 extern u32 bna_napi_dim_vector[][BNA_BIAS_T_MAX];
24
25 /**
26  *
27  *  Macros and constants
28  *
29  */
30
31 #define BNA_IOC_TIMER_FREQ              200
32
33 /* Log string size */
34 #define BNA_MESSAGE_SIZE                256
35
36 #define bna_device_timer(_dev)          bfa_timer_beat(&((_dev)->timer_mod))
37
38 /* MBOX API for PORT, TX, RX */
39 #define bna_mbox_qe_fill(_qe, _cmd, _cmd_len, _cbfn, _cbarg)            \
40 do {                                                                    \
41         memcpy(&((_qe)->cmd.msg[0]), (_cmd), (_cmd_len));       \
42         (_qe)->cbfn = (_cbfn);                                          \
43         (_qe)->cbarg = (_cbarg);                                        \
44 } while (0)
45
46 #define bna_is_small_rxq(rcb) ((rcb)->id == 1)
47
48 #define BNA_MAC_IS_EQUAL(_mac1, _mac2)                                  \
49         (!memcmp((_mac1), (_mac2), sizeof(mac_t)))
50
51 #define BNA_POWER_OF_2(x) (((x) & ((x) - 1)) == 0)
52
53 #define BNA_TO_POWER_OF_2(x)                                            \
54 do {                                                                    \
55         int _shift = 0;                                                 \
56         while ((x) && (x) != 1) {                                       \
57                 (x) >>= 1;                                              \
58                 _shift++;                                               \
59         }                                                               \
60         (x) <<= _shift;                                                 \
61 } while (0)
62
63 #define BNA_TO_POWER_OF_2_HIGH(x)                                       \
64 do {                                                                    \
65         int n = 1;                                                      \
66         while (n < (x))                                                 \
67                 n <<= 1;                                                \
68         (x) = n;                                                        \
69 } while (0)
70
71 /*
72  * input : _addr-> os dma addr in host endian format,
73  * output : _bna_dma_addr-> pointer to hw dma addr
74  */
75 #define BNA_SET_DMA_ADDR(_addr, _bna_dma_addr)                          \
76 do {                                                                    \
77         u64 tmp_addr =                                          \
78         cpu_to_be64((u64)(_addr));                              \
79         (_bna_dma_addr)->msb = ((struct bna_dma_addr *)&tmp_addr)->msb; \
80         (_bna_dma_addr)->lsb = ((struct bna_dma_addr *)&tmp_addr)->lsb; \
81 } while (0)
82
83 /*
84  * input : _bna_dma_addr-> pointer to hw dma addr
85  * output : _addr-> os dma addr in host endian format
86  */
87 #define BNA_GET_DMA_ADDR(_bna_dma_addr, _addr)                  \
88 do {                                                            \
89         (_addr) = ((((u64)ntohl((_bna_dma_addr)->msb))) << 32)          \
90         | ((ntohl((_bna_dma_addr)->lsb) & 0xffffffff)); \
91 } while (0)
92
93 #define containing_rec(addr, type, field)                               \
94         ((type *)((unsigned char *)(addr) -                             \
95         (unsigned char *)(&((type *)0)->field)))
96
97 #define BNA_TXQ_WI_NEEDED(_vectors)     (((_vectors) + 3) >> 2)
98
99 /* TxQ element is 64 bytes */
100 #define BNA_TXQ_PAGE_INDEX_MAX          (PAGE_SIZE >> 6)
101 #define BNA_TXQ_PAGE_INDEX_MAX_SHIFT    (PAGE_SHIFT - 6)
102
103 #define BNA_TXQ_QPGE_PTR_GET(_qe_idx, _qpt_ptr, _qe_ptr, _qe_ptr_range) \
104 {                                                                       \
105         unsigned int page_index;        /* index within a page */       \
106         void *page_addr;                                                \
107         page_index = (_qe_idx) & (BNA_TXQ_PAGE_INDEX_MAX - 1);          \
108         (_qe_ptr_range) = (BNA_TXQ_PAGE_INDEX_MAX - page_index);        \
109         page_addr = (_qpt_ptr)[((_qe_idx) >>  BNA_TXQ_PAGE_INDEX_MAX_SHIFT)];\
110         (_qe_ptr) = &((struct bna_txq_entry *)(page_addr))[page_index]; \
111 }
112
113 /* RxQ element is 8 bytes */
114 #define BNA_RXQ_PAGE_INDEX_MAX          (PAGE_SIZE >> 3)
115 #define BNA_RXQ_PAGE_INDEX_MAX_SHIFT    (PAGE_SHIFT - 3)
116
117 #define BNA_RXQ_QPGE_PTR_GET(_qe_idx, _qpt_ptr, _qe_ptr, _qe_ptr_range) \
118 {                                                                       \
119         unsigned int page_index;        /* index within a page */       \
120         void *page_addr;                                                \
121         page_index = (_qe_idx) & (BNA_RXQ_PAGE_INDEX_MAX - 1);          \
122         (_qe_ptr_range) = (BNA_RXQ_PAGE_INDEX_MAX - page_index);        \
123         page_addr = (_qpt_ptr)[((_qe_idx) >>                            \
124                                 BNA_RXQ_PAGE_INDEX_MAX_SHIFT)];         \
125         (_qe_ptr) = &((struct bna_rxq_entry *)(page_addr))[page_index]; \
126 }
127
128 /* CQ element is 16 bytes */
129 #define BNA_CQ_PAGE_INDEX_MAX           (PAGE_SIZE >> 4)
130 #define BNA_CQ_PAGE_INDEX_MAX_SHIFT     (PAGE_SHIFT - 4)
131
132 #define BNA_CQ_QPGE_PTR_GET(_qe_idx, _qpt_ptr, _qe_ptr, _qe_ptr_range)  \
133 {                                                                       \
134         unsigned int page_index;          /* index within a page */     \
135         void *page_addr;                                                \
136                                                                         \
137         page_index = (_qe_idx) & (BNA_CQ_PAGE_INDEX_MAX - 1);           \
138         (_qe_ptr_range) = (BNA_CQ_PAGE_INDEX_MAX - page_index);         \
139         page_addr = (_qpt_ptr)[((_qe_idx) >>                            \
140                                     BNA_CQ_PAGE_INDEX_MAX_SHIFT)];      \
141         (_qe_ptr) = &((struct bna_cq_entry *)(page_addr))[page_index];\
142 }
143
144 #define BNA_QE_INDX_2_PTR(_cast, _qe_idx, _q_base)                      \
145         (&((_cast *)(_q_base))[(_qe_idx)])
146
147 #define BNA_QE_INDX_RANGE(_qe_idx, _q_depth) ((_q_depth) - (_qe_idx))
148
149 #define BNA_QE_INDX_ADD(_qe_idx, _qe_num, _q_depth)                     \
150         ((_qe_idx) = ((_qe_idx) + (_qe_num)) & ((_q_depth) - 1))
151
152 #define BNA_Q_INDEX_CHANGE(_old_idx, _updated_idx, _q_depth)            \
153         (((_updated_idx) - (_old_idx)) & ((_q_depth) - 1))
154
155 #define BNA_QE_FREE_CNT(_q_ptr, _q_depth)                               \
156         (((_q_ptr)->consumer_index - (_q_ptr)->producer_index - 1) &    \
157          ((_q_depth) - 1))
158
159 #define BNA_QE_IN_USE_CNT(_q_ptr, _q_depth)                             \
160         ((((_q_ptr)->producer_index - (_q_ptr)->consumer_index)) &      \
161          (_q_depth - 1))
162
163 #define BNA_Q_GET_CI(_q_ptr)            ((_q_ptr)->q.consumer_index)
164
165 #define BNA_Q_GET_PI(_q_ptr)            ((_q_ptr)->q.producer_index)
166
167 #define BNA_Q_PI_ADD(_q_ptr, _num)                                      \
168         (_q_ptr)->q.producer_index =                                    \
169                 (((_q_ptr)->q.producer_index + (_num)) &                \
170                 ((_q_ptr)->q.q_depth - 1))
171
172 #define BNA_Q_CI_ADD(_q_ptr, _num)                                      \
173         (_q_ptr)->q.consumer_index =                                    \
174                 (((_q_ptr)->q.consumer_index + (_num))                  \
175                 & ((_q_ptr)->q.q_depth - 1))
176
177 #define BNA_Q_FREE_COUNT(_q_ptr)                                        \
178         (BNA_QE_FREE_CNT(&((_q_ptr)->q), (_q_ptr)->q.q_depth))
179
180 #define BNA_Q_IN_USE_COUNT(_q_ptr)                                      \
181         (BNA_QE_IN_USE_CNT(&(_q_ptr)->q, (_q_ptr)->q.q_depth))
182
183 /* These macros build the data portion of the TxQ/RxQ doorbell */
184 #define BNA_DOORBELL_Q_PRD_IDX(_pi)     (0x80000000 | (_pi))
185 #define BNA_DOORBELL_Q_STOP             (0x40000000)
186
187 /* These macros build the data portion of the IB doorbell */
188 #define BNA_DOORBELL_IB_INT_ACK(_timeout, _events) \
189         (0x80000000 | ((_timeout) << 16) | (_events))
190 #define BNA_DOORBELL_IB_INT_DISABLE     (0x40000000)
191
192 /* Set the coalescing timer for the given ib */
193 #define bna_ib_coalescing_timer_set(_i_dbell, _cls_timer)               \
194         ((_i_dbell)->doorbell_ack = BNA_DOORBELL_IB_INT_ACK((_cls_timer), 0));
195
196 /* Acks 'events' # of events for a given ib */
197 #define bna_ib_ack(_i_dbell, _events)                                   \
198         (writel(((_i_dbell)->doorbell_ack | (_events)), \
199                 (_i_dbell)->doorbell_addr));
200
201 #define bna_txq_prod_indx_doorbell(_tcb)                                \
202         (writel(BNA_DOORBELL_Q_PRD_IDX((_tcb)->producer_index), \
203                 (_tcb)->q_dbell));
204
205 #define bna_rxq_prod_indx_doorbell(_rcb)                                \
206         (writel(BNA_DOORBELL_Q_PRD_IDX((_rcb)->producer_index), \
207                 (_rcb)->q_dbell));
208
209 #define BNA_LARGE_PKT_SIZE              1000
210
211 #define BNA_UPDATE_PKT_CNT(_pkt, _len)                                  \
212 do {                                                                    \
213         if ((_len) > BNA_LARGE_PKT_SIZE) {                              \
214                 (_pkt)->large_pkt_cnt++;                                \
215         } else {                                                        \
216                 (_pkt)->small_pkt_cnt++;                                \
217         }                                                               \
218 } while (0)
219
220 #define call_rxf_stop_cbfn(rxf, status)                                 \
221         if ((rxf)->stop_cbfn) {                                         \
222                 (*(rxf)->stop_cbfn)((rxf)->stop_cbarg, (status));       \
223                 (rxf)->stop_cbfn = NULL;                                \
224                 (rxf)->stop_cbarg = NULL;                               \
225         }
226
227 #define call_rxf_start_cbfn(rxf, status)                                \
228         if ((rxf)->start_cbfn) {                                        \
229                 (*(rxf)->start_cbfn)((rxf)->start_cbarg, (status));     \
230                 (rxf)->start_cbfn = NULL;                               \
231                 (rxf)->start_cbarg = NULL;                              \
232         }
233
234 #define call_rxf_cam_fltr_cbfn(rxf, status)                             \
235         if ((rxf)->cam_fltr_cbfn) {                                     \
236                 (*(rxf)->cam_fltr_cbfn)((rxf)->cam_fltr_cbarg, rxf->rx, \
237                                         (status));                      \
238                 (rxf)->cam_fltr_cbfn = NULL;                            \
239                 (rxf)->cam_fltr_cbarg = NULL;                           \
240         }
241
242 #define call_rxf_pause_cbfn(rxf, status)                                \
243         if ((rxf)->oper_state_cbfn) {                                   \
244                 (*(rxf)->oper_state_cbfn)((rxf)->oper_state_cbarg, rxf->rx,\
245                                         (status));                      \
246                 (rxf)->rxf_flags &= ~BNA_RXF_FL_OPERSTATE_CHANGED;      \
247                 (rxf)->oper_state_cbfn = NULL;                          \
248                 (rxf)->oper_state_cbarg = NULL;                         \
249         }
250
251 #define call_rxf_resume_cbfn(rxf, status) call_rxf_pause_cbfn(rxf, status)
252
253 #define is_xxx_enable(mode, bitmask, xxx) ((bitmask & xxx) && (mode & xxx))
254
255 #define is_xxx_disable(mode, bitmask, xxx) ((bitmask & xxx) && !(mode & xxx))
256
257 #define xxx_enable(mode, bitmask, xxx)                                  \
258 do {                                                                    \
259         bitmask |= xxx;                                                 \
260         mode |= xxx;                                                    \
261 } while (0)
262
263 #define xxx_disable(mode, bitmask, xxx)                                 \
264 do {                                                                    \
265         bitmask |= xxx;                                                 \
266         mode &= ~xxx;                                                   \
267 } while (0)
268
269 #define xxx_inactive(mode, bitmask, xxx)                                \
270 do {                                                                    \
271         bitmask &= ~xxx;                                                \
272         mode &= ~xxx;                                                   \
273 } while (0)
274
275 #define is_promisc_enable(mode, bitmask)                                \
276         is_xxx_enable(mode, bitmask, BNA_RXMODE_PROMISC)
277
278 #define is_promisc_disable(mode, bitmask)                               \
279         is_xxx_disable(mode, bitmask, BNA_RXMODE_PROMISC)
280
281 #define promisc_enable(mode, bitmask)                                   \
282         xxx_enable(mode, bitmask, BNA_RXMODE_PROMISC)
283
284 #define promisc_disable(mode, bitmask)                                  \
285         xxx_disable(mode, bitmask, BNA_RXMODE_PROMISC)
286
287 #define promisc_inactive(mode, bitmask)                                 \
288         xxx_inactive(mode, bitmask, BNA_RXMODE_PROMISC)
289
290 #define is_default_enable(mode, bitmask)                                \
291         is_xxx_enable(mode, bitmask, BNA_RXMODE_DEFAULT)
292
293 #define is_default_disable(mode, bitmask)                               \
294         is_xxx_disable(mode, bitmask, BNA_RXMODE_DEFAULT)
295
296 #define default_enable(mode, bitmask)                                   \
297         xxx_enable(mode, bitmask, BNA_RXMODE_DEFAULT)
298
299 #define default_disable(mode, bitmask)                                  \
300         xxx_disable(mode, bitmask, BNA_RXMODE_DEFAULT)
301
302 #define default_inactive(mode, bitmask)                                 \
303         xxx_inactive(mode, bitmask, BNA_RXMODE_DEFAULT)
304
305 #define is_allmulti_enable(mode, bitmask)                               \
306         is_xxx_enable(mode, bitmask, BNA_RXMODE_ALLMULTI)
307
308 #define is_allmulti_disable(mode, bitmask)                              \
309         is_xxx_disable(mode, bitmask, BNA_RXMODE_ALLMULTI)
310
311 #define allmulti_enable(mode, bitmask)                                  \
312         xxx_enable(mode, bitmask, BNA_RXMODE_ALLMULTI)
313
314 #define allmulti_disable(mode, bitmask)                                 \
315         xxx_disable(mode, bitmask, BNA_RXMODE_ALLMULTI)
316
317 #define allmulti_inactive(mode, bitmask)                                \
318         xxx_inactive(mode, bitmask, BNA_RXMODE_ALLMULTI)
319
320 #define GET_RXQS(rxp, q0, q1)   do {                                    \
321         switch ((rxp)->type) {                                          \
322         case BNA_RXP_SINGLE:                                            \
323                 (q0) = rxp->rxq.single.only;                            \
324                 (q1) = NULL;                                            \
325                 break;                                                  \
326         case BNA_RXP_SLR:                                               \
327                 (q0) = rxp->rxq.slr.large;                              \
328                 (q1) = rxp->rxq.slr.small;                              \
329                 break;                                                  \
330         case BNA_RXP_HDS:                                               \
331                 (q0) = rxp->rxq.hds.data;                               \
332                 (q1) = rxp->rxq.hds.hdr;                                \
333                 break;                                                  \
334         }                                                               \
335 } while (0)
336
337 /**
338  *
339  * Function prototypes
340  *
341  */
342
343 /**
344  * BNA
345  */
346
347 /* Internal APIs */
348 void bna_adv_res_req(struct bna_res_info *res_info);
349
350 /* APIs for BNAD */
351 void bna_res_req(struct bna_res_info *res_info);
352 void bna_init(struct bna *bna, struct bnad *bnad,
353                         struct bfa_pcidev *pcidev,
354                         struct bna_res_info *res_info);
355 void bna_uninit(struct bna *bna);
356 void bna_stats_get(struct bna *bna);
357 void bna_stats_clr(struct bna *bna);
358 void bna_get_perm_mac(struct bna *bna, u8 *mac);
359
360 /* APIs for Rx */
361 int bna_rit_mod_can_satisfy(struct bna_rit_mod *rit_mod, int seg_size);
362
363 /* APIs for RxF */
364 struct bna_mac *bna_ucam_mod_mac_get(struct bna_ucam_mod *ucam_mod);
365 void bna_ucam_mod_mac_put(struct bna_ucam_mod *ucam_mod,
366                           struct bna_mac *mac);
367 struct bna_mac *bna_mcam_mod_mac_get(struct bna_mcam_mod *mcam_mod);
368 void bna_mcam_mod_mac_put(struct bna_mcam_mod *mcam_mod,
369                           struct bna_mac *mac);
370 struct bna_rit_segment *
371 bna_rit_mod_seg_get(struct bna_rit_mod *rit_mod, int seg_size);
372 void bna_rit_mod_seg_put(struct bna_rit_mod *rit_mod,
373                         struct bna_rit_segment *seg);
374
375 /**
376  * DEVICE
377  */
378
379 /* Interanl APIs */
380 void bna_adv_device_init(struct bna_device *device, struct bna *bna,
381                         struct bna_res_info *res_info);
382
383 /* APIs for BNA */
384 void bna_device_init(struct bna_device *device, struct bna *bna,
385                      struct bna_res_info *res_info);
386 void bna_device_uninit(struct bna_device *device);
387 void bna_device_cb_port_stopped(void *arg, enum bna_cb_status status);
388 int bna_device_status_get(struct bna_device *device);
389 int bna_device_state_get(struct bna_device *device);
390
391 /* APIs for BNAD */
392 void bna_device_enable(struct bna_device *device);
393 void bna_device_disable(struct bna_device *device,
394                         enum bna_cleanup_type type);
395
396 /**
397  * MBOX
398  */
399
400 /* APIs for DEVICE */
401 void bna_mbox_mod_init(struct bna_mbox_mod *mbox_mod, struct bna *bna);
402 void bna_mbox_mod_uninit(struct bna_mbox_mod *mbox_mod);
403 void bna_mbox_mod_start(struct bna_mbox_mod *mbox_mod);
404 void bna_mbox_mod_stop(struct bna_mbox_mod *mbox_mod);
405
406 /* APIs for PORT, TX, RX */
407 void bna_mbox_handler(struct bna *bna, u32 intr_status);
408 void bna_mbox_send(struct bna *bna, struct bna_mbox_qe *mbox_qe);
409
410 /**
411  * PORT
412  */
413
414 /* APIs for BNA */
415 void bna_port_init(struct bna_port *port, struct bna *bna);
416 void bna_port_uninit(struct bna_port *port);
417 int bna_port_state_get(struct bna_port *port);
418 int bna_llport_state_get(struct bna_llport *llport);
419
420 /* APIs for DEVICE */
421 void bna_port_start(struct bna_port *port);
422 void bna_port_stop(struct bna_port *port);
423 void bna_port_fail(struct bna_port *port);
424
425 /* API for RX */
426 int bna_port_mtu_get(struct bna_port *port);
427 void bna_llport_admin_up(struct bna_llport *llport);
428 void bna_llport_admin_down(struct bna_llport *llport);
429
430 /* API for BNAD */
431 void bna_port_enable(struct bna_port *port);
432 void bna_port_disable(struct bna_port *port, enum bna_cleanup_type type,
433                       void (*cbfn)(void *, enum bna_cb_status));
434 void bna_port_pause_config(struct bna_port *port,
435                            struct bna_pause_config *pause_config,
436                            void (*cbfn)(struct bnad *, enum bna_cb_status));
437 void bna_port_mtu_set(struct bna_port *port, int mtu,
438                       void (*cbfn)(struct bnad *, enum bna_cb_status));
439 void bna_port_mac_get(struct bna_port *port, mac_t *mac);
440 void bna_port_type_set(struct bna_port *port, enum bna_port_type type);
441 void bna_port_linkcbfn_set(struct bna_port *port,
442                            void (*linkcbfn)(struct bnad *,
443                                             enum bna_link_status));
444 void bna_port_admin_up(struct bna_port *port);
445 void bna_port_admin_down(struct bna_port *port);
446
447 /* Callbacks for TX, RX */
448 void bna_port_cb_tx_stopped(struct bna_port *port,
449                             enum bna_cb_status status);
450 void bna_port_cb_rx_stopped(struct bna_port *port,
451                             enum bna_cb_status status);
452
453 /* Callbacks for MBOX */
454 void bna_port_cb_link_up(struct bna_port *port, struct bfi_ll_aen *aen,
455                          int status);
456 void bna_port_cb_link_down(struct bna_port *port, int status);
457
458 /**
459  * IB
460  */
461
462 /* APIs for BNA */
463 void bna_ib_mod_init(struct bna_ib_mod *ib_mod, struct bna *bna,
464                      struct bna_res_info *res_info);
465 void bna_ib_mod_uninit(struct bna_ib_mod *ib_mod);
466
467 /* APIs for TX, RX */
468 struct bna_ib *bna_ib_get(struct bna_ib_mod *ib_mod,
469                             enum bna_intr_type intr_type, int vector);
470 void bna_ib_put(struct bna_ib_mod *ib_mod, struct bna_ib *ib);
471 int bna_ib_reserve_idx(struct bna_ib *ib);
472 void bna_ib_release_idx(struct bna_ib *ib, int idx);
473 int bna_ib_config(struct bna_ib *ib, struct bna_ib_config *ib_config);
474 void bna_ib_start(struct bna_ib *ib);
475 void bna_ib_stop(struct bna_ib *ib);
476 void bna_ib_fail(struct bna_ib *ib);
477 void bna_ib_coalescing_timeo_set(struct bna_ib *ib, u8 coalescing_timeo);
478
479 /**
480  * TX MODULE AND TX
481  */
482
483 /* Internal APIs */
484 void bna_tx_prio_changed(struct bna_tx *tx, int prio);
485
486 /* APIs for BNA */
487 void bna_tx_mod_init(struct bna_tx_mod *tx_mod, struct bna *bna,
488                      struct bna_res_info *res_info);
489 void bna_tx_mod_uninit(struct bna_tx_mod *tx_mod);
490 int bna_tx_state_get(struct bna_tx *tx);
491
492 /* APIs for PORT */
493 void bna_tx_mod_start(struct bna_tx_mod *tx_mod, enum bna_tx_type type);
494 void bna_tx_mod_stop(struct bna_tx_mod *tx_mod, enum bna_tx_type type);
495 void bna_tx_mod_fail(struct bna_tx_mod *tx_mod);
496 void bna_tx_mod_prio_changed(struct bna_tx_mod *tx_mod, int prio);
497 void bna_tx_mod_cee_link_status(struct bna_tx_mod *tx_mod, int cee_link);
498
499 /* APIs for BNAD */
500 void bna_tx_res_req(int num_txq, int txq_depth,
501                     struct bna_res_info *res_info);
502 struct bna_tx *bna_tx_create(struct bna *bna, struct bnad *bnad,
503                                struct bna_tx_config *tx_cfg,
504                                struct bna_tx_event_cbfn *tx_cbfn,
505                                struct bna_res_info *res_info, void *priv);
506 void bna_tx_destroy(struct bna_tx *tx);
507 void bna_tx_enable(struct bna_tx *tx);
508 void bna_tx_disable(struct bna_tx *tx, enum bna_cleanup_type type,
509                     void (*cbfn)(void *, struct bna_tx *,
510                                  enum bna_cb_status));
511 enum bna_cb_status
512 bna_tx_prio_set(struct bna_tx *tx, int prio,
513                 void (*cbfn)(struct bnad *, struct bna_tx *,
514                              enum bna_cb_status));
515 void bna_tx_coalescing_timeo_set(struct bna_tx *tx, int coalescing_timeo);
516
517 /**
518  * RX MODULE, RX, RXF
519  */
520
521 /* Internal APIs */
522 void rxf_cb_cam_fltr_mbox_cmd(void *arg, int status);
523 void rxf_cam_mbox_cmd(struct bna_rxf *rxf, u8 cmd,
524                 const struct bna_mac *mac_addr);
525 void __rxf_vlan_filter_set(struct bna_rxf *rxf, enum bna_status status);
526 void bna_rxf_adv_init(struct bna_rxf *rxf,
527                 struct bna_rx *rx,
528                 struct bna_rx_config *q_config);
529 int rxf_process_packet_filter_ucast(struct bna_rxf *rxf);
530 int rxf_process_packet_filter_promisc(struct bna_rxf *rxf);
531 int rxf_process_packet_filter_default(struct bna_rxf *rxf);
532 int rxf_process_packet_filter_allmulti(struct bna_rxf *rxf);
533 int rxf_clear_packet_filter_ucast(struct bna_rxf *rxf);
534 int rxf_clear_packet_filter_promisc(struct bna_rxf *rxf);
535 int rxf_clear_packet_filter_default(struct bna_rxf *rxf);
536 int rxf_clear_packet_filter_allmulti(struct bna_rxf *rxf);
537 void rxf_reset_packet_filter_ucast(struct bna_rxf *rxf);
538 void rxf_reset_packet_filter_promisc(struct bna_rxf *rxf);
539 void rxf_reset_packet_filter_default(struct bna_rxf *rxf);
540 void rxf_reset_packet_filter_allmulti(struct bna_rxf *rxf);
541
542 /* APIs for BNA */
543 void bna_rx_mod_init(struct bna_rx_mod *rx_mod, struct bna *bna,
544                      struct bna_res_info *res_info);
545 void bna_rx_mod_uninit(struct bna_rx_mod *rx_mod);
546 int bna_rx_state_get(struct bna_rx *rx);
547 int bna_rxf_state_get(struct bna_rxf *rxf);
548
549 /* APIs for PORT */
550 void bna_rx_mod_start(struct bna_rx_mod *rx_mod, enum bna_rx_type type);
551 void bna_rx_mod_stop(struct bna_rx_mod *rx_mod, enum bna_rx_type type);
552 void bna_rx_mod_fail(struct bna_rx_mod *rx_mod);
553
554 /* APIs for BNAD */
555 void bna_rx_res_req(struct bna_rx_config *rx_config,
556                     struct bna_res_info *res_info);
557 struct bna_rx *bna_rx_create(struct bna *bna, struct bnad *bnad,
558                                struct bna_rx_config *rx_cfg,
559                                struct bna_rx_event_cbfn *rx_cbfn,
560                                struct bna_res_info *res_info, void *priv);
561 void bna_rx_destroy(struct bna_rx *rx);
562 void bna_rx_enable(struct bna_rx *rx);
563 void bna_rx_disable(struct bna_rx *rx, enum bna_cleanup_type type,
564                     void (*cbfn)(void *, struct bna_rx *,
565                                  enum bna_cb_status));
566 void bna_rx_coalescing_timeo_set(struct bna_rx *rx, int coalescing_timeo);
567 void bna_rx_dim_reconfig(struct bna *bna, u32 vector[][BNA_BIAS_T_MAX]);
568 void bna_rx_dim_update(struct bna_ccb *ccb);
569 enum bna_cb_status
570 bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac,
571                  void (*cbfn)(struct bnad *, struct bna_rx *,
572                               enum bna_cb_status));
573 enum bna_cb_status
574 bna_rx_ucast_add(struct bna_rx *rx, u8* ucmac,
575                  void (*cbfn)(struct bnad *, struct bna_rx *,
576                               enum bna_cb_status));
577 enum bna_cb_status
578 bna_rx_ucast_del(struct bna_rx *rx, u8 *ucmac,
579                  void (*cbfn)(struct bnad *, struct bna_rx *,
580                               enum bna_cb_status));
581 enum bna_cb_status
582 bna_rx_mcast_add(struct bna_rx *rx, u8 *mcmac,
583                  void (*cbfn)(struct bnad *, struct bna_rx *,
584                               enum bna_cb_status));
585 enum bna_cb_status
586 bna_rx_mcast_del(struct bna_rx *rx, u8 *mcmac,
587                  void (*cbfn)(struct bnad *, struct bna_rx *,
588                               enum bna_cb_status));
589 enum bna_cb_status
590 bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac,
591                      void (*cbfn)(struct bnad *, struct bna_rx *,
592                                   enum bna_cb_status));
593 void bna_rx_mcast_delall(struct bna_rx *rx,
594                          void (*cbfn)(struct bnad *, struct bna_rx *,
595                                       enum bna_cb_status));
596 enum bna_cb_status
597 bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode rxmode,
598                 enum bna_rxmode bitmask,
599                 void (*cbfn)(struct bnad *, struct bna_rx *,
600                              enum bna_cb_status));
601 void bna_rx_vlan_add(struct bna_rx *rx, int vlan_id);
602 void bna_rx_vlan_del(struct bna_rx *rx, int vlan_id);
603 void bna_rx_vlanfilter_enable(struct bna_rx *rx);
604 void bna_rx_vlanfilter_disable(struct bna_rx *rx);
605 void bna_rx_rss_enable(struct bna_rx *rx);
606 void bna_rx_rss_disable(struct bna_rx *rx);
607 void bna_rx_rss_reconfig(struct bna_rx *rx, struct bna_rxf_rss *rss_config);
608 void bna_rx_rss_rit_set(struct bna_rx *rx, unsigned int *vectors,
609                         int nvectors);
610 void bna_rx_hds_enable(struct bna_rx *rx, struct bna_rxf_hds *hds_config,
611                        void (*cbfn)(struct bnad *, struct bna_rx *,
612                                     enum bna_cb_status));
613 void bna_rx_hds_disable(struct bna_rx *rx,
614                         void (*cbfn)(struct bnad *, struct bna_rx *,
615                                      enum bna_cb_status));
616 void bna_rx_receive_pause(struct bna_rx *rx,
617                           void (*cbfn)(struct bnad *, struct bna_rx *,
618                                        enum bna_cb_status));
619 void bna_rx_receive_resume(struct bna_rx *rx,
620                            void (*cbfn)(struct bnad *, struct bna_rx *,
621                                         enum bna_cb_status));
622
623 /* RxF APIs for RX */
624 void bna_rxf_start(struct bna_rxf *rxf);
625 void bna_rxf_stop(struct bna_rxf *rxf);
626 void bna_rxf_fail(struct bna_rxf *rxf);
627 void bna_rxf_init(struct bna_rxf *rxf, struct bna_rx *rx,
628                   struct bna_rx_config *q_config);
629 void bna_rxf_uninit(struct bna_rxf *rxf);
630
631 /* Callback from RXF to RX */
632 void bna_rx_cb_rxf_stopped(struct bna_rx *rx, enum bna_cb_status);
633 void bna_rx_cb_rxf_started(struct bna_rx *rx, enum bna_cb_status);
634
635 /**
636  * BNAD
637  */
638
639 /* Callbacks for BNA */
640 void bnad_cb_stats_get(struct bnad *bnad, enum bna_cb_status status,
641                        struct bna_stats *stats);
642 void bnad_cb_stats_clr(struct bnad *bnad);
643
644 /* Callbacks for DEVICE */
645 void bnad_cb_device_enabled(struct bnad *bnad, enum bna_cb_status status);
646 void bnad_cb_device_disabled(struct bnad *bnad, enum bna_cb_status status);
647 void bnad_cb_device_enable_mbox_intr(struct bnad *bnad);
648 void bnad_cb_device_disable_mbox_intr(struct bnad *bnad);
649
650 /* Callbacks for port */
651 void bnad_cb_port_link_status(struct bnad *bnad,
652                               enum bna_link_status status);
653
654 #endif  /* __BNA_H__ */