Revert "dpdk: fix mempool sizing to always yield 2^n -1"

Due to incorrect mempool size calculation, in some cases
(e.g. when rx-descriptors=32k, tx-descriptors=64) the mempool
size was calculated insufficiently in the auto mode (in the example
case it would result to 32767 which wouldn't even hold RX descriptors).

Even with a fix, the mempool size would increase (and in turn hugepage
consumption), as current mempools are just a sum of rx + tx descriptors.
To avoid introducing behavior-change this commit is reverted.

Ticket: 8371

This reverts commit 0c54932a4b.
pull/15050/head
Lukas Sismis 2 months ago committed by Jason Ish
parent 6484a012a3
commit 2a764b47a8

@ -1459,11 +1459,8 @@ static int DeviceConfigureQueues(DPDKIfaceConfig *iconf, const struct rte_eth_de
// +4 for VLAN header
uint16_t mtu_size = iconf->mtu + RTE_ETHER_CRC_LEN + RTE_ETHER_HDR_LEN + 4;
uint16_t mbuf_size = ROUNDUP(mtu_size, 1024) + RTE_PKTMBUF_HEADROOM;
// Follows DPDK recommendation of having a mempool size that is a power of 2 minus one.
// So e.g. mp_size of 262144 and 262143 both lead to 65535 on 4 rx queues
uint32_t raw = iconf->mempool_size / iconf->nb_rx_queues;
uint32_t next_p2 = rte_align32pow2(raw + 1);
uint32_t q_mp_sz = (next_p2 == raw + 1) ? raw : (next_p2 >> 1) - 1;
// ceil the div so e.g. mp_size of 262144 and 262143 both lead to 65535 on 4 rx queues
uint32_t q_mp_sz = (iconf->mempool_size + iconf->nb_rx_queues - 1) / iconf->nb_rx_queues - 1;
uint32_t q_mp_cache_sz = iconf->mempool_cache_size_auto ? MempoolCacheSizeCalculate(q_mp_sz)
: iconf->mempool_cache_size;
SCLogInfo("%s: creating %u packet mempools of size %u, cache size %u, mbuf size %u",

Loading…
Cancel
Save