heinbali01 wrote on Saturday, April 01, 2017:
( I am truly sorry to be lengthy again … )
My default setup (don’t know the the default xProperties of the socket)
The defaults of the
xProperties of a socket are indeed taken from these two macro’s:
/* Defines the default size of the TX stream buffer. */
#define ipconfigTCP_TX_BUFFER_LENGTH (4 * ipconfigTCP_MSS)
/* Defines the default size of the RX stream buffer. */
#define ipconfigTCP_RX_BUFFER_LENGTH (4 * ipconfigTCP_MSS)
ipconfigNETWORK_MTU, minus the overhead of a TCP package.
These are the default values:
xProperties.lTxBufSize = ipconfigTCP_TX_BUFFER_LENGTH;
xProperties.lTxWinSize = ipconfigTCP_TX_BUFFER_LENGTH / ipconfigTCP_MSS;
xProperties.lRxBufSize = ipconfigTCP_RX_BUFFER_LENGTH;
xProperties.lRxWinSize = ipconfigTCP_RX_BUFFER_LENGTH / ipconfigTCP_MSS;
The driver will make sure that
lRxWinSize are at least 1.
lTxBufSize will always be a multiple of
MSS, and if necessary, it will be rounded-up.
In case no TCP sliding windows are used (
FREERTOS_SO_WIN_PROPERTIES = 0 ), the actual window size will be one MSS.
The following macro is something different:
#define ipconfigTCP_WIN_SEG_COUNT 12
It says that all TCP sockets together ( at any time ) may have a total of 12 outstanding ( i.e. unconfirmed ) packets. It determines the number of buffers ( of type
TCPSegment_t ) that are allocated in
I am downloading the file and writing it out to a SD card.
Time to complete is 800 seconds.
I can’t change the MSS size but I did change the following properties for THAT specific socket:
xProperties.lRxBufSize = 20 * ipconfigTCP_MSS;
xProperties.lRxWinSize = 20;
Download time (and SD writing) was reduced to 110 seconds – so dare close to a times 8 improvement.
That is good news! But maybe you get the same performance with 10. In a PCAP you can count the actual number of outstanding packets. It is indicated as:
TCP -> [SEQ/ACK analysis] -> [Bytes in flight 16060]`.
In my example, there are at most 16060 bytes (11 times MSS) outstanding without an ACK.
About getting UDP faster using an application-hook :
Have you used
The UDP messages can be delivered to your application with this function:
void * pvData,
const struct freertos_sockaddr * pxFrom,
const struct freertos_sockaddr * pxDestination );
The address of your function can be bound to a socket by calling
FreeRTOS_setsockopt() with ‘FREERTOS_SO_UDP_RECV_HANDLER’.
The function must return non-zero to tell the stack that it may discard the packet.
When using this call-back, time is saved: your application task doesn’t not need to become active.
The call-back should be fast though (do not block or wait), because it is called from the IP-task.