-
Notifications
You must be signed in to change notification settings - Fork 206
Description
Describe the bug
pxGetNetworkBufferWithDescriptor() failed in 'zero copy driver‘ after recent commit '28dd66ce23c966625fc0e1c58340b8fef5ffa781' with 'BufferAllocation_1.c' after add size check for buffer.
Target
- STM32Hxx
Expected behavior
Zero-Copy Driver request 'ipTOTAL_ETHERNET_FRAME_SIZE (1522)' or 'ETH_MAX_PACKET_SIZE (1528)' size of buffer to DMA to send or recieve. but 'BufferAllocation_1.c' limits maximum buffer to 'ipconfigNETWORK_MTU(1500) + ipSIZE_OF_ETH_HEADER (14)' which is small then request.
The size check of pxGetNetworkBufferWithDescriptor() cause DMA could not get enough buffer to store a maximum size of ethernet frame.
the pxGetNetworkBufferWithDescriptor() always return '0' to cause tcpip stack stock.
Additional context
Code in 'BufferAllocation_1.c' as follow
NetworkBufferDescriptor_t * pxReturn = NULL;
BaseType_t xInvalid = pdFALSE;
UBaseType_t uxCount;
if( ( xNetworkBufferSemaphore != NULL ) &&
( xRequestedSizeBytes <= ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER ) ) )
{
/* If there is a semaphore available, there is a network buffer
* available. */
if( xSemaphoreTake( xNetworkBufferSemaphore, xBlockTimeTicks ) == pdPASS )
{
/* Protect the structure as it is accessed from tasks and
* interrupts. */
ipconfigBUFFER_ALLOC_LOCK();
{
Frame size defined in 'FreeRTOS_IP.h'
#define ipSIZE_OF_ETH_CRC_BYTES ( 4UL )
#define ipSIZE_OF_ETH_OPTIONAL_802_1Q_TAG_BYTES ( 4UL )
#define ipTOTAL_ETHERNET_FRAME_SIZE ( ( ( uint32_t ) ipconfigNETWORK_MTU ) + ( ( uint32_t ) ipSIZE_OF_ETH_HEADER ) + ipSIZE_OF_ETH_CRC_BYTES + ipSIZE_OF_ETH_OPTIONAL_802_1Q_TAG_BYTES )