8139too update available for testing
Jeff Garzik
jgarzik@mandrakesoft.com
Tue Feb 15 11:41:16 2000
This is a multi-part message in MIME format.
--------------2988B51D83FAD47457F2DCAB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello 8139 users!
Here is an update against Linux kernel 2.3.45 which imports some
features and fixes from the FreeBSD driver.
If anyone wanted to give this a stress test, that would be great.
--
Jeff Garzik | Writing software is
Building 1024 | more fun than working.
MandrakeSoft, Inc. | -Anon
--------------2988B51D83FAD47457F2DCAB
Content-Type: text/plain; charset=us-ascii;
name="8139too.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="8139too.patch"
Index: drivers/net/8139too.c
===================================================================
RCS file: /g/cvslan/linux_2_3/drivers/net/Attic/8139too.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.8.2
diff -u -r1.1.1.1 -r1.1.1.1.8.2
--- drivers/net/8139too.c 2000/02/13 19:14:32 1.1.1.1
+++ drivers/net/8139too.c 2000/02/15 16:04:21 1.1.1.1.8.2
@@ -19,6 +19,8 @@
David S. Miller - PCI DMA and softnet updates
+ Ernst Gill - fixes ported from BSD driver
+
-----------------------------------------------------------------------------
Theory of Operation
@@ -82,7 +84,7 @@
#include <asm/io.h>
-#define RTL8139_VERSION "0.9.0"
+#define RTL8139_VERSION "0.9.1"
#define RTL8139_MODULE_NAME "8139too"
#define RTL8139_DRIVER_NAME RTL8139_MODULE_NAME " Fast Ethernet driver " RTL8139_VERSION
#define PFX RTL8139_MODULE_NAME ": "
@@ -154,15 +156,17 @@
#define RTL8139_CAPS HAS_CHIP_XCVR|HAS_LNK_CHNG
typedef enum {
- UNKNOWN = 0,
RTL8139,
RTL8139_CB,
SMC1211TX,
- MPX5030,
+ /*MPX5030,*/
SIS900,
SIS7016,
+ DELTA8139,
+ ADDTRON8139,
} chip_t;
+
static struct {
chip_t chip;
const char *name;
@@ -170,19 +174,24 @@
{ RTL8139, "RealTek RTL8139 Fast Ethernet"},
{ RTL8139_CB, "RealTek RTL8139B PCI/CardBus"},
{ SMC1211TX, "SMC1211TX EZCard 10/100 (RealTek RTL8139)"},
- { MPX5030, "Accton MPX5030 (RealTek RTL8139)"},
+/* { MPX5030, "Accton MPX5030 (RealTek RTL8139)"},*/
{ SIS900, "SiS 900 (RealTek RTL8139) Fast Ethernet"},
{ SIS7016, "SiS 7016 (RealTek RTL8139) Fast Ethernet"},
+ { DELTA8139, "Delta Electronics 8139 10/100BaseTX"},
+ { ADDTRON8139, "Addtron Technolgy 8139 10/100BaseTX"},
{0,},
};
+
static struct pci_device_id rtl8139_pci_tbl[] __devinitdata = {
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139_CB },
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SMC1211TX },
- {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MPX5030 },
+/* {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MPX5030 },*/
{0x1039, 0x0900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS900 },
{0x1039, 0x7016, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS7016 },
+ {0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DELTA8139 },
+ {0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ADDTRON8139 },
{0,},
};
MODULE_DEVICE_TABLE (pci, rtl8139_pci_tbl);
@@ -379,6 +388,12 @@
#define RTL_R32(reg) readl (ioaddr + reg)
+static const u16 rtl8139_intr_mask =
+ PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver |
+ TxErr | TxOK | RxErr | RxOK;
+
+
+
static const char * __devinit rtl8139_name_from_chip (chip_t chip)
{
int i;
@@ -897,9 +912,7 @@
RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb);
/* Enable all known interrupts by setting the interrupt mask. */
- RTL_W16 (IntrMask,
- PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver
- | TxErr | TxOK | RxErr | RxOK);
+ RTL_W16 (IntrMask, rtl8139_intr_mask);
DPRINTK ("%s: rtl8139_open() ioaddr %#lx IRQ %d"
" GP Pins %2.2x %s-duplex.\n",
@@ -974,9 +987,7 @@
rtl8139_set_rx_mode (dev);
RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb);
/* Enable all known interrupts by setting the interrupt mask. */
- RTL_W16 (IntrMask,
- PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver
- | TxErr | TxOK | RxErr | RxOK);
+ RTL_W16 (IntrMask, rtl8139_intr_mask);
netif_start_queue (dev);
@@ -1359,6 +1370,18 @@
printk (".\n");
#endif
+ /* E. Gill */
+ /* Note from BSD driver:
+ * Here's a totally undocumented fact for you. When the
+ * RealTek chip is in the process of copying a packet into
+ * RAM for you, the length will be 0xfff0. If you spot a
+ * packet header with this value, you need to stop. The
+ * datasheet makes absolutely no mention of this and
+ * RealTek should be shot for this.
+ */
+ if (rx_size == 0xfff0)
+ break;
+
if (rx_status &
(RxBadSymbol | RxRunt | RxTooLong | RxCRCErr |
RxBadAlign)) {
@@ -1524,14 +1547,37 @@
spin_lock_irq (&tp->lock);
+ /* disable interrupt generation while handling this interrupt */
+ RTL_W16 (IntrMask, 0x0000);
+
do {
int status = readw (ioaddr + IntrStatus);
/* Acknowledge all of the current interrupt sources ASAP, but
an first get an additional status bit from CSCR. */
if (status & RxUnderrun)
link_changed = readw (ioaddr + CSCR) & CSCR_LinkChangeBit;
- RTL_W16 (IntrStatus, status);
+ /* E. Gill */
+ /* In case of an RxFIFOOver we must also clear the RxOverflow
+ bit to avoid dropping frames for ever. Believe me, I got a
+ lot of troubles copying huge data (approximately 2 RxFIFOOver
+ errors per 1GB data transfer).
+ The following is written in the 'p-guide.pdf' file (RTL8139(A/B)
+ Programming guide V0.1, from 1999/1/15) on page 9 from REALTEC.
+ -----------------------------------------------------------
+ 2. RxFIFOOvw handling:
+ When RxFIFOOvw occurs, all incoming packets are discarded.
+ Clear ISR(RxFIFOOvw) doesn't dismiss RxFIFOOvw event. To
+ dismiss RxFIFOOvw event, the ISR(RxBufOvw) must be written
+ with a '1'.
+ -----------------------------------------------------------
+ Unfortunately I was not able to find any reason for the
+ RxFIFOOver error (I got the feeling this depends on the
+ CPU speed, lower CPU speed --> more errors).
+ After clearing the RxOverflow bit the transfer of the
+ packet was repeated and all data are error free transfered */
+ RTL_W16 (IntrStatus, (status & RxFIFOOver) ? (status | RxOverflow) : status);
+
DPRINTK ("%s: interrupt status=%#4.4x new intstat=%#4.4x.\n",
dev->name, status,
readw (ioaddr + IntrStatus));
@@ -1565,11 +1611,14 @@
}
} while (1);
- DPRINTK ("%s: exiting interrupt, intr_status=%#4.4x.\n",
- dev->name, readw (ioaddr + IntrStatus));
+ /* Enable all known interrupts by setting the interrupt mask. */
+ RTL_W16 (IntrMask, rtl8139_intr_mask);
spin_unlock_irq (&tp->lock);
- return;
+
+ DPRINTK ("%s: exiting interrupt, intr_status=%#4.4x.\n",
+ dev->name, RTL_R16 (IntrStatus));
+
}
static int rtl8139_close (struct net_device *dev)
--------------2988B51D83FAD47457F2DCAB--
| To unsubscribe, send mail to Majordomo@cesdis.gsfc.nasa.gov, and within the
| body of the mail, include only the text:
| unsubscribe this-list-name youraddress@wherever.org
| You will be unsubscribed as speedily as possible.