DRV_HDWR_pbuf_pool_free_hook()

Name

DRV_HDWR_pbuf_pool_free_hook() -- PBUF free hook callback

Synopsis

#include <cyg/io/eth/eth_drv.h>

u8_t DRV_HDWR_pbuf_pool_free_hook(struct pbuf *p);

Description

If the driver specific header file defines ECOS_LWIP_PBUF_POOL_FREE_HOOK then the driver should implement a hardware-specific function matching this defined prototype.

The function is called when lwIP is releasing a packet buffer, allowing the low-level device driver access to the (now unused) packet buffer. This avoids the overhead of lwIP having to complete the free operation, and for the driver having to make a subsequent allocation call.

If the driver does want to make use of the packet buffer descriptor (for example, to replace a DMA buffer slot) then it must call the lwIP routine pbuf_pool_reinit() to ensure a valid descriptor state prior to reuse.

Return value

If the driver does not make use of the referenced struct pbuf then it returns a value of 1 to indicate that the packet buffer has not been reused.

If the driver does claim the packet buffer then it should return 0 to indicate that the packet buffer descriptor has been reused.

2017-02-09
Documentation license for this page: Open Publication License