Commit 9f2adacb authored by Ion Badulescu's avatar Ion Badulescu Committed by Jeff Garzik

starfire net driver updates:

* Sparc64 support and fixes.
* Better stats and error handling.
parent 579574a4
...@@ -148,7 +148,7 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then ...@@ -148,7 +148,7 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
fi fi
if [ "$CONFIG_NET_PCI" = "y" ]; then if [ "$CONFIG_NET_PCI" = "y" ]; then
dep_tristate ' AMD PCnet32 PCI support' CONFIG_PCNET32 $CONFIG_PCI dep_tristate ' AMD PCnet32 PCI support' CONFIG_PCNET32 $CONFIG_PCI
dep_tristate ' Adaptec Starfire support (EXPERIMENTAL)' CONFIG_ADAPTEC_STARFIRE $CONFIG_PCI $CONFIG_EXPERIMENTAL dep_tristate ' Adaptec Starfire/DuraLAN support' CONFIG_ADAPTEC_STARFIRE $CONFIG_PCI
if [ "$CONFIG_ISA" = "y" -o "$CONFIG_EISA" = "y" ]; then if [ "$CONFIG_ISA" = "y" -o "$CONFIG_EISA" = "y" ]; then
dep_tristate ' Ansel Communications EISA 3200 support (EXPERIMENTAL)' CONFIG_AC3200 $CONFIG_EXPERIMENTAL dep_tristate ' Ansel Communications EISA 3200 support (EXPERIMENTAL)' CONFIG_AC3200 $CONFIG_EXPERIMENTAL
fi fi
......
...@@ -96,13 +96,18 @@ ...@@ -96,13 +96,18 @@
LK1.3.5 (jgarzik) LK1.3.5 (jgarzik)
- ethtool NWAY_RST, GLINK, [GS]MSGLVL support - ethtool NWAY_RST, GLINK, [GS]MSGLVL support
LK1.3.6 (Ion Badulescu)
- Sparc64 support and fixes
- Better stats and error handling
TODO: TODO:
- implement tx_timeout() properly - implement tx_timeout() properly
- VLAN support
*/ */
#define DRV_NAME "starfire" #define DRV_NAME "starfire"
#define DRV_VERSION "1.03+LK1.3.5" #define DRV_VERSION "1.03+LK1.3.6"
#define DRV_RELDATE "November 17, 2001" #define DRV_RELDATE "March 6, 2002"
#include <linux/version.h> #include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -128,8 +133,11 @@ ...@@ -128,8 +133,11 @@
* for this driver to really use the firmware. Note that Rx/Tx * for this driver to really use the firmware. Note that Rx/Tx
* hardware TCP checksumming is not possible without the firmware. * hardware TCP checksumming is not possible without the firmware.
* *
* I'm currently [Feb 2001] talking to Adaptec about this redistribution * If Adaptec could allow redistribution of the firmware (even in binary
* issue. Stay tuned... * format), life would become a lot easier. Unfortunately, I've lost my
* Adaptec contacts, so progress on this front is rather unlikely to
* occur. If anybody from Adaptec reads this and can help with this matter,
* please let me know...
*/ */
#undef HAS_FIRMWARE #undef HAS_FIRMWARE
/* /*
...@@ -609,6 +617,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev, ...@@ -609,6 +617,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
long ioaddr; long ioaddr;
int drv_flags, io_size; int drv_flags, io_size;
int boguscnt; int boguscnt;
u16 cmd;
u8 cache; u8 cache;
/* when built into the kernel, we only print version if device is found */ /* when built into the kernel, we only print version if device is found */
...@@ -644,14 +653,22 @@ static int __devinit starfire_init_one(struct pci_dev *pdev, ...@@ -644,14 +653,22 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
goto err_out_free_netdev; goto err_out_free_netdev;
} }
ioaddr = (long) ioremap (ioaddr, io_size); /* ioremap is borken in Linux-2.2.x/sparc64 */
#if !defined(CONFIG_SPARC64) || LINUX_VERSION_CODE > 0x20300
ioaddr = (long) ioremap(ioaddr, io_size);
if (!ioaddr) { if (!ioaddr) {
printk (KERN_ERR DRV_NAME " %d: cannot remap 0x%x @ 0x%lx, aborting\n", printk (KERN_ERR DRV_NAME " %d: cannot remap 0x%x @ 0x%lx, aborting\n",
card_idx, io_size, ioaddr); card_idx, io_size, ioaddr);
goto err_out_free_res; goto err_out_free_res;
} }
#endif /* !CONFIG_SPARC64 || Linux 2.3.0+ */
pci_set_master(pdev);
pci_set_master (pdev); /* enable MWI -- it vastly improves Rx performance on sparc64 */
pci_read_config_word(pdev, PCI_COMMAND, &cmd);
cmd |= PCI_COMMAND_INVALIDATE;
pci_write_config_word(pdev, PCI_COMMAND, cmd);
/* set PCI cache size */ /* set PCI cache size */
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache); pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache);
...@@ -670,7 +687,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev, ...@@ -670,7 +687,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
/* Serial EEPROM reads are hidden by the hardware. */ /* Serial EEPROM reads are hidden by the hardware. */
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
dev->dev_addr[i] = readb(ioaddr + EEPROMCtrl + 20-i); dev->dev_addr[i] = readb(ioaddr + EEPROMCtrl + 20 - i);
#if ! defined(final_version) /* Dump the EEPROM contents during development. */ #if ! defined(final_version) /* Dump the EEPROM contents during development. */
if (debug > 4) if (debug > 4)
...@@ -932,7 +949,7 @@ static int netdev_open(struct net_device *dev) ...@@ -932,7 +949,7 @@ static int netdev_open(struct net_device *dev)
/* Fill both the unused Tx SA register and the Rx perfect filter. */ /* Fill both the unused Tx SA register and the Rx perfect filter. */
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
writeb(dev->dev_addr[i], ioaddr + StationAddr + 5-i); writeb(dev->dev_addr[i], ioaddr + StationAddr + 5 - i);
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
u16 *eaddrs = (u16 *)dev->dev_addr; u16 *eaddrs = (u16 *)dev->dev_addr;
long setup_frm = ioaddr + PerfFilterTable + i * 16; long setup_frm = ioaddr + PerfFilterTable + i * 16;
...@@ -979,9 +996,9 @@ static int netdev_open(struct net_device *dev) ...@@ -979,9 +996,9 @@ static int netdev_open(struct net_device *dev)
#ifdef HAS_FIRMWARE #ifdef HAS_FIRMWARE
/* Load Rx/Tx firmware into the frame processors */ /* Load Rx/Tx firmware into the frame processors */
for (i = 0; i < FIRMWARE_RX_SIZE * 2; i++) for (i = 0; i < FIRMWARE_RX_SIZE * 2; i++)
writel(cpu_to_le32(firmware_rx[i]), ioaddr + RxGfpMem + i * 4); writel(firmware_rx[i], ioaddr + RxGfpMem + i * 4);
for (i = 0; i < FIRMWARE_TX_SIZE * 2; i++) for (i = 0; i < FIRMWARE_TX_SIZE * 2; i++)
writel(cpu_to_le32(firmware_tx[i]), ioaddr + TxGfpMem + i * 4); writel(firmware_tx[i], ioaddr + TxGfpMem + i * 4);
/* Enable the Rx and Tx units, and the Rx/Tx frame processors. */ /* Enable the Rx and Tx units, and the Rx/Tx frame processors. */
writel(0x003F, ioaddr + GenCtrl); writel(0x003F, ioaddr + GenCtrl);
#else /* not HAS_FIRMWARE */ #else /* not HAS_FIRMWARE */
...@@ -1156,8 +1173,8 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -1156,8 +1173,8 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
np->tx_ring[entry].first_addr = cpu_to_le32(np->tx_info[entry].first_mapping); np->tx_ring[entry].first_addr = cpu_to_le32(np->tx_info[entry].first_mapping);
#ifdef ZEROCOPY #ifdef ZEROCOPY
np->tx_ring[entry].first_len = cpu_to_le32(skb_first_frag_len(skb)); np->tx_ring[entry].first_len = cpu_to_le16(skb_first_frag_len(skb));
np->tx_ring[entry].total_len = cpu_to_le32(skb->len); np->tx_ring[entry].total_len = cpu_to_le16(skb->len);
/* Add "| TxDescIntr" to generate Tx-done interrupts. */ /* Add "| TxDescIntr" to generate Tx-done interrupts. */
np->tx_ring[entry].status = cpu_to_le32(TxDescID | TxCRCEn); np->tx_ring[entry].status = cpu_to_le32(TxDescID | TxCRCEn);
np->tx_ring[entry].nbufs = cpu_to_le32(skb_shinfo(skb)->nr_frags + 1); np->tx_ring[entry].nbufs = cpu_to_le32(skb_shinfo(skb)->nr_frags + 1);
...@@ -1170,8 +1187,10 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -1170,8 +1187,10 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
np->tx_ring[entry].status |= cpu_to_le32(TxRingWrap | TxDescIntr); np->tx_ring[entry].status |= cpu_to_le32(TxRingWrap | TxDescIntr);
#ifdef ZEROCOPY #ifdef ZEROCOPY
if (skb->ip_summed == CHECKSUM_HW) if (skb->ip_summed == CHECKSUM_HW) {
np->tx_ring[entry].status |= cpu_to_le32(TxCalTCP); np->tx_ring[entry].status |= cpu_to_le32(TxCalTCP);
np->stats.tx_compressed++;
}
#endif /* ZEROCOPY */ #endif /* ZEROCOPY */
if (debug > 5) { if (debug > 5) {
...@@ -1449,6 +1468,7 @@ static int netdev_rx(struct net_device *dev) ...@@ -1449,6 +1468,7 @@ static int netdev_rx(struct net_device *dev)
#if defined(full_rx_status) || defined(csum_rx_status) #if defined(full_rx_status) || defined(csum_rx_status)
if (le32_to_cpu(np->rx_done_q[np->rx_done].status2) & 0x01000000) { if (le32_to_cpu(np->rx_done_q[np->rx_done].status2) & 0x01000000) {
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
np->stats.rx_compressed++;
} }
/* /*
* This feature doesn't seem to be working, at least * This feature doesn't seem to be working, at least
...@@ -1580,12 +1600,17 @@ static void netdev_error(struct net_device *dev, int intr_status) ...@@ -1580,12 +1600,17 @@ static void netdev_error(struct net_device *dev, int intr_status)
printk(KERN_NOTICE "%s: Increasing Tx FIFO threshold to %d bytes\n", printk(KERN_NOTICE "%s: Increasing Tx FIFO threshold to %d bytes\n",
dev->name, np->tx_threshold * 16); dev->name, np->tx_threshold * 16);
} }
if ((intr_status & ~(IntrNormalMask | IntrAbnormalSummary | IntrLinkChange | IntrStatsMax | IntrTxDataLow | IntrPCIPad)) && debug) if (intr_status & IntrRxGFPDead) {
np->stats.rx_fifo_errors++;
np->stats.rx_errors++;
}
if (intr_status & (IntrNoTxCsum | IntrDMAErr)) {
np->stats.tx_fifo_errors++;
np->stats.tx_errors++;
}
if ((intr_status & ~(IntrNormalMask | IntrAbnormalSummary | IntrLinkChange | IntrStatsMax | IntrTxDataLow | IntrRxGFPDead | IntrNoTxCsum | IntrPCIPad)) && debug)
printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n", printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n",
dev->name, intr_status); dev->name, intr_status);
/* Hmmmmm, it's not clear how to recover from DMA faults. */
if (intr_status & IntrDMAErr)
np->stats.tx_fifo_errors++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment