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