lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] PBUF_REF: udp_send() has pbuf_dechain() removed. Why?


From: Leon Woestenberg
Subject: Re: [lwip-users] PBUF_REF: udp_send() has pbuf_dechain() removed. Why?
Date: Tue, 25 Mar 2003 00:04:14 +0100 (MET)

Hello David,

(replied to mailing list so that it will be archived for future reference).

> I've been looking at this a bit closer.
> 
> I did not have the same problem you did because my low level driver was
> calling pbuf_unref() which replaced the PBUF_REF with a PBUF_POOL
> buffer. That is also the reason I had to remove the call to
> pbuf_dechain() in udp_send().
> 
> Now I have another question for you: What if the buffer chain has to go
> on the arp queue? udp_send() calls pbuf_dechain() before the buffer
> chain has been actually sent (since it is in the arp queue). When arp
> finally sends the buffer chain it will have been dechained and the
> header (which was not freed since arp had incremented ref before
> queuing) now no longer points to the body of the frame. This was what I
> was trying to fix with all these chathink nges.
>
Good thinking. The real problem seems to be that lwIP does not know which
pbufs are allocated on behalf of lwIP, or the application. Within lwIP,
pbufs
are often allocated at one end of the stack layer, and de-allocated at the
opposite end of the stack layer.

Maybe we need to introduce a bit flag that does housekeeping on lwIP
allocated pbufs?

> I have an alternative suggestion. How about if udp_send() calls
> pbuf_ref() right after pbuf_chain(). I think this will solve our
> problems. Although we also will need to make pbuf_unref() call  /****/
> pbuf_free() for the buffer being unchained. I actually think this makes
> more sense anyway. It was troubling to me that I could not call
> pbuf_free() from within pbuf_unref().
> 
I think you have missed a word where I marked /****/ that confuses me
to see fully what your solution is.

Could you paste some (pseudo)code for the proposed udp_send()?

Thanks for implementing PBUF_REF! I think we are almost there.

Regards,

Leon.

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!





reply via email to

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