1
2
3
4
5
6
7 #ifndef DRIVER_ATM_ENI_H
8 #define DRIVER_ATM_ENI_H
9
10 #include <linux/atm.h>
11 #include <linux/atmdev.h>
12 #include <linux/interrupt.h>
13 #include <linux/sonet.h>
14 #include <linux/skbuff.h>
15 #include <linux/time.h>
16 #include <linux/pci.h>
17 #include <linux/spinlock.h>
18 #include <linux/atomic.h>
19
20 #include "midway.h"
21
22
23 #define DEV_LABEL "eni"
24
25 #define UBR_BUFFER (128*1024)
26
27 #define RX_DMA_BUF 8
28 #define TX_DMA_BUF 100
29
30 #define DEFAULT_RX_MULT 300
31 #define DEFAULT_TX_MULT 300
32
33 #define ENI_ZEROES_SIZE 4
34
35
36 struct eni_free {
37 void __iomem *start;
38 int order;
39 };
40
41 struct eni_tx {
42 void __iomem *send;
43 int prescaler;
44 int resolution;
45 unsigned long tx_pos;
46 unsigned long words;
47 int index;
48 int reserved;
49 int shaping;
50 struct sk_buff_head backlog;
51 };
52
53 struct eni_vcc {
54 int (*rx)(struct atm_vcc *vcc);
55 void __iomem *recv;
56 unsigned long words;
57 unsigned long descr;
58 unsigned long rx_pos;
59 struct eni_tx *tx;
60 int rxing;
61 int servicing;
62 int txing;
63 ktime_t timestamp;
64 struct atm_vcc *next;
65 struct sk_buff *last;
66
67 };
68
69 struct eni_dev {
70
71 spinlock_t lock;
72 struct tasklet_struct task;
73 u32 events;
74
75
76 void __iomem *ioaddr;
77 void __iomem *phy;
78 void __iomem *reg;
79 void __iomem *ram;
80 void __iomem *vci;
81 void __iomem *rx_dma;
82 void __iomem *tx_dma;
83 void __iomem *service;
84
85 struct eni_tx tx[NR_CHAN];
86 struct eni_tx *ubr;
87 struct sk_buff_head tx_queue;
88 wait_queue_head_t tx_wait;
89 int tx_bw;
90 u32 dma[TX_DMA_BUF*2];
91 struct eni_zero {
92 u32 *addr;
93 dma_addr_t dma;
94 } zero;
95 int tx_mult;
96
97 u32 serv_read;
98 struct atm_vcc *fast,*last_fast;
99 struct atm_vcc *slow,*last_slow;
100 struct atm_vcc **rx_map;
101 struct sk_buff_head rx_queue;
102 wait_queue_head_t rx_wait;
103 int rx_mult;
104
105 unsigned long lost;
106
107 unsigned long base_diff;
108 int free_len;
109 struct eni_free *free_list;
110 int free_list_size;
111
112 struct atm_dev *more;
113
114 int mem;
115 int asic;
116 unsigned int irq;
117 struct pci_dev *pci_dev;
118 };
119
120
121 #define ENI_DEV(d) ((struct eni_dev *) (d)->dev_data)
122 #define ENI_VCC(d) ((struct eni_vcc *) (d)->dev_data)
123
124
125 struct eni_skb_prv {
126 struct atm_skb_data _;
127 unsigned long pos;
128 int size;
129 dma_addr_t paddr;
130 };
131
132 #define ENI_PRV_SIZE(skb) (((struct eni_skb_prv *) (skb)->cb)->size)
133 #define ENI_PRV_POS(skb) (((struct eni_skb_prv *) (skb)->cb)->pos)
134 #define ENI_PRV_PADDR(skb) (((struct eni_skb_prv *) (skb)->cb)->paddr)
135
136 #endif