Hi all,
Can someone help me understand how I would go about handling buffer descriptors when using statically allocated buffers in a zero copy driver?
Although the documentation suggests that pucGetNetworkBuffer() would normally be used with zero copy drivers, this is only available in BufferAllocation_2.c and uses malloc to allocate space for the buffer.
Since FreeRTOS only seems to have a single buffer pool for TX and RX frames, my thoughts are to initialise the RX descriptor ring of my ethernet chip (AMD LANCE Am79C90) with half of those buffers, and point each buffer descriptor at one of the statically allocated buffers. The other half is then available for TX frames.
What Im trying to figure out at the moment is how to acquire buffers for this. I could call pxGetNetworkBufferWithDescriptor() and make a pointer to the pucEthernetBuffer member of the returned descriptor and put that into my RX ring entries. It looks like as part of vNetworkInterfaceAllocateRAMToBuffers() a pointer to the descriptor entry is stored just before the memory allocated to the buffer itself, so would this be a legitimate way to keep track of used descriptors? I can subtract ipBUFFER_PADDING from the buffer address to be able to recover a pointer to the descriptor which could then be used to return that descriptor to the free list after the received frame has been processed?
If those descriptors dont need to be returned to the free list, then I can just reconfigure the RX ring entry to say it is available to the ethernet chip again and move on?
Hope that all makes sense.
Thanks