From 2bd64bedf2f3a5a1a4a6292207702064b1a37ccf Mon Sep 17 00:00:00 2001 From: Daniel Byrne Date: Thu, 7 Aug 2025 14:42:28 -0400 Subject: [PATCH] add accel config and DSA initialize script --- README.md | 17 +++++++++++++-- accelConfig.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100755 accelConfig.sh diff --git a/README.md b/README.md index c26ccbc..1a746e2 100644 --- a/README.md +++ b/README.md @@ -114,10 +114,23 @@ make dto-test make dto-test-wodto ``` +## Initializing DSA devices + +You can initialize a DSA device using the following: +```bash +./accelConfig.sh +``` +If you get invalid traffic class error, reload the idxd driver with tc_override=1: +```bash +modprobe -r idxd +modprobe idxd tc_override=1 +``` +You can set the permissions of the DSA via chmod /dev/dsa/wqX.Y to allow users to submit +to the DSA device. ## Test ```bash -1. Make changes to test.sh or dto-4-dsa.conf to change DSA configuration if desired. test.sh configures DSA(s) using the config parameters in dto-4-dsa.conf +1. Follow the steps in the Initializing DSA Devices section. Or you can make changes to test.sh or dto-4-dsa.conf to change DSA configuration if desired. test.sh configures DSA(s) using the config parameters in dto-4-dsa.conf. 2. Run the test.sh script to run the dto-test app (DTO linked using -ldto) or dto-test-wodto app (DTO linked using LD_PRELOAD). 3. Using with other applications (two ways to use it) 3a. Using "-ldto" linker option (requires recompiling the application) @@ -125,7 +138,7 @@ make dto-test-wodto ii. Setup DTO environment variables (examples below) export DTO_USESTDC_CALLS=0 export DTO_COLLECT_STATS=1 - export DTO_WAIT_METHOD=yield + export DTO_WAIT_METHOD=busypoll export DTO_MIN_BYTES=8192 export DTO_CPU_SIZE_FRACTION=0.33 export DTO_AUTO_ADJUST_KNOBS=1 diff --git a/accelConfig.sh b/accelConfig.sh new file mode 100755 index 0000000..dd8b4d5 --- /dev/null +++ b/accelConfig.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +echo "OPTIONAL Arg-1: DSA device id. Default: 0" +echo "OPTIONAL Arg-2: Enable/Disable DSA device. Default: yes" +echo "OPTIONAL Arg-3: SHARED WQ id. Default: 1" +echo "OPTIONAL Arg-4: ENGINE count. Default: 4" + +if [ "$#" -ge 5 ]; then + echo "ERROR: Incorrect argument count. Expected arg count <= 4" + exit 1 +fi + +DEVID=${1:-0} +ENABLE=${2:-yes} +SWQID=${3:-1} +NENGS=${4:-4} + +DEV=dsa${DEVID} +SWQ=${DEV}/wq${DEVID}.${SWQID} + +echo "=> ${SWQ}:" +accel-config disable-wq ${SWQ} + +echo "=> ${DEV}:" +accel-config disable-device ${DEV} + +if [ "${ENABLE}" != "yes" ]; then + echo "Exit after disabling ${DEV}." + exit 1 +fi + +for ((i=0; i < ${NENGS}; i++)) +do + echo "=> ${DEV}/engine${DEVID}.${i}" + echo "configured" + accel-config config-engine ${DEV}/engine${DEVID}.${i} --group-id=0 +done + +accel-config config-wq ${SWQ} --group-id=0 +accel-config config-wq ${SWQ} --priority=1 +accel-config config-wq ${SWQ} --wq-size=128 +accel-config config-wq ${SWQ} --max-batch-size=1024 +accel-config config-wq ${SWQ} --max-transfer-size=2147483648 +accel-config config-wq ${SWQ} --block-on-fault=0 +accel-config config-wq ${SWQ} --type=user +accel-config config-wq ${SWQ} --name="dsa-test" +accel-config config-wq ${SWQ} --mode=shared +accel-config config-wq ${SWQ} --threshold=127 +accel-config config-wq ${SWQ} --driver-name="user" + +echo "=> ${DEV}:" +accel-config enable-device ${DEV} + +echo "=> ${SWQ}:" +accel-config enable-wq ${SWQ} + +#accel-config config-group ${DEV}/group0.0 --traffic-class-a=1 +#accel-config config-group ${DEV}/group0.0 --traffic-class-b=1