EmbeddedRelated.com
Forums

Slowwwww TCP-Net ....

Started by nourson54 January 16, 2008
Hi,

I'm using a MCB2368 board with both RTX and TCP Net from Keil, over
ethernet. The board is running a 72Mhz, and the tick is 10ms.

My project is to build a little FTP server that is connected to a SD
memory card. For the FAT stack I use one from Elm-chan.

For TCP, I have a single task that manages all my (2 : ftp command and
ftp data ) sockets.

The other task is the FTP server connected to a SD memory card and
communicates through mailbox and events mith the main tcp.

My chins dropped away (is it the good expression ? ) when I saw the
transfer speed : 6KB/s ....

Then I first removed the SD card reading and I had something like that
when sending data over my socket in order to test the TCP part speed:

----------------------------------
sdbuf=_alloc_box(sdcardpool); //a dynamic allocated block

memset(sdbuf,1,1400); // fill the block with 0x01

// Send quite filled TCP frame 20times (20*1400(000 bytes)
for (i=0;got<20;got++)
{
SendFtpData(sdbuf,1400);
}
----------------------------------

In SendFtpData() , I allocate the tcp buffer , send the frame, and
wait for a ACK event from the main tcp task :

----------------------------------
void SendFtpData(U8 *buf,U16 len)
{
TcpFrame *frame;

frame=_alloc_box (mpool);

os_mut_wait(mutex_getbuf,0xFFFF);
frame->message=tcp_get_buf(len);
os_mut_release(mutex_getbuf);
memcpy(frame->message,buf,len);
frame->length=len;
os_mbx_send(mailbox3,&frame,0xFFFF);
os_evt_wait_or(EVT_FTP_DATA_ACK,0xFFFF);
_free_box(mpool,frame);
}
----------------------------------

So , with a simple memory block filled and sent 20 times I get only
6.3 KB/s ... So I can say that it's not the FAT/SD card stack that is
slow.

In this case why Tcpnet is so slow ?
Is it possible to manage blocks of data and not each tcp frame ?
I guess I did or (used ) something wrong but what ?

Thanks in advance.

Yann

An Engineer's Guide to the LPC2100 Series

Hi

can the Naggle algorithm been an issue ?
When small packets are sent the stack waits some time to see if more will arrive to avoid ragmentation and to reduce network traffic.
Disabling the Naggle forces every sent to be immediate.
(TCP NOWAIT is the magic socket option ..when writing TCP desktop apps)

----- Original Message -----
From: karelvergauwe
To: l...
Sent: Tuesday, January 15, 2008 1:58 PM
Subject: [lpc2000] Re: Slowwwww TCP-Net ....
Don't you use the tcp_send function??? take a look at
http://www.keil.com/support/man/docs/rlarm/rlarm_tcp_send.htm

First you have to initiate your socket. Make sure it's in the connected
state. Then ask a location to send your data (pointer wil be returned).
Then send it with the tcp_send function. You can then use the callback
function to see if all was ok.

This way you should be able to send blocks of data.

Also check the tcp_max_dsize function
(http://www.keil.com/support/man/docs/rlarm/rlarm_tcp_max_dsize.htm)
and the settings for MEM_SIZE in Net_Config.c file (line 34)

Hope this helps