[dpdk-dev] When are mbufs released back to the mempool?

Stephen Hemminger stephen at networkplumber.org
Thu Dec 19 20:35:55 CET 2013


On Thu, 19 Dec 2013 19:09:48 +0000
"Schumm, Ken" <ken.schumm at intel.com> wrote:

> Hello Olivier,
> 
> Do you know what the reason is for the tx rings filling up and holding on to mbufs?

Optimization to defer freeing.
Note, there is no interrupts with DPDK so Transmit done can not be detected
until the next transmit.

> 
> It seems they could be freed when the DMA xfer is acknowledged instead of waiting until the ring was full.

You should also look at tx_free_thresh value in the rte_eth_txconf structure.
Several drivers use it to control when to free as in:

ixgbe_rxtx.c:
 
static inline uint16_t
tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
	     uint16_t nb_pkts)
{
	struct igb_tx_queue *txq = (struct igb_tx_queue *)tx_queue;
	volatile union ixgbe_adv_tx_desc *tx_r = txq->tx_ring;
	uint16_t n = 0;

	/*
	 * Begin scanning the H/W ring for done descriptors when the
	 * number of available descriptors drops below tx_free_thresh.  For
	 * each done descriptor, free the associated buffer.
	 */
	if (txq->nb_tx_free < txq->tx_free_thresh)
		ixgbe_tx_free_bufs(txq);


More information about the dev mailing list