[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / drivers / net / wan / sbni.h
blob27715e70f28b1ba599981b78e0e07689b9eb1e1e
1 /* sbni.h: definitions for a Granch SBNI12 driver, version 5.0.0
2 * Written 2001 Denis I.Timofeev (timofeev@granch.ru)
3 * This file is distributed under the GNU GPL
4 */
6 #ifndef SBNI_H
7 #define SBNI_H
9 #ifdef SBNI_DEBUG
10 #define DP( A ) A
11 #else
12 #define DP( A )
13 #endif
16 /* We don't have official vendor id yet... */
17 #define SBNI_PCI_VENDOR 0x55
18 #define SBNI_PCI_DEVICE 0x9f
20 #define ISA_MODE 0x00
21 #define PCI_MODE 0x01
23 #define SBNI_IO_EXTENT 4
25 enum sbni_reg {
26 CSR0 = 0,
27 CSR1 = 1,
28 DAT = 2
31 /* CSR0 mapping */
32 enum {
33 BU_EMP = 0x02,
34 RC_CHK = 0x04,
35 CT_ZER = 0x08,
36 TR_REQ = 0x10,
37 TR_RDY = 0x20,
38 EN_INT = 0x40,
39 RC_RDY = 0x80
43 /* CSR1 mapping */
44 #define PR_RES 0x80
46 struct sbni_csr1 {
47 unsigned rxl : 5;
48 unsigned rate : 2;
49 unsigned : 1;
52 /* fields in frame header */
53 #define FRAME_ACK_MASK (unsigned short)0x7000
54 #define FRAME_LEN_MASK (unsigned short)0x03FF
55 #define FRAME_FIRST (unsigned short)0x8000
56 #define FRAME_RETRY (unsigned short)0x0800
58 #define FRAME_SENT_BAD (unsigned short)0x4000
59 #define FRAME_SENT_OK (unsigned short)0x3000
62 /* state flags */
63 enum {
64 FL_WAIT_ACK = 0x01,
65 FL_NEED_RESEND = 0x02,
66 FL_PREV_OK = 0x04,
67 FL_SLOW_MODE = 0x08,
68 FL_SECONDARY = 0x10,
69 #ifdef CONFIG_SBNI_MULTILINE
70 FL_SLAVE = 0x20,
71 #endif
72 FL_LINE_DOWN = 0x40
76 enum {
77 DEFAULT_IOBASEADDR = 0x210,
78 DEFAULT_INTERRUPTNUMBER = 5,
79 DEFAULT_RATE = 0,
80 DEFAULT_FRAME_LEN = 1012
83 #define DEF_RXL_DELTA -1
84 #define DEF_RXL 0xf
86 #define SBNI_SIG 0x5a
88 #define SBNI_MIN_LEN 60 /* Shortest Ethernet frame without FCS */
89 #define SBNI_MAX_FRAME 1023
90 #define ETHER_MAX_LEN 1518
92 #define SBNI_TIMEOUT (HZ/10)
94 #define TR_ERROR_COUNT 32
95 #define CHANGE_LEVEL_START_TICKS 4
97 #define SBNI_MAX_NUM_CARDS 16
99 /* internal SBNI-specific statistics */
100 struct sbni_in_stats {
101 u32 all_rx_number;
102 u32 bad_rx_number;
103 u32 timeout_number;
104 u32 all_tx_number;
105 u32 resend_tx_number;
108 /* SBNI ioctl params */
109 #define SIOCDEVGETINSTATS SIOCDEVPRIVATE
110 #define SIOCDEVRESINSTATS SIOCDEVPRIVATE+1
111 #define SIOCDEVGHWSTATE SIOCDEVPRIVATE+2
112 #define SIOCDEVSHWSTATE SIOCDEVPRIVATE+3
113 #define SIOCDEVENSLAVE SIOCDEVPRIVATE+4
114 #define SIOCDEVEMANSIPATE SIOCDEVPRIVATE+5
117 /* data packet for SIOCDEVGHWSTATE/SIOCDEVSHWSTATE ioctl requests */
118 struct sbni_flags {
119 u32 rxl : 4;
120 u32 rate : 2;
121 u32 fixed_rxl : 1;
122 u32 slow_mode : 1;
123 u32 mac_addr : 24;
127 * CRC-32 stuff
129 #define CRC32(c,crc) (crc32tab[((size_t)(crc) ^ (c)) & 0xff] ^ (((crc) >> 8) & 0x00FFFFFF))
130 /* CRC generator 0xEDB88320 */
131 /* CRC remainder 0x2144DF1C */
132 /* CRC initial value 0x00000000 */
133 #define CRC32_REMAINDER 0x2144DF1C
134 #define CRC32_INITIAL 0x00000000
136 #ifndef __initdata
137 #define __initdata
138 #endif
140 #endif