xref: /spdk/test/accel/mlx5/accel_mlx5_copy.sh (revision ee32a82bfd3ff5b1a10ed775ee06f0eaffce60eb)
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
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		      "subsystem": "bdev",
33		      "config": [
34		        {
35		          "method": "bdev_malloc_create",
36		          "params": {
37		            "name": "Malloc0",
38		            "num_blocks": 262144,
39		            "block_size": 512,
40		            "uuid": "e1c24cb1-dd44-4be6-8d67-de92a332013f"
41		          }
42		        },
43		        {
44		          "method": "bdev_wait_for_examine"
45		        }
46		      ]
47		    }
48		  ]
49		}
50	JSON
51}
52
53# Test copy operation with fragmented payload
54"$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
55"$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
56"$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
57
58# Test lack of resources
59"$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
60"$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
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 64) -b "Malloc0" -f -x translate
62