lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Incorrect Nagle implimentation


From: Bob Grice
Subject: [lwip-users] Incorrect Nagle implimentation
Date: Thu, 24 Nov 2005 14:00:36 -0000

While investigating the tcp throughput on my LWIP implimentation, I noticed
a distinct stop & restart occurring at a regular 200ms interval. Furthur
investigation led me to LWIP's implimentation of Nagle's algorithm in
function do_write( ).
 
The code currently delays transmission until the timer expires whenever
there is outstanding acks (unless TF_NODELAY), whereas Nagle requires
transmission only to be delayed if there is outstanding acks and you can't
send a MSS sized segment.

I made a quick change of the code to :

   if(err == ERR_OK && (msg->conn->pcb.tcp->unacked == NULL ||
(msg->conn->pcb.tcp->flags & TF_NODELAY) || 
         ( msg->conn->pcb.tcp->snd_queuelen) > 1) ) {
  tcp_output(msg->conn->pcb.tcp);
       }

Basically allowing the call to tcp_output if the current queue length is
more than one segment (as this implies you must have at least one full sized
one). 

This change more than doubled my tcp send transfer rate for large transfers,
but I haven't checked it out yet with lots of small (< mss) writes. Perhaps
someone who has an implimentation that does small writes on a slow link
could also check it.

I don't think this is the ideal implimentation, I think it would be more
obvious if Nagle was moved into tcp_output, and do_write always called
tcp_output.




reply via email to

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