7. dpdk-test-dma-perf Application
The dpdk-test-dma-perf tool is a Data Plane Development Kit (DPDK) application
that evaluates the performance of DMA (Direct Memory Access) devices accessible in DPDK environment.
It provides a benchmark framework to assess the performance
of CPU and DMA devices under various combinations,
such as varying buffer lengths, scatter-gather copy, copying in remote memory etc.
It helps in evaluating performance of DMA device as hardware acceleration vehicle
in DPDK application.
In addition, this tool supports memory-to-memory, memory-to-device and device-to-memory copy tests, to compare the performance of CPU and DMA capabilities under various conditions with the help of a pre-set configuration file.
7.1. Configuration
Along with EAL command-line arguments, this application supports various parameters for the benchmarking through a configuration file. An example configuration file is provided below along with the application to demonstrate all the parameters.
[case1]
type=DMA_MEM_COPY
mem_size=10
buf_size=64,8192,2,MUL
dma_ring_size=1024
kick_batch=32
src_numa_node=0
dst_numa_node=0
cache_flush=0
test_seconds=2
lcore_dma0=lcore=10,dev=0000:00:04.2,dir=mem2mem
lcore_dma0=lcore=11,dev=0000:00:04.3,dir=mem2mem
eal_args=--in-memory --file-prefix=test
[case2]
type=CPU_MEM_COPY
mem_size=10
buf_size=64,8192,2,MUL
src_numa_node=0
dst_numa_node=1
cache_flush=0
test_seconds=2
lcore = 3, 4
eal_args=--in-memory --no-pci
[case3]
skip=1
type=DMA_MEM_COPY
dma_src_sge=4
dma_dst_sge=1
mem_size=10
buf_size=64,8192,2,MUL
dma_ring_size=1024
kick_batch=32
src_numa_node=0
dst_numa_node=0
cache_flush=0
test_seconds=2
lcore_dma0=lcore=10,dev=0000:00:04.1,dir=mem2mem
lcore_dma1=lcore=11,dev=0000:00:04.2,dir=dev2mem,raddr=0x200000000,coreid=1,pfid=2,vfid=3
lcore_dma2=lcore=12,dev=0000:00:04.3,dir=mem2dev,raddr=0x200000000,coreid=1,pfid=2,vfid=3
eal_args=--in-memory --file-prefix=test
The configuration file is divided into multiple sections, each section represents a test case.
The four mandatory variables mem_size, buf_size, dma_ring_size, and kick_batch
can vary in each test case.
The format for this is variable=first,last,increment,ADD|MUL.
This means that the first value of the variable is first,
the last value is last, increment is the step size,
and ADD|MUL indicates whether the change is by addition or multiplication.
The variables for mem2dev and dev2mem copy are
dir, dev, lcore, coreid, pfid, vfid, raddr
and can vary for each device.
For scatter-gather copy test dma_src_sge, dma_dst_sge must be configured.
Each case can only have one variable change, and each change will generate a scenario, so each case can have multiple scenarios.
7.1.1. Configuration Parameters
skipTo skip a test-case, must be configured as
1typeThe type of the test. Currently supported types are
DMA_MEM_COPYandCPU_MEM_COPY.dma_src_sgeNumber of source segments for scatter-gather.
dma_dst_sgeNumber of destination segments for scatter-gather.
mem_sizeThe size of the memory footprint in megabytes (MB) for source and destination.
buf_sizeThe memory size of a single operation in bytes (B).
dma_ring_sizeThe DMA ring buffer size. Must be a power of two, and between
64and4096.kick_batchThe DMA operation batch size, should be greater than
1normally.src_numa_nodeControls the NUMA node where the source memory is allocated.
dst_numa_nodeControls the NUMA node where the destination memory is allocated.
cache_flushDetermines whether the cache should be flushed.
1indicates to flush and0to not flush.test_secondsControls the test time for each scenario.
lcore_dmaSpecifies the lcore/DMA mapping and per device specific config.
lcoreCore number mapped to a DMA device.
dirThe direction of data transfer. Currently supported directions:
mem2mem- memory to memory copymem2dev- memory to device copydev2mem- device to memory copy
devDMA device bus address.
raddrRemote machine address for
mem2devanddev2memcopy.
coreidDenotes PCIe core index for
mem2devanddev2memcopy.
pfidDenotes PF-id to be used for
mem2devanddev2memcopy.
vfidDenotes VF-id of PF-id to be used for
mem2devanddev2memcopy.
Note
The mapping of lcore to DMA must be one-to-one and cannot be duplicated.
lcoreSpecifies the lcore for CPU testing.
eal_argsSpecifies the EAL arguments.
7.2. Running the Application
Typical command-line invocation to execute the application:
dpdk-test-dma-perf --config ./config_dma.ini --result ./res_dma.csv
Where config_dma.ini is the configuration file,
and res_dma.csv will be the generated result file.
If no result file is specified, the test results are found in a file
with the same name as the configuration file with the addition of _result.csv at the end.
7.3. Limitations
Additional enhancements are possible in the future.