I'm using LPC1769 MCU. I'm using source code from NXP SDK that works.
I need to free some RAM to use mbedTLS libraries, so I was studying the
code better. I found that NXP Ethernet driver preallocates a number of
pbufs for RX DMA descriptors. The code uses:
p = pbuf_alloc(PBUF_RAW, (u16_t) ENET_ETH_MAX_FLEN, PBUF_RAM);
When a new frame is received, a new pbuf is allocated with the same
instruction. The pbuf of received frame is finally freed.
With PBUF_RAM parameter, this code allocates pbuf with mem_malloc, that
is standard malloc in my case. However ENET_ETH_MAX_FLEN is 1552 bytes.
With so many alloc and free of 1552 bytes, I will have big fragmentation.
So I replace PBUF_RAM with PBUF_POOL, to use memory pools that don't
suffer from fragmentation. I tried and it works, but I don't know if
there's some drawbacks in doing so.
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users