[PATCH v6 3/7] mbuf: record mbuf operations history
Morten Brørup
mb at smartsharesystems.com
Thu Oct 16 11:04:34 CEST 2025
> + /* Calculate total allocated mbufs */
> + uint64_t total_allocated =
> + stats[RTE_MBUF_HISTORY_OP_LIB_ALLOC] +
> + stats[RTE_MBUF_HISTORY_OP_PMD_ALLOC] +
> + stats[RTE_MBUF_HISTORY_OP_APP_ALLOC] +
> + stats[RTE_MBUF_HISTORY_OP_RX] +
> + stats[RTE_MBUF_HISTORY_OP_TX] +
> + stats[RTE_MBUF_HISTORY_OP_TX_PREP] +
> + stats[RTE_MBUF_HISTORY_OP_TX_BUSY] +
> + stats[RTE_MBUF_HISTORY_OP_ENQUEUE] +
> + stats[RTE_MBUF_HISTORY_OP_DEQUEUE];
Assuming the purpose of total_allocated is to count the mbufs not sitting available in the mempool, it's not calculated correctly. E.g. USR1 and USR2 are missing.
Instead of summing some specific states, just sum all states (for op=0; op<OP_MAX; op++) and subtract OP_NEVER and OP_LIB_FREE.
More information about the dev
mailing list