[dpdk-dev] Looks like rte_mempool_free_count() and rte_mempool_count() are swapped
Dmitry Vyal
dmitryvyal at gmail.com
Thu Sep 12 09:52:35 CEST 2013
Greetings.
I had a suspect I run into a mbuf depletion issue and decided to check
using rte_mempool_free_count(). To my surprise, it returned a value
equal to mempool size. I tried calling rte_mempool_count() and it
returned zero.
I inspected the code in dpdk-1.3.1-7 and dpdk.1.4.1-4:
rte_mempool_count(const struct rte_mempool *mp)
{
unsigned count;
count = rte_ring_count(mp->ring);
#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
{
unsigned lcore_id;
if (mp->cache_size == 0)
return count;
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
count += mp->local_cache[lcore_id].len;
}
#endif
/*
* due to race condition (access to len is not locked), the
* total can be greater than size... so fix the result
*/
if (count > mp->size)
return mp->size;
return count;
}
If I understand it correctly, the ring contains free buffers and
rte_ring_count() returns a number of entries inside a ring. So this
function actually calculates the number of free entries, not busy.
Moreover, rte_mempool_count() is used in many places. For example it's
called in rte_mempool_free_count() and rte_mempool_full().
Can anyone confirm or refute my findings?
Regards,
Dmitry
More information about the dev
mailing list