PATCH: arch/ppc/8xx_io_fec.c

Jean-Denis Boyer jdboyer at m5t.com
Wed May 28 00:38:49 EST 2003


I discovered an old bug in the Fast Ethernet driver of the 860T.
In function fec_restart, the FEC is reset with no concern
to pending MDIO requests.

If an MDIO request is being served while the FEC is reset,
it is lost, causing the system to hang if it is waiting for
the answer (MDIO read). It may also lose a register modification
request (MDIO write).

1 - Especially at boot up, in function fec_enet_open, we could hang on:
        while(!fep->sequence_done)
            schedule();
2 - Or, the worst, in function mdio_read called through the ioctl,
    which would hang the calling process.

I encountered only the first problem, hanging at boot up just after printing:
  eth0: Phy @ 0x1, type DP83846A (0x20005c23)
The problem was extremely rare, due to a link down/link up sequence
that occurs at every boot up, and probably an MDIO request queued just
before the time of the FEC reset.

Attached is a patch (over 2.4.21-rc3) that adds two functions:
  static void stop_mii_queue(struct net_device *dev)
  static void start_mii_queue(struct net_device *dev)
that are both called by fec_restart.
The tests I performed easily demonstrates that we no longer loose
an MDIO request when fec_restart is called.

I also cleanen up some code around the MDIO management.

1 - In function mii_link_interrupt, I removed the code that juggles with
    the bit ECNTRL[ETHER_EN]. It is completly useless since the MDIO will
    work no matter the state of this bit. It can also as bad effects
    to put this bit to 1 without initializing the rest properly.
2 - In function fec_stop, I simplified the code, since there is no need
    to reconfigure all the registers after a graceful transmitter stop.
    Especially, the code that "Clear outstanding MII command interrupts."
    should not be there.

I'm waiting for comments.

--------------------------------------------
 Jean-Denis Boyer, Software Designer
 M5T Inc.
 4283 rue Garlock
 Sherbrooke (Québec)
 J1L 2C8  CANADA
 (819)829-3972 x241
--------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_8xx_fec_20030526.diff.gz
Type: application/x-gzip
Size: 1449 bytes
Desc: patch_8xx_fec_20030526.diff.gz
Url : http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20030527/94df5338/attachment.bin 


More information about the Linuxppc-embedded mailing list