Week 0: TCP performance test and tunning

May 13th to May 23th

The test results can be found at these notes:

Found TCP FIN ACK number issue

Upper layer protocols stop the TCP xfer by calling tcp_xfer_close().

If the call path is:

   tcp_rx()->tcp_rx_data()->...Upper layer...->tcp_xfer_close().
   Which is at lease happened in HTTP while received expected
   length of data.

Sending FIN in tcp_xfer_close() in this case, will cause error ACK number, since the ACK number have not updated by that time. Later trying to send a correct one in tcp_rx() will fail too, due to the TCP state already changed.

This patch let the TCP stack send FIN in normal tcp_rx() flow if the packet contains the last data of the session.