Download FreeRTOS
 

Quality RTOS & Embedded Software

LIBRARIES
WHAT'S NEW
Simplifying Authenticated Cloud Connectivity for Any Device.
Designing an energy efficient and cloud-connected IoT solution with CoAP.
Introducing FreeRTOS Kernel version 11.0.0:
FreeRTOS Roadmap and Code Contribution process.
OPC-UA over TSN with FreeRTOS.

MSS

MSS stands for Maximum Segment Size. It defines the maximum amount of data that can be sent or received in a TCP or UDP packet. It differs from the MTU value in that its value only applies to the data size, not the frame size, so it excludes the Ethernet, IP, TCP or UDP protocol headers. The MSS is dependent on the MTU and the maximum number of options bytes.

The following is an IPv4 example MSS calculation starting from an MTU of 1526 bytes. The number of bytes consumed by the various headers contained within the frame are subtracted to get the MSS size:

1526  MTU size
 -14  Ethernet header size
 -20  IPv4 protocol header size
 -20  TCP protocol header size
 -12  TCP options bytes
----
1460  MSS size
					

The following is an IPv6 example MSS calculation starting from an MTU of 1526 bytes. The number of bytes consumed by the various headers contained within the frame are subtracted to get the MSS size:

1526        MTU size
 -14        Ethernet header size
 -40        IPv6 protocol header size
 -${var}    IPv6 extension header size(optional)
 -20        TCP protocol header size
 -12        TCP options bytes
----
1440-${var} MSS size
In FreeRTOS-Plus-TCP the MSS value is set by the ipconfigTCP_MSS setting in FreeRTOSIPConfig.h. If ipconfigTCP_MSS is not defined then it will be set to a default value of 1460.

In the above example the calculated MSS value of 1460 bytes is suitable for a local area network (LAN), but is probably too large for use across the Internet, where the MSS should be restricted to 1400 bytes for maximum reliability. Therefore if the IP address of a remote node is outside of the local network (see netmask), then FreeRTOS-Plus-TCP will automatically set the MSS to the smallest of either 1400 or the configured ipconfigTCP_MSS value.

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.