1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. 4# All rights reserved. 5# 6 7testdir=$(readlink -f $(dirname $0)) 8rootdir=$(readlink -f $testdir/../../..) 9source $rootdir/test/common/autotest_common.sh 10source $rootdir/test/nvmf/common.sh 11 12function gen_accel_mlx5_json() { 13 accel_qp_size=${1:-256} 14 accel_num_requests=${2:-2047} 15 16 jq . <<- JSON 17 { 18 "subsystems": [ 19 { 20 "subsystem": "accel", 21 "config": [ 22 { 23 "method": "mlx5_scan_accel_module", 24 "params": { 25 "qp_size": ${accel_qp_size}, 26 "num_requests": ${accel_num_requests} 27 } 28 } 29 ] 30 } 31 ] 32 } 33 JSON 34} 35 36accelperf=$rootdir/build/examples/accel_perf 37 38$accelperf -c <(gen_accel_mlx5_json) -w crc32c -t 5 -m 0xf -y -C 1 -o 4096 -q 64 39$accelperf -c <(gen_accel_mlx5_json) -w crc32c -t 5 -m 0xf -y -C 33 -o 4096 -q 64 40$accelperf -c <(gen_accel_mlx5_json) -w crc32c -t 5 -m 0xf -y -C 33 -o 131072 -q 128 41# accel perf consumes to much memory in this test, lowe qd and number of cores 42$accelperf -c <(gen_accel_mlx5_json) -w crc32c -t 5 -m 0x3 -y -C 77 -o 524288 -q 64 43 44$accelperf -c <(gen_accel_mlx5_json) -w copy_crc32c -t 5 -m 0xf -y -C 1 -o 4096 -q 64 45$accelperf -c <(gen_accel_mlx5_json) -w copy_crc32c -t 5 -m 0xf -y -C 33 -o 4096 -q 64 46$accelperf -c <(gen_accel_mlx5_json) -w copy_crc32c -t 5 -m 0xf -y -C 33 -o 131072 -q 128 47# accel perf consumes to much memory in this test, lower qd and number of cores 48$accelperf -c <(gen_accel_mlx5_json) -w copy_crc32c -t 5 -m 0x3 -y -C 77 -o 524288 -q 64 49 50# Test with small amount of resources 51$accelperf -c <(gen_accel_mlx5_json 16 2047) -w crc32c -t 5 -m 0x3 -y -C 17 -o 131072 -q 128 52$accelperf -c <(gen_accel_mlx5_json 256 32) -w crc32c -t 5 -m 0x3 -y -C 17 -o 131072 -q 128 53$accelperf -c <(gen_accel_mlx5_json 16 32) -w crc32c -t 5 -m 0x3 -y -C 17 -o 131072 -q 128 54 55$accelperf -c <(gen_accel_mlx5_json 16 2047) -w copy_crc32c -t 5 -m 0x3 -y -C 17 -o 131072 -q 128 56$accelperf -c <(gen_accel_mlx5_json 256 32) -w copy_crc32c -t 5 -m 0x3 -y -C 17 -o 131072 -q 128 57$accelperf -c <(gen_accel_mlx5_json 16 32) -w copy_crc32c -t 5 -m 0x3 -y -C 17 -o 131072 -q 128 58 59if [ "$TEST_TRANSPORT" != "tcp" ]; then 60 exit 0 61fi 62 63MALLOC_BDEV_SIZE=256 64MALLOC_BLOCK_SIZE=512 65 66function gen_accel_mlx5_crc_json() { 67 68 jq . <<- JSON 69 { 70 "subsystems": [ 71 { 72 "subsystem": "accel", 73 "config": [ 74 { 75 "method": "mlx5_scan_accel_module", 76 "params": { 77 } 78 } 79 ] 80 }, 81 { 82 "subsystem": "bdev", 83 "config": [ 84 { 85 "method": "bdev_nvme_attach_controller", 86 "params": { 87 "name": "Nvme0", 88 "trtype": "$TEST_TRANSPORT", 89 "adrfam": "IPv4", 90 "traddr": "$NVMF_FIRST_TARGET_IP", 91 "trsvcid": "$NVMF_PORT", 92 "subnqn": "nqn.2016-06.io.spdk:cnode0", 93 "ddgst": true 94 } 95 }, 96 { 97 "method": "bdev_wait_for_examine" 98 } 99 ] 100 } 101 ] 102 } 103 JSON 104} 105 106nvmftestinit 107nvmfappstart -m 0x3 108 109$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS 110$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0 111$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode0 -a -s SPDK00000000000001 112$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode0 Malloc0 113$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT 114 115# test crc32c with TCP data digest 116bdevperf=$rootdir/build/examples/bdevperf 117$bdevperf --json <(gen_accel_mlx5_crc_json) -q 128 -o 4096 -t 5 -w randrw -M 50 -m 0xc -r /var/tmp/bdev.sock 118$bdevperf --json <(gen_accel_mlx5_crc_json) -q 128 -o 131072 -t 5 -w randrw -M 50 -m 0xc -r /var/tmp/bdev.sock 119 120trap - SIGINT SIGTERM EXIT 121 122nvmftestfini 123