As I read the code the each pbuf size is defined by the PBUF_POOL_BUFSIZE. That is defined by the TCP_MSS + 40.
So in the case using TCP_MSS of 128 it will be 168 for each PBUF's. ?? In the case of WinXP i will receive a lot of 128 bytes segemnts eating a lot of pbuf's. Then the lwip runs out and crashes? In the case of Win7 I receive few 536 byte segment. Why does that not take as many pbuf as with winXP? I have increased the TCP_MSS and lowered the PBUF_POOL_SIZE and that seems to be good. Also for peformance. But I actually lowered the number of available PBUFs for the stack. The define for MEM_SIZE is increased. What is the define mem size actually used for? Niall Donovan wrote > One simple reason will be not enough pbufs allocated. Each received > segment > will take at lease one pbuf. Depending on the memory allocation scheme you > have used each pbuf might be a pre-allocated size (say 1518 + header). In > such a case each received segment in the win XP case will use a 1518 pbuf > to store a 128 byte segment...it's easy to run out! For Win 7 you are less > likely to run out since each segment is 536 so fewer pbufs are need to > save > the full payload. > > (at lease this is my understanding of how TCP works in lwip - someone > please correct me if I'm wrong!) > > You can have dynamic pbuf allocation - slow but possibly better use of > memory. > Pre-allocated fixed size pbufs pools - good performance but sizing pbufs > to > give optimal memory use is tricky. > custom pools i.e. varying size pre-allocated pbufs, picked based on best > fit. > > Which you select depends on your needs and sometimes the capability if the > device driver (if it uses DMA then dynamic pbuf allocation may not be > possible) > > Niall. > > > > On 1 November 2013 07:17, ThomasJ < > tjo@ > > wrote: > >> Hi >> >> I see. Thanks for reply. >> >> But I also wonder, why the lwip crashes when the same amount of data >> comes >> in segments of 128 from WindowsXP. But do not crash when the same data >> comes >> from Win7 in 536 bytes chunks? >> >> There is enough memory to receive the data (it can be received when send >> from Win7). >> >> I have changed the MSS to 536 and increased the MEM_SIZE a bit. Seems to >> have helped. >> >> Thomas >> >> >> >> -- >> View this message in context: >> http://lwip.100.n7.nabble.com/Works-with-Win7-not-Windows-XP-tp22003p22020.html >> Sent from the lwip-users mailing list archive at Nabble.com. >> >> _______________________________________________ >> lwip-users mailing list >> > lwip-users@ >> https://lists.nongnu.org/mailman/listinfo/lwip-users >> > > _______________________________________________ > lwip-users mailing list > lwip-users@ > https://lists.nongnu.org/mailman/listinfo/lwip-users -- View this message in context: http://lwip.100.n7.nabble.com/Works-with-Win7-not-Windows-XP-tp22003p22022.html Sent from the lwip-users mailing list archive at Nabble.com. _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
