lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: [lwip] questions & suggestions


From: Adam Dunkels
Subject: [lwip-users] Re: [lwip] questions & suggestions
Date: Wed, 08 Jan 2003 22:21:11 -0000

Hi Adel!

On Tuesday 04 December 2001 18.18, you wrote:
> 1. pbuf structure has a field "ref". What is the purpose of this field and
> when I should
>    use this field?

The purpose of the ref field is to hold the number of references to the pbuf. 
It is mainly used in the TCP code when a pbuf is sent. Since TCP will keep 
the pbuf in the retransmission queue, it increases the ref count so that the 
pbuf won't be deallocated when it has been sent. See the implementation of 
pbuf_free() for more details.

> 2. there are the functions pbuf_chain() and pbuf_dechain() in the code. In
> what situations
>    do I need to use them?

They are used to add and remove a pbuf from a pbuf chain. They are used for 
instance in the TCP code to add a TCP header to a pbuf with data in ROM. (See 
the lwIP documentation for a discussion about pbuf chains.)

> 3. lwIP-0.4.1 can't assemble fragmented packets and also it can't split
> large packets
>    into the packets of smaller sizes (the application should take care
> about the size of
>    transmitting frames). Do you have any ideas about this kind of
> realization:
>    an application doesn't explicitly allocate memory using APIs of lwIP but
> gives it the
>    pointer to the data to send. The data has an unlimited length. In this
> case the lwIP
>    constructs all the nessesary headers for this data in the different
> memory, splits
>    the data and sends the data not actualy copying it. I see that the code
> size for this
>    would be larger. What about the performance? It is interesting to know
> your opinion.

While lwIP cannot do fragmentation at the IP layer, it can do just what you 
propose at the TCP level. The function tcp_write() which in turn calls 
tcp_enqueue() takes care of splitting a large data block into smaller 
segments without doing any copying. For UDP, however, IP fragmentation is 
needed if the application cannot handle the fragmentation by itself.

> 4. I think that it would be nice if you can compile your code with
> predefined symbols
>    like UDP_SUPPORT and TCP_SUPPORT to allow exclude udp or tcp support in
> the
>    executable  module to reduce its size. I believe that in some cases it
> would be very
>    helpful feature.

This is something I have meant to do for some time, and this seemed like a 
good time to add it. So now it is possible to turn UDP and TCP on or off by 
#defining LWIP_UDP and LWIP_TCP to either 1 or 0.

Thanks for your comments Adel!

/adam
-- 
Adam Dunkels <address@hidden>
http://www.sics.se/~adam
[This message was sent through the lwip discussion list.]




reply via email to

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