Subject: Re: 10/100 ethernet cards - followup (fxp FIX)
To: Sanjay Lal <sanjayl@iqmail.net>
From: Ben Harris <bjh21@cam.ac.uk>
List: port-macppc
Date: 05/04/2000 22:58:04
On Sun, 1 Jan 1995, Sanjay Lal wrote:
> Hmm, I must have forgotten to submit this fix for the fxp driver. Here
> it goes (sorry I dont have the diffs.
>
> In -current the file in question is .../dev/ice/i82557.c In both cases
> the bug is a endian issue. The driver issued a command to the chip and
> polls a bit waiting for it to complete. however due to the endian
> swap, the wrong bit is polled, and the kernel hangs an in infinite
> while loop. I have added the htole16() call whithin the while loop.
That _seems_ to have worked. There was a third occurrence of the problem
that you'd forgotten about, though. Here's the patch (beware tab->space
cut/paste lossage):
--------8<--------
--- i82557.c.orig Thu Mar 30 13:22:53 2000
+++ i82557.c Wed May 3 23:48:55 2000
@@ -1373,7 +1373,7 @@
do {
FXP_CDCONFIGSYNC(sc,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- } while ((cbp->cb_status & FXP_CB_STATUS_C) == 0);
+ } while ((htole16(cbp->cb_status) & FXP_CB_STATUS_C) == 0);
/*
* Initialize the station address.
@@ -1398,7 +1398,7 @@
do {
FXP_CDIASSYNC(sc,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- } while ((cb_ias->cb_status & FXP_CB_STATUS_C) == 0);
+ } while ((htole16(cb_ias->cb_status) & FXP_CB_STATUS_C) == 0);
/*
* Initialize the transmit descriptor ring. txlast is initialized
@@ -1848,7 +1848,7 @@
do {
FXP_CDMCSSYNC(sc,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- } while ((mcsp->cb_status & FXP_CB_STATUS_C) == 0);
+ } while ((htole16(mcsp->cb_status) & FXP_CB_STATUS_C) == 0);
}
int
-------->8--------
This was to revision 1.25 of the file. Incidentally, wouldn't le16toh be
slightly more appropriate here?
FWIW, here's the dmesg fragment:
--------8<--------
fxp0 at pci0 dev 13 function 0: Intel i82557 Ethernet, rev 1
fxp0: interrupting at irq 23
fxp0: Ethernet address a0:00:10:c9:53:93, 10 Mb/s
fxp0: Seeq 80c24 AutoDUPLEX media interface present
-------->8--------
The card is an Intel EtherExpress PRO/10+ PCI LAN Adapter, according to
the cover of the manual.
I've not tested the interface under load yet, but I can at least log in
over it now.
--
Ben Harris
Unix Support, University of Cambridge Computing Service.