[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] Fwd: Re: TCP errors going from 1.4.1 to 2.0.3

From: Bill Auerbach
Subject: Re: [lwip-devel] Fwd: Re: TCP errors going from 1.4.1 to 2.0.3
Date: Wed, 1 Nov 2017 12:36:39 +0000

Hi Sergio,

>at first sight, it looks like a timing issue to me. How frequently are you 
>calling sys_check_timeouts() ?
>You should do it as frequently as possible (head of main loop, for example)

Turns out to be a cache coherency problem.  I was using pointers to pbufs and 
pbuf->payloads with the "don't cache" bit set so I could DMA into and out of 
this memory without overhead.  Pbuf allocation between 1.4.1 and 2.0.3 must be 
different because this was OK in 1.4.1.  Even after properly confirming cache 
flushes are cached areas there's still a problem because internally lwIP sees 
the pointer as cached.  To prove this I modified pbuf.c to always set the 
"don't cache" bit on the pbuf and payload pointers and return them that way and 
the system works perfectly. This is actually my preferred method since the 
cache flushing code on my platform (NIOS II) takes 48 loops through the payload 
addresses to ensure coherency.  This was why back in the days of 1.4.1 I came 
up with the idea allocating RX and TX pbufs with the "don't cache" bit already 

Would it be of any use to post a pbuf patch that allows this change to be done 
at the port level if the user sets a #define in cc.h or sys_arch.h?  I know 
Simon, you use (used) the NIOS II and maybe you could comment on this or tell 
me if you think this optimization is worthwhile.

Thank you,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]