blob: 6f5ee27f80fcbe12939dc52fdb7ccffb6168d150 [file] [log] [blame]
Jens Osterkampaaec0fa2005-09-05 15:19:29 -07001/*
2 * Network device driver for Cell Processor-Based Blade
3 *
4 * (C) Copyright IBM Corp. 2005
5 *
6 * Authors : Utz Bacher <utz.bacher@de.ibm.com>
7 * Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef _SPIDER_NET_H
25#define _SPIDER_NET_H
26
Linas Vepstas5a028872006-12-13 15:08:25 -060027#define VERSION "1.6 B"
Linas Vepstas90f10842006-10-10 15:56:04 -050028
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070029#include "sungem_phy.h"
30
31extern int spider_net_stop(struct net_device *netdev);
32extern int spider_net_open(struct net_device *netdev);
33
Jeff Garzik7282d492006-09-13 14:30:00 -040034extern const struct ethtool_ops spider_net_ethtool_ops;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070035
36extern char spider_net_driver_name[];
37
Arnd Bergmann11f1a522006-01-12 17:16:44 -050038#define SPIDER_NET_MAX_FRAME 2312
39#define SPIDER_NET_MAX_MTU 2294
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070040#define SPIDER_NET_MIN_MTU 64
41
42#define SPIDER_NET_RXBUF_ALIGN 128
43
Arnd Bergmann11f1a522006-01-12 17:16:44 -050044#define SPIDER_NET_RX_DESCRIPTORS_DEFAULT 256
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070045#define SPIDER_NET_RX_DESCRIPTORS_MIN 16
Arnd Bergmann11f1a522006-01-12 17:16:44 -050046#define SPIDER_NET_RX_DESCRIPTORS_MAX 512
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070047
Arnd Bergmann11f1a522006-01-12 17:16:44 -050048#define SPIDER_NET_TX_DESCRIPTORS_DEFAULT 256
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070049#define SPIDER_NET_TX_DESCRIPTORS_MIN 16
Arnd Bergmann11f1a522006-01-12 17:16:44 -050050#define SPIDER_NET_TX_DESCRIPTORS_MAX 512
51
Linas Vepstas204e5fa2006-10-10 16:11:33 -050052#define SPIDER_NET_TX_TIMER (HZ/5)
Kou Ishizakiabdb66b2007-02-20 16:33:41 -060053#define SPIDER_NET_ANEG_TIMER (HZ)
54#define SPIDER_NET_ANEG_TIMEOUT 2
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070055
56#define SPIDER_NET_RX_CSUM_DEFAULT 1
57
Arnd Bergmann11f1a522006-01-12 17:16:44 -050058#define SPIDER_NET_WATCHDOG_TIMEOUT 50*HZ
59#define SPIDER_NET_NAPI_WEIGHT 64
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070060
Arnd Bergmann11f1a522006-01-12 17:16:44 -050061#define SPIDER_NET_FIRMWARE_SEQS 6
62#define SPIDER_NET_FIRMWARE_SEQWORDS 1024
63#define SPIDER_NET_FIRMWARE_LEN (SPIDER_NET_FIRMWARE_SEQS * \
64 SPIDER_NET_FIRMWARE_SEQWORDS * \
65 sizeof(u32))
Jens Osterkampaaec0fa2005-09-05 15:19:29 -070066#define SPIDER_NET_FIRMWARE_NAME "spider_fw.bin"
67
68/** spider_net SMMIO registers */
69#define SPIDER_NET_GHIINT0STS 0x00000000
70#define SPIDER_NET_GHIINT1STS 0x00000004
71#define SPIDER_NET_GHIINT2STS 0x00000008
72#define SPIDER_NET_GHIINT0MSK 0x00000010
73#define SPIDER_NET_GHIINT1MSK 0x00000014
74#define SPIDER_NET_GHIINT2MSK 0x00000018
75
76#define SPIDER_NET_GRESUMINTNUM 0x00000020
77#define SPIDER_NET_GREINTNUM 0x00000024
78
79#define SPIDER_NET_GFFRMNUM 0x00000028
80#define SPIDER_NET_GFAFRMNUM 0x0000002c
81#define SPIDER_NET_GFBFRMNUM 0x00000030
82#define SPIDER_NET_GFCFRMNUM 0x00000034
83#define SPIDER_NET_GFDFRMNUM 0x00000038
84
85/* clear them (don't use it) */
86#define SPIDER_NET_GFREECNNUM 0x0000003c
87#define SPIDER_NET_GONETIMENUM 0x00000040
88
89#define SPIDER_NET_GTOUTFRMNUM 0x00000044
90
91#define SPIDER_NET_GTXMDSET 0x00000050
92#define SPIDER_NET_GPCCTRL 0x00000054
93#define SPIDER_NET_GRXMDSET 0x00000058
94#define SPIDER_NET_GIPSECINIT 0x0000005c
95#define SPIDER_NET_GFTRESTRT 0x00000060
96#define SPIDER_NET_GRXDMAEN 0x00000064
97#define SPIDER_NET_GMRWOLCTRL 0x00000068
98#define SPIDER_NET_GPCWOPCMD 0x0000006c
99#define SPIDER_NET_GPCROPCMD 0x00000070
100#define SPIDER_NET_GTTFRMCNT 0x00000078
101#define SPIDER_NET_GTESTMD 0x0000007c
102
103#define SPIDER_NET_GSINIT 0x00000080
104#define SPIDER_NET_GSnPRGADR 0x00000084
105#define SPIDER_NET_GSnPRGDAT 0x00000088
106
107#define SPIDER_NET_GMACOPEMD 0x00000100
108#define SPIDER_NET_GMACLENLMT 0x00000108
Kou Ishizakiabdb66b2007-02-20 16:33:41 -0600109#define SPIDER_NET_GMACST 0x00000110
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700110#define SPIDER_NET_GMACINTEN 0x00000118
111#define SPIDER_NET_GMACPHYCTRL 0x00000120
112
113#define SPIDER_NET_GMACAPAUSE 0x00000154
114#define SPIDER_NET_GMACTXPAUSE 0x00000164
115
116#define SPIDER_NET_GMACMODE 0x000001b0
117#define SPIDER_NET_GMACBSTLMT 0x000001b4
118
119#define SPIDER_NET_GMACUNIMACU 0x000001c0
120#define SPIDER_NET_GMACUNIMACL 0x000001c8
121
122#define SPIDER_NET_GMRMHFILnR 0x00000400
123#define SPIDER_NET_MULTICAST_HASHES 256
124
125#define SPIDER_NET_GMRUAFILnR 0x00000500
126#define SPIDER_NET_GMRUA0FIL15R 0x00000578
127
Jens Osterkampb636d172006-05-04 05:59:56 -0400128#define SPIDER_NET_GTTQMSK 0x00000934
129
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700130/* RX DMA controller registers, all 0x00000a.. are for DMA controller A,
131 * 0x00000b.. for DMA controller B, etc. */
132#define SPIDER_NET_GDADCHA 0x00000a00
133#define SPIDER_NET_GDADMACCNTR 0x00000a04
134#define SPIDER_NET_GDACTDPA 0x00000a08
135#define SPIDER_NET_GDACTDCNT 0x00000a0c
136#define SPIDER_NET_GDACDBADDR 0x00000a20
137#define SPIDER_NET_GDACDBSIZE 0x00000a24
138#define SPIDER_NET_GDACNEXTDA 0x00000a28
139#define SPIDER_NET_GDACCOMST 0x00000a2c
140#define SPIDER_NET_GDAWBCOMST 0x00000a30
141#define SPIDER_NET_GDAWBRSIZE 0x00000a34
142#define SPIDER_NET_GDAWBVSIZE 0x00000a38
143#define SPIDER_NET_GDAWBTRST 0x00000a3c
144#define SPIDER_NET_GDAWBTRERR 0x00000a40
145
146/* TX DMA controller registers */
147#define SPIDER_NET_GDTDCHA 0x00000e00
148#define SPIDER_NET_GDTDMACCNTR 0x00000e04
149#define SPIDER_NET_GDTCDPA 0x00000e08
150#define SPIDER_NET_GDTDMASEL 0x00000e14
151
152#define SPIDER_NET_ECMODE 0x00000f00
153/* clock and reset control register */
154#define SPIDER_NET_CKRCTRL 0x00000ff0
155
156/** SCONFIG registers */
157#define SPIDER_NET_SCONFIG_IOACTE 0x00002810
158
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500159/** interrupt mask registers */
160#define SPIDER_NET_INT0_MASK_VALUE 0x3f7fe2c7
161#define SPIDER_NET_INT1_MASK_VALUE 0xffff7ff7
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700162/* no MAC aborts -> auto retransmission */
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500163#define SPIDER_NET_INT2_MASK_VALUE 0xffef7ff1
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700164
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700165/* we rely on flagged descriptor interrupts */
166#define SPIDER_NET_FRAMENUM_VALUE 0x00000000
167/* set this first, then the FRAMENUM_VALUE */
168#define SPIDER_NET_GFXFRAMES_VALUE 0x00000000
169
170#define SPIDER_NET_STOP_SEQ_VALUE 0x00000000
171#define SPIDER_NET_RUN_SEQ_VALUE 0x0000007e
172
173#define SPIDER_NET_PHY_CTRL_VALUE 0x00040040
174/* #define SPIDER_NET_PHY_CTRL_VALUE 0x01070080*/
175#define SPIDER_NET_RXMODE_VALUE 0x00000011
176/* auto retransmission in case of MAC aborts */
177#define SPIDER_NET_TXMODE_VALUE 0x00010000
178#define SPIDER_NET_RESTART_VALUE 0x00000000
179#define SPIDER_NET_WOL_VALUE 0x00001111
180#if 0
181#define SPIDER_NET_WOL_VALUE 0x00000000
182#endif
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500183#define SPIDER_NET_IPSECINIT_VALUE 0x6f716f71
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700184
185/* pause frames: automatic, no upper retransmission count */
186/* outside loopback mode: ETOMOD signal dont matter, not connected */
187#define SPIDER_NET_OPMODE_VALUE 0x00000063
188/*#define SPIDER_NET_OPMODE_VALUE 0x001b0062*/
189#define SPIDER_NET_LENLMT_VALUE 0x00000908
190
191#define SPIDER_NET_MACAPAUSE_VALUE 0x00000800 /* about 1 ms */
192#define SPIDER_NET_TXPAUSE_VALUE 0x00000000
193
194#define SPIDER_NET_MACMODE_VALUE 0x00000001
195#define SPIDER_NET_BURSTLMT_VALUE 0x00000200 /* about 16 us */
196
Linas Vepstasded80282006-10-10 16:02:54 -0500197/* DMAC control register GDMACCNTR
198 *
199 * 1(0) enable r/tx dma
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700200 * 0000000 fixed to 0
201 *
202 * 000000 fixed to 0
203 * 0(1) en/disable descr writeback on force end
204 * 0(1) force end
205 *
206 * 000000 fixed to 0
207 * 00 burst alignment: 128 bytes
Linas Vepstasded80282006-10-10 16:02:54 -0500208 * 11 burst alignment: 1024 bytes
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700209 *
210 * 00000 fixed to 0
211 * 0 descr writeback size 32 bytes
212 * 0(1) descr chain end interrupt enable
213 * 0(1) descr status writeback enable */
214
215/* to set RX_DMA_EN */
216#define SPIDER_NET_DMA_RX_VALUE 0x80000000
217#define SPIDER_NET_DMA_RX_FEND_VALUE 0x00030003
218/* to set TX_DMA_EN */
Linas Vepstasded80282006-10-10 16:02:54 -0500219#define SPIDER_NET_TX_DMA_EN 0x80000000
220#define SPIDER_NET_GDTBSTA 0x00000300
221#define SPIDER_NET_GDTDCEIDIS 0x00000002
222#define SPIDER_NET_DMA_TX_VALUE SPIDER_NET_TX_DMA_EN | \
Linas Vepstas7bd54c82006-11-17 14:39:40 -0800223 SPIDER_NET_GDTBSTA
Linas Vepstasded80282006-10-10 16:02:54 -0500224
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700225#define SPIDER_NET_DMA_TX_FEND_VALUE 0x00030003
226
227/* SPIDER_NET_UA_DESCR_VALUE is OR'ed with the unicast address */
228#define SPIDER_NET_UA_DESCR_VALUE 0x00080000
229#define SPIDER_NET_PROMISC_VALUE 0x00080000
230#define SPIDER_NET_NONPROMISC_VALUE 0x00000000
231
232#define SPIDER_NET_DMASEL_VALUE 0x00000001
233
234#define SPIDER_NET_ECMODE_VALUE 0x00000000
235
236#define SPIDER_NET_CKRCTRL_RUN_VALUE 0x1fff010f
237#define SPIDER_NET_CKRCTRL_STOP_VALUE 0x0000010f
238
239#define SPIDER_NET_SBIMSTATE_VALUE 0x00000000
240#define SPIDER_NET_SBTMSTATE_VALUE 0x00000000
241
242/* SPIDER_NET_GHIINT0STS bits, in reverse order so that they can be used
243 * with 1 << SPIDER_NET_... */
244enum spider_net_int0_status {
245 SPIDER_NET_GPHYINT = 0,
246 SPIDER_NET_GMAC2INT,
247 SPIDER_NET_GMAC1INT,
248 SPIDER_NET_GIPSINT,
249 SPIDER_NET_GFIFOINT,
250 SPIDER_NET_GDMACINT,
251 SPIDER_NET_GSYSINT,
252 SPIDER_NET_GPWOPCMPINT,
253 SPIDER_NET_GPROPCMPINT,
254 SPIDER_NET_GPWFFINT,
255 SPIDER_NET_GRMDADRINT,
256 SPIDER_NET_GRMARPINT,
257 SPIDER_NET_GRMMPINT,
258 SPIDER_NET_GDTDEN0INT,
259 SPIDER_NET_GDDDEN0INT,
260 SPIDER_NET_GDCDEN0INT,
261 SPIDER_NET_GDBDEN0INT,
262 SPIDER_NET_GDADEN0INT,
263 SPIDER_NET_GDTFDCINT,
264 SPIDER_NET_GDDFDCINT,
265 SPIDER_NET_GDCFDCINT,
266 SPIDER_NET_GDBFDCINT,
267 SPIDER_NET_GDAFDCINT,
268 SPIDER_NET_GTTEDINT,
269 SPIDER_NET_GDTDCEINT,
270 SPIDER_NET_GRFDNMINT,
271 SPIDER_NET_GRFCNMINT,
272 SPIDER_NET_GRFBNMINT,
273 SPIDER_NET_GRFANMINT,
274 SPIDER_NET_GRFNMINT,
275 SPIDER_NET_G1TMCNTINT,
276 SPIDER_NET_GFREECNTINT
277};
278/* GHIINT1STS bits */
279enum spider_net_int1_status {
280 SPIDER_NET_GTMFLLINT = 0,
281 SPIDER_NET_GRMFLLINT,
282 SPIDER_NET_GTMSHTINT,
283 SPIDER_NET_GDTINVDINT,
284 SPIDER_NET_GRFDFLLINT,
285 SPIDER_NET_GDDDCEINT,
286 SPIDER_NET_GDDINVDINT,
287 SPIDER_NET_GRFCFLLINT,
288 SPIDER_NET_GDCDCEINT,
289 SPIDER_NET_GDCINVDINT,
290 SPIDER_NET_GRFBFLLINT,
291 SPIDER_NET_GDBDCEINT,
292 SPIDER_NET_GDBINVDINT,
293 SPIDER_NET_GRFAFLLINT,
294 SPIDER_NET_GDADCEINT,
295 SPIDER_NET_GDAINVDINT,
296 SPIDER_NET_GDTRSERINT,
297 SPIDER_NET_GDDRSERINT,
298 SPIDER_NET_GDCRSERINT,
299 SPIDER_NET_GDBRSERINT,
300 SPIDER_NET_GDARSERINT,
301 SPIDER_NET_GDSERINT,
302 SPIDER_NET_GDTPTERINT,
303 SPIDER_NET_GDDPTERINT,
304 SPIDER_NET_GDCPTERINT,
305 SPIDER_NET_GDBPTERINT,
306 SPIDER_NET_GDAPTERINT
307};
308/* GHIINT2STS bits */
309enum spider_net_int2_status {
310 SPIDER_NET_GPROPERINT = 0,
311 SPIDER_NET_GMCTCRSNGINT,
312 SPIDER_NET_GMCTLCOLINT,
313 SPIDER_NET_GMCTTMOTINT,
314 SPIDER_NET_GMCRCAERINT,
315 SPIDER_NET_GMCRCALERINT,
316 SPIDER_NET_GMCRALNERINT,
317 SPIDER_NET_GMCROVRINT,
318 SPIDER_NET_GMCRRNTINT,
319 SPIDER_NET_GMCRRXERINT,
320 SPIDER_NET_GTITCSERINT,
321 SPIDER_NET_GTIFMTERINT,
322 SPIDER_NET_GTIPKTRVKINT,
323 SPIDER_NET_GTISPINGINT,
324 SPIDER_NET_GTISADNGINT,
325 SPIDER_NET_GTISPDNGINT,
326 SPIDER_NET_GRIFMTERINT,
327 SPIDER_NET_GRIPKTRVKINT,
328 SPIDER_NET_GRISPINGINT,
329 SPIDER_NET_GRISADNGINT,
330 SPIDER_NET_GRISPDNGINT
331};
332
Linas Vepstas7bd54c82006-11-17 14:39:40 -0800333#define SPIDER_NET_TXINT ( (1 << SPIDER_NET_GDTFDCINT) | \
334 (1 << SPIDER_NET_GDTDCEINT) )
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700335
Linas Vepstas43932d92006-10-10 16:05:00 -0500336/* We rely on flagged descriptor interrupts */
337#define SPIDER_NET_RXINT ( (1 << SPIDER_NET_GDAFDCINT) )
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700338
Kou Ishizakiabdb66b2007-02-20 16:33:41 -0600339#define SPIDER_NET_LINKINT ( 1 << SPIDER_NET_GMAC2INT )
340
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500341#define SPIDER_NET_ERRINT ( 0xffffffff & \
342 (~SPIDER_NET_TXINT) & \
Kou Ishizakiabdb66b2007-02-20 16:33:41 -0600343 (~SPIDER_NET_RXINT) & \
344 (~SPIDER_NET_LINKINT) )
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500345
Jens Osterkampbdd01502006-07-13 11:54:08 +0200346#define SPIDER_NET_GPREXEC 0x80000000
347#define SPIDER_NET_GPRDAT_MASK 0x0000ffff
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700348
Jens Osterkampbdd01502006-07-13 11:54:08 +0200349#define SPIDER_NET_DMAC_NOINTR_COMPLETE 0x00800000
350#define SPIDER_NET_DMAC_NOCS 0x00040000
351#define SPIDER_NET_DMAC_TCP 0x00020000
352#define SPIDER_NET_DMAC_UDP 0x00030000
353#define SPIDER_NET_TXDCEST 0x08000000
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700354
Jens Osterkampbdd01502006-07-13 11:54:08 +0200355#define SPIDER_NET_DESCR_IND_PROC_MASK 0xF0000000
356#define SPIDER_NET_DESCR_COMPLETE 0x00000000 /* used in rx and tx */
357#define SPIDER_NET_DESCR_RESPONSE_ERROR 0x10000000 /* used in rx and tx */
358#define SPIDER_NET_DESCR_PROTECTION_ERROR 0x20000000 /* used in rx and tx */
359#define SPIDER_NET_DESCR_FRAME_END 0x40000000 /* used in rx */
360#define SPIDER_NET_DESCR_FORCE_END 0x50000000 /* used in rx and tx */
361#define SPIDER_NET_DESCR_CARDOWNED 0xA0000000 /* used in rx and tx */
362#define SPIDER_NET_DESCR_NOT_IN_USE 0xF0000000
Linas Vepstas204e5fa2006-10-10 16:11:33 -0500363#define SPIDER_NET_DESCR_TXDESFLG 0x00800000
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700364
365struct spider_net_descr {
366 /* as defined by the hardware */
Arnd Bergmann8e0a6132006-01-12 17:16:43 -0500367 u32 buf_addr;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700368 u32 buf_size;
Arnd Bergmann8e0a6132006-01-12 17:16:43 -0500369 u32 next_descr_addr;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700370 u32 dmac_cmd_status;
371 u32 result_size;
372 u32 valid_size; /* all zeroes for tx */
373 u32 data_status;
374 u32 data_error; /* all zeroes for tx */
375
376 /* used in the driver */
377 struct sk_buff *skb;
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500378 u32 bus_addr;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700379 struct spider_net_descr *next;
380 struct spider_net_descr *prev;
381} __attribute__((aligned(32)));
382
383struct spider_net_descr_chain {
Jens Osterkampbdd01502006-07-13 11:54:08 +0200384 spinlock_t lock;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700385 struct spider_net_descr *head;
386 struct spider_net_descr *tail;
Linas Vepstasd4ed8f82006-12-13 15:06:59 -0600387 struct spider_net_descr *ring;
388 int num_desc;
389 dma_addr_t dma_addr;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700390};
391
392/* descriptor data_status bits */
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500393#define SPIDER_NET_RX_IPCHK 29
394#define SPIDER_NET_RX_TCPCHK 28
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700395#define SPIDER_NET_VLAN_PACKET 21
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500396#define SPIDER_NET_DATA_STATUS_CKSUM_MASK ( (1 << SPIDER_NET_RX_IPCHK) | \
397 (1 << SPIDER_NET_RX_TCPCHK) )
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700398
399/* descriptor data_error bits */
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500400#define SPIDER_NET_RX_IPCHKERR 27
401#define SPIDER_NET_RX_RXTCPCHKERR 28
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700402
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500403#define SPIDER_NET_DATA_ERR_CKSUM_MASK (1 << SPIDER_NET_RX_IPCHKERR)
404
405/* the cases we don't pass the packet to the stack.
406 * 701b8000 would be correct, but every packets gets that flag */
407#define SPIDER_NET_DESTROY_RX_FLAGS 0x700b8000
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700408
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700409/* this will be bigger some time */
410struct spider_net_options {
411 int rx_csum; /* for rx: if 0 ip_summed=NONE,
412 if 1 and hw has verified, ip_summed=UNNECESSARY */
413};
414
415#define SPIDER_NET_DEFAULT_MSG ( NETIF_MSG_DRV | \
416 NETIF_MSG_PROBE | \
417 NETIF_MSG_LINK | \
418 NETIF_MSG_TIMER | \
419 NETIF_MSG_IFDOWN | \
420 NETIF_MSG_IFUP | \
421 NETIF_MSG_RX_ERR | \
422 NETIF_MSG_TX_ERR | \
423 NETIF_MSG_TX_QUEUED | \
424 NETIF_MSG_INTR | \
425 NETIF_MSG_TX_DONE | \
426 NETIF_MSG_RX_STATUS | \
427 NETIF_MSG_PKTDATA | \
428 NETIF_MSG_HW | \
429 NETIF_MSG_WOL )
430
Jim Lewis9b6b0b82006-09-22 17:22:53 -0700431struct spider_net_extra_stats {
432 unsigned long rx_desc_error;
433 unsigned long tx_timeouts;
434 unsigned long alloc_rx_skb_error;
435 unsigned long rx_iommu_map_error;
436 unsigned long tx_iommu_map_error;
437 unsigned long rx_desc_unk_state;
438};
439
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700440struct spider_net_card {
441 struct net_device *netdev;
442 struct pci_dev *pdev;
443 struct mii_phy phy;
444
445 void __iomem *regs;
446
447 struct spider_net_descr_chain tx_chain;
448 struct spider_net_descr_chain rx_chain;
Linas Vepstas204e5fa2006-10-10 16:11:33 -0500449 struct spider_net_descr *low_watermark;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700450
Kou Ishizakiabdb66b2007-02-20 16:33:41 -0600451 int aneg_count;
452 struct timer_list aneg_timer;
Arnd Bergmann11f1a522006-01-12 17:16:44 -0500453 struct timer_list tx_timer;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700454 struct work_struct tx_timeout_task;
455 atomic_t tx_timeout_task_counter;
456 wait_queue_head_t waitq;
457
458 /* for ethtool */
459 int msg_enable;
Linas Vepstasd4ed8f82006-12-13 15:06:59 -0600460 struct net_device_stats netdev_stats;
Jim Lewis9b6b0b82006-09-22 17:22:53 -0700461 struct spider_net_extra_stats spider_stats;
Linas Vepstasd4ed8f82006-12-13 15:06:59 -0600462 struct spider_net_options options;
Jens Osterkampaaec0fa2005-09-05 15:19:29 -0700463};
464
465#define pr_err(fmt,arg...) \
466 printk(KERN_ERR fmt ,##arg)
467
468#endif