>I was also wondering: To pre-allocate pbufs, do I have
to that in pbuf_init() (which is currently empty) or does LwiP take care of
that internally?
I create an array of pbuf pointers in ethernetif_init. The
ISR adds a RX packet to a pbuf next in line in the array using a circular
queue using the array index in and out slot. Then my low_level_input (which
is polled in my case) removes the new RX pbuf(s) and uses pbuf_alloc to replace
it/them. I then return the new RX pbuf. lwIP will free this packet
when it’s done. The size of the array depends on how much memory
you want to tie up in pbufs as they will always be allocated for keeping the
array full.