Network problem - Gradually getting slower after time - Resolved.

Ian Caddy ianc at goanna.iinet.net.au
Thu Nov 24 05:56:24 UTC 2005


Hi Jonas,


Jonas Moberg wrote:
> Thanks,
> The problem is now resolved after a patch from Ian Caddy.

That is good news.

> An internal rx buffer pointer set was not handled properly for the
> optimized target.
> Adding a volatile directive to these variables seems to be the solution.
> For the moment i can't see through the "compiler logic" and the guess is
> that this is a compiler optimization bug.

Bascially there was a rx packet count variable, that is read at the top 
of the rx task, and then decremented (with interrupts off) at the bottom 
of the rx task when the packet is finished with.

There is a rx dma routine that increments the packet count.

The problem was that it wasn't picked up with the 4.5.0 compiler as the 
two places in the rx task, it obviously read the global again and then 
rewrote it at the bottom.  This made it safe from the rx dma routine.

With the 4.6.2 compiler, a different GCC, the optimisation is 
better/more agressive, and the global was obviously now no longer read 
at the bottom of the rx task, but a register value of it was used.  The 
global was then incremented by the rx dma routine, between the first 
read and the second decrement, but the rx task had the old value in a 
register, and decremented that.  Therefore that packet count increment 
was lost.

The packets were never actually lost, they were in the circular buffer. 
  The next time a packet came in, the count was incremented and the last 
packet that was lost was found, but the new packet is now lost, until 
the next packet.  If you get this lost increment a few times, you start 
to notice the delays, particularly if you are just doing a ping once a 
second, you will notice a 1 second delay, then later a 2 second delay 
and so on until it became unacceptable.



> The driver we are using (based on Ians work a few years back) has been
> maintained independently by us.
> I will do a manual diff to the updated driver just received from Ian and
> update him on any feature that we might have added or any problem found.

Thanks that would be much appreciated.

regards,

Ian Caddy

-- 
Ian Caddy
Goanna Technologies Pty Ltd
+61 8 9221 1860




More information about the users mailing list