lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] NXP LPC 17xx lwip port: use of pbuf for rx


From: Giuseppe Modugno
Subject: [lwip-users] NXP LPC 17xx lwip port: use of pbuf for rx
Date: Fri, 29 Mar 2019 12:37:48 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]