1 /* drivers/atm/zatm.h - ZeitNet ZN122x device driver declarations */
3 /* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */
6 #ifndef DRIVER_ATM_ZATM_H
7 #define DRIVER_ATM_ZATM_H
9 #include <linux/config.h>
10 #include <linux/skbuff.h>
11 #include <linux/atm.h>
12 #include <linux/atmdev.h>
13 #include <linux/sonet.h>
14 #include <linux/pci.h>
17 #define DEV_LABEL "zatm"
19 #define MAX_AAL5_PDU 10240 /* allocate for AAL5 PDUs of this size */
20 #define MAX_RX_SIZE_LD 14 /* ceil(log2((MAX_AAL5_PDU+47)/48)) */
22 #define LOW_MARK 12 /* start adding new buffers if less than 12 */
23 #define HIGH_MARK 30 /* stop adding buffers after reaching 30 */
24 #define OFF_CNG_THRES 5 /* threshold for offset changes */
26 #define RX_SIZE 2 /* RX lookup entry size (in bytes) */
27 #define NR_POOLS 32 /* number of free buffer pointers */
28 #define POOL_SIZE 8 /* buffer entry size (in bytes) */
29 #define NR_SHAPERS 16 /* number of shapers */
30 #define SHAPER_SIZE 4 /* shaper entry size (in bytes) */
31 #define VC_SIZE 32 /* VC dsc (TX or RX) size (in bytes) */
33 #define RING_ENTRIES 32 /* ring entries (without back pointer) */
34 #define RING_WORDS 4 /* ring element size */
35 #define RING_SIZE (sizeof(unsigned long)*(RING_ENTRIES+1)*RING_WORDS)
37 #define NR_MBX 4 /* four mailboxes */
38 #define MBX_RX_0 0 /* mailbox indices */
44 /*-------------------------------- RX part */
45 int rx_chan
; /* RX channel, 0 if none */
46 int pool
; /* free buffer pool */
47 /*-------------------------------- TX part */
48 int tx_chan
; /* TX channel, 0 if none */
49 int shaper
; /* shaper, <0 if none */
50 struct sk_buff_head tx_queue
; /* list of buffers in transit */
51 wait_queue_head_t tx_wait
; /* for close */
52 u32
*ring
; /* transmit ring */
53 int ring_curr
; /* current write position */
54 int txing
; /* number of transmits in progress */
55 struct sk_buff_head backlog
; /* list of buffers waiting for ring */
59 /*-------------------------------- TX part */
60 int tx_bw
; /* remaining bandwidth */
61 u32 free_shapers
; /* bit set */
62 int ubr
; /* UBR shaper; -1 if none */
63 int ubr_ref_cnt
; /* number of VCs using UBR shaper */
64 /*-------------------------------- RX part */
65 int pool_ref
[NR_POOLS
]; /* free buffer pool usage counters */
66 volatile struct sk_buff
*last_free
[NR_POOLS
];
67 /* last entry in respective pool */
68 struct sk_buff_head pool
[NR_POOLS
];/* free buffer pools */
69 struct zatm_pool_info pool_info
[NR_POOLS
]; /* pool information */
70 /*-------------------------------- maps */
71 struct atm_vcc
**tx_map
; /* TX VCCs */
72 struct atm_vcc
**rx_map
; /* RX VCCs */
73 int chans
; /* map size, must be 2^n */
74 /*-------------------------------- mailboxes */
75 unsigned long mbx_start
[NR_MBX
];/* start addresses */
76 u16 mbx_end
[NR_MBX
]; /* end offset (in bytes) */
77 /*-------------------------------- other pointers */
78 u32 pool_base
; /* Free buffer pool dsc (word addr) */
79 /*-------------------------------- ZATM links */
80 struct atm_dev
*more
; /* other ZATM devices */
81 /*-------------------------------- general information */
82 int mem
; /* RAM on board (in bytes) */
83 int khz
; /* timer clock */
84 int copper
; /* PHY type */
85 unsigned char irq
; /* IRQ */
86 unsigned int base
; /* IO base address */
87 struct pci_dev
*pci_dev
; /* PCI stuff */
92 #define ZATM_DEV(d) ((struct zatm_dev *) (d)->dev_data)
93 #define ZATM_VCC(d) ((struct zatm_vcc *) (d)->dev_data)
97 struct atm_skb_data _
; /* reserved */
98 u32
*dsc
; /* pointer to skb's descriptor */
101 #define ZATM_PRV_DSC(skb) (((struct zatm_skb_prv *) (skb)->cb)->dsc)