disable ipconfigUSE_TCP_WIN compilation errors

miclam wrote on Thursday, March 23, 2017:

following the low RAM recommendations I disabled ipconfigUSE_TCP_WIN.

Now I get a few errors like
../FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c:807:45: error: 'IPTCPSocket_t {aka struct TCPSOCKET}' has no member named 'ucMyWinScaleFactor'
because there are unguarded occurences of pxSocket->u.xTCP.ucMyWinScaleFactor in lines 807, 2387, 2388, 2421. ucMyWinScaleFactor is not defined when ipconfigUSE_TCP_WIN is disabled.
Also there is an error in prvSetSynAckOptions, with the usage of

	#if( ipconfigUSE_TCP_WIN != 0 )
		uxOptionsLength = 4u;

which is defined as

#if	ipconfigUSE_TCP_WIN == 1
	UBaseType_t uxOptionsLength;

Also I think the different uses of ipconfigUSE_TCP_WIN == 1, ipconfigUSE_TCP_WIN == 0 and ipconfigUSE_TCP_WIN != 0 are a bit confusing.

As I do not fully understand TCP sliding windows and their implementation in FreeRTOS+TCP I’d like to ask for support to fix these bugs.

Regards, Michael

heinbali01 wrote on Thursday, March 23, 2017:

Hi Michael, we know about these compilation problems and a new release is in preparation. But that always takes more time than we hope for.

I’ll attach the current version of FreeRTOS_TCP_IP.c It has been tested with ipconfigUSE_TCP_WIN == 0.

If there are any problems, please let it know.

A known problem with ipconfigUSE_TCP_WIN == 0 is slowness in case the devices sends TCP data. Acknowledgements from the host may be delayed for 200 ms.


heinbali01 wrote on Thursday, March 23, 2017:

Here is the promised attachment: FreeRTOS_TCP_IP.c

miclam wrote on Thursday, March 23, 2017:

Thanks Hein, that works!

I can also confirm the delay you mentioned. HTTP requests for 1kb files take 210ms with MTU 1500, 2kb need 620ms. Delay scales with decreasing MTU. Is there any plan to fix this?

heinbali01 wrote on Friday, March 24, 2017:

Is there any plan to fix this?

Try google “naggle 200ms”.

If you look with Wireshark, you will see that the host (Linux/Windows) is delaying its ACK, and we can’t fix that :slight_smile:
Normally the device would send a second packet and that one will be acknowledged without delay.
When ipconfigUSE_TCP_WIN == 0, the device doesn’t have this mechanism of sending-out a next packet.

What some users do is to sending out TCP data packets two times. These are packets carrying actual TCP data. If a host receives a packet a second time, it will be acknowledged immediately.

When performance matters, it is maybe better to use a small MTU along with ipconfigUSE_TCP_WIN == 1.
I would choose an MTU of 552, which allows to send 512 bytes in each TCP packet. Make sure that the size of the DMA buffers depend on ipconfigNETWORK_MTU, normally ipconfigNETWORK_MTU + 36 (unless you’re using small chained DMA buffers).

I attached a ZIP in which:

● double_send.c
some sample code which sends-out every TCP data packet twice. Each second packet is acknowledged without a delay

● no_sliding_window.pcap
A PCAP of the double-sending with ipconfigUSE_TCP_WIN = 0

● sliding_window.pcap
A PCAP when using a sliding TCP window ipconfigUSE_TCP_WIN = 1