[dpdk-users] Freeing up Mbuf

Take Ceara dumitru.ceara at gmail.com
Thu Dec 22 18:00:39 CET 2016

Hi Param,

On Thu, Dec 22, 2016 at 5:47 PM, Kumaraparameshwaran Rathnavel
<krath at cloudsimple.com> wrote:
> Hi All,
> The mbuf implementation is similar to the Network Driver of the FreeBSD Network Driver. In DPDK userspace driver it is the responsibility of the rte_eth_dev implementation to free the memory buffer associated with a Queue when descriptors reach below a threshold. In FreeBSD the user can actually specify the free routine for the mbuf when the transmit routine is called. Is this implemented in DPDK. I basically will give the data buffer of the application layer that will be chained with the Transport Layer Headers and I do not want to free up the routines always. Is this possible?

You can send a clone of the mbuf (see rte_pktmbuf_clone). Cloning the
mbuf will increase the refcount of the direct mbuf (that stores the
actual data). When the driver is done transmitting the clone it will
decrement the refcount and only free the direct mbuf if the refcount
is 0 (see rte_pktmbuf_free_seg and __rte_pktmbuf_prefree_seg).

However, you need to be careful if you plan to change the data stored
in the direct mbuf and make sure there are no more clones of the data
pending transmission.

> Thanking You,
> Param.


More information about the users mailing list