diff options
Diffstat (limited to 'drivers/net/spider_net.h')
-rw-r--r-- | drivers/net/spider_net.h | 71 |
1 files changed, 40 insertions, 31 deletions
diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h index 98f11ecf48fc..5922b529a048 100644 --- a/drivers/net/spider_net.h +++ b/drivers/net/spider_net.h | |||
@@ -33,25 +33,32 @@ extern struct ethtool_ops spider_net_ethtool_ops; | |||
33 | 33 | ||
34 | extern char spider_net_driver_name[]; | 34 | extern char spider_net_driver_name[]; |
35 | 35 | ||
36 | #define SPIDER_NET_MAX_MTU 2308 | 36 | #define SPIDER_NET_MAX_FRAME 2312 |
37 | #define SPIDER_NET_MAX_MTU 2294 | ||
37 | #define SPIDER_NET_MIN_MTU 64 | 38 | #define SPIDER_NET_MIN_MTU 64 |
38 | 39 | ||
39 | #define SPIDER_NET_RXBUF_ALIGN 128 | 40 | #define SPIDER_NET_RXBUF_ALIGN 128 |
40 | 41 | ||
41 | #define SPIDER_NET_RX_DESCRIPTORS_DEFAULT 64 | 42 | #define SPIDER_NET_RX_DESCRIPTORS_DEFAULT 256 |
42 | #define SPIDER_NET_RX_DESCRIPTORS_MIN 16 | 43 | #define SPIDER_NET_RX_DESCRIPTORS_MIN 16 |
43 | #define SPIDER_NET_RX_DESCRIPTORS_MAX 256 | 44 | #define SPIDER_NET_RX_DESCRIPTORS_MAX 512 |
44 | 45 | ||
45 | #define SPIDER_NET_TX_DESCRIPTORS_DEFAULT 64 | 46 | #define SPIDER_NET_TX_DESCRIPTORS_DEFAULT 256 |
46 | #define SPIDER_NET_TX_DESCRIPTORS_MIN 16 | 47 | #define SPIDER_NET_TX_DESCRIPTORS_MIN 16 |
47 | #define SPIDER_NET_TX_DESCRIPTORS_MAX 256 | 48 | #define SPIDER_NET_TX_DESCRIPTORS_MAX 512 |
49 | |||
50 | #define SPIDER_NET_TX_TIMER 20 | ||
48 | 51 | ||
49 | #define SPIDER_NET_RX_CSUM_DEFAULT 1 | 52 | #define SPIDER_NET_RX_CSUM_DEFAULT 1 |
50 | 53 | ||
51 | #define SPIDER_NET_WATCHDOG_TIMEOUT 5*HZ | 54 | #define SPIDER_NET_WATCHDOG_TIMEOUT 50*HZ |
52 | #define SPIDER_NET_NAPI_WEIGHT 64 | 55 | #define SPIDER_NET_NAPI_WEIGHT 64 |
53 | 56 | ||
54 | #define SPIDER_NET_FIRMWARE_LEN 1024 | 57 | #define SPIDER_NET_FIRMWARE_SEQS 6 |
58 | #define SPIDER_NET_FIRMWARE_SEQWORDS 1024 | ||
59 | #define SPIDER_NET_FIRMWARE_LEN (SPIDER_NET_FIRMWARE_SEQS * \ | ||
60 | SPIDER_NET_FIRMWARE_SEQWORDS * \ | ||
61 | sizeof(u32)) | ||
55 | #define SPIDER_NET_FIRMWARE_NAME "spider_fw.bin" | 62 | #define SPIDER_NET_FIRMWARE_NAME "spider_fw.bin" |
56 | 63 | ||
57 | /** spider_net SMMIO registers */ | 64 | /** spider_net SMMIO registers */ |
@@ -142,14 +149,12 @@ extern char spider_net_driver_name[]; | |||
142 | /** SCONFIG registers */ | 149 | /** SCONFIG registers */ |
143 | #define SPIDER_NET_SCONFIG_IOACTE 0x00002810 | 150 | #define SPIDER_NET_SCONFIG_IOACTE 0x00002810 |
144 | 151 | ||
145 | /** hardcoded register values */ | 152 | /** interrupt mask registers */ |
146 | #define SPIDER_NET_INT0_MASK_VALUE 0x3f7fe3ff | 153 | #define SPIDER_NET_INT0_MASK_VALUE 0x3f7fe2c7 |
147 | #define SPIDER_NET_INT1_MASK_VALUE 0xffffffff | 154 | #define SPIDER_NET_INT1_MASK_VALUE 0xffff7ff7 |
148 | /* no MAC aborts -> auto retransmission */ | 155 | /* no MAC aborts -> auto retransmission */ |
149 | #define SPIDER_NET_INT2_MASK_VALUE 0xfffffff1 | 156 | #define SPIDER_NET_INT2_MASK_VALUE 0xffef7ff1 |
150 | 157 | ||
151 | /* clear counter when interrupt sources are cleared | ||
152 | #define SPIDER_NET_FRAMENUM_VALUE 0x0001f001 */ | ||
153 | /* we rely on flagged descriptor interrupts */ | 158 | /* we rely on flagged descriptor interrupts */ |
154 | #define SPIDER_NET_FRAMENUM_VALUE 0x00000000 | 159 | #define SPIDER_NET_FRAMENUM_VALUE 0x00000000 |
155 | /* set this first, then the FRAMENUM_VALUE */ | 160 | /* set this first, then the FRAMENUM_VALUE */ |
@@ -168,7 +173,7 @@ extern char spider_net_driver_name[]; | |||
168 | #if 0 | 173 | #if 0 |
169 | #define SPIDER_NET_WOL_VALUE 0x00000000 | 174 | #define SPIDER_NET_WOL_VALUE 0x00000000 |
170 | #endif | 175 | #endif |
171 | #define SPIDER_NET_IPSECINIT_VALUE 0x00f000f8 | 176 | #define SPIDER_NET_IPSECINIT_VALUE 0x6f716f71 |
172 | 177 | ||
173 | /* pause frames: automatic, no upper retransmission count */ | 178 | /* pause frames: automatic, no upper retransmission count */ |
174 | /* outside loopback mode: ETOMOD signal dont matter, not connected */ | 179 | /* outside loopback mode: ETOMOD signal dont matter, not connected */ |
@@ -318,6 +323,10 @@ enum spider_net_int2_status { | |||
318 | #define SPIDER_NET_RXINT ( (1 << SPIDER_NET_GDAFDCINT) | \ | 323 | #define SPIDER_NET_RXINT ( (1 << SPIDER_NET_GDAFDCINT) | \ |
319 | (1 << SPIDER_NET_GRMFLLINT) ) | 324 | (1 << SPIDER_NET_GRMFLLINT) ) |
320 | 325 | ||
326 | #define SPIDER_NET_ERRINT ( 0xffffffff & \ | ||
327 | (~SPIDER_NET_TXINT) & \ | ||
328 | (~SPIDER_NET_RXINT) ) | ||
329 | |||
321 | #define SPIDER_NET_GPREXEC 0x80000000 | 330 | #define SPIDER_NET_GPREXEC 0x80000000 |
322 | #define SPIDER_NET_GPRDAT_MASK 0x0000ffff | 331 | #define SPIDER_NET_GPRDAT_MASK 0x0000ffff |
323 | 332 | ||
@@ -358,9 +367,6 @@ enum spider_net_int2_status { | |||
358 | /* descr ready, descr is in middle of chain, get interrupt on completion */ | 367 | /* descr ready, descr is in middle of chain, get interrupt on completion */ |
359 | #define SPIDER_NET_DMAC_RX_CARDOWNED 0xa0800000 | 368 | #define SPIDER_NET_DMAC_RX_CARDOWNED 0xa0800000 |
360 | 369 | ||
361 | /* multicast is no problem */ | ||
362 | #define SPIDER_NET_DATA_ERROR_MASK 0xffffbfff | ||
363 | |||
364 | enum spider_net_descr_status { | 370 | enum spider_net_descr_status { |
365 | SPIDER_NET_DESCR_COMPLETE = 0x00, /* used in rx and tx */ | 371 | SPIDER_NET_DESCR_COMPLETE = 0x00, /* used in rx and tx */ |
366 | SPIDER_NET_DESCR_RESPONSE_ERROR = 0x01, /* used in rx and tx */ | 372 | SPIDER_NET_DESCR_RESPONSE_ERROR = 0x01, /* used in rx and tx */ |
@@ -384,7 +390,7 @@ struct spider_net_descr { | |||
384 | 390 | ||
385 | /* used in the driver */ | 391 | /* used in the driver */ |
386 | struct sk_buff *skb; | 392 | struct sk_buff *skb; |
387 | dma_addr_t bus_addr; | 393 | u32 bus_addr; |
388 | struct spider_net_descr *next; | 394 | struct spider_net_descr *next; |
389 | struct spider_net_descr *prev; | 395 | struct spider_net_descr *prev; |
390 | } __attribute__((aligned(32))); | 396 | } __attribute__((aligned(32))); |
@@ -396,21 +402,21 @@ struct spider_net_descr_chain { | |||
396 | }; | 402 | }; |
397 | 403 | ||
398 | /* descriptor data_status bits */ | 404 | /* descriptor data_status bits */ |
399 | #define SPIDER_NET_RXIPCHK 29 | 405 | #define SPIDER_NET_RX_IPCHK 29 |
400 | #define SPIDER_NET_TCPUDPIPCHK 28 | 406 | #define SPIDER_NET_RX_TCPCHK 28 |
401 | #define SPIDER_NET_DATA_STATUS_CHK_MASK (1 << SPIDER_NET_RXIPCHK | \ | ||
402 | 1 << SPIDER_NET_TCPUDPIPCHK) | ||
403 | |||
404 | #define SPIDER_NET_VLAN_PACKET 21 | 407 | #define SPIDER_NET_VLAN_PACKET 21 |
408 | #define SPIDER_NET_DATA_STATUS_CKSUM_MASK ( (1 << SPIDER_NET_RX_IPCHK) | \ | ||
409 | (1 << SPIDER_NET_RX_TCPCHK) ) | ||
405 | 410 | ||
406 | /* descriptor data_error bits */ | 411 | /* descriptor data_error bits */ |
407 | #define SPIDER_NET_RXIPCHKERR 27 | 412 | #define SPIDER_NET_RX_IPCHKERR 27 |
408 | #define SPIDER_NET_RXTCPCHKERR 26 | 413 | #define SPIDER_NET_RX_RXTCPCHKERR 28 |
409 | #define SPIDER_NET_DATA_ERROR_CHK_MASK (1 << SPIDER_NET_RXIPCHKERR | \ | 414 | |
410 | 1 << SPIDER_NET_RXTCPCHKERR) | 415 | #define SPIDER_NET_DATA_ERR_CKSUM_MASK (1 << SPIDER_NET_RX_IPCHKERR) |
411 | 416 | ||
412 | /* the cases we don't pass the packet to the stack */ | 417 | /* the cases we don't pass the packet to the stack. |
413 | #define SPIDER_NET_DESTROY_RX_FLAGS 0x70138000 | 418 | * 701b8000 would be correct, but every packets gets that flag */ |
419 | #define SPIDER_NET_DESTROY_RX_FLAGS 0x700b8000 | ||
414 | 420 | ||
415 | #define SPIDER_NET_DESCR_SIZE 32 | 421 | #define SPIDER_NET_DESCR_SIZE 32 |
416 | 422 | ||
@@ -445,13 +451,16 @@ struct spider_net_card { | |||
445 | 451 | ||
446 | struct spider_net_descr_chain tx_chain; | 452 | struct spider_net_descr_chain tx_chain; |
447 | struct spider_net_descr_chain rx_chain; | 453 | struct spider_net_descr_chain rx_chain; |
448 | spinlock_t chain_lock; | 454 | atomic_t rx_chain_refill; |
455 | atomic_t tx_chain_release; | ||
449 | 456 | ||
450 | struct net_device_stats netdev_stats; | 457 | struct net_device_stats netdev_stats; |
451 | 458 | ||
452 | struct spider_net_options options; | 459 | struct spider_net_options options; |
453 | 460 | ||
454 | spinlock_t intmask_lock; | 461 | spinlock_t intmask_lock; |
462 | struct tasklet_struct rxram_full_tl; | ||
463 | struct timer_list tx_timer; | ||
455 | 464 | ||
456 | struct work_struct tx_timeout_task; | 465 | struct work_struct tx_timeout_task; |
457 | atomic_t tx_timeout_task_counter; | 466 | atomic_t tx_timeout_task_counter; |