Bob, Thanks for you message and your patch. I applied and tested it with several clone cards (LC82C115, LC82168, and MX98715). Unfortunately it failed to function properly (it hung), probably because of the compile errors you noted in your message. I fixed the compile problems (the compiler objects to memset-ing volatile structures) by removing the memsets, which don't really seem to be needed. I also added a sanity timeout on the TX status busy loops to make sure the driver doesn't hang there. Would you be so kind as to test the following patch? I believe it addresses all of the issues you have raised, and seems to work with the clones I have tested. It should provide close to the performance you are reporting, while maintaining compatibility with current cards. To use the patch, you'll need to copy the patch below to a file (patchfile.txt) and do something like: $ cd etherboot-4.4.3/src $ cp ntulip.c ntulip.c.save $ cp ntulip.c.orig ntulip.c $ patch ntulip.c patchfile.txt $ cd ../src-32 $ make ntulip.fd0 This should give you a floppy test version to try. I'd be interested in the results of your testing. I also ask other users of ntulip.c to do the same thing so that we can make sure that these changes do not break currently working cards. Thanks for your help in improving this driver, Bob. Regards, Marty ------ patch begins on next line ------- --- ../src/ntulip.c.orig Sun Feb 20 11:38:56 2000 +++ ../src/ntulip.c Mon Feb 21 22:10:55 2000 @@ -37,6 +37,15 @@ /*********************************************************************/ /* + 21 Feb 2000 mdc patch to Etherboot 4.4.3 + Incorporated patches from Bob Edwards to deal with inefficiencies + in ntulip_transmit and udelay. We now wait for packet transmission + to complete (or sanity timeout). + 04 Feb 2000 Robert.Edwards@anu.edu.au patch to Etherboot 4.4.2 + patch to ntulip.c that implements the automatic selection of the MII + interface on cards using the Intel/ DEC 21143 reference design, in + particular, the TRENDnet TE100-PCIA NIC which uses a genuine Intel + 21143-PD chipset. 11 Jan 2000 mdc 0.75b4 Added support for NetGear FA310TX card based on the LC82C168 chip. This should also support Lite-On LC82C168 boards. @@ -51,7 +60,7 @@ from tulip.c to support other tulip compatible cards. 02 Dec 1999 mdc 0.75b1 Released Beta MX987x5 Driver for code review and testing to netboot - and thinguin mailing lists. + and thinguin mailing lists. */ @@ -81,6 +90,8 @@ #define DEC_21142_CSR6_HBD 0x00080000 /* Heartbeat Disable */ #define DEC_21142_CSR6_PS 0x00040000 /* Port Select */ +#define TX_TIME_OUT 1000000; + /* EEPROM Address width definitions */ #define EEPROM_ADDRLEN 6 #define EEPROM_SIZE 128 /* 2 << EEPROM_ADDRLEN */ @@ -112,7 +123,7 @@ #define le16_to_cpu(val) (val) /* Calibration constant for udelay loop. Very approximate */ -#define UADJUST 870 +#define UADJUST 16 /* transmit and receive descriptor format */ struct txrxdesc { @@ -131,12 +142,12 @@ longword divisable */ /* transmit descriptor and buffer */ -static struct txrxdesc txd; +static volatile struct txrxdesc txd; static unsigned char txb[BUFLEN]; /* receive descriptor(s) and buffer(s) */ #define NRXD 4 -static struct txrxdesc rxd[NRXD]; +static volatile struct txrxdesc rxd[NRXD]; static int rxd_tail = 0; static unsigned char rxb[NRXD][BUFLEN]; @@ -179,7 +190,7 @@ static void udelay(unsigned long usec) { unsigned long i; - for (i=((usec*UADJUST)/33)+1; i>0; i--) + for (i=usec*33/UADJUST+1; i>0; i--) (void) inl(ioaddr + CSR0); } @@ -308,7 +319,6 @@ int i; /* setup the transmit descriptor */ - memset(&txd, 0, sizeof(struct txrxdesc)); txd.buf1addr = &txb[0]; txd.buf2addr = &txb[0]; /* just in case */ txd.buf1sz = 192; /* setup packet must be 192 bytes */ @@ -328,13 +338,12 @@ /* setup receive descriptor */ for (i=0; i<NRXD; i++) { - memset(&rxd[i], 0, sizeof(struct txrxdesc)); rxd[i].buf1addr = &rxb[i][0]; rxd[i].buf2addr = 0; /* not used */ rxd[i].buf1sz = BUFLEN; rxd[i].buf2sz = 0; /* not used */ rxd[i].control = 0x0; - rxd[i].status = 0x80000000; /* give ownership it to device */ + rxd[i].status = 0x80000000; /* give ownership to device */ } /* Set Receive end of ring on last descriptor */ @@ -348,6 +357,8 @@ /*********************************************************************/ static void ntulip_reset(struct nic *nic) { + unsigned long to; + whereami("ntulip_reset\n"); if (vendor == PCI_VENDOR_ID_MACRONIX && dev_id == PCI_DEVICE_ID_MX987x5) { @@ -445,6 +456,22 @@ outl(csr6, ioaddr + CSR6); outl(csr6 | 0x00002000, ioaddr + CSR6); outl(csr6 | 0x00002002, ioaddr + CSR6); + + /* immediate transmit demand */ + outl(0, ioaddr + CSR1); + + to = TX_TIME_OUT; + while ((txd.status & 0x80000000) && --to) + /* wait */ ; + + if (!to) + printf ("TX Timeout!\n"); + +#ifdef NTULIP_DEBUG + printf ("TX: Loop executed %d times.\n", TIME_OUT-to); + printf ("txd.status = %X\n", txd.status); +#endif + } @@ -454,10 +481,7 @@ static void ntulip_transmit(struct nic *nic, char *d, unsigned int t, unsigned int s, char *p) { - unsigned int len; - int pad; - int status; - unsigned char c; + unsigned long to; whereami("ntulip_transmit\n"); @@ -471,20 +495,34 @@ ehdr[ETHER_ADDR_SIZE*2+1] = t & 0xff; /* setup the transmit descriptor */ - memset(&txd, 0, sizeof(struct txrxdesc)); txd.buf1addr = &ehdr[0]; /* ethernet header */ txd.buf1sz = ETHER_HDR_SIZE; txd.buf2addr = p; /* packet to transmit */ txd.buf2sz = s; txd.control = 0x00000188; /* LS+FS+TER */ - txd.status = 0x80000000; /* give it the device */ + txd.status = 0x80000000; /* give ownership to device */ /* Point to transmit descriptor */ outl((unsigned long)&txd, ioaddr + CSR4); /* Start Tx */ outl(inl(ioaddr + CSR6) | 0x00002000, ioaddr + CSR6); - udelay(300); + + /* immediate transmit demand */ + outl(0, ioaddr + CSR1); + + to = TX_TIME_OUT; + while ((txd.status & 0x80000000) && --to) + /* wait */ ; + + if (!to) + printf ("TX Timeout!\n"); + +#ifdef NTULIP_DEBUG + printf ("TX: Loop executed %d times.\n", TIME_OUT-to); + printf ("txd.status = %X\n", txd.status); +#endif + } /*********************************************************************/ ------ end of patch --------- --- Name: Martin D. Connor US Mail: Entity Cyber, Inc.; P.O. Box 391827; Cambridge, MA 02139; USA Voice: (617) 491-6935, Fax: (617) 491-7046 Email: mdc@thinguin.org Web: http://www.thinguin.org/ =========================================================================== This Mail was sent to netboot mailing list by: Marty Connor <mdc@thinguin.org> To get help about this list, send a mail with 'help' as the only string in it's body to majordomo@baghira.han.de. If you have problems with this list, send a mail to netboot-owner@baghira.han.de.
For requests or suggestions regarding this mailing list archive please write to netboot@gkminix.han.de.