From: address@hidden
[mailto:address@hidden On Behalf Of Piero 74
Sent: Monday, February 25, 2008
8:43 AM
To: Mailing
list for lwIP users; lwip-devel
Subject: [lwip-users] LWIP 130RC1
and Socket - Application receive morepacket than it can manage - what does it
happen?
Hi all.
I'll use in my application socket. I'll use UPD connection and TCP connection
for receiving packets.
I have limited buffers in my application, because i have few RAM available.
I saw that setting some lwip options, i can limit packet queueing, pbuf used (i
don't know how.. i have to try) and limit memory available for lwip stack.
My question is:
if my application tasks cannot consume all packet received from the network,
because has all buffers full, what does it happen? lwip will crash my application?
or it will drop udp packet and kill tcp connections?
My emac driver send packet to tcp_ip thread if present.... i could drop packet
in the low level side, but driver need to know when drop packet and when pass
packet to tcpip thread...
can i know this information in some way???
in my ethernetif implementation (low_level_input), if packet is present, i do
this:
....
/* We allocate a pbuf chain of pbufs from the pool. */
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
if (p != NULL) {
....
} else {
// Drop packet because no free pbuf available
endReadFrame(0);
LINK_STATS_INC(link.memerr);
LINK_STATS_INC(link.drop);
}
...
I suppose (please CONFIRM):
if lwip has no memory free DOESN'T crash application
BUT pbuf_alloc will reurn NULL until pbufs will free.
SO, application CAN CONSUME packets slower than network produces them, because
low_level_input will drop some packets.
I saw in lwip code that calls to sys_mbox_trypost avoid lwip blocks if
mailboxes are full, and free pbufs (SO... drop packets... IS IT RIGHT???)
again.... if lwip has no memory free DOESN'T crash application ???
Someone can discuss with me about this issues?
thanks,
Piero