eni.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* drivers/atm/eni.h - Efficient Networks ENI155P device driver declarations */
  2. /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
  3. #ifndef DRIVER_ATM_ENI_H
  4. #define DRIVER_ATM_ENI_H
  5. #include <linux/atm.h>
  6. #include <linux/atmdev.h>
  7. #include <linux/sonet.h>
  8. #include <linux/skbuff.h>
  9. #include <linux/time.h>
  10. #include <linux/pci.h>
  11. #include <linux/spinlock.h>
  12. #include <asm/atomic.h>
  13. #include "midway.h"
  14. #define DEV_LABEL "eni"
  15. #define UBR_BUFFER (128*1024) /* UBR buffer size */
  16. #define RX_DMA_BUF 8 /* burst and skip a few things */
  17. #define TX_DMA_BUF 100 /* should be enough for 64 kB */
  18. #define DEFAULT_RX_MULT 300 /* max_sdu*3 */
  19. #define DEFAULT_TX_MULT 300 /* max_sdu*3 */
  20. #define ENI_ZEROES_SIZE 4 /* need that many DMA-able zero bytes */
  21. struct eni_free {
  22. void __iomem *start; /* counting in bytes */
  23. int order;
  24. };
  25. struct eni_tx {
  26. void __iomem *send; /* base, 0 if unused */
  27. int prescaler; /* shaping prescaler */
  28. int resolution; /* shaping divider */
  29. unsigned long tx_pos; /* current TX write position */
  30. unsigned long words; /* size of TX queue */
  31. int index; /* TX channel number */
  32. int reserved; /* reserved peak cell rate */
  33. int shaping; /* shaped peak cell rate */
  34. struct sk_buff_head backlog; /* queue of waiting TX buffers */
  35. };
  36. struct eni_vcc {
  37. int (*rx)(struct atm_vcc *vcc); /* RX function, NULL if none */
  38. void __iomem *recv; /* receive buffer */
  39. unsigned long words; /* its size in words */
  40. unsigned long descr; /* next descriptor (RX) */
  41. unsigned long rx_pos; /* current RX descriptor pos */
  42. struct eni_tx *tx; /* TXer, NULL if none */
  43. int rxing; /* number of pending PDUs */
  44. int servicing; /* number of waiting VCs (0 or 1) */
  45. int txing; /* number of pending TX bytes */
  46. ktime_t timestamp; /* for RX timing */
  47. struct atm_vcc *next; /* next pending RX */
  48. struct sk_buff *last; /* last PDU being DMAed (used to carry
  49. discard information) */
  50. };
  51. struct eni_dev {
  52. /*-------------------------------- spinlock */
  53. spinlock_t lock; /* sync with interrupt */
  54. struct tasklet_struct task; /* tasklet for interrupt work */
  55. u32 events; /* pending events */
  56. /*-------------------------------- base pointers into Midway address
  57. space */
  58. void __iomem *phy; /* PHY interface chip registers */
  59. void __iomem *reg; /* register base */
  60. void __iomem *ram; /* RAM base */
  61. void __iomem *vci; /* VCI table */
  62. void __iomem *rx_dma; /* RX DMA queue */
  63. void __iomem *tx_dma; /* TX DMA queue */
  64. void __iomem *service; /* service list */
  65. /*-------------------------------- TX part */
  66. struct eni_tx tx[NR_CHAN]; /* TX channels */
  67. struct eni_tx *ubr; /* UBR channel */
  68. struct sk_buff_head tx_queue; /* PDUs currently being TX DMAed*/
  69. wait_queue_head_t tx_wait; /* for close */
  70. int tx_bw; /* remaining bandwidth */
  71. u32 dma[TX_DMA_BUF*2]; /* DMA request scratch area */
  72. int tx_mult; /* buffer size multiplier (percent) */
  73. /*-------------------------------- RX part */
  74. u32 serv_read; /* host service read index */
  75. struct atm_vcc *fast,*last_fast;/* queues of VCCs with pending PDUs */
  76. struct atm_vcc *slow,*last_slow;
  77. struct atm_vcc **rx_map; /* for fast lookups */
  78. struct sk_buff_head rx_queue; /* PDUs currently being RX-DMAed */
  79. wait_queue_head_t rx_wait; /* for close */
  80. int rx_mult; /* buffer size multiplier (percent) */
  81. /*-------------------------------- statistics */
  82. unsigned long lost; /* number of lost cells (RX) */
  83. /*-------------------------------- memory management */
  84. unsigned long base_diff; /* virtual-real base address */
  85. int free_len; /* free list length */
  86. struct eni_free *free_list; /* free list */
  87. int free_list_size; /* maximum size of free list */
  88. /*-------------------------------- ENI links */
  89. struct atm_dev *more; /* other ENI devices */
  90. /*-------------------------------- general information */
  91. int mem; /* RAM on board (in bytes) */
  92. int asic; /* PCI interface type, 0 for FPGA */
  93. unsigned int irq; /* IRQ */
  94. struct pci_dev *pci_dev; /* PCI stuff */
  95. };
  96. #define ENI_DEV(d) ((struct eni_dev *) (d)->dev_data)
  97. #define ENI_VCC(d) ((struct eni_vcc *) (d)->dev_data)
  98. struct eni_skb_prv {
  99. struct atm_skb_data _; /* reserved */
  100. unsigned long pos; /* position of next descriptor */
  101. int size; /* PDU size in reassembly buffer */
  102. dma_addr_t paddr; /* DMA handle */
  103. };
  104. #define ENI_PRV_SIZE(skb) (((struct eni_skb_prv *) (skb)->cb)->size)
  105. #define ENI_PRV_POS(skb) (((struct eni_skb_prv *) (skb)->cb)->pos)
  106. #define ENI_PRV_PADDR(skb) (((struct eni_skb_prv *) (skb)->cb)->paddr)
  107. #endif