lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Rapid tcp sending leads to a very long chain of pbufs


From: Muhamad Ikhwan Ismail
Subject: [lwip-users] Rapid tcp sending leads to a very long chain of pbufs
Date: Tue, 25 Nov 2008 07:26:07 +0000



Hi guys,

I have noticed the following, when I have a TaskA(low priority) sends a couple of ASCII letters rapidly, the tcp task does not
send the data directly, but instead queue them and chain them (pbufs). My problem is that the chain gets very long, the longest
i have seen a chain of 82 pbufs,and some of the pbufs only have a few bytes of data. I also have a queue overflow. And the biggest
problem of all is since I have a chain of a lot of pbufs, my ethernet driver crashed since it can only chain 16 pbufs at anytime.
(Only 16 Buffer descriptor available). A workaround would be to delay the send with a semaphore e.g, but I would like to address this
problem in the stack since I am gonna be doing a lot of  rapid TCP transmission with up to 64 sockets. Is there anything I can do to
limit the maximum chain elements ? My implementation is on a PowerPC microcontroller with lwip v1.3.0 (release). Underneath is
my TCP configuration in opt.h. Thanks a lot in advance.

Greetings
M Ikhwan Ismail



/**
 * TCP_MSS: TCP Maximum segment size. (default is 128, a *very*
 * conservative default.)
 * For the receive side, this MSS is advertised to the remote side
 * when opening a connection. For the transmit size, this MSS sets
 * an upper limit on the MSS advertised by the remote host.
 */
#ifndef TCP_MSS
#define TCP_MSS                         1460 //Ikhwan Optimum for Ethernet MTU
#endif

/**
 * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
 * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which
 * reflects the available reassembly buffer size at the remote host) and the
 * largest size permitted by the IP layer" (RFC 1122)
 * Setting this to 1 enables code that checks TCP_MSS against the MTU of the
 * netif used for a connection and limits the MSS if it would be too big otherwise.
 */
#ifndef TCP_CALCULATE_EFF_SEND_MSS
#define TCP_CALCULATE_EFF_SEND_MSS      1
#endif


/**
 * TCP_SND_BUF: TCP sender buffer space (bytes).
 */
#ifndef TCP_SND_BUF
#define TCP_SND_BUF                     25*TCP_MSS
#endif

/**
 * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
 * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work.
 */
#ifndef TCP_SND_QUEUELEN
#define TCP_SND_QUEUELEN                (4 * (TCP_SND_BUF/TCP_MSS))
#endif

/**
 * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than or equal
 * to TCP_SND_BUF. It is the amount of space which must be available in the
 * TCP snd_buf for select to return writable.
 */
#ifndef TCP_SNDLOWAT
#define TCP_SNDLOWAT                    (TCP_SND_BUF/2)
#endif


Proud to be a PC? Show the world. Download the “I’m a PC” Messenger themepack now. Download now.

reply via email to

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