lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] udp


From: Leon Woestenberg
Subject: Re: [lwip-users] udp
Date: Sun, 16 Mar 2003 22:51:23 +0100

Hello David,

the issue you address is a problem, but is not a bug.
> ...
> not free the original data buffer. So although the ARP queue does
> increment the reference count and does properly free the pbuf
> afterwards, this particular pbuf is of type ROM and actually only points
> to the data buffer. Nothing is done to free the original data buffer and
> no signal is received by the application to know when it can free the
> data buffer.
>
lwIP assumes that PBUF_ROM refers to static, constant data (such as
Read Only Memory devices).

You cannot use it for data buffers within lwIP.

If you want to cheat, and use it for UDP data buffers anyway, you have to
disable ARP queueing in "lwipopts.h". For UDP, that seems to be the only
place where the memory can be referenced after a call to lwIP.

I am not sure about the IP fragmention code. Maybe you have to disable
that as well.

So, the real problem you are facing is that you cannot have lwIP refer
to application-owned RAM (such as a data buffer). Read on...

>
> I cannot beleive that anyone is using UDP with the sockets interface and
> not running into this problem (unless I really missed something here).
>
We ran into this problem ourselves. My proposition was to create a
PBUF_REF type that refers to non-lwIP RAM.

lwIP would then try to use the PBUF_REF just like PBUF_ROM
(maintaining the zero-copy feature of lwIP) unless it was queued by
lwIP (such as in ARP). It would then copy the PBUF_REF referenced
RAM into a pbuf held by its own.

The application can simply free its pbuf and databuffer right after it
was sent (in a transparent fashion).

This change to the pbuf.c code should go hand in hand with a simpler
memory pool model (powers of 2 sized pools of memory blocks).

All this has been discussed earlier but the changes are so fundemental
that nobody has really started this yet.

I am interested in doing this, but only if I can find some time during other
high-pri tasks at work.

At least I will submit a change request into Savannah soon, as a starter.

Regards,

Leon Woestenberg.





reply via email to

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