Messages in this thread Patch in this message | | | Date | Mon, 4 Jan 1999 04:12:38 -0500 (EST) | From | Stephen Richard Ives <> | Subject | [patch] 2.2.0pre4 epic100.c cosmetic tweaks |
| |
While hunting down some transmit hang problems I've been experiencing with this driver, I've cleaned up the source a bit:
* #if LINUX_VERSION_CODE checks to the byte counters added in 2.2.0pre4 * URL updates * removed some #include's we don't actually depend on * a few spelling/whitespace/comment/printk tweaks
-Steve
Stephen R. Ives (Senior ECE BS/MS, CS BS) | We are CMU students of Borg. Carnegie Mellon University | Sleep is irrelevant. email: ives+@andrew.cmu.edu | You will be caffeinated. http://photon.res.cmu.edu/~ives | --- /usr/src/linux-2.2.0-pre4/drivers/net/epic100.c Thu Dec 31 15:05:12 1998 +++ /home/ives/src/epic100.new.c Mon Jan 4 03:39:00 1999 @@ -58,10 +58,8 @@ #endif #include <linux/kernel.h> -#include <linux/sched.h> #include <linux/string.h> #include <linux/timer.h> -#include <linux/ptrace.h> #include <linux/errno.h> #include <linux/ioport.h> #include <linux/malloc.h> @@ -77,7 +75,6 @@ #include <asm/processor.h> /* Processor type for cache alignment. */ #include <asm/bitops.h> #include <asm/io.h> -#include <asm/dma.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> @@ -125,11 +122,10 @@ I. Board Compatibility -This device driver is designed for the SMC "EPCI/100", the SMC +This device driver is designed for the SMC "EPIC/100", the SMC single-chip Ethernet controllers for PCI. This chip is used on the SMC EtherPower II boards. - II. Board-specific settings PCI bus devices are configured by the system at boot time, so no jumpers @@ -144,9 +140,10 @@ IVb. References -http://www.smc.com/components/catalog/smc83c170.html +http://www.smsc.com/main/datasheets/83c171.pdf +http://www.smsc.com/main/datasheets/83c175.pdf http://cesdis.gsfc.nasa.gov/linux/misc/NWay.html -http://www.national.com/pf/DP/DP83840.html +http://www.national.com/pf/DP/DP83840A.html IVc. Errata @@ -162,6 +159,7 @@ PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3, }; + struct chip_info { const char *name; u16 vendor_id, device_id, device_id_mask, pci_flags; @@ -221,7 +219,7 @@ const char *product_name; struct device *next_module; - /* Rx and Rx rings here so that they remain paragraph aligned. */ + /* Tx and Rx rings here so that they remain paragraph aligned. */ struct epic_rx_desc rx_ring[RX_RING_SIZE]; struct epic_tx_desc tx_ring[TX_RING_SIZE]; /* The saved address of a sent-in-place packet/buffer, for skfree(). */ @@ -808,7 +806,7 @@ /* Perhaps stop and restart the chip's Tx processes . */ /* Trigger a transmit demand. */ - outl(0x0004, dev->base_addr + COMMAND); + outl(0x0004, ioaddr + COMMAND); dev->trans_start = jiffies; ep->stats.tx_errors++; @@ -884,11 +882,13 @@ ep->tx_ring[entry].bufaddr = virt_to_bus(skb->data); ep->tx_ring[entry].buflength = skb->len; +#if LINUX_VERSION_CODE >= 0x20125 /* tx_bytes counting -- Nolan Leake */ ep->stats.tx_bytes += ep->tx_ring[entry].txlength; +#endif if (ep->cur_tx - ep->dirty_tx < TX_RING_SIZE/2) {/* Typical path */ - flag = 0x10; /* No interrupt */ + flag = 0x10; /* No Tx-done intr. */ clear_bit(0, (void*)&dev->tbusy); } else if (ep->cur_tx - ep->dirty_tx == TX_RING_SIZE/2) { flag = 0x14; /* Tx-done intr. */ @@ -930,7 +930,7 @@ #if defined(__i386__) /* A lock to prevent simultaneous entry bug on Intel SMP machines. */ if (test_and_set_bit(0, (void*)&dev->interrupt)) { - printk(KERN_ERR"%s: SMP simultaneous entry of an interrupt handler.\n", + printk(KERN_ERR "%s: SMP simultaneous entry of an interrupt handler.\n", dev->name); dev->interrupt = 0; /* Avoid halting machine. */ return; @@ -1115,8 +1115,10 @@ skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); ep->stats.rx_packets++; +#if LINUX_VERSION_CODE >= 0x20125 /* rx_bytes counting -- Nolan Leake */ ep->stats.rx_bytes += pkt_len; +#endif } work_done++; entry = (++ep->cur_rx) % RX_RING_SIZE; @@ -1187,7 +1189,6 @@ ep->tx_skbuff[i] = 0; } - /* Green! Leave the chip in low-power mode. */ outl(0x0008, ioaddr + GENCTL); @@ -1236,7 +1237,6 @@ } return crc; } - static void set_rx_mode(struct device *dev) { | |