mbuf: reduce pktmbuf init cycles

There is no need for initializing the complete
packet buffer with zero as the packet data area will be
overwritten by the NIC Rx HW anyway.

The testpmd configures the packet mempool
with around 180k buffers with
2176B size. In existing scheme, the init routine
needs to memset around ~370MB vs the proposed scheme
requires only around ~22MB on 128B cache aligned system.

Useful in running DPDK in HW simulators/emulators,
where millions of cycles have an impact on boot time.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Jerin Jacob 2017-06-27 17:27:51 +05:30 committed by Thomas Monjalon
parent cabe6ebb4d
commit cb327a7802

View File

@ -131,8 +131,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
RTE_ASSERT(mp->elt_size >= mbuf_size);
RTE_ASSERT(buf_len <= UINT16_MAX);
memset(m, 0, mp->elt_size);
memset(m, 0, mbuf_size);
/* start of buffer is after mbuf structure and priv data */
m->priv_size = priv_size;
m->buf_addr = (char *)m + mbuf_size;