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>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6992
(cherry picked from commit e99cfdb6c9
)
Change-Id: Idefa39c4a62c9e650a03e237f49940461e9782a6
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7745
Tested-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
f4c28506d5
commit
94abf2d8c2
@ -243,23 +243,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/rxe"+([0-9]); do
|
||||
if [[ $(< "$rxe_dev/parent") == "${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