Skip to content

Commit b28f908

Browse files
qat, initcontainer: add enablement of auto_reset
Signed-off-by: Hyeongju Johannes Lee <[email protected]>
1 parent 8b4a793 commit b28f908

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

demo/qat-init.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ QAT_420XX_DEVICE_PCI_ID="0x4946"
1111
SERVICES_ENABLED="NONE"
1212
SERVICES_ENABLED_FOUND="FALSE"
1313

14+
AUTORESET_ENABLED="NONE"
15+
AUTORESET_ENABLED_FOUND="FALSE"
16+
AUTORESET_OPTIONS_LIST="on off"
17+
1418
check_config() {
1519
enabled_config="NONE"
1620
[ -f "conf/qat.conf" ] && enabled_config=$(grep "^$1=" conf/qat.conf | cut -d= -f 2 | grep '\S')
@@ -79,7 +83,29 @@ enable_sriov() {
7983
done
8084
}
8185

86+
enable_auto_reset() {
87+
if [ "$AUTORESET_ENABLED_FOUND" = "TRUE" ]; then
88+
for dev in $DEVS; do
89+
DEVPATH="/sys/bus/pci/devices/0000:$dev"
90+
AUTORESET_PATH="$DEVPATH/qat/auto_reset"
91+
if ! test -w "$AUTORESET_PATH"; then
92+
echo "error: $AUTORESET_PATH is not found or not writable. Check if QAT driver module is loaded. Skipping..."
93+
exit 1
94+
fi
95+
if [ "$(cat "$AUTORESET_PATH")" == "$AUTORESET_ENABLED" ]; then
96+
echo "$DEVPATH's auto reset is already $AUTORESET_ENABLED"
97+
else
98+
echo "$AUTORESET_ENABLED" > "$AUTORESET_PATH" && echo "$DEVPATH's auto reset has been set $AUTORESET_ENABLED"
99+
fi
100+
done
101+
fi
102+
}
103+
82104
SERVICES_ENABLED=$(check_config "ServicesEnabled" "$SERVICES_LIST")
83105
SERVICES_ENABLED_FOUND=$(is_found "$SERVICES_ENABLED")
84106
sysfs_config
85107
enable_sriov
108+
109+
AUTORESET_ENABLED=$(check_config "AutoresetEnabled" "$AUTORESET_OPTIONS_LIST")
110+
AUTORESET_ENABLED_FOUND=$(is_found "$AUTORESET_ENABLED")
111+
enable_auto_reset

0 commit comments

Comments
 (0)