[En-Nut-Discussion] Suggested modification to nut\net\tcpsm.c again

Harald Kipp harald.kipp at egnite.de
Thu Nov 12 10:54:00 CET 2009


Some time ago Zack suggested a modification of the TCP state machine:

http://lists.egnite.de/pipermail/en-nut-discussion/2007-May/008089.html

I assume, that this one fixed the problem at that time. However, recent
tests showed, that the problem is back again.

I do not have a proof, just a strong feeling that somehow the way
changed, the GNU compiler does calculations. Wasn't there similar fix
required during the last months? I'm currently using GCC 4.4.2.

Unfortunately the problem now appears more often after

http://ethernut.svn.sourceforge.net/viewvc/ethernut/trunk/nut/net/tcpout.c?r1=1751&r2=2082

because so_retran_time may be 1 ms ahead.

As a result, Ethernut sends duplicate segments quite often.

Anyone else observed something similar with GCC calculation routines?

The following change seems to fix it.

/*
 * Process retransmit timer.
 */
if (sock->so_tx_nbq && sock->so_retran_time) {
  uint16_t millis = (uint16_t)NutGetMillis();
  uint16_t diff = millis > sock->so_retran_time ? millis -
sock->so_retran_time : sock->so_retran_time - millis;
  if (diff >= sock->so_rtto) {
    NutTcpStateRetranTimeout(sock);
  }
}

I'm afraid, that there are other parts of the OS/Net code failing with
the latest GCC.

Harald




More information about the En-Nut-Discussion mailing list