Go to the documentation of this file.
28 #include <linux/types.h>
29 #include <linux/errno.h>
30 #include <linux/module.h>
31 #include <linux/pci.h>
32 #include <linux/netdevice.h>
36 #include <linux/slab.h>
37 #include <linux/list.h>
39 #include <linux/sched.h>
42 #include <linux/ipv6.h>
43 #include <linux/udp.h>
44 #include <linux/mii.h>
48 #include <linux/tcp.h>
49 #include <linux/ethtool.h>
50 #include <linux/if_vlan.h>
57 #define PCI_REG_COMMAND 0x04
58 #define CMD_IO_SPACE 0x0001
59 #define CMD_MEMORY_SPACE 0x0002
60 #define CMD_BUS_MASTER 0x0004
67 #define AT_WUFC_LNKC 0x00000001
68 #define AT_WUFC_MAG 0x00000002
69 #define AT_WUFC_EX 0x00000004
70 #define AT_WUFC_MC 0x00000008
71 #define AT_WUFC_BC 0x00000010
73 #define SPEED_0 0xffff
78 #define AT_ERR_EEPROM 1
80 #define AT_ERR_CONFIG 3
81 #define AT_ERR_PARAM 4
82 #define AT_ERR_MAC_TYPE 5
83 #define AT_ERR_PHY_TYPE 6
84 #define AT_ERR_PHY_SPEED 7
85 #define AT_ERR_PHY_RES 8
86 #define AT_ERR_TIMEOUT 9
88 #define MAX_JUMBO_FRAME_SIZE 0x2000
90 #define AT_VLAN_TAG_TO_TPD_TAG(_vlan, _tpd) \
91 _tpd = (((_vlan) << (4)) | (((_vlan) >> 13) & 7) |\
94 #define AT_TPD_TAG_TO_VLAN_TAG(_tpd, _vlan) \
95 _vlan = (((_tpd) >> 8) | (((_tpd) & 0x77) << 9) |\
96 (((_tdp) & 0x88) << 5))
98 #define AT_MAX_RECEIVE_QUEUE 4
99 #define AT_PAGE_NUM_PER_QUEUE 2
101 #define AT_DMA_HI_ADDR_MASK 0xffffffff00000000ULL
102 #define AT_DMA_LO_ADDR_MASK 0x00000000ffffffffULL
104 #define AT_TX_WATCHDOG (5 * HZ)
105 #define AT_MAX_INT_WORK 10
106 #define AT_TWSI_EEPROM_TIMEOUT 100
107 #define AT_HW_MAX_IDLE_DELAY 10
108 #define AT_SUSPEND_LINK_TIMEOUT 28
110 #define AT_REGS_LEN 75
111 #define AT_EEPROM_LEN 512
112 #define AT_ADV_MASK (ADVERTISE_10_HALF |\
114 ADVERTISE_100_HALF |\
115 ADVERTISE_100_FULL |\
119 #define TPD_BUFLEN_MASK 0x3FFF
120 #define TPD_BUFLEN_SHIFT 0
121 #define TPD_DMAINT_MASK 0x0001
122 #define TPD_DMAINT_SHIFT 14
123 #define TPD_PKTNT_MASK 0x0001
124 #define TPD_PKTINT_SHIFT 15
125 #define TPD_VLANTAG_MASK 0xFFFF
126 #define TPD_VLAN_SHIFT 16
129 #define TPD_EOP_MASK 0x0001
130 #define TPD_EOP_SHIFT 0
131 #define TPD_IP_VERSION_MASK 0x0001
132 #define TPD_IP_VERSION_SHIFT 1
133 #define TPD_INS_VL_TAG_MASK 0x0001
134 #define TPD_INS_VL_TAG_SHIFT 2
135 #define TPD_CC_SEGMENT_EN_MASK 0x0001
136 #define TPD_CC_SEGMENT_EN_SHIFT 3
137 #define TPD_SEGMENT_EN_MASK 0x0001
138 #define TPD_SEGMENT_EN_SHIFT 4
141 #define TPD_IP_CSUM_MASK 0x0001
142 #define TPD_IP_CSUM_SHIFT 5
143 #define TPD_TCP_CSUM_MASK 0x0001
144 #define TPD_TCP_CSUM_SHIFT 6
145 #define TPD_UDP_CSUM_MASK 0x0001
146 #define TPD_UDP_CSUM_SHIFT 7
149 #define TPD_V6_IPHLLO_MASK 0x0007
150 #define TPD_V6_IPHLLO_SHIFT 7
153 #define TPD_VL_TAGGED_MASK 0x0001
154 #define TPD_VL_TAGGED_SHIFT 8
155 #define TPD_ETHTYPE_MASK 0x0001
156 #define TPD_ETHTYPE_SHIFT 9
159 #define TDP_V4_IPHL_MASK 0x000F
160 #define TPD_V4_IPHL_SHIFT 10
163 #define TPD_V6_IPHLHI_MASK 0x000F
164 #define TPD_V6_IPHLHI_SHIFT 10
167 #define TPD_TCPHDRLEN_MASK 0x000F
168 #define TPD_TCPHDRLEN_SHIFT 14
169 #define TPD_HDRFLAG_MASK 0x0001
170 #define TPD_HDRFLAG_SHIFT 18
171 #define TPD_MSS_MASK 0x1FFF
172 #define TPD_MSS_SHIFT 19
175 #define TPD_PLOADOFFSET_MASK 0x00FF
176 #define TPD_PLOADOFFSET_SHIFT 16
177 #define TPD_CCSUMOFFSET_MASK 0x00FF
178 #define TPD_CCSUMOFFSET_SHIFT 24
187 #define MAX_TX_BUF_LEN 0x2000
188 #define MAX_TX_BUF_SHIFT 13
192 #define RRS_RX_CSUM_MASK 0xFFFF
193 #define RRS_RX_CSUM_SHIFT 0
194 #define RRS_PKT_SIZE_MASK 0x3FFF
195 #define RRS_PKT_SIZE_SHIFT 16
196 #define RRS_CPU_NUM_MASK 0x0003
197 #define RRS_CPU_NUM_SHIFT 30
199 #define RRS_IS_RSS_IPV4 0x0001
200 #define RRS_IS_RSS_IPV4_TCP 0x0002
201 #define RRS_IS_RSS_IPV6 0x0004
202 #define RRS_IS_RSS_IPV6_TCP 0x0008
203 #define RRS_IS_IPV6 0x0010
204 #define RRS_IS_IP_FRAG 0x0020
205 #define RRS_IS_IP_DF 0x0040
206 #define RRS_IS_802_3 0x0080
207 #define RRS_IS_VLAN_TAG 0x0100
208 #define RRS_IS_ERR_FRAME 0x0200
209 #define RRS_IS_IPV4 0x0400
210 #define RRS_IS_UDP 0x0800
211 #define RRS_IS_TCP 0x1000
212 #define RRS_IS_BCAST 0x2000
213 #define RRS_IS_MCAST 0x4000
214 #define RRS_IS_PAUSE 0x8000
216 #define RRS_ERR_BAD_CRC 0x0001
217 #define RRS_ERR_CODE 0x0002
218 #define RRS_ERR_DRIBBLE 0x0004
219 #define RRS_ERR_RUNT 0x0008
220 #define RRS_ERR_RX_OVERFLOW 0x0010
221 #define RRS_ERR_TRUNC 0x0020
222 #define RRS_ERR_IP_CSUM 0x0040
223 #define RRS_ERR_L4_CSUM 0x0080
224 #define RRS_ERR_LENGTH 0x0100
225 #define RRS_ERR_DES_ADDR 0x0200
334 #define MEDIA_TYPE_AUTO_SENSOR 0
335 #define MEDIA_TYPE_100M_FULL 1
336 #define MEDIA_TYPE_100M_HALF 2
337 #define MEDIA_TYPE_10M_FULL 3
338 #define MEDIA_TYPE_10M_HALF 4
341 #define ADVERTISE_10_HALF 0x0001
342 #define ADVERTISE_10_FULL 0x0002
343 #define ADVERTISE_100_HALF 0x0004
344 #define ADVERTISE_100_FULL 0x0008
345 #define ADVERTISE_1000_HALF 0x0010
346 #define ADVERTISE_1000_FULL 0x0020
381 #define ATL1E_TX_PCIMAP_SINGLE 0x0001
382 #define ATL1E_TX_PCIMAP_PAGE 0x0002
383 #define ATL1E_TX_PCIMAP_TYPE_MASK 0x0003
388 #define ATL1E_SET_PCIMAP_TYPE(tx_buff, type) do { \
389 ((tx_buff)->flags) &= ~ATL1E_TX_PCIMAP_TYPE_MASK; \
390 ((tx_buff)->flags) |= (type); \
464 #define __AT_TESTING 0x0001
465 #define __AT_RESETTING 0x0002
466 #define __AT_DOWN 0x0003
473 #define AT_WRITE_REG(a, reg, value) ( \
474 writel((value), ((a)->hw_addr + reg)))
476 #define AT_WRITE_FLUSH(a) (\
479 #define AT_READ_REG(a, reg) ( \
480 readl((a)->hw_addr + reg))
482 #define AT_WRITE_REGB(a, reg, value) (\
483 writeb((value), ((a)->hw_addr + reg)))
485 #define AT_READ_REGB(a, reg) (\
486 readb((a)->hw_addr + reg))
488 #define AT_WRITE_REGW(a, reg, value) (\
489 writew((value), ((a)->hw_addr + reg)))
491 #define AT_READ_REGW(a, reg) (\
492 readw((a)->hw_addr + reg))
494 #define AT_WRITE_REG_ARRAY(a, reg, offset, value) ( \
495 writel((value), (((a)->hw_addr + reg) + ((offset) << 2))))
497 #define AT_READ_REG_ARRAY(a, reg, offset) ( \
498 readl(((a)->hw_addr + reg) + ((offset) << 2)))