Thank you @rtel, here some more details:
Are these historical leftovers?
Yes they are. They were already present in the earlier UDP-only library that preceded FreeRTOS+TCP.
And about IEEE 802.1Q: there has been an intention, but it never became realised, support for virtual LANs. It would increase the size of the Ethernet header with 4 bytes, from 14 to 18.
About ipSIZE_OF_ETH_CRC_BYTES
: normally you do not see the Ethernet checksum, although I had one peripheral that would also pass them as 4 received bytes.
To anyone who wants to work with full-length packets, i.e. 1500 + 14 bytes long, I always recommend to reserve a maximum buffer size of 1536 ( 0x600 ) bytes. The MTU will be 1500, and the 14 bytes are used for the Ethernet header.
See this discussion about FreeRTOS+TCP Network Buffers and their length. It explains that part of the buffer space is reserved for the IP-task: it contains a pointer and IP-type information.
When using BufferAllocation_1.c
, the buffer memory is allocated statically at start-up, as one chunk of memory, with a length of e.g. ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS
times 1536 bytes.
In projects where less RAM is available, BufferAllocation_2.c
is used. Every packet will be allocated dynamically, by calling pvPortMalloc()
, to get just enough bytes as needed. vPortFree()
is called to release the memory.