0001
0002
0003
0004
0005
0006
0007 #ifndef DRIVER_ATM_ENI_H
0008 #define DRIVER_ATM_ENI_H
0009
0010 #include <linux/atm.h>
0011 #include <linux/atmdev.h>
0012 #include <linux/interrupt.h>
0013 #include <linux/sonet.h>
0014 #include <linux/skbuff.h>
0015 #include <linux/time.h>
0016 #include <linux/pci.h>
0017 #include <linux/spinlock.h>
0018 #include <linux/atomic.h>
0019
0020 #include "midway.h"
0021
0022
0023 #define DEV_LABEL "eni"
0024
0025 #define UBR_BUFFER (128*1024)
0026
0027 #define RX_DMA_BUF 8
0028 #define TX_DMA_BUF 100
0029
0030 #define DEFAULT_RX_MULT 300
0031 #define DEFAULT_TX_MULT 300
0032
0033 #define ENI_ZEROES_SIZE 4
0034
0035
0036 struct eni_free {
0037 void __iomem *start;
0038 int order;
0039 };
0040
0041 struct eni_tx {
0042 void __iomem *send;
0043 int prescaler;
0044 int resolution;
0045 unsigned long tx_pos;
0046 unsigned long words;
0047 int index;
0048 int reserved;
0049 int shaping;
0050 struct sk_buff_head backlog;
0051 };
0052
0053 struct eni_vcc {
0054 int (*rx)(struct atm_vcc *vcc);
0055 void __iomem *recv;
0056 unsigned long words;
0057 unsigned long descr;
0058 unsigned long rx_pos;
0059 struct eni_tx *tx;
0060 int rxing;
0061 int servicing;
0062 int txing;
0063 ktime_t timestamp;
0064 struct atm_vcc *next;
0065 struct sk_buff *last;
0066
0067 };
0068
0069 struct eni_dev {
0070
0071 spinlock_t lock;
0072 struct tasklet_struct task;
0073 u32 events;
0074
0075
0076 void __iomem *ioaddr;
0077 void __iomem *phy;
0078 void __iomem *reg;
0079 void __iomem *ram;
0080 void __iomem *vci;
0081 void __iomem *rx_dma;
0082 void __iomem *tx_dma;
0083 void __iomem *service;
0084
0085 struct eni_tx tx[NR_CHAN];
0086 struct eni_tx *ubr;
0087 struct sk_buff_head tx_queue;
0088 wait_queue_head_t tx_wait;
0089 int tx_bw;
0090 u32 dma[TX_DMA_BUF*2];
0091 struct eni_zero {
0092 u32 *addr;
0093 dma_addr_t dma;
0094 } zero;
0095 int tx_mult;
0096
0097 u32 serv_read;
0098 struct atm_vcc *fast,*last_fast;
0099 struct atm_vcc *slow,*last_slow;
0100 struct atm_vcc **rx_map;
0101 struct sk_buff_head rx_queue;
0102 wait_queue_head_t rx_wait;
0103 int rx_mult;
0104
0105 unsigned long lost;
0106
0107 unsigned long base_diff;
0108 int free_len;
0109 struct eni_free *free_list;
0110 int free_list_size;
0111
0112 struct atm_dev *more;
0113
0114 int mem;
0115 int asic;
0116 unsigned int irq;
0117 struct pci_dev *pci_dev;
0118 };
0119
0120
0121 #define ENI_DEV(d) ((struct eni_dev *) (d)->dev_data)
0122 #define ENI_VCC(d) ((struct eni_vcc *) (d)->dev_data)
0123
0124
0125 struct eni_skb_prv {
0126 struct atm_skb_data _;
0127 unsigned long pos;
0128 int size;
0129 dma_addr_t paddr;
0130 };
0131
0132 #define ENI_PRV_SIZE(skb) (((struct eni_skb_prv *) (skb)->cb)->size)
0133 #define ENI_PRV_POS(skb) (((struct eni_skb_prv *) (skb)->cb)->pos)
0134 #define ENI_PRV_PADDR(skb) (((struct eni_skb_prv *) (skb)->cb)->paddr)
0135
0136 #endif