xref: /spdk/test/accel/accel_rpc.sh (revision cedcbfc31ad754902731c937718c4df27b7d2799)
1#!/usr/bin/env bash
2#  SPDX-License-Identifier: BSD-3-Clause
3#  Copyright (C) 2023 Intel Corporation
4#  All rights reserved.
5#
6
7testdir=$(readlink -f $(dirname $0))
8rootdir=$(readlink -f $testdir/../..)
9source $rootdir/test/common/autotest_common.sh
10
11trap 'killprocess $spdk_tgt_pid; exit 1' ERR
12
13$SPDK_BIN_DIR/spdk_tgt --wait-for-rpc &
14spdk_tgt_pid=$!
15waitforlisten $spdk_tgt_pid
16
17# The RPC dsa_scan_accel_module method may be performed to use the DSA Module
18# before starting the framework.
19# Should FAIL - double-calling of this function is not allowed.
20function accel_scan_dsa_modules_test_suite() {
21	$rpc_py dsa_scan_accel_module
22	NOT $rpc_py dsa_scan_accel_module
23}
24
25# The RPC iaa_scan_accel_module method may be performed to use the IAA Module
26# before starting the framework.
27# Should FAIL - double-calling of this function is not allowed.
28function accel_scan_iaa_modules_test_suite() {
29	$rpc_py iaa_scan_accel_module
30	NOT $rpc_py iaa_scan_accel_module
31}
32
33# The RPC accel_assign_opc method may be performed to override the operation code
34# assignments to modules before starting the framework.
35# Should PASS - opcode assignments can be verified after starting the framework.
36function accel_assign_opcode_test_suite() {
37	# Assign opc twice, to test replacing the assignment
38	$rpc_py accel_assign_opc -o copy -m incorrect
39
40	$rpc_py accel_assign_opc -o copy -m software
41	$rpc_py framework_start_init
42	$rpc_py accel_get_opc_assignments | jq -r '.copy' | grep software
43}
44
45if [[ $CONFIG_IDXD == y && $SPDK_TEST_ACCEL_DSA -gt 0 ]]; then
46	run_test "accel_scan_dsa_modules" accel_scan_dsa_modules_test_suite
47fi
48
49if [[ $CONFIG_IDXD == y && $SPDK_TEST_ACCEL_IAA -gt 0 ]]; then
50	run_test "accel_scan_iaa_modules" accel_scan_iaa_modules_test_suite
51fi
52
53run_test "accel_assign_opcode" accel_assign_opcode_test_suite
54
55killprocess $spdk_tgt_pid
56