patch-2.4.20 linux-2.4.20/drivers/net/dl2k.c
Next file: linux-2.4.20/drivers/net/dl2k.h
Previous file: linux-2.4.20/drivers/net/depca.c
Back to the patch index
Back to the overall index
- Lines: 147
- Date:
Thu Nov 28 15:53:13 2002
- Orig file:
linux-2.4.19/drivers/net/dl2k.c
- Orig date:
Fri Aug 2 17:39:44 2002
diff -urN linux-2.4.19/drivers/net/dl2k.c linux-2.4.20/drivers/net/dl2k.c
@@ -1,6 +1,6 @@
/* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */
/*
- Copyright (c) 2001,2002 by D-Link Corporation
+ Copyright (c) 2001, 2002 by D-Link Corporation
Written by Edward Peng.<edward_peng@dlink.com.tw>
Created 03-May-2001, base on Linux' sundance.c.
@@ -33,12 +33,13 @@
1.11 2002/05/23 Added ISR schedule scheme.
Fixed miscount of rx frame error for DGE-550SX.
Fixed VLAN bug.
+ 1.12 2002/06/13 Lock tx_coalesce=1 on 10/100Mbps mode.
*/
#include "dl2k.h"
static char version[] __devinitdata =
- KERN_INFO "D-Link DL2000-based linux driver v1.11 2002/05/23\n";
+ KERN_INFO "D-Link DL2000-based linux driver v1.12 2002/06/13\n";
#define MAX_UNITS 8
static int mtu[MAX_UNITS];
@@ -138,15 +139,15 @@
}
SET_MODULE_OWNER (dev);
-#ifdef USE_IO_OPS
- ioaddr = pci_resource_start (pdev, 0);
-#else
+#ifdef MEM_MAPPING
ioaddr = pci_resource_start (pdev, 1);
ioaddr = (long) ioremap (ioaddr, RIO_IO_SIZE);
if (!ioaddr) {
err = -ENOMEM;
goto err_out_dev;
}
+#else
+ ioaddr = pci_resource_start (pdev, 0);
#endif
dev->base_addr = ioaddr;
dev->irq = irq;
@@ -158,6 +159,7 @@
/* Parse manual configuration */
np->an_enable = 1;
+ np->tx_coalesce = 1;
if (card_idx < MAX_UNITS) {
if (media[card_idx] != NULL) {
np->an_enable = 0;
@@ -213,7 +215,7 @@
if (tx_coalesce < 1)
tx_coalesce = 1;
- if (tx_coalesce > TX_RING_SIZE-1)
+ else if (tx_coalesce > TX_RING_SIZE-1)
tx_coalesce = TX_RING_SIZE - 1;
}
dev->open = &rio_open;
@@ -303,7 +305,7 @@
err_out_unmap_tx:
pci_free_consistent (pdev, TX_TOTAL_SIZE, np->tx_ring, np->tx_ring_dma);
err_out_iounmap:
-#ifndef USE_IO_OPS
+#ifdef MEM_MAPPING
iounmap ((void *) ioaddr);
err_out_dev:
@@ -361,7 +363,7 @@
}
/* Check CRC */
- crc = ~ether_crc_le(256 - 4, sromdata);
+ crc = ~ether_crc_le (256 - 4, sromdata);
if (psrom->crc != crc) {
printk (KERN_ERR "%s: EEPROM data CRC error.\n", dev->name);
return -1;
@@ -636,7 +638,7 @@
/* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode
* Work around: Always use 1 descriptor in 10Mbps mode */
- if (entry % tx_coalesce == 0 || np->speed == 10)
+ if (entry % np->tx_coalesce == 0 || np->speed == 10)
txdesc->status = cpu_to_le64 (entry | tfc_vlan_tag |
WordAlignDisable |
TxDMAIndicate |
@@ -807,13 +809,8 @@
/* Let TxStartThresh stay default value */
}
/* Maximum Collisions */
-#ifdef ETHER_STATS
- if (tx_status & 0x08)
- np->stats.collisions16++;
-#else
if (tx_status & 0x08)
np->stats.collisions++;
-#endif
/* Restart the Tx */
writel (readw (dev->base_addr + MACCtrl) | TxEnable, ioaddr + MACCtrl);
}
@@ -936,6 +933,10 @@
mii_get_media_pcs (dev);
else
mii_get_media (dev);
+ if (np->speed == 1000)
+ np->tx_coalesce = tx_coalesce;
+ else
+ np->tx_coalesce = 1;
macctrl = 0;
macctrl |= (np->vlan) ? AutoVLANuntagging : 0;
macctrl |= (np->full_duplex) ? DuplexSelect : 0;
@@ -1102,7 +1103,6 @@
u16 rx_mode = 0;
int i;
int bit;
- int index, crc;
struct dev_mc_list *mclist;
struct netdev_private *np = dev->priv;
@@ -1124,13 +1124,14 @@
for (i=0, mclist = dev->mc_list; mclist && i < dev->mc_count;
i++, mclist=mclist->next) {
- crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr);
+ int index = 0;
+ int crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr);
/* The inverted high significant 6 bits of CRC are
used as an index to hashtable */
- for (index = 0, bit = 0; bit < 6; bit++)
- if (test_bit(31 - bit, &crc))
- set_bit(bit, &index);
+ for (bit = 0; bit < 6; bit++)
+ if (crc & (1 << (31 - bit)))
+ index |= (1 << bit);
hash_table[index / 32] |= (1 << (index % 32));
}
@@ -1671,7 +1672,7 @@
np->rx_ring_dma);
pci_free_consistent (pdev, TX_TOTAL_SIZE, np->tx_ring,
np->tx_ring_dma);
-#ifndef USE_IO_OPS
+#ifdef MEM_MAPPING
iounmap ((char *) (dev->base_addr));
#endif
kfree (dev);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)