xref: /spdk/test/accel/mlx5/accel_mlx5_copy.sh (revision 671ee5e075565cae5d7a23767c887600496be6f0)
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_malloc_json() {
13	accel_qp_size=${1:-256}
14	accel_num_requests=${2:-2047}
15	accel_driver=${3:-false}
16
17	jq . <<- JSON
18		{
19		  "subsystems": [
20		    {
21		      "subsystem": "accel",
22		      "config": [
23		        {
24		          "method": "mlx5_scan_accel_module",
25		          "params": {
26		            "qp_size": ${accel_qp_size},
27		            "num_requests": ${accel_num_requests},
28		            "enable_driver": ${accel_driver}
29		          }
30		        }
31		      ]
32		    },
33		    {
34		      "subsystem": "bdev",
35		      "config": [
36		        {
37		          "method": "bdev_malloc_create",
38		          "params": {
39		            "name": "Malloc0",
40		            "num_blocks": 262144,
41		            "block_size": 512,
42		            "uuid": "e1c24cb1-dd44-4be6-8d67-de92a332013f"
43		          }
44		        },
45		        {
46		          "method": "bdev_wait_for_examine"
47		        }
48		      ]
49		    }
50		  ]
51		}
52	JSON
53}
54
55# Test copy operation with fragmented payload
56"$rootdir/test/dma/test_dma/test_dma" -q 64 -o 4096 -O 17 -w verify -t 5 -m 0xf --json <(gen_accel_mlx5_malloc_json) -b "Malloc0" -f -x translate
57"$rootdir/test/dma/test_dma/test_dma" -q 64 -o 4096 -O 33 -w verify -t 5 -m 0xf --json <(gen_accel_mlx5_malloc_json) -b "Malloc0" -f -x translate
58"$rootdir/test/dma/test_dma/test_dma" -q 64 -o 524288 -O 79 -w verify -t 5 -m 0xf --json <(gen_accel_mlx5_malloc_json) -b "Malloc0" -f -x translate
59
60# Test lack of resources
61"$rootdir/test/dma/test_dma/test_dma" -q 64 -o 131072 -O 49 -w verify -t 5 -m 0xf --json <(gen_accel_mlx5_malloc_json 16 2047) -b "Malloc0" -f -x translate
62"$rootdir/test/dma/test_dma/test_dma" -q 64 -o 131072 -O 49 -w verify -t 5 -m 0xf --json <(gen_accel_mlx5_malloc_json 256 64) -b "Malloc0" -f -x translate
63"$rootdir/test/dma/test_dma/test_dma" -q 64 -o 131072 -O 49 -w verify -t 5 -m 0xf --json <(gen_accel_mlx5_malloc_json 16 64) -b "Malloc0" -f -x translate
64
65# Test copy operation with fragmented payload and platform driver enabled
66"$rootdir/test/dma/test_dma/test_dma" -q 64 -o 4096 -O 17 -w verify -t 5 -m 0xf --json <(gen_accel_mlx5_malloc_json 256 2047 true) -b "Malloc0" -f -x translate
67