scripts/rxe_cfg: Split collect_devices()
collect_devices() is split into two functions: - collect_net_devices(): Collect ethernet net devs from the net class. - collect_rxe_devices(): Collect all rxe devices from the infiniband class. This is done in order to make handling of some conditions easier. Case and point, in newer kernels, device/net link is not anymore created for the soft roce devices, instead only ./parent attribute is available. collect_rxe_devices() is adjusted to handle such a condition. Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: Idefa39c4a62c9e650a03e237f49940461e9782a6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6992 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
132d80be05
commit
e99cfdb6c9
@ -251,23 +251,38 @@ link_up() {
|
||||
echo $(($(< "$net/$1/flags") | 0x1)) > "$net/$1/flags"
|
||||
}
|
||||
|
||||
collect_devices() {
|
||||
local net_dev rxe_dev
|
||||
collect_net_devices() {
|
||||
local net_dev
|
||||
|
||||
for net_dev in "$net/"!(bonding_masters); do
|
||||
(($(< "$net_dev/type") != 1)) && continue
|
||||
net_devices["${net_dev##*/}"]=$net_dev
|
||||
for rxe_dev in "$infiniband/"*; do
|
||||
if [[ -e $rxe_dev/device/net/${net_dev##*/} ]]; then
|
||||
net_to_rxe["${net_dev##*/}"]=${rxe_dev##*/}
|
||||
rxe_to_net["${rxe_dev##*/}"]=${net_dev##*/}
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
collect_devices
|
||||
collect_rxe_devices() {
|
||||
local rxe_dev net_dev
|
||||
|
||||
for rxe_dev in "$infiniband/"*; do
|
||||
if [[ -e $rxe_dev/parent ]]; then
|
||||
# Soft
|
||||
net_dev=$(< "$rxe_dev/parent")
|
||||
elif [[ -e $rxe_dev/device/net ]]; then
|
||||
# HW
|
||||
net_dev=$(readlink -f "$rxe_dev/device/net/"*)
|
||||
net_dev=${net_dev##*/}
|
||||
else
|
||||
continue
|
||||
fi 2> /dev/null
|
||||
|
||||
[[ -n ${net_devices["$net_dev"]} ]] || continue
|
||||
net_to_rxe["$net_dev"]=${rxe_dev##*/}
|
||||
rxe_to_net["${rxe_dev##*/}"]=$net_dev
|
||||
done
|
||||
}
|
||||
|
||||
collect_net_devices
|
||||
collect_rxe_devices
|
||||
|
||||
case "${1:-status}" in
|
||||
start)
|
||||
|
Loading…
Reference in New Issue
Block a user