Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bna_types.h
Go to the documentation of this file.
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-2010 Brocade Communications Systems, Inc.
15  * All rights reserved
16  * www.brocade.com
17  */
18 #ifndef __BNA_TYPES_H__
19 #define __BNA_TYPES_H__
20 
21 #include "cna.h"
22 #include "bna_hw_defs.h"
23 #include "bfa_cee.h"
24 #include "bfa_msgq.h"
25 
26 /* Forward declarations */
27 
28 struct bna_mcam_handle;
29 struct bna_txq;
30 struct bna_tx;
31 struct bna_rxq;
32 struct bna_cq;
33 struct bna_rx;
34 struct bna_rxf;
35 struct bna_enet;
36 struct bna;
37 struct bnad;
38 
39 /* Enums, primitive data types */
40 
41 enum bna_status {
44 };
45 
49 };
50 
61 };
62 
66 };
67 
71 };
72 
76 };
77 
84 };
85 
96 };
97 
107 };
108 
110  BNA_RX_RES_MEM_T_CCB = 0, /* CQ context */
111  BNA_RX_RES_MEM_T_RCB = 1, /* CQ context */
112  BNA_RX_RES_MEM_T_UNMAPQ = 2, /* UnmapQ for RxQs */
113  BNA_RX_RES_MEM_T_CQPT = 3, /* CQ QPT */
114  BNA_RX_RES_MEM_T_CSWQPT = 4, /* S/W QPT */
115  BNA_RX_RES_MEM_T_CQPT_PAGE = 5, /* CQPT page */
116  BNA_RX_RES_MEM_T_HQPT = 6, /* RX QPT */
117  BNA_RX_RES_MEM_T_DQPT = 7, /* RX QPT */
118  BNA_RX_RES_MEM_T_HSWQPT = 8, /* RX s/w QPT */
119  BNA_RX_RES_MEM_T_DSWQPT = 9, /* RX s/w QPT */
120  BNA_RX_RES_MEM_T_DPAGE = 10, /* RX s/w QPT */
121  BNA_RX_RES_MEM_T_HPAGE = 11, /* RX s/w QPT */
124  BNA_RX_RES_T_INTR = 14, /* Rx interrupts */
126 };
127 
131 };
132 
138 };
139 
143 };
144 
148 };
149 
154 };
155 
160 };
161 
171 };
172 
176 };
177 
181 };
182 
185 };
186 
195 };
196 
201 };
202 
207 };
208 
213 };
214 
220 };
221 
226 };
227 
230 };
231 
241 };
242 
244  BNA_LOAD_T_HIGH_4 = 0, /* 80K <= r */
245  BNA_LOAD_T_HIGH_3 = 1, /* 60K <= r < 80K */
246  BNA_LOAD_T_HIGH_2 = 2, /* 50K <= r < 60K */
247  BNA_LOAD_T_HIGH_1 = 3, /* 40K <= r < 50K */
248  BNA_LOAD_T_LOW_1 = 4, /* 30K <= r < 40K */
249  BNA_LOAD_T_LOW_2 = 5, /* 20K <= r < 30K */
250  BNA_LOAD_T_LOW_3 = 6, /* 10K <= r < 20K */
251  BNA_LOAD_T_LOW_4 = 7, /* r < 10K */
253 };
254 
256  BNA_BIAS_T_SMALL = 0, /* small pkts > (large pkts * 2) */
257  BNA_BIAS_T_LARGE = 1, /* Not BNA_BIAS_T_SMALL */
259 };
260 
261 #define BNA_MAX_NAME_SIZE 64
262 struct bna_ident {
263  int id;
265 };
266 
267 struct bna_mac {
268  /* This should be the first one */
269  struct list_head qe;
272 };
273 
276  void *kva;
278 };
279 
280 struct bna_mem_info {
284  u32 align_sz; /* 0/1 = no alignment */
286  void *cookie; /* For bnad to unmap dma later */
287 };
288 
290  int vector;
291 };
292 
295  int num;
297 };
298 
299 union bna_res_u {
302 };
303 
304 struct bna_res_info {
307 };
308 
309 /* HW QPT */
310 struct bna_qpt {
312  void *kv_qpt_ptr;
315 };
316 
317 struct bna_attr {
319  int num_txq;
320  int num_rxp;
324 };
325 
326 /* IOCEth */
327 
328 struct bna_ioceth {
330  struct bfa_ioc ioc;
331 
332  struct bna_attr attr;
335 
336  void (*stop_cbfn)(struct bnad *bnad);
337  struct bnad *stop_cbarg;
338 
339  struct bna *bna;
340 };
341 
342 /* Enet */
343 
344 /* Pause configuration */
348 };
349 
350 struct bna_enet {
353 
355 
357  int mtu;
358 
359  /* Callback for bna_enet_disable(), enet_stop() */
360  void (*stop_cbfn)(void *);
361  void *stop_cbarg;
362 
363  /* Callback for bna_enet_pause_config() */
364  void (*pause_cbfn)(struct bnad *);
365 
366  /* Callback for bna_enet_mtu_set() */
367  void (*mtu_cbfn)(struct bnad *);
368 
370 
373 
374  struct bna *bna;
375 };
376 
377 /* Ethport */
378 
379 struct bna_ethport {
382 
384 
386 
387  void (*stop_cbfn)(struct bna_enet *);
388 
389  void (*adminup_cbfn)(struct bnad *, enum bna_cb_status);
390 
391  void (*link_cbfn)(struct bnad *, enum bna_link_status);
392 
394  union {
397  } bfi_enet_cmd;
398 
399  struct bna *bna;
400 };
401 
402 /* Interrupt Block */
403 
404 /* Doorbell structure */
405 struct bna_ib_dbell {
408 };
409 
410 /* IB structure */
411 struct bna_ib {
414 
416 
419 
420  u8 coalescing_timeo; /* Unit is 5usec. */
421 
424 };
425 
426 /* Tx object */
427 
428 /* Tx datapath control structure */
429 #define BNA_Q_NAME_SIZE 16
430 struct bna_tcb {
431  /* Fast path */
432  void **sw_qpt;
433  void *unmap_q;
440  int page_idx;
442  /* Control path */
443  struct bna_txq *txq;
444  struct bnad *bnad;
445  void *priv; /* BNAD's cookie */
448  u8 priority; /* Current priority */
449  unsigned long flags; /* Used by bnad as required */
450  int id;
452 };
453 
454 /* TxQ QPT and configuration */
455 struct bna_txq {
456  /* This should be the first one */
457  struct list_head qe;
458 
460 
461  struct bna_qpt qpt;
462  struct bna_tcb *tcb;
463  struct bna_ib ib;
464 
465  struct bna_tx *tx;
466 
467  int hw_id;
468 
471 };
472 
473 /* Tx object */
474 struct bna_tx {
475  /* This should be the first one */
476  struct list_head qe;
477  int rid;
478  int hw_id;
479 
482 
484  int num_txq;
485 
486  struct list_head txq_q;
488 
489  /* Tx event handlers */
490  void (*tcb_setup_cbfn)(struct bnad *, struct bna_tcb *);
491  void (*tcb_destroy_cbfn)(struct bnad *, struct bna_tcb *);
492  void (*tx_stall_cbfn)(struct bnad *, struct bna_tx *);
493  void (*tx_resume_cbfn)(struct bnad *, struct bna_tx *);
494  void (*tx_cleanup_cbfn)(struct bnad *, struct bna_tx *);
495 
496  /* callback for bna_tx_disable(), bna_tx_stop() */
497  void (*stop_cbfn)(void *arg, struct bna_tx *tx);
498  void *stop_cbarg;
499 
500  /* callback for bna_tx_prio_set() */
501  void (*prio_change_cbfn)(struct bnad *bnad, struct bna_tx *tx);
502 
504  union {
508  } bfi_enet_cmd;
509 
510  struct bna *bna;
511  void *priv; /* bnad's cookie */
512 };
513 
514 /* Tx object configuration used during creation */
516  int num_txq;
520 };
521 
523  /* Optional */
524  void (*tcb_setup_cbfn)(struct bnad *, struct bna_tcb *);
525  void (*tcb_destroy_cbfn)(struct bnad *, struct bna_tcb *);
526  /* Mandatory */
527  void (*tx_stall_cbfn)(struct bnad *, struct bna_tx *);
528  void (*tx_resume_cbfn)(struct bnad *, struct bna_tx *);
529  void (*tx_cleanup_cbfn)(struct bnad *, struct bna_tx *);
530 };
531 
532 /* Tx module - keeps track of free, active tx objects */
533 struct bna_tx_mod {
534  struct bna_tx *tx; /* BFI_MAX_TXQ entries */
535  struct bna_txq *txq; /* BFI_MAX_TXQ entries */
536 
539 
541 
542  /* callback for bna_tx_mod_stop() */
544 
546 
548 
554 
556 
557  struct bna *bna;
558 };
559 
560 /* Rx object */
561 
562 /* Rx datapath control structure */
563 struct bna_rcb {
564  /* Fast path */
565  void **sw_qpt;
566  void *unmap_q;
571  int page_idx;
573  /* Control path */
574  struct bna_rxq *rxq;
575  struct bna_ccb *ccb;
576  struct bnad *bnad;
577  void *priv; /* BNAD's cookie */
578  unsigned long flags;
579  int id;
580 };
581 
582 /* RxQ structure - QPT, configuration */
583 struct bna_rxq {
584  struct list_head qe;
585 
587  int q_depth;
588 
589  struct bna_qpt qpt;
590  struct bna_rcb *rcb;
591 
592  struct bna_rxp *rxp;
593  struct bna_rx *rx;
594 
595  int hw_id;
596 
601 };
602 
603 /* RxQ pair */
604 union bna_rxq_u {
605  struct {
606  struct bna_rxq *hdr;
607  struct bna_rxq *data;
608  } hds;
609  struct {
610  struct bna_rxq *small;
611  struct bna_rxq *large;
612  } slr;
613  struct {
614  struct bna_rxq *only;
615  struct bna_rxq *reserved;
616  } single;
617 };
618 
619 /* Packet rate for Dynamic Interrupt Moderation */
620 struct bna_pkt_rate {
623 };
624 
625 /* Completion control structure */
626 struct bna_ccb {
627  /* Fast path */
628  void **sw_qpt;
633  struct bna_rcb *rcb[2];
634  void *ctrl; /* For bnad */
636  int page_idx;
638 
639  /* Control path */
640  struct bna_cq *cq;
641  struct bnad *bnad;
642  void *priv; /* BNAD's cookie */
645  u8 rx_coalescing_timeo; /* For NAPI */
646  int id;
648 };
649 
650 /* CQ QPT, configuration */
651 struct bna_cq {
652  struct bna_qpt qpt;
653  struct bna_ccb *ccb;
654 
655  struct bna_ib ib;
656 
657  struct bna_rx *rx;
658 };
659 
664 };
665 
669 };
670 
671 /* Rx object configuration used during creation */
676  int paused;
677  int q_depth;
679  /*
680  * Small/Large (or Header/Data) buffer size to be configured
681  * for SLR and HDS queue type. Large buffer size comes from
682  * enet->mtu.
683  */
685 
688 
690 
692 };
693 
694 /* Rx Path structure - one per MSIX vector/CPU */
695 struct bna_rxp {
696  /* This should be the first one */
697  struct list_head qe;
698 
700  union bna_rxq_u rxq;
701  struct bna_cq cq;
702 
703  struct bna_rx *rx;
704 
705  /* MSI-x vector number for configuring RSS */
706  int vector;
707  int hw_id;
708 };
709 
710 /* RxF structure (hardware Rx Function) */
711 struct bna_rxf {
714 
716  union {
724  } bfi_enet_cmd;
725 
726  /* callback for bna_rxf_start() */
727  void (*start_cbfn) (struct bna_rx *rx);
729 
730  /* callback for bna_rxf_stop() */
731  void (*stop_cbfn) (struct bna_rx *rx);
733 
734  /* callback for bna_rx_receive_pause() / bna_rx_receive_resume() */
735  void (*oper_state_cbfn) (struct bnad *bnad, struct bna_rx *rx);
737 
745  void (*cam_fltr_cbfn)(struct bnad *bnad, struct bna_rx *rx);
747 
748  /* List of unicast addresses yet to be applied to h/w */
753  /* ucast addresses applied to the h/w */
757 
758  /* List of multicast addresses yet to be applied to h/w */
761  /* multicast addresses applied to the h/w */
764 
765  /* Rx modes yet to be applied to h/w */
768  /* Rx modes applied to h/w */
770 
776 
780  u8 *rit;
781  int rit_size;
782 
783  struct bna_rx *rx;
784 };
785 
786 /* Rx object */
787 struct bna_rx {
788  /* This should be the first one */
789  struct list_head qe;
790  int rid;
791  int hw_id;
792 
794 
796 
798  struct list_head rxp_q;
799 
801 
802  struct bna_rxf rxf;
803 
805 
807  union {
811  } bfi_enet_cmd;
812 
813  /* Rx event handlers */
814  void (*rcb_setup_cbfn)(struct bnad *, struct bna_rcb *);
815  void (*rcb_destroy_cbfn)(struct bnad *, struct bna_rcb *);
816  void (*ccb_setup_cbfn)(struct bnad *, struct bna_ccb *);
817  void (*ccb_destroy_cbfn)(struct bnad *, struct bna_ccb *);
818  void (*rx_stall_cbfn)(struct bnad *, struct bna_rx *);
819  void (*rx_cleanup_cbfn)(struct bnad *, struct bna_rx *);
820  void (*rx_post_cbfn)(struct bnad *, struct bna_rx *);
821 
822  /* callback for bna_rx_disable(), bna_rx_stop() */
823  void (*stop_cbfn)(void *arg, struct bna_rx *rx);
824  void *stop_cbarg;
825 
826  struct bna *bna;
827  void *priv; /* bnad's cookie */
828 };
829 
831  /* Optional */
832  void (*rcb_setup_cbfn)(struct bnad *, struct bna_rcb *);
833  void (*rcb_destroy_cbfn)(struct bnad *, struct bna_rcb *);
834  void (*ccb_setup_cbfn)(struct bnad *, struct bna_ccb *);
835  void (*ccb_destroy_cbfn)(struct bnad *, struct bna_ccb *);
836  void (*rx_stall_cbfn)(struct bnad *, struct bna_rx *);
837  /* Mandatory */
838  void (*rx_cleanup_cbfn)(struct bnad *, struct bna_rx *);
839  void (*rx_post_cbfn)(struct bnad *, struct bna_rx *);
840 };
841 
842 /* Rx module - keeps track of free, active rx objects */
843 struct bna_rx_mod {
844  struct bna *bna; /* back pointer to parent */
845  struct bna_rx *rx; /* BFI_MAX_RXQ entries */
846  struct bna_rxp *rxp; /* BFI_MAX_RXQ entries */
847  struct bna_rxq *rxq; /* BFI_MAX_RXQ entries */
848 
852 
855 
858 
860 
861  /* callback for bna_rx_mod_stop() */
863 
867 };
868 
869 /* CAM */
870 
871 struct bna_ucam_mod {
872  struct bna_mac *ucmac; /* BFI_MAX_UCMAC entries */
874 
875  struct bna *bna;
876 };
877 
879  /* This should be the first one */
880  struct list_head qe;
881  int handle;
882  int refcnt;
883 };
884 
885 struct bna_mcam_mod {
886  struct bna_mac *mcmac; /* BFI_MAX_MCMAC entries */
887  struct bna_mcam_handle *mchandle; /* BFI_MAX_MCMAC entries */
890 
891  struct bna *bna;
892 };
893 
894 /* Statistics */
895 
896 struct bna_stats {
900 };
901 
903  bool ioc_ready;
910 };
911 
912 /* BNA */
913 
914 struct bna {
915  struct bna_ident ident;
917 
918  struct bna_reg regs;
920 
921  struct bna_stats stats;
922 
924  struct bfa_cee cee;
925  struct bfa_flash flash;
926  struct bfa_msgq msgq;
927 
929  struct bna_enet enet;
931 
936 
938 
941 
942  struct bnad *bnad;
943 };
944 #endif /* __BNA_TYPES_H__ */