lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] Bug in pbuf.c regarding PBUF_POOL


From: Goldschmidt Simon
Subject: RE: [lwip-users] Bug in pbuf.c regarding PBUF_POOL
Date: Fri, 6 Oct 2006 13:05:24 +0200

Hi,

1:
Sorry to be so 'unprofessional' :)
But:
The 1.1.0 version I was using was provided by Altera with the NIOS2
devkit. I just compared this version to the oringinal 1.1.0 and saw that
Altera changed that part... They simply just used the semaphore used by
PBUF_POOL_FREE() in pbuf_pool_alloc() as well. I can submit a patch
doing this if anyone cares...

2:
The other question is: Why did nobody get corrupted pbufs like I do?
Have you all set SYS_LIGHTWEIGHT_PROT to 1? (since it's by default set
to 0...)

3:
OK, maybe the stack is not supposed to be multithreaded, BUT: I have a
separate thread for receiveing, and that thread must allocate fresh
pbufs (PBUF_POOL in my case) so where should I do that if not in a
seperate thread? With SYS_LIGHTWEIGHT_PROT=1, INTs are diables (=
threadsafe); in PBUF_POOL_FREE(), a semaphore is used (=threadsafe), so
I still think the design goal is to make pbufs and memory access thread
safe!

4:
The reason pbuf_pool_free_lock is never set to anything except 0 is that
it is not used on the FREE-side. What strikes me more is, that
pbuf_pool_alloc_lock is never tested against, only set to a value. But
that seems only to be a typo (in v1.1.1, pbuf.c line 146 should use
pbuf_pool_alloc_lock instead of pbuf_pool_free_lock).

@Kieran: The discussion you pointed out is 3 years old and the version
of pbuf.c at that time (cvs #1.10 or something) seems not to have
SYS_LIGHTWEIGHT_PROT included. Disabeling interrupts is even faster than
testing and incrementing a variable, so SYS_LIGHTWEIGHT_PROT=0 should
youse the sem, in my opinion...

@Christiann: I read the post on lwip-devel Kieran pointed me to. Seems
you had the same idea like me... Could you change the pbuf_pool_alloc()
stuff to use the semaphore, too? I know you didn't want to touch that
one, but the way it is now it's broken anyway... The speed is poor
anyway if SYS_LIGHTWEIGHT_PROT=0, since PBUF_POOL_FREE uses the
semaphore, too.

Oh, and thanks for the fast replies!

Simon




reply via email to

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