Skip to content

Commit 87ffb96

Browse files
authored
add accel config and DSA initialize script (#20)
1 parent c61074a commit 87ffb96

File tree

2 files changed

+73
-2
lines changed

2 files changed

+73
-2
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,31 @@ make dto-test
114114
make dto-test-wodto
115115
116116
```
117+
## Initializing DSA devices
118+
119+
You can initialize a DSA device using the following:
120+
```bash
121+
./accelConfig.sh <device-id> <enable (yes/no)> <wq-id>
122+
```
123+
If you get invalid traffic class error, reload the idxd driver with tc_override=1:
124+
```bash
125+
modprobe -r idxd
126+
modprobe idxd tc_override=1
127+
```
128+
You can set the permissions of the DSA via chmod /dev/dsa/wqX.Y to allow users to submit
129+
to the DSA device.
117130
118131
## Test
119132
```bash
120-
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
133+
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.
121134
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).
122135
3. Using with other applications (two ways to use it)
123136
3a. Using "-ldto" linker option (requires recompiling the application)
124137
i. Recompile the application with "-ldto" linker options
125138
ii. Setup DTO environment variables (examples below)
126139
export DTO_USESTDC_CALLS=0
127140
export DTO_COLLECT_STATS=1
128-
export DTO_WAIT_METHOD=yield
141+
export DTO_WAIT_METHOD=busypoll
129142
export DTO_MIN_BYTES=8192
130143
export DTO_CPU_SIZE_FRACTION=0.33
131144
export DTO_AUTO_ADJUST_KNOBS=1

accelConfig.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
echo "OPTIONAL Arg-1: DSA device id. Default: 0"
4+
echo "OPTIONAL Arg-2: Enable/Disable DSA device. Default: yes"
5+
echo "OPTIONAL Arg-3: SHARED WQ id. Default: 1"
6+
echo "OPTIONAL Arg-4: ENGINE count. Default: 4"
7+
8+
if [ "$#" -ge 5 ]; then
9+
echo "ERROR: Incorrect argument count. Expected arg count <= 4"
10+
exit 1
11+
fi
12+
13+
DEVID=${1:-0}
14+
ENABLE=${2:-yes}
15+
SWQID=${3:-1}
16+
NENGS=${4:-4}
17+
18+
DEV=dsa${DEVID}
19+
SWQ=${DEV}/wq${DEVID}.${SWQID}
20+
21+
echo "=> ${SWQ}:"
22+
accel-config disable-wq ${SWQ}
23+
24+
echo "=> ${DEV}:"
25+
accel-config disable-device ${DEV}
26+
27+
if [ "${ENABLE}" != "yes" ]; then
28+
echo "Exit after disabling ${DEV}."
29+
exit 1
30+
fi
31+
32+
for ((i=0; i < ${NENGS}; i++))
33+
do
34+
echo "=> ${DEV}/engine${DEVID}.${i}"
35+
echo "configured"
36+
accel-config config-engine ${DEV}/engine${DEVID}.${i} --group-id=0
37+
done
38+
39+
accel-config config-wq ${SWQ} --group-id=0
40+
accel-config config-wq ${SWQ} --priority=1
41+
accel-config config-wq ${SWQ} --wq-size=128
42+
accel-config config-wq ${SWQ} --max-batch-size=1024
43+
accel-config config-wq ${SWQ} --max-transfer-size=2147483648
44+
accel-config config-wq ${SWQ} --block-on-fault=0
45+
accel-config config-wq ${SWQ} --type=user
46+
accel-config config-wq ${SWQ} --name="dsa-test"
47+
accel-config config-wq ${SWQ} --mode=shared
48+
accel-config config-wq ${SWQ} --threshold=127
49+
accel-config config-wq ${SWQ} --driver-name="user"
50+
51+
echo "=> ${DEV}:"
52+
accel-config enable-device ${DEV}
53+
54+
echo "=> ${SWQ}:"
55+
accel-config enable-wq ${SWQ}
56+
57+
#accel-config config-group ${DEV}/group0.0 --traffic-class-a=1
58+
#accel-config config-group ${DEV}/group0.0 --traffic-class-b=1

0 commit comments

Comments
 (0)