lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Slow TCP


From: Bernard Mentink
Subject: Re: [lwip-users] Slow TCP
Date: Fri, 4 Mar 2011 07:46:24 +1300

Hi Kieran,

Replies in-line below.


Just to be sure: which end is running lwIP?  I think it's 192.168.0.100
(the http server)

That is correct. 

A few things:
 - everything looks mostly fine for the first 10 seconds or so of the
trace.
 - then I can see the server making increasing numbers of unnecessary
retransmissions.  i.e. retransmitting packets that the client has
acknowledged as received.  This is probably the root of the problem.
 - then we start to see connections being reset by the server.  This in
itself is a bit odd, unless your server normally works by aborting
rather than closing connections.
 - the client doesn't seem to be expecting the resets, and even seems to
ignore them: it carries on trying to use those connections
retransmitting packets and so the server repeatedly replies to them with
resets.

So, yes something is wrong.  I'm not sure what though.

I think most of my issues are to do with running out of memory buffers.
I managed to get printf debugging working out the serial port and with the  MEM_DEBUG and MEMP_DEBUG debug zones turned on, was able to see that various buffers were running out.
I increased the size of these as much as I could (I only have 32K on this micro) and I am getting a lot less errors in wireshark, and the page is loading much faster ... but there is still an issue.

Could you try experimenting with fewer concurrent connections and see if
that is the trigger?  How does you web server deal with concurrent
connections?

I am only opening one connection at present (web browser on 192.168.0.100) 
 Does it for example use multiple threads?  Which API are
you using in your web server to send and receive packets?

Using the RAW API. 

It would be useful if you could show us some of your code, particularly
around how your application interfaces to lwIP, and how your driver
interfaces to lwIP.  These are the most common areas for problems.

The code that interfaces the application (both web server and UDP handling) is below:

 ------------------------------------------------------------------------------
me->netif = eth_driver_init((QActive *)me, macaddr);

me->ip_addr = 0xFFFFFFFF;             // initialize to impossible value

    // initialize the lwIP applications...
httpd_init();         // initialize the simple HTTP-Deamon (web server)
http_set_ssi_handler(&ssi_handler, ssi_tags, Q_DIM(ssi_tags));
http_set_cgi_handlers(cgi_handlers, Q_DIM(cgi_handlers));

me->upcb = udp_new();
udp_bind(me->upcb, IP_ADDR_ANY, 1235);           // use port 1235 for UDP
udp_recv(me->upcb, &udp_rx_handler, me);
---------------------------------------------------------------------------------

The http_init() function to set up the TCP callbacks is:

void httpd_init(void) {
    struct tcp_pcb *pcb;

    DEBUG_PRINT("httpd_init\n");

    pcb = tcp_new();
    tcp_bind(pcb, IP_ADDR_ANY, 80);
    pcb = tcp_listen(pcb);
    tcp_accept(pcb, http_accept);
}

As far as the driver is concerned, there are a lot of files so not sure what to include.
I have attached the top level file.

Many Thanks,
Bernie

-----------------------------------------------------------------------------


Kieran



_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users



--
You always have believers and scepticts.. A True inventor is always a believer..

Attachment: eth_driver.c
Description: Text Data


reply via email to

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