Thanks very much, that clears it all up.

-----Original Message-----
From: Stephen Hemminger [mailto:step...@networkplumber.org] 
Sent: Thursday, December 19, 2013 11:36 AM
To: Schumm, Ken
Cc: Olivier MATZ; dev at dpdk.org
Subject: Re: [dpdk-dev] When are mbufs released back to the mempool?

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);

Reply via email to