numam-dpdk/devtools/test-null.sh

33 lines
962 B
Bash
Raw Normal View History

#! /bin/sh -e
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2015 6WIND S.A.
# Copyright 2019 Mellanox Technologies, Ltd
# Run a quick testpmd forwarding with null PMD without hugepage
build=${1:-build} # first argument can be the build directory
testpmd=$1 # or first argument can be the testpmd path
coremask=${2:-3} # default using cores 0 and 1
eal_options=$3
testpmd_options=$4
[ -f "$testpmd" ] && build=$(dirname $(dirname $testpmd))
[ -f "$testpmd" ] || testpmd=$build/app/dpdk-testpmd
[ -f "$testpmd" ] || testpmd=$build/app/testpmd
if [ ! -f "$testpmd" ] ; then
echo 'ERROR: testpmd cannot be found' >&2
exit 1
fi
if ldd $testpmd | grep -q librte_ ; then
export LD_LIBRARY_PATH=$build/lib:$LD_LIBRARY_PATH
libs="-d $build/drivers"
else
libs=
fi
(sleep 1 && echo stop) |
app/testpmd: reduce memory consumption Following [1], testpmd memory consumption has skyrocketted. The rte_port structure has gotten quite fat. struct rte_port { [...] struct rte_eth_rxconf rx_conf[65536]; /* 266280 3145728 */ /* --- cacheline 53312 boundary (3411968 bytes) was 40 bytes ago --- */ struct rte_eth_txconf tx_conf[65536]; /* 3412008 3670016 */ /* --- cacheline 110656 boundary (7081984 bytes) was 40 bytes ago --- */ [...] /* size: 8654936, cachelines: 135234, members: 31 */ [...] testpmd handles RTE_MAX_ETHPORTS ports (32 by default) which means that it needs ~256MB just for this internal representation. The reason is that a testpmd rte_port (the name is quite confusing, as it is a local type) maintains configurations for all queues of a port. But where you would expect testpmd to use RTE_MAX_QUEUES_PER_PORT as the maximum queue count, the rte_port uses MAX_QUEUE_ID set to 64k. Prefer the ethdev maximum value. After this patch: struct rte_port { [...] struct rte_eth_rxconf rx_conf[1025]; /* 8240 49200 */ /* --- cacheline 897 boundary (57408 bytes) was 32 bytes ago --- */ struct rte_eth_txconf tx_conf[1025]; /* 57440 57400 */ /* --- cacheline 1794 boundary (114816 bytes) was 24 bytes ago --- */ [...] /* size: 139488, cachelines: 2180, members: 31 */ [...] With this, we can ask for less memory in test-null.sh. [1]: https://git.dpdk.org/dpdk/commit/?id=436b3a6b6e62 Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
2019-11-22 10:43:23 +00:00
$testpmd -c $coremask --no-huge -m 20 \
$libs -w 0:0.0 --vdev net_null1 --vdev net_null2 $eal_options -- \
--no-mlockall --total-num-mbufs=2048 $testpmd_options -ia