[RTEMS Project] #1465: Network autonegotiation fails with GRETH driver

RTEMS trac trac at rtems.org
Sun Nov 23 19:09:58 UTC 2014


#1465: Network autonegotiation fails with GRETH driver
---------------------+----------------------
 Reporter:  jorisvr  |       Owner:  jiri
     Type:  defect   |      Status:  closed
 Priority:  normal   |   Milestone:  4.11
Component:  libcpu   |     Version:  4.11
 Severity:  minor    |  Resolution:  wontfix
 Keywords:           |
---------------------+----------------------
Changes (by joel.sherrill):

 * version:  unknown => 4.11


Old description:

> The RTEMS driver for the GRETH Ethernet core incorrectly reports a
> timeout during link autonegotiation. The output looks like this:
>
> Auto negotiation timed out. Selecting default config
> greth: driver attached
> **** PHY ****
> Vendor: 1f0   Device: a   Revision: 3
> Current Operating Mode: 10 Mbit Half Duplex
> Autonegotiation Time: 4295959ms
>
> But in fact autonegotiation has succeeded and the link is already in 100
> Mbit full duplex mode. Also note the insane autonegatiation time
> reported.
>
> This is caused by a bug in the the timeout logic.
> In c/src/libchip/network/greth.c, there is a line that says:
>
>   msecs = (tnow.seconds-tstart.seconds)*1000+(tnow.microseconds-
> tstart.microseconds)/1000;
>
> The variable tnow.microsenconds has type uint32_t, therefore the
> calculation is incorrect when tnow.microseconds < tstart.microseconds.
>
> Better would be:
>
>   msecs = (tnow.seconds-
> tstart.seconds)*1000+tnow.microseconds/1000-tstart.microseconds/1000;
>
> I'm using a recent CVS version of RTEMS. My platform is the LEON3 core
> from grlib-1.0.21 on a Digilent XC3S1600E board.
>
> Greetings, Joris.

New description:

 The RTEMS driver for the GRETH Ethernet core incorrectly reports a timeout
 during link autonegotiation. The output looks like this:

 Auto negotiation timed out. Selecting default config
 greth: driver attached
 **** PHY ****
 Vendor: 1f0   Device: a   Revision: 3
 Current Operating Mode: 10 Mbit Half Duplex
 Autonegotiation Time: 4295959ms

 But in fact autonegotiation has succeeded and the link is already in 100
 Mbit full duplex mode. Also note the insane autonegatiation time reported.

 This is caused by a bug in the the timeout logic.
 In c/src/libchip/network/greth.c, there is a line that says:

   msecs = (tnow.seconds-tstart.seconds)*1000+(tnow.microseconds-
 tstart.microseconds)/1000;

 The variable tnow.microsenconds has type uint32_t, therefore the
 calculation is incorrect when tnow.microseconds < tstart.microseconds.

 Better would be:

   msecs = (tnow.seconds-
 tstart.seconds)*1000+tnow.microseconds/1000-tstart.microseconds/1000;

 I'm using a recent CVS version of RTEMS. My platform is the LEON3 core
 from grlib-1.0.21 on a Digilent XC3S1600E board.

 Greetings, Joris.

--

--
Ticket URL: <http://devel.rtems.org/ticket/1465#comment:8>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list