aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hamachi.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
commit6aa20a2235535605db6d6d2bd850298b2fe7f31e (patch)
treedf0b855043407b831d57f2f2c271f8aab48444f4 /drivers/net/hamachi.c
parent7a291083225af6e22ffaa46b3d91cfc1a1ccaab4 (diff)
drivers/net: Trim trailing whitespace
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/hamachi.c')
-rw-r--r--drivers/net/hamachi.c226
1 files changed, 113 insertions, 113 deletions
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 9927bff75d6f..a860c81e4d87 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -3,7 +3,7 @@
3 Written 1998-2000 by Donald Becker. 3 Written 1998-2000 by Donald Becker.
4 Updates 2000 by Keith Underwood. 4 Updates 2000 by Keith Underwood.
5 5
6 This software may be used and distributed according to the terms of 6 This software may be used and distributed according to the terms of
7 the GNU General Public License (GPL), incorporated herein by reference. 7 the GNU General Public License (GPL), incorporated herein by reference.
8 Drivers based on or derived from this code fall under the GPL and must 8 Drivers based on or derived from this code fall under the GPL and must
9 retain the authorship, copyright and license notice. This file is not 9 retain the authorship, copyright and license notice. This file is not
@@ -46,7 +46,7 @@ static int mtu;
46static int max_rx_latency = 0x11; 46static int max_rx_latency = 0x11;
47static int max_rx_gap = 0x05; 47static int max_rx_gap = 0x05;
48static int min_rx_pkt = 0x18; 48static int min_rx_pkt = 0x18;
49static int max_tx_latency = 0x00; 49static int max_tx_latency = 0x00;
50static int max_tx_gap = 0x00; 50static int max_tx_gap = 0x00;
51static int min_tx_pkt = 0x30; 51static int min_tx_pkt = 0x30;
52 52
@@ -76,7 +76,7 @@ static int force32;
76 - The next bit can be used to force half-duplex. This is a bad 76 - The next bit can be used to force half-duplex. This is a bad
77 idea since no known implementations implement half-duplex, and, 77 idea since no known implementations implement half-duplex, and,
78 in general, half-duplex for gigabit ethernet is a bad idea. 78 in general, half-duplex for gigabit ethernet is a bad idea.
79 0x00000080 : Force half-duplex 79 0x00000080 : Force half-duplex
80 Default is full-duplex. 80 Default is full-duplex.
81 - In the original driver, the ninth bit could be used to force 81 - In the original driver, the ninth bit could be used to force
82 full-duplex. Maintain that for compatibility 82 full-duplex. Maintain that for compatibility
@@ -87,7 +87,7 @@ static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
87static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; 87static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
88/* The Hamachi chipset supports 3 parameters each for Rx and Tx 88/* The Hamachi chipset supports 3 parameters each for Rx and Tx
89 * interruput management. Parameters will be loaded as specified into 89 * interruput management. Parameters will be loaded as specified into
90 * the TxIntControl and RxIntControl registers. 90 * the TxIntControl and RxIntControl registers.
91 * 91 *
92 * The registers are arranged as follows: 92 * The registers are arranged as follows:
93 * 23 - 16 15 - 8 7 - 0 93 * 23 - 16 15 - 8 7 - 0
@@ -95,10 +95,10 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
95 * | min_pkt | max_gap | max_latency | 95 * | min_pkt | max_gap | max_latency |
96 * --------------------------------- 96 * ---------------------------------
97 * min_pkt : The minimum number of packets processed between 97 * min_pkt : The minimum number of packets processed between
98 * interrupts. 98 * interrupts.
99 * max_gap : The maximum inter-packet gap in units of 8.192 us 99 * max_gap : The maximum inter-packet gap in units of 8.192 us
100 * max_latency : The absolute time between interrupts in units of 8.192 us 100 * max_latency : The absolute time between interrupts in units of 8.192 us
101 * 101 *
102 */ 102 */
103static int rx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; 103static int rx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
104static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; 104static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
@@ -183,7 +183,7 @@ KERN_INFO " Further modifications by Keith Underwood <keithu@parl.clemson.edu>
183 other linux headers causing many compiler warnings. 183 other linux headers causing many compiler warnings.
184*/ 184*/
185#ifndef IP_MF 185#ifndef IP_MF
186 #define IP_MF 0x2000 /* IP more frags from <netinet/ip.h> */ 186 #define IP_MF 0x2000 /* IP more frags from <netinet/ip.h> */
187#endif 187#endif
188 188
189/* Define IP_OFFSET to be IPOPT_OFFSET */ 189/* Define IP_OFFSET to be IPOPT_OFFSET */
@@ -204,9 +204,9 @@ KERN_INFO " Further modifications by Keith Underwood <keithu@parl.clemson.edu>
204/* Condensed bus+endian portability operations. */ 204/* Condensed bus+endian portability operations. */
205#if ADDRLEN == 64 205#if ADDRLEN == 64
206#define cpu_to_leXX(addr) cpu_to_le64(addr) 206#define cpu_to_leXX(addr) cpu_to_le64(addr)
207#else 207#else
208#define cpu_to_leXX(addr) cpu_to_le32(addr) 208#define cpu_to_leXX(addr) cpu_to_le32(addr)
209#endif 209#endif
210 210
211 211
212/* 212/*
@@ -291,30 +291,30 @@ Hamachi Engineering Design Specification, 5/15/97
291 291
292IVc. Errata 292IVc. Errata
293 293
294None noted. 294None noted.
295 295
296V. Recent Changes 296V. Recent Changes
297 297
29801/15/1999 EPK Enlargement of the TX and RX ring sizes. This appears 29801/15/1999 EPK Enlargement of the TX and RX ring sizes. This appears
299 to help avoid some stall conditions -- this needs further research. 299 to help avoid some stall conditions -- this needs further research.
300 300
30101/15/1999 EPK Creation of the hamachi_tx function. This function cleans 30101/15/1999 EPK Creation of the hamachi_tx function. This function cleans
302 the Tx ring and is called from hamachi_start_xmit (this used to be 302 the Tx ring and is called from hamachi_start_xmit (this used to be
303 called from hamachi_interrupt but it tends to delay execution of the 303 called from hamachi_interrupt but it tends to delay execution of the
304 interrupt handler and thus reduce bandwidth by reducing the latency 304 interrupt handler and thus reduce bandwidth by reducing the latency
305 between hamachi_rx()'s). Notably, some modification has been made so 305 between hamachi_rx()'s). Notably, some modification has been made so
306 that the cleaning loop checks only to make sure that the DescOwn bit 306 that the cleaning loop checks only to make sure that the DescOwn bit
307 isn't set in the status flag since the card is not required 307 isn't set in the status flag since the card is not required
308 to set the entire flag to zero after processing. 308 to set the entire flag to zero after processing.
309 309
31001/15/1999 EPK In the hamachi_start_tx function, the Tx ring full flag is 31001/15/1999 EPK In the hamachi_start_tx function, the Tx ring full flag is
311 checked before attempting to add a buffer to the ring. If the ring is full 311 checked before attempting to add a buffer to the ring. If the ring is full
312 an attempt is made to free any dirty buffers and thus find space for 312 an attempt is made to free any dirty buffers and thus find space for
313 the new buffer or the function returns non-zero which should case the 313 the new buffer or the function returns non-zero which should case the
314 scheduler to reschedule the buffer later. 314 scheduler to reschedule the buffer later.
315 315
31601/15/1999 EPK Some adjustments were made to the chip initialization. 31601/15/1999 EPK Some adjustments were made to the chip initialization.
317 End-to-end flow control should now be fully active and the interrupt 317 End-to-end flow control should now be fully active and the interrupt
318 algorithm vars have been changed. These could probably use further tuning. 318 algorithm vars have been changed. These could probably use further tuning.
319 319
32001/15/1999 EPK Added the max_{rx,tx}_latency options. These are used to 32001/15/1999 EPK Added the max_{rx,tx}_latency options. These are used to
@@ -322,7 +322,7 @@ V. Recent Changes
322 problems with network stalls, try setting these to higher values. 322 problems with network stalls, try setting these to higher values.
323 Valid values are 0x00 through 0xff. 323 Valid values are 0x00 through 0xff.
324 324
32501/15/1999 EPK In general, the overall bandwidth has increased and 32501/15/1999 EPK In general, the overall bandwidth has increased and
326 latencies are better (sometimes by a factor of 2). Stalls are rare at 326 latencies are better (sometimes by a factor of 2). Stalls are rare at
327 this point, however there still appears to be a bug somewhere between the 327 this point, however there still appears to be a bug somewhere between the
328 hardware and driver. TCP checksum errors under load also appear to be 328 hardware and driver. TCP checksum errors under load also appear to be
@@ -334,20 +334,20 @@ V. Recent Changes
334 rings was typically getting set correctly, but the Tx ring wasn't getting 334 rings was typically getting set correctly, but the Tx ring wasn't getting
335 the DescEndRing bit set during initialization. ??? Does this mean the 335 the DescEndRing bit set during initialization. ??? Does this mean the
336 hamachi card is using the DescEndRing in processing even if a particular 336 hamachi card is using the DescEndRing in processing even if a particular
337 slot isn't in use -- hypothetically, the card might be searching the 337 slot isn't in use -- hypothetically, the card might be searching the
338 entire Tx ring for slots with the DescOwn bit set and then processing 338 entire Tx ring for slots with the DescOwn bit set and then processing
339 them. If the DescEndRing bit isn't set, then it might just wander off 339 them. If the DescEndRing bit isn't set, then it might just wander off
340 through memory until it hits a chunk of data with that bit set 340 through memory until it hits a chunk of data with that bit set
341 and then looping back. 341 and then looping back.
342 342
34302/09/1999 EPK Added Michel Mueller's TxDMA Interrupt and Tx-timeout 34302/09/1999 EPK Added Michel Mueller's TxDMA Interrupt and Tx-timeout
344 problem (TxCmd and RxCmd need only to be set when idle or stopped. 344 problem (TxCmd and RxCmd need only to be set when idle or stopped.
345 345
34602/09/1999 EPK Added code to check/reset dev->tbusy in hamachi_interrupt. 34602/09/1999 EPK Added code to check/reset dev->tbusy in hamachi_interrupt.
347 (Michel Mueller pointed out the ``permanently busy'' potential 347 (Michel Mueller pointed out the ``permanently busy'' potential
348 problem here). 348 problem here).
349 349
35002/22/1999 EPK Added Pete Wyckoff's ioctl to control the Tx/Rx latencies. 35002/22/1999 EPK Added Pete Wyckoff's ioctl to control the Tx/Rx latencies.
351 351
35202/23/1999 EPK Verified that the interrupt status field bits for Tx were 35202/23/1999 EPK Verified that the interrupt status field bits for Tx were
353 incorrectly defined and corrected (as per Michel Mueller). 353 incorrectly defined and corrected (as per Michel Mueller).
@@ -363,7 +363,7 @@ V. Recent Changes
363 363
36402/20/2000 KDU Some of the control was just plain odd. Cleaned up the 36402/20/2000 KDU Some of the control was just plain odd. Cleaned up the
365hamachi_start_xmit() and hamachi_interrupt() code. There is still some 365hamachi_start_xmit() and hamachi_interrupt() code. There is still some
366re-structuring I would like to do. 366re-structuring I would like to do.
367 367
36803/01/2000 KDU Experimenting with a WIDE range of interrupt mitigation 36803/01/2000 KDU Experimenting with a WIDE range of interrupt mitigation
369parameters on a dual P3-450 setup yielded the new default interrupt 369parameters on a dual P3-450 setup yielded the new default interrupt
@@ -371,25 +371,25 @@ mitigation parameters. Tx should interrupt VERY infrequently due to
371Eric's scheme. Rx should be more often... 371Eric's scheme. Rx should be more often...
372 372
37303/13/2000 KDU Added a patch to make the Rx Checksum code interact 37303/13/2000 KDU Added a patch to make the Rx Checksum code interact
374nicely with non-linux machines. 374nicely with non-linux machines.
375 375
37603/13/2000 KDU Experimented with some of the configuration values: 37603/13/2000 KDU Experimented with some of the configuration values:
377 377
378 -It seems that enabling PCI performance commands for descriptors 378 -It seems that enabling PCI performance commands for descriptors
379 (changing RxDMACtrl and TxDMACtrl lower nibble from 5 to D) has minimal 379 (changing RxDMACtrl and TxDMACtrl lower nibble from 5 to D) has minimal
380 performance impact for any of my tests. (ttcp, netpipe, netperf) I will 380 performance impact for any of my tests. (ttcp, netpipe, netperf) I will
381 leave them that way until I hear further feedback. 381 leave them that way until I hear further feedback.
382 382
383 -Increasing the PCI_LATENCY_TIMER to 130 383 -Increasing the PCI_LATENCY_TIMER to 130
384 (2 + (burst size of 128 * (0 wait states + 1))) seems to slightly 384 (2 + (burst size of 128 * (0 wait states + 1))) seems to slightly
385 degrade performance. Leaving default at 64 pending further information. 385 degrade performance. Leaving default at 64 pending further information.
386 386
38703/14/2000 KDU Further tuning: 38703/14/2000 KDU Further tuning:
388 388
389 -adjusted boguscnt in hamachi_rx() to depend on interrupt 389 -adjusted boguscnt in hamachi_rx() to depend on interrupt
390 mitigation parameters chosen. 390 mitigation parameters chosen.
391 391
392 -Selected a set of interrupt parameters based on some extensive testing. 392 -Selected a set of interrupt parameters based on some extensive testing.
393 These may change with more testing. 393 These may change with more testing.
394 394
395TO DO: 395TO DO:
@@ -398,14 +398,14 @@ TO DO:
398PCI_COMMAND_INVALIDATE. Set maximum burst size to cache line size in 398PCI_COMMAND_INVALIDATE. Set maximum burst size to cache line size in
399that case. 399that case.
400 400
401-fix the reset procedure. It doesn't quite work. 401-fix the reset procedure. It doesn't quite work.
402*/ 402*/
403 403
404/* A few values that may be tweaked. */ 404/* A few values that may be tweaked. */
405/* Size of each temporary Rx buffer, calculated as: 405/* Size of each temporary Rx buffer, calculated as:
406 * 1518 bytes (ethernet packet) + 2 bytes (to get 8 byte alignment for 406 * 1518 bytes (ethernet packet) + 2 bytes (to get 8 byte alignment for
407 * the card) + 8 bytes of status info + 8 bytes for the Rx Checksum + 407 * the card) + 8 bytes of status info + 8 bytes for the Rx Checksum +
408 * 2 more because we use skb_reserve. 408 * 2 more because we use skb_reserve.
409 */ 409 */
410#define PKT_BUF_SZ 1538 410#define PKT_BUF_SZ 1538
411 411
@@ -465,7 +465,7 @@ enum intr_status_bits {
465 465
466/* The Hamachi Rx and Tx buffer descriptors. */ 466/* The Hamachi Rx and Tx buffer descriptors. */
467struct hamachi_desc { 467struct hamachi_desc {
468 u32 status_n_length; 468 u32 status_n_length;
469#if ADDRLEN == 64 469#if ADDRLEN == 64
470 u32 pad; 470 u32 pad;
471 u64 addr; 471 u64 addr;
@@ -476,7 +476,7 @@ struct hamachi_desc {
476 476
477/* Bits in hamachi_desc.status_n_length */ 477/* Bits in hamachi_desc.status_n_length */
478enum desc_status_bits { 478enum desc_status_bits {
479 DescOwn=0x80000000, DescEndPacket=0x40000000, DescEndRing=0x20000000, 479 DescOwn=0x80000000, DescEndPacket=0x40000000, DescEndRing=0x20000000,
480 DescIntr=0x10000000, 480 DescIntr=0x10000000,
481}; 481};
482 482
@@ -546,7 +546,7 @@ MODULE_PARM_DESC(tx_params, "GNIC-II min_tx_pkt+max_tx_gap+max_tx_latency");
546MODULE_PARM_DESC(options, "GNIC-II Bits 0-3: media type, bits 4-6: as force32, bit 7: half duplex, bit 9 full duplex"); 546MODULE_PARM_DESC(options, "GNIC-II Bits 0-3: media type, bits 4-6: as force32, bit 7: half duplex, bit 9 full duplex");
547MODULE_PARM_DESC(full_duplex, "GNIC-II full duplex setting(s) (1)"); 547MODULE_PARM_DESC(full_duplex, "GNIC-II full duplex setting(s) (1)");
548MODULE_PARM_DESC(force32, "GNIC-II: Bit 0: 32 bit PCI, bit 1: disable parity, bit 2: 64 bit PCI (all boards)"); 548MODULE_PARM_DESC(force32, "GNIC-II: Bit 0: 32 bit PCI, bit 1: disable parity, bit 2: 64 bit PCI (all boards)");
549 549
550static int read_eeprom(void __iomem *ioaddr, int location); 550static int read_eeprom(void __iomem *ioaddr, int location);
551static int mdio_read(struct net_device *dev, int phy_id, int location); 551static int mdio_read(struct net_device *dev, int phy_id, int location);
552static void mdio_write(struct net_device *dev, int phy_id, int location, int value); 552static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
@@ -659,7 +659,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
659 option = dev->mem_start; 659 option = dev->mem_start;
660 660
661 /* If the bus size is misidentified, do the following. */ 661 /* If the bus size is misidentified, do the following. */
662 force32 = force32 ? force32 : 662 force32 = force32 ? force32 :
663 ((option >= 0) ? ((option & 0x00000070) >> 4) : 0 ); 663 ((option >= 0) ? ((option & 0x00000070) >> 4) : 0 );
664 if (force32) 664 if (force32)
665 writeb(force32, ioaddr + VirtualJumpers); 665 writeb(force32, ioaddr + VirtualJumpers);
@@ -671,11 +671,11 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
671 * be valid for a moment. Wait for a little while until it is. If 671 * be valid for a moment. Wait for a little while until it is. If
672 * it takes more than 10ms, forget it. 672 * it takes more than 10ms, forget it.
673 */ 673 */
674 udelay(10); 674 udelay(10);
675 i = readb(ioaddr + PCIClkMeas); 675 i = readb(ioaddr + PCIClkMeas);
676 for (boguscnt = 0; (!(i & 0x080)) && boguscnt < 1000; boguscnt++){ 676 for (boguscnt = 0; (!(i & 0x080)) && boguscnt < 1000; boguscnt++){
677 udelay(10); 677 udelay(10);
678 i = readb(ioaddr + PCIClkMeas); 678 i = readb(ioaddr + PCIClkMeas);
679 } 679 }
680 680
681 hmp->base = ioaddr; 681 hmp->base = ioaddr;
@@ -714,9 +714,9 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
714 714
715 rx_int_var = card_idx < MAX_UNITS ? rx_params[card_idx] : -1; 715 rx_int_var = card_idx < MAX_UNITS ? rx_params[card_idx] : -1;
716 tx_int_var = card_idx < MAX_UNITS ? tx_params[card_idx] : -1; 716 tx_int_var = card_idx < MAX_UNITS ? tx_params[card_idx] : -1;
717 hmp->rx_int_var = rx_int_var >= 0 ? rx_int_var : 717 hmp->rx_int_var = rx_int_var >= 0 ? rx_int_var :
718 (min_rx_pkt << 16 | max_rx_gap << 8 | max_rx_latency); 718 (min_rx_pkt << 16 | max_rx_gap << 8 | max_rx_latency);
719 hmp->tx_int_var = tx_int_var >= 0 ? tx_int_var : 719 hmp->tx_int_var = tx_int_var >= 0 ? tx_int_var :
720 (min_tx_pkt << 16 | max_tx_gap << 8 | max_tx_latency); 720 (min_tx_pkt << 16 | max_tx_gap << 8 | max_tx_latency);
721 721
722 722
@@ -783,10 +783,10 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
783 return 0; 783 return 0;
784 784
785err_out_unmap_rx: 785err_out_unmap_rx:
786 pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring, 786 pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring,
787 hmp->rx_ring_dma); 787 hmp->rx_ring_dma);
788err_out_unmap_tx: 788err_out_unmap_tx:
789 pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring, 789 pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring,
790 hmp->tx_ring_dma); 790 hmp->tx_ring_dma);
791err_out_cleardev: 791err_out_cleardev:
792 free_netdev (dev); 792 free_netdev (dev);
@@ -856,7 +856,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
856 return; 856 return;
857} 857}
858 858
859 859
860static int hamachi_open(struct net_device *dev) 860static int hamachi_open(struct net_device *dev)
861{ 861{
862 struct hamachi_private *hmp = netdev_priv(dev); 862 struct hamachi_private *hmp = netdev_priv(dev);
@@ -886,7 +886,7 @@ static int hamachi_open(struct net_device *dev)
886 writel(cpu_to_le32(hmp->tx_ring_dma), ioaddr + TxPtr); 886 writel(cpu_to_le32(hmp->tx_ring_dma), ioaddr + TxPtr);
887#endif 887#endif
888 888
889 /* TODO: It would make sense to organize this as words since the card 889 /* TODO: It would make sense to organize this as words since the card
890 * documentation does. -KDU 890 * documentation does. -KDU
891 */ 891 */
892 for (i = 0; i < 6; i++) 892 for (i = 0; i < 6; i++)
@@ -898,36 +898,36 @@ static int hamachi_open(struct net_device *dev)
898 /* Configure the FIFO */ 898 /* Configure the FIFO */
899 fifo_info = (readw(ioaddr + GPIO) & 0x00C0) >> 6; 899 fifo_info = (readw(ioaddr + GPIO) & 0x00C0) >> 6;
900 switch (fifo_info){ 900 switch (fifo_info){
901 case 0 : 901 case 0 :
902 /* No FIFO */ 902 /* No FIFO */
903 writew(0x0000, ioaddr + FIFOcfg); 903 writew(0x0000, ioaddr + FIFOcfg);
904 break; 904 break;
905 case 1 : 905 case 1 :
906 /* Configure the FIFO for 512K external, 16K used for Tx. */ 906 /* Configure the FIFO for 512K external, 16K used for Tx. */
907 writew(0x0028, ioaddr + FIFOcfg); 907 writew(0x0028, ioaddr + FIFOcfg);
908 break; 908 break;
909 case 2 : 909 case 2 :
910 /* Configure the FIFO for 1024 external, 32K used for Tx. */ 910 /* Configure the FIFO for 1024 external, 32K used for Tx. */
911 writew(0x004C, ioaddr + FIFOcfg); 911 writew(0x004C, ioaddr + FIFOcfg);
912 break; 912 break;
913 case 3 : 913 case 3 :
914 /* Configure the FIFO for 2048 external, 32K used for Tx. */ 914 /* Configure the FIFO for 2048 external, 32K used for Tx. */
915 writew(0x006C, ioaddr + FIFOcfg); 915 writew(0x006C, ioaddr + FIFOcfg);
916 break; 916 break;
917 default : 917 default :
918 printk(KERN_WARNING "%s: Unsupported external memory config!\n", 918 printk(KERN_WARNING "%s: Unsupported external memory config!\n",
919 dev->name); 919 dev->name);
920 /* Default to no FIFO */ 920 /* Default to no FIFO */
921 writew(0x0000, ioaddr + FIFOcfg); 921 writew(0x0000, ioaddr + FIFOcfg);
922 break; 922 break;
923 } 923 }
924 924
925 if (dev->if_port == 0) 925 if (dev->if_port == 0)
926 dev->if_port = hmp->default_port; 926 dev->if_port = hmp->default_port;
927 927
928 928
929 /* Setting the Rx mode will start the Rx process. */ 929 /* Setting the Rx mode will start the Rx process. */
930 /* If someone didn't choose a duplex, default to full-duplex */ 930 /* If someone didn't choose a duplex, default to full-duplex */
931 if (hmp->duplex_lock != 1) 931 if (hmp->duplex_lock != 1)
932 hmp->mii_if.full_duplex = 1; 932 hmp->mii_if.full_duplex = 1;
933 933
@@ -940,7 +940,7 @@ static int hamachi_open(struct net_device *dev)
940#endif 940#endif
941 writew(0x8000, ioaddr + MACCnfg); /* Soft reset the MAC */ 941 writew(0x8000, ioaddr + MACCnfg); /* Soft reset the MAC */
942 writew(0x215F, ioaddr + MACCnfg); 942 writew(0x215F, ioaddr + MACCnfg);
943 writew(0x000C, ioaddr + FrameGap0); 943 writew(0x000C, ioaddr + FrameGap0);
944 /* WHAT?!?!? Why isn't this documented somewhere? -KDU */ 944 /* WHAT?!?!? Why isn't this documented somewhere? -KDU */
945 writew(0x1018, ioaddr + FrameGap1); 945 writew(0x1018, ioaddr + FrameGap1);
946 /* Why do we enable receives/transmits here? -KDU */ 946 /* Why do we enable receives/transmits here? -KDU */
@@ -962,16 +962,16 @@ static int hamachi_open(struct net_device *dev)
962 962
963 if (hamachi_debug > 1) { 963 if (hamachi_debug > 1) {
964 printk("max_tx_latency: %d, max_tx_gap: %d, min_tx_pkt: %d\n", 964 printk("max_tx_latency: %d, max_tx_gap: %d, min_tx_pkt: %d\n",
965 tx_int_var & 0x00ff, (tx_int_var & 0x00ff00) >> 8, 965 tx_int_var & 0x00ff, (tx_int_var & 0x00ff00) >> 8,
966 (tx_int_var & 0x00ff0000) >> 16); 966 (tx_int_var & 0x00ff0000) >> 16);
967 printk("max_rx_latency: %d, max_rx_gap: %d, min_rx_pkt: %d\n", 967 printk("max_rx_latency: %d, max_rx_gap: %d, min_rx_pkt: %d\n",
968 rx_int_var & 0x00ff, (rx_int_var & 0x00ff00) >> 8, 968 rx_int_var & 0x00ff, (rx_int_var & 0x00ff00) >> 8,
969 (rx_int_var & 0x00ff0000) >> 16); 969 (rx_int_var & 0x00ff0000) >> 16);
970 printk("rx_int_var: %x, tx_int_var: %x\n", rx_int_var, tx_int_var); 970 printk("rx_int_var: %x, tx_int_var: %x\n", rx_int_var, tx_int_var);
971 } 971 }
972 972
973 writel(tx_int_var, ioaddr + TxIntrCtrl); 973 writel(tx_int_var, ioaddr + TxIntrCtrl);
974 writel(rx_int_var, ioaddr + RxIntrCtrl); 974 writel(rx_int_var, ioaddr + RxIntrCtrl);
975 975
976 set_rx_mode(dev); 976 set_rx_mode(dev);
977 977
@@ -1016,21 +1016,21 @@ static inline int hamachi_tx(struct net_device *dev)
1016 int entry = hmp->dirty_tx % TX_RING_SIZE; 1016 int entry = hmp->dirty_tx % TX_RING_SIZE;
1017 struct sk_buff *skb; 1017 struct sk_buff *skb;
1018 1018
1019 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn)) 1019 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn))
1020 break; 1020 break;
1021 /* Free the original skb. */ 1021 /* Free the original skb. */
1022 skb = hmp->tx_skbuff[entry]; 1022 skb = hmp->tx_skbuff[entry];
1023 if (skb != 0) { 1023 if (skb != 0) {
1024 pci_unmap_single(hmp->pci_dev, 1024 pci_unmap_single(hmp->pci_dev,
1025 hmp->tx_ring[entry].addr, skb->len, 1025 hmp->tx_ring[entry].addr, skb->len,
1026 PCI_DMA_TODEVICE); 1026 PCI_DMA_TODEVICE);
1027 dev_kfree_skb(skb); 1027 dev_kfree_skb(skb);
1028 hmp->tx_skbuff[entry] = NULL; 1028 hmp->tx_skbuff[entry] = NULL;
1029 } 1029 }
1030 hmp->tx_ring[entry].status_n_length = 0; 1030 hmp->tx_ring[entry].status_n_length = 0;
1031 if (entry >= TX_RING_SIZE-1) 1031 if (entry >= TX_RING_SIZE-1)
1032 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= 1032 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |=
1033 cpu_to_le32(DescEndRing); 1033 cpu_to_le32(DescEndRing);
1034 hmp->stats.tx_packets++; 1034 hmp->stats.tx_packets++;
1035 } 1035 }
1036 1036
@@ -1082,7 +1082,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
1082 printk("\n"); 1082 printk("\n");
1083 } 1083 }
1084 1084
1085 /* Reinit the hardware and make sure the Rx and Tx processes 1085 /* Reinit the hardware and make sure the Rx and Tx processes
1086 are up and running. 1086 are up and running.
1087 */ 1087 */
1088 dev->if_port = 0; 1088 dev->if_port = 0;
@@ -1092,7 +1092,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
1092 * -Turn off MAC receiver 1092 * -Turn off MAC receiver
1093 * -Issue Reset 1093 * -Issue Reset
1094 */ 1094 */
1095 1095
1096 for (i = 0; i < RX_RING_SIZE; i++) 1096 for (i = 0; i < RX_RING_SIZE; i++)
1097 hmp->rx_ring[i].status_n_length &= cpu_to_le32(~DescOwn); 1097 hmp->rx_ring[i].status_n_length &= cpu_to_le32(~DescOwn);
1098 1098
@@ -1106,11 +1106,11 @@ static void hamachi_tx_timeout(struct net_device *dev)
1106 hmp->tx_ring[i].status_n_length = cpu_to_le32( 1106 hmp->tx_ring[i].status_n_length = cpu_to_le32(
1107 DescEndRing | 1107 DescEndRing |
1108 (hmp->tx_ring[i].status_n_length & 0x0000FFFF)); 1108 (hmp->tx_ring[i].status_n_length & 0x0000FFFF));
1109 else 1109 else
1110 hmp->tx_ring[i].status_n_length &= 0x0000ffff; 1110 hmp->tx_ring[i].status_n_length &= 0x0000ffff;
1111 skb = hmp->tx_skbuff[i]; 1111 skb = hmp->tx_skbuff[i];
1112 if (skb){ 1112 if (skb){
1113 pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr, 1113 pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr,
1114 skb->len, PCI_DMA_TODEVICE); 1114 skb->len, PCI_DMA_TODEVICE);
1115 dev_kfree_skb(skb); 1115 dev_kfree_skb(skb);
1116 hmp->tx_skbuff[i] = NULL; 1116 hmp->tx_skbuff[i] = NULL;
@@ -1119,20 +1119,20 @@ static void hamachi_tx_timeout(struct net_device *dev)
1119 1119
1120 udelay(60); /* Sleep 60 us just for safety sake */ 1120 udelay(60); /* Sleep 60 us just for safety sake */
1121 writew(0x0002, ioaddr + RxCmd); /* STOP Rx */ 1121 writew(0x0002, ioaddr + RxCmd); /* STOP Rx */
1122 1122
1123 writeb(0x01, ioaddr + ChipReset); /* Reinit the hardware */ 1123 writeb(0x01, ioaddr + ChipReset); /* Reinit the hardware */
1124 1124
1125 hmp->tx_full = 0; 1125 hmp->tx_full = 0;
1126 hmp->cur_rx = hmp->cur_tx = 0; 1126 hmp->cur_rx = hmp->cur_tx = 0;
1127 hmp->dirty_rx = hmp->dirty_tx = 0; 1127 hmp->dirty_rx = hmp->dirty_tx = 0;
1128 /* Rx packets are also presumed lost; however, we need to make sure a 1128 /* Rx packets are also presumed lost; however, we need to make sure a
1129 * ring of buffers is in tact. -KDU 1129 * ring of buffers is in tact. -KDU
1130 */ 1130 */
1131 for (i = 0; i < RX_RING_SIZE; i++){ 1131 for (i = 0; i < RX_RING_SIZE; i++){
1132 struct sk_buff *skb = hmp->rx_skbuff[i]; 1132 struct sk_buff *skb = hmp->rx_skbuff[i];
1133 1133
1134 if (skb){ 1134 if (skb){
1135 pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr, 1135 pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr,
1136 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1136 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1137 dev_kfree_skb(skb); 1137 dev_kfree_skb(skb);
1138 hmp->rx_skbuff[i] = NULL; 1138 hmp->rx_skbuff[i] = NULL;
@@ -1146,9 +1146,9 @@ static void hamachi_tx_timeout(struct net_device *dev)
1146 break; 1146 break;
1147 skb->dev = dev; /* Mark as being used by this device. */ 1147 skb->dev = dev; /* Mark as being used by this device. */
1148 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 1148 skb_reserve(skb, 2); /* 16 byte align the IP header. */
1149 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, 1149 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
1150 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 1150 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE));
1151 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | 1151 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn |
1152 DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2)); 1152 DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2));
1153 } 1153 }
1154 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 1154 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
@@ -1187,11 +1187,11 @@ static void hamachi_init_ring(struct net_device *dev)
1187#endif 1187#endif
1188 /* My attempt at a reasonable correction */ 1188 /* My attempt at a reasonable correction */
1189 /* +26 gets the maximum ethernet encapsulation, +7 & ~7 because the 1189 /* +26 gets the maximum ethernet encapsulation, +7 & ~7 because the
1190 * card needs room to do 8 byte alignment, +2 so we can reserve 1190 * card needs room to do 8 byte alignment, +2 so we can reserve
1191 * the first 2 bytes, and +16 gets room for the status word from the 1191 * the first 2 bytes, and +16 gets room for the status word from the
1192 * card. -KDU 1192 * card. -KDU
1193 */ 1193 */
1194 hmp->rx_buf_sz = (dev->mtu <= 1492 ? PKT_BUF_SZ : 1194 hmp->rx_buf_sz = (dev->mtu <= 1492 ? PKT_BUF_SZ :
1195 (((dev->mtu+26+7) & ~7) + 2 + 16)); 1195 (((dev->mtu+26+7) & ~7) + 2 + 16));
1196 1196
1197 /* Initialize all Rx descriptors. */ 1197 /* Initialize all Rx descriptors. */
@@ -1207,10 +1207,10 @@ static void hamachi_init_ring(struct net_device *dev)
1207 break; 1207 break;
1208 skb->dev = dev; /* Mark as being used by this device. */ 1208 skb->dev = dev; /* Mark as being used by this device. */
1209 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 1209 skb_reserve(skb, 2); /* 16 byte align the IP header. */
1210 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, 1210 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
1211 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 1211 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE));
1212 /* -2 because it doesn't REALLY have that first 2 bytes -KDU */ 1212 /* -2 because it doesn't REALLY have that first 2 bytes -KDU */
1213 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | 1213 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn |
1214 DescEndPacket | DescIntr | (hmp->rx_buf_sz -2)); 1214 DescEndPacket | DescIntr | (hmp->rx_buf_sz -2));
1215 } 1215 }
1216 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 1216 hmp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
@@ -1267,7 +1267,7 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
1267 unsigned entry; 1267 unsigned entry;
1268 u16 status; 1268 u16 status;
1269 1269
1270 /* Ok, now make sure that the queue has space before trying to 1270 /* Ok, now make sure that the queue has space before trying to
1271 add another skbuff. if we return non-zero the scheduler 1271 add another skbuff. if we return non-zero the scheduler
1272 should interpret this as a queue full and requeue the buffer 1272 should interpret this as a queue full and requeue the buffer
1273 for later. 1273 for later.
@@ -1282,7 +1282,7 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
1282 if( !(status & 0x0001) || (status & 0x0002)) 1282 if( !(status & 0x0001) || (status & 0x0002))
1283 writew(0x0001, hmp->base + TxCmd); 1283 writew(0x0001, hmp->base + TxCmd);
1284 return 1; 1284 return 1;
1285 } 1285 }
1286 1286
1287 /* Caution: the write order is important here, set the field 1287 /* Caution: the write order is important here, set the field
1288 with the "ownership" bits last. */ 1288 with the "ownership" bits last. */
@@ -1322,15 +1322,15 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
1322 } 1322 }
1323#endif 1323#endif
1324 1324
1325 hmp->tx_ring[entry].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, 1325 hmp->tx_ring[entry].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
1326 skb->data, skb->len, PCI_DMA_TODEVICE)); 1326 skb->data, skb->len, PCI_DMA_TODEVICE));
1327 1327
1328 /* Hmmmm, could probably put a DescIntr on these, but the way 1328 /* Hmmmm, could probably put a DescIntr on these, but the way
1329 the driver is currently coded makes Tx interrupts unnecessary 1329 the driver is currently coded makes Tx interrupts unnecessary
1330 since the clearing of the Tx ring is handled by the start_xmit 1330 since the clearing of the Tx ring is handled by the start_xmit
1331 routine. This organization helps mitigate the interrupts a 1331 routine. This organization helps mitigate the interrupts a
1332 bit and probably renders the max_tx_latency param useless. 1332 bit and probably renders the max_tx_latency param useless.
1333 1333
1334 Update: Putting a DescIntr bit on all of the descriptors and 1334 Update: Putting a DescIntr bit on all of the descriptors and
1335 mitigating interrupt frequency with the tx_min_pkt parameter. -KDU 1335 mitigating interrupt frequency with the tx_min_pkt parameter. -KDU
1336 */ 1336 */
@@ -1359,7 +1359,7 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
1359 * hence, any packet that got put off because we were in the transmit 1359 * hence, any packet that got put off because we were in the transmit
1360 * routine should IMMEDIATELY get a chance to be re-queued. -KDU 1360 * routine should IMMEDIATELY get a chance to be re-queued. -KDU
1361 */ 1361 */
1362 if ((hmp->cur_tx - hmp->dirty_tx) < (TX_RING_SIZE - 4)) 1362 if ((hmp->cur_tx - hmp->dirty_tx) < (TX_RING_SIZE - 4))
1363 netif_wake_queue(dev); /* Typical path */ 1363 netif_wake_queue(dev); /* Typical path */
1364 else { 1364 else {
1365 hmp->tx_full = 1; 1365 hmp->tx_full = 1;
@@ -1412,27 +1412,27 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs
1412 /* This code should RARELY need to execute. After all, this is 1412 /* This code should RARELY need to execute. After all, this is
1413 * a gigabit link, it should consume packets as fast as we put 1413 * a gigabit link, it should consume packets as fast as we put
1414 * them in AND we clear the Tx ring in hamachi_start_xmit(). 1414 * them in AND we clear the Tx ring in hamachi_start_xmit().
1415 */ 1415 */
1416 if (hmp->tx_full){ 1416 if (hmp->tx_full){
1417 for (; hmp->cur_tx - hmp->dirty_tx > 0; hmp->dirty_tx++){ 1417 for (; hmp->cur_tx - hmp->dirty_tx > 0; hmp->dirty_tx++){
1418 int entry = hmp->dirty_tx % TX_RING_SIZE; 1418 int entry = hmp->dirty_tx % TX_RING_SIZE;
1419 struct sk_buff *skb; 1419 struct sk_buff *skb;
1420 1420
1421 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn)) 1421 if (hmp->tx_ring[entry].status_n_length & cpu_to_le32(DescOwn))
1422 break; 1422 break;
1423 skb = hmp->tx_skbuff[entry]; 1423 skb = hmp->tx_skbuff[entry];
1424 /* Free the original skb. */ 1424 /* Free the original skb. */
1425 if (skb){ 1425 if (skb){
1426 pci_unmap_single(hmp->pci_dev, 1426 pci_unmap_single(hmp->pci_dev,
1427 hmp->tx_ring[entry].addr, 1427 hmp->tx_ring[entry].addr,
1428 skb->len, 1428 skb->len,
1429 PCI_DMA_TODEVICE); 1429 PCI_DMA_TODEVICE);
1430 dev_kfree_skb_irq(skb); 1430 dev_kfree_skb_irq(skb);
1431 hmp->tx_skbuff[entry] = NULL; 1431 hmp->tx_skbuff[entry] = NULL;
1432 } 1432 }
1433 hmp->tx_ring[entry].status_n_length = 0; 1433 hmp->tx_ring[entry].status_n_length = 0;
1434 if (entry >= TX_RING_SIZE-1) 1434 if (entry >= TX_RING_SIZE-1)
1435 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= 1435 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |=
1436 cpu_to_le32(DescEndRing); 1436 cpu_to_le32(DescEndRing);
1437 hmp->stats.tx_packets++; 1437 hmp->stats.tx_packets++;
1438 } 1438 }
@@ -1498,9 +1498,9 @@ static int hamachi_rx(struct net_device *dev)
1498 struct hamachi_desc *desc = &(hmp->rx_ring[entry]); 1498 struct hamachi_desc *desc = &(hmp->rx_ring[entry]);
1499 u32 desc_status = le32_to_cpu(desc->status_n_length); 1499 u32 desc_status = le32_to_cpu(desc->status_n_length);
1500 u16 data_size = desc_status; /* Implicit truncate */ 1500 u16 data_size = desc_status; /* Implicit truncate */
1501 u8 *buf_addr; 1501 u8 *buf_addr;
1502 s32 frame_status; 1502 s32 frame_status;
1503 1503
1504 if (desc_status & DescOwn) 1504 if (desc_status & DescOwn)
1505 break; 1505 break;
1506 pci_dma_sync_single_for_cpu(hmp->pci_dev, 1506 pci_dma_sync_single_for_cpu(hmp->pci_dev,
@@ -1540,7 +1540,7 @@ static int hamachi_rx(struct net_device *dev)
1540 } else { 1540 } else {
1541 struct sk_buff *skb; 1541 struct sk_buff *skb;
1542 /* Omit CRC */ 1542 /* Omit CRC */
1543 u16 pkt_len = (frame_status & 0x07ff) - 4; 1543 u16 pkt_len = (frame_status & 0x07ff) - 4;
1544#ifdef RX_CHECKSUM 1544#ifdef RX_CHECKSUM
1545 u32 pfck = *(u32 *) &buf_addr[data_size - 8]; 1545 u32 pfck = *(u32 *) &buf_addr[data_size - 8];
1546#endif 1546#endif
@@ -1576,7 +1576,7 @@ static int hamachi_rx(struct net_device *dev)
1576 PCI_DMA_FROMDEVICE); 1576 PCI_DMA_FROMDEVICE);
1577 /* Call copy + cksum if available. */ 1577 /* Call copy + cksum if available. */
1578#if 1 || USE_IP_COPYSUM 1578#if 1 || USE_IP_COPYSUM
1579 eth_copy_and_sum(skb, 1579 eth_copy_and_sum(skb,
1580 hmp->rx_skbuff[entry]->data, pkt_len, 0); 1580 hmp->rx_skbuff[entry]->data, pkt_len, 0);
1581 skb_put(skb, pkt_len); 1581 skb_put(skb, pkt_len);
1582#else 1582#else
@@ -1588,7 +1588,7 @@ static int hamachi_rx(struct net_device *dev)
1588 hmp->rx_buf_sz, 1588 hmp->rx_buf_sz,
1589 PCI_DMA_FROMDEVICE); 1589 PCI_DMA_FROMDEVICE);
1590 } else { 1590 } else {
1591 pci_unmap_single(hmp->pci_dev, 1591 pci_unmap_single(hmp->pci_dev,
1592 hmp->rx_ring[entry].addr, 1592 hmp->rx_ring[entry].addr,
1593 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1593 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1594 skb_put(skb = hmp->rx_skbuff[entry], pkt_len); 1594 skb_put(skb = hmp->rx_skbuff[entry], pkt_len);
@@ -1619,18 +1619,18 @@ static int hamachi_rx(struct net_device *dev)
1619 p_r = *p; 1619 p_r = *p;
1620 p_r1 = *(p-1); 1620 p_r1 = *(p-1);
1621 switch (inv) { 1621 switch (inv) {
1622 case 0: 1622 case 0:
1623 crc = (p_r & 0xffff) + (p_r >> 16); 1623 crc = (p_r & 0xffff) + (p_r >> 16);
1624 break; 1624 break;
1625 case 1: 1625 case 1:
1626 crc = (p_r >> 16) + (p_r & 0xffff) 1626 crc = (p_r >> 16) + (p_r & 0xffff)
1627 + (p_r1 >> 16 & 0xff00); 1627 + (p_r1 >> 16 & 0xff00);
1628 break; 1628 break;
1629 case 2: 1629 case 2:
1630 crc = p_r + (p_r1 >> 16); 1630 crc = p_r + (p_r1 >> 16);
1631 break; 1631 break;
1632 case 3: 1632 case 3:
1633 crc = p_r + (p_r1 & 0xff00) + (p_r1 >> 16); 1633 crc = p_r + (p_r1 & 0xff00) + (p_r1 >> 16);
1634 break; 1634 break;
1635 default: /*NOTREACHED*/ crc = 0; 1635 default: /*NOTREACHED*/ crc = 0;
1636 } 1636 }
@@ -1650,7 +1650,7 @@ static int hamachi_rx(struct net_device *dev)
1650 */ 1650 */
1651 skb->ip_summed = CHECKSUM_HW; 1651 skb->ip_summed = CHECKSUM_HW;
1652 } 1652 }
1653 } 1653 }
1654 } 1654 }
1655#endif /* RX_CHECKSUM */ 1655#endif /* RX_CHECKSUM */
1656 1656
@@ -1675,15 +1675,15 @@ static int hamachi_rx(struct net_device *dev)
1675 break; /* Better luck next round. */ 1675 break; /* Better luck next round. */
1676 skb->dev = dev; /* Mark as being used by this device. */ 1676 skb->dev = dev; /* Mark as being used by this device. */
1677 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1677 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
1678 desc->addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, 1678 desc->addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
1679 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 1679 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE));
1680 } 1680 }
1681 desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz); 1681 desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz);
1682 if (entry >= RX_RING_SIZE-1) 1682 if (entry >= RX_RING_SIZE-1)
1683 desc->status_n_length |= cpu_to_le32(DescOwn | 1683 desc->status_n_length |= cpu_to_le32(DescOwn |
1684 DescEndPacket | DescEndRing | DescIntr); 1684 DescEndPacket | DescEndRing | DescIntr);
1685 else 1685 else
1686 desc->status_n_length |= cpu_to_le32(DescOwn | 1686 desc->status_n_length |= cpu_to_le32(DescOwn |
1687 DescEndPacket | DescIntr); 1687 DescEndPacket | DescIntr);
1688 } 1688 }
1689 1689
@@ -1794,8 +1794,8 @@ static int hamachi_close(struct net_device *dev)
1794 hmp->rx_ring[i].status_n_length = 0; 1794 hmp->rx_ring[i].status_n_length = 0;
1795 hmp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ 1795 hmp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
1796 if (skb) { 1796 if (skb) {
1797 pci_unmap_single(hmp->pci_dev, 1797 pci_unmap_single(hmp->pci_dev,
1798 hmp->rx_ring[i].addr, hmp->rx_buf_sz, 1798 hmp->rx_ring[i].addr, hmp->rx_buf_sz,
1799 PCI_DMA_FROMDEVICE); 1799 PCI_DMA_FROMDEVICE);
1800 dev_kfree_skb(skb); 1800 dev_kfree_skb(skb);
1801 hmp->rx_skbuff[i] = NULL; 1801 hmp->rx_skbuff[i] = NULL;
@@ -1804,8 +1804,8 @@ static int hamachi_close(struct net_device *dev)
1804 for (i = 0; i < TX_RING_SIZE; i++) { 1804 for (i = 0; i < TX_RING_SIZE; i++) {
1805 skb = hmp->tx_skbuff[i]; 1805 skb = hmp->tx_skbuff[i];
1806 if (skb) { 1806 if (skb) {
1807 pci_unmap_single(hmp->pci_dev, 1807 pci_unmap_single(hmp->pci_dev,
1808 hmp->tx_ring[i].addr, skb->len, 1808 hmp->tx_ring[i].addr, skb->len,
1809 PCI_DMA_TODEVICE); 1809 PCI_DMA_TODEVICE);
1810 dev_kfree_skb(skb); 1810 dev_kfree_skb(skb);
1811 hmp->tx_skbuff[i] = NULL; 1811 hmp->tx_skbuff[i] = NULL;
@@ -1829,7 +1829,7 @@ static struct net_device_stats *hamachi_get_stats(struct net_device *dev)
1829 according to ifconfig. It does get incremented in hamachi_tx(), 1829 according to ifconfig. It does get incremented in hamachi_tx(),
1830 so I think I'll comment it out here and see if better things 1830 so I think I'll comment it out here and see if better things
1831 happen. 1831 happen.
1832 */ 1832 */
1833 /* hmp->stats.tx_packets = readl(ioaddr + 0x000); */ 1833 /* hmp->stats.tx_packets = readl(ioaddr + 0x000); */
1834 1834
1835 hmp->stats.rx_bytes = readl(ioaddr + 0x330); /* Total Uni+Brd+Multi */ 1835 hmp->stats.rx_bytes = readl(ioaddr + 0x330); /* Total Uni+Brd+Multi */
@@ -1976,9 +1976,9 @@ static void __devexit hamachi_remove_one (struct pci_dev *pdev)
1976 if (dev) { 1976 if (dev) {
1977 struct hamachi_private *hmp = netdev_priv(dev); 1977 struct hamachi_private *hmp = netdev_priv(dev);
1978 1978
1979 pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring, 1979 pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring,
1980 hmp->rx_ring_dma); 1980 hmp->rx_ring_dma);
1981 pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring, 1981 pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring,
1982 hmp->tx_ring_dma); 1982 hmp->tx_ring_dma);
1983 unregister_netdev(dev); 1983 unregister_netdev(dev);
1984 iounmap(hmp->base); 1984 iounmap(hmp->base);