|
Honggang Li |
929538 |
#!/bin/bash
|
|
Honggang Li |
929538 |
#
|
|
Honggang Li |
929538 |
# This is a simple sanity test to satisfy the RHEL8.1 onboard gating
|
|
Honggang Li |
929538 |
# requirement.
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
ret=0
|
|
Honggang Li |
929538 |
cx2="ConnectX VPI PCIe 2.0"
|
|
Honggang Li |
929538 |
cx3="[ConnectX-3]"
|
|
Honggang Li |
929538 |
device_list=$(lspci | grep 'Mellanox' | grep -v 'Virtual' | grep -v 'DMA controller' | awk '{print $1}')
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
# Skip loop if device list is empty
|
|
Honggang Li |
929538 |
[[ -z "${dev// }" ]] || for dev in "$device_list"; do
|
|
Honggang Li |
929538 |
# View Device Info
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
lspci -vvv -s "$dev"
|
|
Honggang Li |
929538 |
dev_name=$(lspci -s "$dev")
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
# Test Mstflint Tools
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
mstflint -d "$dev" q
|
|
Honggang Li |
929538 |
let ret=$ret+$?
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
# mstconfig does not support < 4th Gen devices (e.g. ConnectX-2)
|
|
Honggang Li |
929538 |
if [[ "$dev_name" != *"$cx2"* ]]; then
|
|
Honggang Li |
929538 |
mstconfig -d "${dev}" q
|
|
Honggang Li |
929538 |
let ret=$ret+$?
|
|
Honggang Li |
929538 |
fi
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
mstvpd "$dev" 2>/dev/null
|
|
Honggang Li |
929538 |
let ret=$ret+$?
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
mstregdump "$dev" >/dev/null
|
|
Honggang Li |
929538 |
let ret=$ret+$?
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
# mstfwmanager/mstfwreset do not support ConnectX-2 or ConnectX-3
|
|
Honggang Li |
929538 |
if [[ "$dev_name" != *"$cx2"* && "$dev_name" != *"$cx3"* ]]; then
|
|
Honggang Li |
929538 |
mstfwmanager -d "$dev" --query
|
|
Honggang Li |
929538 |
let ret=$ret+$?
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
mstfwreset -d "$dev" q
|
|
Honggang Li |
929538 |
let ret=$ret+$?
|
|
Honggang Li |
929538 |
fi
|
|
Honggang Li |
929538 |
done
|
|
Honggang Li |
929538 |
|
|
Honggang Li |
929538 |
# end test - it is possible no Mellanox devices were available at all to test,
|
|
Honggang Li |
929538 |
# in which case we automatically mark the test PASS (exit 0)
|
|
Honggang Li |
929538 |
exit $ret
|